Changeset 461


Ignore:
Timestamp:
Feb 6, 2014 11:31:21 PM (10 years ago)
Author:
anonymous
Message:

Empty strings are better than zero for default select options. Updated functionality of Nav::currentPage().

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/list_template.cli.php

    r457 r461  
    148148    <input type="text" class="sc-small" size="20" name="search_query" value="<\x3fphp echo getFormData('search_query'); \x3f>" title="<\x3fphp echo oTxt(_("Fields searched: __///__.")); \x3f>" />
    149149    <select name="filter___///__">
    150         <\x3fphp // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); \x3f>
     150        <\x3fphp // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('' => 'Any __///__'), 'ORDER BY __///__ ASC'); \x3f>
    151151    </select>
    152152    <input type="submit" name="list" value="<\x3fphp echo _("Search"); \x3f>" />
  • trunk/bin/module_maker/skel/adm_list.ihtml

    r457 r461  
    88        <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
    99        <select name="filter___///__" class="sc-small">
    10             <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
     10            <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('' => 'Any __///__'), 'ORDER BY __///__ ASC'); ?>
    1111        </select>
    1212        <input type="submit" value="<?php echo _("Filter"); ?>" />
  • trunk/lib/Navigation.inc.php

    r396 r461  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2828 * and titles, as well as setting page params such as hiding the page title on
    2929 * some pages but not others, and storing vars like the page title itself.
    30  * 
     30 *
    3131 * Note: this class was renamed from "Nav" because of the change in API and to be more descriptive.
    3232 *
     
    3737
    3838    // Configuration parameters for this object.
    39     var $_params = array(       
     39    var $_params = array(
    4040        'head_title' => true,
    4141        'body_title' => true,
     
    6868     * current page added last. Vars can be specified for any page, but only vars
    6969     * from the "current" page will be accessed with Nav::get.
    70      * 
     70     *
    7171     * @access  public
    7272     * @param   string  $title      The title of the page.
     
    9494    {
    9595        $app =& App::getInstance();
    96    
     96
    9797        if (isset($params) && is_array($params)) {
    9898            // Merge new parameters with old overriding only those passed.
     
    113113    {
    114114        $app =& App::getInstance();
    115    
     115
    116116        if (isset($this->_params[$param])) {
    117117            return $this->_params[$param];
     
    142142    {
    143143        // Set params of current page.
    144         $curr_page =& $this->pages[sizeof($this->pages) - 1];       
     144        $curr_page =& $this->pages[sizeof($this->pages) - 1];
    145145        $curr_page[$key] = $val;
    146146    }
     
    157157    {
    158158        $curr_page =& $this->pages[sizeof($this->pages) - 1];
    159        
     159
    160160        switch ($key) {
    161161        case 'title' :
     
    279279     * @return  mixed   The value set for $return, TRUE by default.
    280280     */
    281     function currentPage($page_uri, $return=true)
    282     {
    283         if (preg_match('/^' . preg_quote(urldecode($page_uri), '/') . '/i', $_SERVER['PHP_SELF'])) {
    284             return $return;
    285         }
     281    function currentPage($test_uri, $true_return=true, $false_return=false, $include_query=true)
     282    {
     283        $actual_uri = $include_query ? $_SERVER['REQUEST_URI'] : strtok($_SERVER['REQUEST_URI'], '?');
     284        if (preg_match('/^' . preg_quote(urldecode($test_uri), '/') . '$/i', $actual_uri)) {
     285            return $true_return;
     286        }
     287        return $false_return;
    286288    }
    287289
Note: See TracChangeset for help on using the changeset viewer.