Changeset 13457

Show
Ignore:
Timestamp:
11/16/07 14:07:29 (1 year ago)
Author:
juhana
Message:

Implemented nav_noentry

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midgard/data/midgard_admin_sitewizard_creator_host.php

    r13068 r13457  
    211211            $code_finish->page = $this->root_page->id; 
    212212            $code_finish->info = 'inherit'; 
     213            $code_finish->sitegroup = $this->sitegroup->id; 
    213214            $code_finish->value = "<?php \$_MIDCOM->finish(); ?>\n"; 
    214215             
  • trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php

    r13133 r13457  
    399399                $topic->style = $node['style']; 
    400400            } 
     401             
     402            if (isset($node['nav_noentry']) && $node['nav_noentry'] == true) 
     403            { 
     404                $topic->metadata->navnoentry = true; 
     405            } 
    401406 
    402407            if (!$topic->create()) 
     
    448453                 
    449454                // Setting styleInherit 
    450                 if (isset($node['styleInherit']) && $node['styleInherit'] == true) 
     455                if (isset($node['style_inherit']) && $node['style_inherit'] == true) 
    451456                { 
    452457                    $this->creation_root_topic->styleInherit = 1; 
     
    551556            $this->creation_root_topic->sitegroup = $this->sitegroup->id; 
    552557            $this->creation_root_topic->extra = $this->replace($this->structure['root']['title']);  
    553             $this->creation_root_topic->name = $this->replace($this->structure['root']['name'])
     558            $this->creation_root_topic->name = $this->replace($this->structure['root']['name']) . $this->host->prefix
    554559            $this->creation_root_topic->component = $this->structure['root']['component']; 
    555560             
    556             if (isset($node['root']['style']) && !empty($node['root']['style'])) 
     561            if (isset($this->structure['root']['style']) && !empty($this->structure['root']['style'])) 
    557562            { 
    558563                $this->verbose("Setting style for topic " . $this->structure['root']['name']  
    559                     . "(" . $node['root']['style'] . ")"); 
    560                 $this->creation_root_topic->style = $node['root']['style']; 
    561             } 
    562  
     564                    . "(" . $this->structure['root']['style'] . ")"); 
     565                $this->creation_root_topic->style = $this->structure['root']['style']; 
     566            } 
     567            else 
     568            { 
     569                $this->verbose("Setting style for topic " . $this->structure['root']['name'] . ": (" . $this->host->style . ")"); 
     570                 
     571                if (isset($this->structure['root']['use_inherited_style']) && $this->structure['root']['use_inherited_style'] == false) 
     572                { 
     573                    $this->creation_root_topic->style = $this->get_host_style_name($this->host->style, false);  
     574                }            
     575                else 
     576                { 
     577                    $this->creation_root_topic->style = $this->get_host_style_name($this->host->style); 
     578                } 
     579            } 
     580             
     581            if (isset($this->structure['root']['nav_noentry']) && $this->structure['root']['nav_noentry'] == true) 
     582            { 
     583                $this->creation_root_topic->metadata->navnoentry = true; 
     584            } 
     585             
    563586            if (!$this->creation_root_topic->create()) 
    564587            { 
     
    571594            { 
    572595                // Setting style parameter 
    573                 if (isset($node['root']['style']) && !empty($node['root']['style'])) 
    574                 { 
    575                      $this->creation_root_topic->parameter('midcom', 'style', $node['root']['style']); 
     596                if (isset($this->structure['root']['style']) && !empty($this->structure['root']['style'])) 
     597                { 
     598                     $this->creation_root_topic->parameter('midcom', 'style', $this->structure['root']['style']); 
     599                } 
     600                else 
     601                { 
     602                    if (isset($this->structure['root']['use_inherited_style']) && $this->structure['root']['use_inherited_style'] == false) 
     603                    { 
     604                        $this->creation_root_topic->parameter('midcom', 'style', $this->get_host_style_name($this->host->style, false)); 
     605                    } 
     606                    else 
     607                    { 
     608                        $this->creation_root_topic->parameter('midcom', 'style', $this->get_host_style_name($this->host->style)); 
     609                    } 
    576610                } 
    577611             
     
    589623                 
    590624                // Setting styleInherit 
    591                 if (isset($this->structure['root']['styleInherit']) && $this->structure['root']['styleInherit'] == true) 
     625                if (isset($this->structure['root']['style_inherit']) && $this->structure['root']['style_inherit'] == true) 
    592626                { 
    593627                    $this->creation_root_topic->styleInherit = 1; 
     628                    $this->creation_root_topic->update(); 
    594629                } 
    595630                 
     
    771806    } 
    772807     
     808    public function get_host_style_name($style_id, $use_inherited_style = true) 
     809    { 
     810        $qb = new midgard_query_builder('midgard_style'); 
     811        $qb->add_constraint('id', '=', $style_id); 
     812        $styles = $qb->execute();     
     813         
     814        if (count($styles) > 0) 
     815        { 
     816            if (!$use_inherited_style) 
     817            { 
     818                $qb = new midgard_query_builder('midgard_style'); 
     819                $qb->add_constraint('id', '=', $styles[0]->up); 
     820                $parent_styles = $qb->execute(); 
     821                 
     822                return $parent_styles[0]->name; 
     823            } 
     824             
     825            return $styles[0]->name; 
     826        } 
     827        else 
     828        { 
     829            return ''; 
     830        } 
     831    } 
     832     
    773833    public function get_host() 
    774834    { 
     
    802862        $code_init->page = $this->root_page->id; 
    803863        $code_init->info = 'inherit'; 
     864        $code_init->sitegroup = $this->sitegroup->id; 
    804865        $code_init->value = "<?php 
    805866