Show
Ignore:
Timestamp:
10/20/10 22:49:29 (3 years ago)
Author:
grum
Message:

fix bug and implement new features
bug:1926, bug:1927, bug:1929, bug:1930, bug:1931, bug:1939, bug:1946

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/gmaps_aip.class.inc.php

    r7177 r7308  
    5757                          l10n('gmaps_search'), 
    5858                          $this->getAdminLink()."&fGMaps_tabsheet=search"); 
     59    $this->tabsheet->add('config', 
     60                          l10n('gmaps_config'), 
     61                          $this->getAdminLink()."&fGMaps_tabsheet=config"); 
     62 
    5963/*    $this->tabsheet->add('help', 
    6064                          l10n('gmaps_help'), 
     
    112116      case 'search': 
    113117        $this->displaySearch(); 
     118        break; 
     119      case 'config': 
     120        $this->displayConfig(); 
    114121        break; 
    115122      case 'help': 
     
    335342 
    336343 
     344 
     345 
     346  /** 
     347   * display the config page 
     348   * 
     349   */ 
     350  protected function displayConfig() 
     351  { 
     352    global $template; 
     353 
     354    $this->updateConfig(); 
     355    $this->configForTemplate(); 
     356 
     357    $template->set_filename('body_page', 
     358                dirname($this->getFileLocation()).'/admin/gmaps_config.tpl'); 
     359 
     360    $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page'); 
     361  } 
     362 
     363  /** 
     364   * update config values 
     365   */ 
     366  protected function updateConfig() 
     367  { 
     368    global $infos; 
     369 
     370    if(!isset($_POST) or count($_POST)==0) return(false); 
     371 
     372 
     373    if(isset($_POST['fBDPopupAutomaticSize']) and $_POST['fBDPopupAutomaticSize']>=0.5 and $_POST['fBDPopupAutomaticSize']<=0.95) 
     374    { 
     375      $this->config['popupAutomaticSize']=$_POST['fBDPopupAutomaticSize']; 
     376    } 
     377    else 
     378    { 
     379      return(false); 
     380    } 
     381 
     382    if($this->saveConfig()) 
     383    { 
     384      $this->displayResult(l10n('gmaps_config_saved'), true); 
     385      return(true); 
     386    } 
     387    return(false); 
     388  } 
     389 
     390 
     391 
     392 
     393 
     394 
     395 
    337396  /** 
    338397   * build an ordered category list 
     
    373432      { 
    374433        $row['level']=1+substr_count($row['rank'], '.'); 
    375  
    376         /* rank is in formated without leading zero, giving bad order 
    377          *  1 
    378          *  1.10 
    379          *  1.11 
    380          *  1.2 
    381          *  1.3 
    382          *  .... 
    383          * 
    384          *  this loop cp,vert all sub rank in four 0 format, allowing to order 
    385          *  categories easily 
    386          *  0001 
    387          *  0001.0010 
    388          *  0001.0011 
    389          *  0001.0002 
    390          *  0001.0003 
    391          */ 
    392         $row['rank']=explode('.', $row['rank']); 
    393         foreach($row['rank'] as $key=>$rank) 
    394         { 
    395           $row['rank'][$key]=str_pad($rank, 4, '0', STR_PAD_LEFT); 
    396         } 
    397         $row['rank']=implode('.', $row['rank']); 
    398  
    399434        $returned[]=$row; 
    400435      } 
     
    414449  public function compareCat($catA, $catB) 
    415450  { 
    416     if($catA['rank'] == $catB['rank']) 
    417     { 
    418       return(0); 
    419     } 
    420     return( ($catA['rank'] < $catB['rank'])?-1:1 ); 
     451    return(strnatcmp($catA['rank'], $catB['rank'])); 
    421452  } 
    422453