Changeset 1588

Show
Ignore:
Timestamp:
05/13/08 09:07:28 (7 months ago)
Author:
misja
Message:

Misja Hoebe <misja@curverider.co.uk> Applied attachment:ticket:351:080511_pages_optional_uri.diff, closes #351

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/pages/lib/pages.inc.php

    r1539 r1588  
    5252                    } else { 
    5353                        // update current record uri 
    54                         $page->uri = pages_build_uri($page->name); 
     54                        if (empty($page->uri)) { 
     55                            $page->uri = pages_build_uri($page->name); 
     56                        } 
    5557 
    5658                        if (empty($page->uri)) { 
     
    6466                } else { 
    6567                    // new uri 
    66                     $page->uri = pages_build_uri($page->name); 
     68                    if (empty($page->uri)) { 
     69                        $page->uri = pages_build_uri($page->name); 
     70                    } 
    6771 
    6872                    if (empty($page->uri)) { 
     
    168172        $parent = optional_param('menu-parent', 0, PARAM_INT); 
    169173        $weight = optional_param('menu-weight', 0, PARAM_INT); 
     174        $uri = str_replace(' ', '', trim(optional_param('page-uri'))); 
    170175        $access = optional_param('page-access'); 
    171176 
     
    222227            $page->weight = !isset($page->weight) ? $weight : $page->weight; 
    223228            $page->access = !isset($page->access) ? $CFG->default_access : $page->access; 
     229 
     230            if (!empty($uri)) { 
     231                $page->uri = $uri; 
     232            } 
    224233 
    225234            //workaround 
     
    529538        } 
    530539 
     540        $input_uri  = pages_html_wrap('label', __gettext('URI:'), array('for' => 'page-uri')); 
     541        $input_uri .= pages_html_input('text', array('name' => 'page-uri', 'value' => $page->uri)); 
     542        $input_uri .= pages_html_wrap('span', __gettext('Optional')); 
     543 
    531544        // help 
    532545        $form_help = __gettext('You can use {{page}} keyword to link to others pages.'); 
     
    583596        $content .= pages_html_wrap('div', $input_parent . $input_weight, array('class' => 'form-item')); 
    584597        $content .= pages_html_wrap('div', $input_access, array('class' => 'form-item')); 
     598        $content .= pages_html_wrap('div', $input_uri, array('class' => 'form-item')); 
    585599        $content .= pages_html_wrap('div', $input_buttons, array('class' => 'form-item form-button')); 
    586600