Changeset 5624

Show
Ignore:
Timestamp:
03/30/07 13:25:57 (2 years ago)
Author:
netblade
Message:

Added option to skip topics
Added options for user to define root topic to show

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/de.linkm.sitemap/config/schemadb_config.inc

    r4369 r5624  
    6363            'widget_select_choices' => de_linkm_sitemap_viewer::list_root_nodes(), 
    6464        ), 
     65        'skip_topics' => array  
     66        ( 
     67            'description'   => 'skip topics', 
     68            'datatype'      => 'multiselect', 
     69            'location'      => 'config', 
     70            'config_domain' => 'de.linkm.sitemap', 
     71            "config_key"    => 'skip_topics', 
     72            'widget'        => 'multiselect', 
     73            "widget_select_size" => 10, 
     74            'multiselect_selection_list' => de_linkm_sitemap_viewer::list_root_nodes(), 
     75        ), 
    6576        'google_sitemap_mode' => array 
    6677        ( 
  • trunk/src/de.linkm.sitemap/handler/sitemap.php

    r5562 r5624  
    6565         
    6666        $root = $this->_config->get('root_topic'); 
    67         if (   $root != null 
    68             && $root != '') 
    69         { 
    70             // User has specified a root topic to use 
    71             $this->_root_folder = new midcom_db_topic($root); 
    72             if (!$this->_root_folder) 
    73             { 
    74                 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Could not open root topic with GUID {$root} please check your component configuration: " . mgd_errstr()); 
    75             } 
    76             // FIXME: Use in_tree constraint with Midgard 1.8 here 
    77             if (! mgd_is_in_topic_tree($this->_nap->get_root_node(), $this->_root_folder->id)) 
    78             { 
    79                 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "The topic with GUID {$root} is not within the content tree as indicated by NAP. Check your configuration."); 
    80             } 
    81              
    82             $this->_root_node_id = $this->_root_folder->id; 
     67        $this->_request_data['skip_topics'] = $this->_config->get('skip_topics'); 
     68        $user_root = ''; 
     69        if(isset($_REQUEST['de_linkm_sitemap_set_root'])) 
     70        { 
     71            $user_root = $_REQUEST['de_linkm_sitemap_set_root']; 
     72        } 
     73        if(isset($_REQUEST['de_linkm_sitemap_set_levels'])) 
     74        { 
     75            $this->_show_levels = $_REQUEST['de_linkm_sitemap_set_levels']; 
     76        } 
     77        else 
     78        { 
     79            $this->_show_levels = 99; 
     80        } 
     81        if (   ($root != null 
     82                && $root != '') 
     83            || ($user_root != null 
     84                && $user_root != '') 
     85            ) 
     86        { 
     87            if (   $user_root != null 
     88                && $user_root != '') 
     89            { 
     90                // User has specified a root topic to use by request parameter 
     91                $this->_root_folder = new midcom_db_topic($user_root); 
     92                if (!$this->_root_folder) 
     93                { 
     94                    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Could not open root topic with GUID {$user_root} please check your component configuration: " . mgd_errstr()); 
     95                } 
     96                // FIXME: Use in_tree constraint with Midgard 1.8 here 
     97                if (! mgd_is_in_topic_tree($this->_nap->get_root_node(), $this->_root_folder->id)) 
     98                { 
     99                    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "The topic with GUID {$user_root} is not within the content tree as indicated by NAP. Check your configuration."); 
     100                } 
     101                 
     102                $this->_root_node_id = $this->_root_folder->id; 
     103            } 
     104            else 
     105            { 
     106                // User has specified a root topic to use in component config 
     107                $this->_root_folder = new midcom_db_topic($root); 
     108                if (!$this->_root_folder) 
     109                { 
     110                    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Could not open root topic with GUID {$root} please check your component configuration: " . mgd_errstr()); 
     111                } 
     112                // FIXME: Use in_tree constraint with Midgard 1.8 here 
     113                if (! mgd_is_in_topic_tree($this->_nap->get_root_node(), $this->_root_folder->id)) 
     114                { 
     115                    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "The topic with GUID {$root} is not within the content tree as indicated by NAP. Check your configuration."); 
     116                } 
     117                 
     118                $this->_root_node_id = $this->_root_folder->id; 
     119            } 
    83120        }  
    84121        else  
     
    273310        $previous = $this->_current_node; 
    274311        $this->_current_node = $this->_nap->get_node($nodeid); 
    275          
    276         // Start a new node and display it 
    277         $data['node'] = $this->_current_node; 
    278         midcom_show_style('node-start'); 
    279         midcom_show_style('node'); 
    280          
    281         // Try to load Child elements         
    282         $subnodes = $this->_nap->list_nodes($nodeid); 
    283         $leaves = null; 
    284         if ($subnodes === false)  
    285         { 
    286             midcom_show_style('node-end'); 
    287             return false; 
    288         } 
    289         if ($this->_config->get('hide_leaves') == false) 
    290         { 
    291             $leaves = $this->_nap->list_leaves($nodeid, $data); 
    292             if ($leaves === false)  
     312        $topics_to_skip = explode(',',$this->_config->get('skip_topics')); 
     313        if(!in_array($this->_current_node[MIDCOM_NAV_GUID],$topics_to_skip)) 
     314        { 
     315 
     316            // Start a new node and display it 
     317            $data['node'] = $this->_current_node; 
     318            midcom_show_style('node-start'); 
     319            midcom_show_style('node'); 
     320             
     321            // Try to load Child elements         
     322            $subnodes = $this->_nap->list_nodes($nodeid); 
     323            $leaves = null; 
     324            if ($subnodes === false)  
    293325            { 
    294326                midcom_show_style('node-end'); 
    295327                return false; 
    296328            } 
    297         } 
    298          
    299         // Now display all subnodes and the leaves in the right order 
    300         if ($this->_config->get('leaves_first'))  
    301         { 
    302             if (! $this->_show_leaves($leaves, $data))  
    303             { 
    304                 midcom_show_style('node-end'); 
    305                 return false; 
    306             } 
     329            if ($this->_config->get('hide_leaves') == false) 
     330            { 
     331                $leaves = $this->_nap->list_leaves($nodeid, $data); 
     332                if ($leaves === false)  
     333                { 
     334                    midcom_show_style('node-end'); 
     335                    return false; 
     336                } 
     337            } 
     338             
     339            // Now display all subnodes and the leaves in the right order 
     340            if ($this->_config->get('leaves_first'))  
     341            { 
     342                if (! $this->_show_leaves($leaves, $data))  
     343                { 
     344                    midcom_show_style('node-end'); 
     345                    return false; 
     346                } 
     347                     
     348                if (!$this->_show_subnodes($subnodes, $data)) 
     349                { 
     350                    midcom_show_style('node-end'); 
     351                    return false; 
     352                } 
     353            }  
     354            else  
     355            { 
     356                if (! $this->_show_subnodes($subnodes, $data))  
     357                { 
     358                    midcom_show_style('node-end'); 
     359                    return false; 
     360                } 
    307361                 
    308             if (!$this->_show_subnodes($subnodes, $data)) 
    309             { 
    310                 midcom_show_style('node-end'); 
    311                 return false; 
    312             } 
    313         }  
    314         else  
    315         { 
    316             if (! $this->_show_subnodes($subnodes, $data))  
    317             { 
    318                 midcom_show_style('node-end'); 
    319                 return false; 
    320             } 
    321              
    322             if (! $this->_show_leaves($leaves, $data))  
    323             { 
    324                 midcom_show_style('node-end'); 
    325                 return false; 
    326             } 
    327         } 
    328          
    329         // Close current node 
    330         midcom_show_style('node-end'); 
    331          
    332         // Clean up 
    333         $this->_current_node = $previous; 
    334          
     362                if (! $this->_show_leaves($leaves, $data))  
     363                { 
     364                    midcom_show_style('node-end'); 
     365                    return false; 
     366                } 
     367            } 
     368             
     369            // Close current node 
     370            midcom_show_style('node-end'); 
     371             
     372            // Clean up 
     373            $this->_current_node = $previous; 
     374        } 
    335375        return true; 
    336376    } 
     
    376416            // First we have to decend a level for the subnode-listing  
    377417            $data['depth']++; 
    378              
     418            if($this->_show_levels > $data['depth']) 
     419            { 
    379420            midcom_show_style('enter-level'); 
    380421             
     
    392433            // Finally we have to ascend back up to the previous level 
    393434            midcom_show_style('leave-level'); 
    394              
     435            } 
    395436            $data['depth']--; 
    396437        } 
  • trunk/src/de.linkm.sitemap/locale/default.en.txt

    r4369 r5624  
    2727Use Google Sitemap mode to output the site structure in XML 
    2828---STRINGEND 
     29 
     30---STRING root topic 
     31Root topic 
     32---STRINGEND 
     33 
     34---STRING Select root to show 
     35Select root to show 
     36---STRINGEND 
     37 
     38---STRING Select root to show 
     39Show levels 
     40---STRINGEND 
     41 
     42---STRING skip topics 
     43Select topics to skip in sitemapview 
     44---STRINGEND 
  • trunk/src/de.linkm.sitemap/locale/default.fi.txt

    r4370 r5624  
    2727KÀytÀ Google Sitemap -tilaa nÀyttÀÀksesi sivuston rakenteen XML-muodossa 
    2828---STRINGEND 
     29 
     30---STRING root topic 
     31Juuritaso 
     32---STRINGEND 
     33 
     34---STRING Select root to show 
     35Valitse nÀytettÀvÀ juuritaso 
     36---STRINGEND 
     37 
     38---STRING Select root to show 
     39NÀytettÀvien tasojen mÀÀrÀ 
     40---STRINGEND 
     41 
     42---STRING skip topics 
     43Valitse sivukartasta piiloitettavat kansiot 
     44---STRINGEND 
  • trunk/src/de.linkm.sitemap/style/begin-sitemap.php

    r5048 r5624  
    11<?php 
    22//$data =& $_MIDCOM->get_custom_context_data('request_data'); 
     3$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 
    34?> 
    45<h1>&(data['view_title']);</h1> 
     6<div id="de_linkm_sitemap_settings"> 
     7<form action="" method="POST"> 
     8<div style="float:left;" id="de_linkm_sitemap_settings_root"> 
     9<?php echo $data['l10n']->get('Select root to show'); ?> 
     10<br /> 
     11<select name="de_linkm_sitemap_set_root"> 
     12<?php 
     13$roots = de_linkm_sitemap_viewer::list_root_nodes(); 
     14$topics_to_skip = explode(',',$data['skip_topics']); 
     15 
     16echo "\t<option value=\"\">".$data['l10n']->get('root topic')."</option>\n"; 
     17 
     18foreach($roots as $root_guid => $root_extra) 
     19{ 
     20    if(!in_array($root_guid,$topics_to_skip) && $root_extra && strlen($root_extra)>0) 
     21    { 
     22        if(isset($_REQUEST['de_linkm_sitemap_set_root']) && $_REQUEST['de_linkm_sitemap_set_root'] == $root_guid) 
     23        { 
     24            echo "\t<option value=\"".$root_guid."\" selected>".$root_extra."</option>\n"; 
     25        } 
     26        else 
     27        { 
     28            echo "\t<option value=\"".$root_guid."\">".$root_extra."</option>\n"; 
     29        } 
     30    } 
     31} 
     32?> 
     33</select> 
     34</div> 
     35<div style="float:left; margin-left:10px;" id="de_linkm_sitemap_settings_levels"> 
     36<?php echo $data['l10n']->get('Show levels'); ?> 
     37<br /> 
     38<select name="de_linkm_sitemap_set_levels"> 
     39<?php 
     40$i = 1; 
     41$max_levels = 6; 
     42while($i <= $max_levels) 
     43{ 
     44    if(isset($_REQUEST['de_linkm_sitemap_set_levels']) && $_REQUEST['de_linkm_sitemap_set_levels'] == $i) 
     45    { 
     46        echo "\t<option value=\"$i\" selected>$i</option>\n"; 
     47    } 
     48    else 
     49    { 
     50        echo "\t<option value=\"$i\">$i</option>\n"; 
     51    } 
     52    $i++; 
     53} 
     54?> 
     55</select> 
     56</div> 
     57<input style="float:left; margin-left:10px; margin-top:15px;" type="submit" value="<?php echo $data['l10n']->get('Submit');?>"> 
     58</form> 
     59</div> 
     60<div style="clear:both"></div> 
     61<br />