Ignore:
Timestamp:
Jun 24, 2012, 9:18:26 PM (12 years ago)
Author:
grum
Message:

feature:2634- compatibility with Piwigo 2.4
+add some objects on js framework

Location:
extensions/GrumPluginClasses/classes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/CommonPlugin.class.inc.php

    r15340 r16012  
    22/* -----------------------------------------------------------------------------
    33  class name: CommonPlugin
    4   class version  : 2.2.0
    5   plugin version : 3.2.0
    6   date           : 2010-07-28
     4  class version  : 2.3.0
     5  plugin version : 3.5.2
     6  date           : 2012-06-24
    77
    88  ------------------------------------------------------------------------------
     
    5151|         |            |   function
    5252|         |            |
     53| 2.3.0   | 2012/06/24 | * Add loadCSS() function
     54|         |            |
    5355|         |            |
    5456|         |            |
     
    6466  private $page_link; //link to admin page
    6567  private $fileLocation; //files plugin location on server
     68  private $pluginDirectory;    //directory of plugin
    6669  private $displayResult_ok;
    6770  private $displayResult_ko;
     
    122125  }
    123126
    124   /* constructor allows to initialize $prefixeTable value */
     127  /**
     128   * constructor allows to initialize $prefixeTable value
     129   * @param String $prefixeTable: prefix used for tables
     130   * @param String $filelocation: file calling the constructor (__FILE__)
     131   */
    125132  public function __construct($prefixeTable, $filelocation)
    126133  {
     
    129136    $this->fileLocation=$filelocation;
    130137    $this->prefixeTable=$prefixeTable;
     138    $this->pluginDirectory=basename(dirname($filelocation));
    131139    $this->page_link=get_root_url().'admin.php?page=plugin-'.basename(dirname($this->getFileLocation()));
    132140    //$this->page_link="admin.php?page=plugin&section=".basename(dirname($this->getFileLocation()))."/admin/".$this->plugin_admin_file.".php";
     
    150158  }
    151159
     160  /**
     161   * return the file location
     162   * @return String: file location
     163   */
    152164  public function getFileLocation()
    153165  {
     
    155167  }
    156168
     169  /**
     170   * return the plugin directory
     171   * @return String: directory
     172   */
     173  public function getDirectory()
     174  {
     175    return($this->pluginDirectory);
     176  }
     177
     178  /**
     179   * return the link of plugin in admin pages
     180   * @return String: url
     181   */
    157182  public function getAdminLink()
    158183  {
     
    160185  }
    161186
     187  /**
     188   * set the link of plugin in admin pages
     189   * @param String $link: url to set
     190   * @return String: url
     191   */
    162192  public function setAdminLink($link)
    163193  {
     
    166196  }
    167197
     198  /**
     199   * set the plugin name
     200   * @param String $name: plugin's name
     201   * @return String: plugin's name
     202   */
    168203  public function setPluginName($name)
    169204  {
     
    172207  }
    173208
     209  /**
     210   * set the plugin name for file system useage
     211   * @param String $name: plugin's name
     212   * @return String: plugin's name
     213   */
    174214  public function setPluginNameFiles($name)
    175215  {
     
    178218  }
    179219
     220  /**
     221   * get the plugin name
     222   * @return String: plugin's name
     223   */
    180224  public function getPluginName()
    181225  {
     
    183227  }
    184228
     229  /**
     230   * get the plugin name for file system useage
     231   * @return String: plugin's name
     232   */
    185233  public function getPluginNameFiles()
    186234  {
     
    192240  --------------------------------------------------------------------------- */
    193241
    194   /* this function initialize var $config with default values */
     242  /**
     243   * this function initialize var $this->config with default values
     244   */
    195245  public function initConfig()
    196246  {
     
    198248  }
    199249
    200   /* load config from CONFIG_TABLE into var $my_config */
     250  /**
     251   * load config from CONFIG_TABLE into var $this->config
     252   * @return Boolean: true if config is loaded, otherwiser false
     253   */
    201254  public function loadConfig()
    202255  {
     
    206259
    207260  /**
    208    * load config from a file into var $my_config
     261   * load config from a file into var $this->config
    209262   *
    210263   * this function don't initialize the default value !
     
    212265   *
    213266   * @param String $fileName : name of file to load
     267   * @return Boolean: true if file is loaded, otherwise false
    214268   */
    215269  public function loadConfigFromFile($fileName)
     
    218272  }
    219273
    220   /* save var $my_config into CONFIG_TABLE */
     274  /**
     275   * save var $this->config into CONFIG_TABLE
     276   * @return Boolean: true if config is saved, otherwise false
     277   */
    221278  public function saveConfig()
    222279  {
     
    224281  }
    225282
    226   /* delete config from CONFIG_TABLE */
     283  /**
     284   * delete config from CONFIG_TABLE
     285   * @return Boolean: true if config is deleted, otherwise false
     286   */
    227287  public function deleteConfig()
    228288  {
     
    234294  --------------------------------------------------------------------------- */
    235295
    236   /*
    237       initialize tables list used by the plugin
    238         $list = array('table1', 'table2')
    239         $this->tables_list['table1'] = $prefixeTable.$plugin_name.'_table1'
    240   */
     296  /**
     297   * initialize tables list used by the plugin; tables name will be prefixed
     298   * automatically
     299   *     $list = array('table1', 'table2')
     300   *     $this->tables_list['table1'] = $prefixeTable.$plugin_name.'_table1'
     301   * @param Array $list: a list of table name
     302   */
    241303  protected function setTablesList($list)
    242304  {
     
    251313  --------------------------------------------------------------------------- */
    252314
    253   /* add plugin into administration menu */
     315  /**
     316   * add plugin into administration menu; url is built automatically
     317   * @param String $menu:
     318   */
    254319  public function pluginAdminMenu($menu)
    255320  {
     
    261326        )
    262327    );
    263     /*
    264     array_push($menu,
    265                array(
    266                   'NAME' => $this->plugin_name,
    267                   'URL' => get_admin_plugin_menu_link(dirname($this->getFileLocation()).
    268                                 '/admin/'.$this->plugin_admin_file.'.php')
    269                    ));*/
    270     return $menu;
    271   }
    272 
    273   /*
    274     manage plugin integration into piwigo's admin interface
    275 
    276     to be surcharged by child's classes
    277   */
     328    return($menu);
     329  }
     330
     331  /**
     332   * manage plugin integration into piwigo's admin interface
     333   *
     334   * to be surcharged by child's classes
     335   */
    278336  public function manage()
    279337  {
    280338  }
    281339
    282   /*
    283     initialize plugin's events
    284     to be surcharged by child's classes
    285   */
     340  /**
     341   * initialize plugin's events
     342   * by default, call the loadCSS() function on the 'loc_begin_page_header' events
     343   *
     344   * to be surcharged by child's classes
     345   */
    286346  public function initEvents()
    287347  {
    288   }
     348    global $plugin_id;
     349
     350    if($plugin_id==$this->getDirectory() or !defined('IN_ADMIN'))
     351        add_event_handler('loc_begin_page_header', array(&$this, 'loadCSS'));
     352  }
     353
     354  /**
     355   * called on the 'loc_begin_page_header' event
     356   *
     357   * to be surcharged by child's classes
     358   */
     359  public function loadCSS()
     360  {
     361  }
     362
    289363
    290364  protected function debug($text, $rewrite=false)
     
    306380  }
    307381
    308   /*
    309     manage infos & errors display
    310   */
    311382  protected function displayResult($action_msg, $result)
    312383  {
  • extensions/GrumPluginClasses/classes/GPCAjax.class.inc.php

    r5550 r16012  
    33/* -----------------------------------------------------------------------------
    44  class name     : GPCAjax
    5   class version  : 3.0.0
    6   plugin version : 3.0.0
    7   date           : 2010-03-30
     5  class version  : 3.1.0
     6  plugin version : 3.5.2
     7  date           : 2012-06-19
    88  ------------------------------------------------------------------------------
    99  author: grum at piwigo.org
     
    1515| release | date       |
    1616| 3.0.0   | 2010/03/30 | * Update class & function names
     17|         |            |
     18| 3.1.0   | 2012/06/19 | * Check token request
     19|         |            |
    1720|         |            |
    1821|         |            |
     
    2730   ---------------------------------------------------------------------- */
    2831
    29 
     32define('GPC_AJAX', 'ajaxfct');
    3033
    3134class GPCAjax
     
    3942    exit(strtr($str, $chars));
    4043  }
     44
     45  /**
     46   * check if there's a valid token in $_REQUEST
     47   * if no, the GPC_AJAX call is set to empty value
     48   *
     49   * @param String $fct: the ajax function field (GPC_AJAX by default)
     50   * @param String $token: the token field ('token' by default) to check
     51   * @return Boolean: true if ok, otherwise false
     52   */
     53  static public function checkToken($fct=GPC_AJAX, $token='token')
     54  {
     55    if(!isset($_REQUEST[$token])) $_REQUEST[$token]='';
     56    if($fct!='' && !isset($_REQUEST[$fct])) $_REQUEST[$fct]='';
     57
     58    if($_REQUEST[$token]==get_pwg_token()) return(true);
     59
     60    if($fct!='') $_REQUEST[$fct]='';
     61    return(false);
     62  }
    4163} //class
    4264
  • extensions/GrumPluginClasses/classes/GPCCore.class.inc.php

    r15373 r16012  
    6767|         |            | * Remove google translate connector (google has changed the useage
    6868|         |            |    and now an API key is needed)
     69|         |            |
     70|         |            | * Add js objects: inputDate, inputFilterBox, inputPages, inputSortBox, inputTag
     71|         |            |                   dynamicTable
     72|         |            |
     73|         |            | * AddHeaderCSS and AddJS are ignored if called in an ajax session (AJAX_CALL defined)
     74|         |            |
     75|         |            |
     76|         |            |
    6977|         |            |
    7078
     
    8189    - static function BBtoHTML
    8290    - static function VarToHTML
     91    - static function TabsToHTML
    8392    - static function FormMailToHTML
    8493    - static function addHeaderCSS
     
    9099    - static function rmDir
    91100    - static function applyMarkups
     101    - static function setTemplateToken
     102    - static function addHeaderContent
    92103   ---------------------------------------------------------------------- */
    93104
     
    129140    return(
    130141      Array(
    131         Array('name' => "CommonPlugin", 'version' => "2.2.0"),
    132         Array('name' => "GPCAjax", 'version' => "3.0.0"),
     142        Array('name' => "CommonPlugin", 'version' => "2.3.0"),
     143        Array('name' => "GPCAjax", 'version' => "3.1.0"),
    133144        Array('name' => "GPCCategorySelector", 'version' => "1.0.1"),
    134145        Array('name' => "GPCCore", 'version' => "1.4.1"),
    135         Array('name' => "GPCCss", 'version' => "3.1.0"),
     146        //Array('name' => "GPCCss", 'version' => "3.1.0"),  removed with v1.4.1
    136147        Array('name' => "GPCPagesNavigation", 'version' => "2.0.0"),
    137148        Array('name' => "GPCPublicIntegration", 'version' => "2.0.0"),
    138         Array('name' => "GPCRequestBuilder", 'version' => "1.1.2"),
     149        Array('name' => "GPCRequestBuilder", 'version' => "1.1.7"),
    139150        Array('name' => "GPCTables", 'version' => "1.5.0"),
    140151        Array('name' => "GPCTabSheet", 'version' => "1.1.1"),
     
    205216
    206217  /**
     218   * return the list of registered plugins
    207219   * @return Array : list of registered plugins
    208220   */
     
    503515  }
    504516
     517  /**
     518   * analyze and replace markups by their value, according to $conf parameted
     519   * @param String $text: text to analyze
     520   * @return String: analyzed text
     521   */
    505522  static public function applyMarkups($text)
    506523  {
     
    532549
    533550  /**
    534    * used to add a css file in the header
     551   * used to add a js or css directly in the header
    535552   *
    536553   * @param String $id : a unique id for the file
    537554   * @param String $file : the css file
     555   * @param String $order: priority
     556   */
     557  static public function addHeaderContent($type, $content)
     558  {
     559    global $template;
     560    $null=null;
     561
     562    if(defined('AJAX_CALL')) return(false); // not needed for an ajax call
     563
     564    switch($type)
     565    {
     566      case 'css':
     567        $template->block_html_style(null, $content, $null, $null);
     568        break;
     569      case 'js':
     570        $template->block_html_head(null, '<script type="text/javascript">'.$content.'</script>', $null, $null);
     571        break;
     572    }
     573  }
     574
     575  /**
     576   * used to add a css file in the header
     577   *
     578   * @param String $id : a unique id for the file
     579   * @param String $file : the css file
     580   * @param String $order: priority
    538581   */
    539582  static public function addHeaderCSS($id, $file, $order=0)
     
    541584    global $template;
    542585
    543     if(!array_key_exists($file, self::$headerItems['css']) and file_exists($file))
     586    if(defined('AJAX_CALL')) return(false); // no CSS needed for an ajax call
     587    if(!array_key_exists($id, self::$headerItems['css']) and file_exists($file))
    544588    {
    545589      self::$headerItems['css'][$id]=$file;
     
    547591    }
    548592  }
     593
     594  /**
     595   * used to add a js file in the header
     596   *
     597   * @param String $id : a unique id for the file
     598   * @param String $file : the js file
     599   * @param Array $require : list of required files
     600   */
    549601  static public function addHeaderJS($id, $file, $require=array())
    550602  {
    551603    global $template;
    552604
    553     if(!array_key_exists($file, self::$headerItems['js']) and file_exists($file))
     605    if(defined('AJAX_CALL')) return(false); // no JS needed for an ajax call
     606    if(!array_key_exists($id, self::$headerItems['js']) and file_exists($file))
    554607    {
    555608      self::$headerItems['js'][$id]=$file;
     
    562615   *
    563616   * @param Array $list : possibles values are
     617   *                        - categorySelector
     618   *                        - dynamicTable
    564619   *                        - inputCheckbox
    565620   *                        - inputColorPicker
    566621   *                        - inputColorsFB
    567622   *                        - inputConsole
     623   *                        - inputDate
    568624   *                        - inputDotArea
     625   *                        - inputFilterBox
    569626   *                        - inputList
    570627   *                        - inputNum
    571628   *                        - inputPosition
    572629   *                        - inputRadio
     630   *                        - inputSortBox
    573631   *                        - inputStatusBar
     632   *                        - inputTag
    574633   *                        - inputText
    575    *                        - categorySelector
    576634   */
    577635  static public function addUI($list)
     
    595653      switch($ui)
    596654      {
     655        case 'gpcCSS':
     656          $fileName='./plugins/'.basename(dirname(dirname(__FILE__))).'/css/gpc';
     657          self::addHeaderCSS('gpc.css', $fileName.'.css', 10);
     658          self::addHeaderCSS('gpc.cssT', $fileName.'_'.$template->get_themeconf('name').'.css', 15);
     659          break;
    597660        case 'categorySelector':
    598661          self::addHeaderCSS('gpc.categorySelector', GPC_PATH.'css/categorySelector.css');
     
    646709          self::addHeaderJS('gpc.inputConsole', GPC_PATH.'js/ui.inputConsole.js', array('jquery.ui.widget'));
    647710          break;
     711        case 'inputDate':
     712          self::addHeaderCSS('gpc.inputDate', GPC_PATH.'css/inputDate.css');
     713          self::addHeaderCSS('gpc.inputDateT', sprintf($themeFile, 'inputDate'));
     714          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     715          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     716          self::addHeaderJS('jquery.ui.datepicker', 'themes/default/js/ui/jquery.ui.datepicker.js', array('jquery.ui.widget'));
     717          self::addHeaderJS('gpc.inputDate', GPC_PATH.'js/ui.inputDate.js', array('jquery.ui.widget'));
     718          break;
    648719        case 'inputDotArea':
    649720          self::addHeaderCSS('gpc.inputDotArea', GPC_PATH.'css/inputDotArea.css');
     
    653724          self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea.js', array('jquery.ui.widget'));
    654725          break;
     726        case 'inputFilterBox':
     727          self::addHeaderCSS('gpc.inputNum', GPC_PATH.'css/inputNum.css');
     728          self::addHeaderCSS('gpc.inputNumT', sprintf($themeFile, 'inputNum'));
     729          self::addHeaderCSS('gpc.inputDate', GPC_PATH.'css/inputDate.css');
     730          self::addHeaderCSS('gpc.inputDateT', sprintf($themeFile, 'inputDate'));
     731          self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css');
     732          self::addHeaderCSS('gpc.inputTextT', sprintf($themeFile, 'inputText'));
     733          self::addHeaderCSS('gpc.inputList', GPC_PATH.'css/inputList.css');
     734          self::addHeaderCSS('gpc.inputListT', sprintf($themeFile, 'inputList'));
     735          self::addHeaderCSS('gpc.inputFilterBox', GPC_PATH.'css/inputFilterBox.css');
     736          self::addHeaderCSS('gpc.inputFilterBoxT', sprintf($themeFile, 'inputFilterBox'));
     737
     738          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     739          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     740
     741          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     742          self::addHeaderJS('jquery.ui.mouse', 'themes/default/js/ui/jquery.ui.mouse.js', array('jquery.ui.widget'));
     743          self::addHeaderJS('jquery.ui.position', 'themes/default/js/ui/jquery.ui.position.js', array('jquery.ui.mouse'));
     744          self::addHeaderJS('jquery.ui.resizable', 'themes/default/js/ui/jquery.ui.resizable.js', array('jquery.ui.position'));
     745          self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/jquery.ui.draggable.js', array('jquery.ui.resizable'));
     746          self::addHeaderJS('jquery.ui.sortable', 'themes/default/js/ui/jquery.ui.sortable.js', array('jquery.ui.draggable'));
     747          self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/jquery.ui.dialog.js', array('jquery.ui.sortable'));
     748
     749          self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum.js', array('jquery.ui.dialog'));
     750          self::addHeaderJS('gpc.inputList', GPC_PATH.'js/ui.inputList.js', array('jquery.ui.dialog'));
     751          self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText.js', array('jquery.ui.dialog'));
     752          self::addHeaderJS('gpc.inputDate', GPC_PATH.'js/ui.inputDate.js', array('jquery.ui.dialog'));
     753          self::addHeaderJS('gpc.inputFilterBox', GPC_PATH.'js/ui.inputFilterBox.js', array('jquery.ui.dialog'));
     754          break;
    655755        case 'inputList':
    656756          self::addHeaderCSS('gpc.inputList', GPC_PATH.'css/inputList.css');
     
    669769          self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum.js', array('jquery','jquery.ui.slider'));
    670770          break;
     771        case 'inputPages':
     772          self::addHeaderCSS('gpc.inputPages', GPC_PATH.'css/inputPages.css');
     773          self::addHeaderCSS('gpc.inputPagesT', sprintf($themeFile, 'inputPages'));
     774          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     775          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     776          self::addHeaderJS('gpc.inputPages', GPC_PATH.'js/ui.inputPages.js', array('jquery','jquery.ui.widget'));
     777          break;
    671778        case 'inputPosition':
    672779          self::addHeaderCSS('gpc.inputPosition', GPC_PATH.'css/inputPosition.css');
     
    681788          self::addHeaderJS('gpc.inputRadio', GPC_PATH.'js/ui.inputRadio.js', array('jquery.ui.widget'));
    682789          break;
     790        case 'inputSortBox':
     791          self::addHeaderCSS('gpc.inputSortBox', GPC_PATH.'css/inputSortBox.css');
     792          self::addHeaderCSS('gpc.inputSortBoxT', sprintf($themeFile, 'inputSortBox'));
     793          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     794          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     795          self::addHeaderJS('jquery.ui.mouse', 'themes/default/js/ui/jquery.ui.mouse.js', array('jquery.ui.widget'));
     796          self::addHeaderJS('jquery.ui.position', 'themes/default/js/ui/jquery.ui.position.js', array('jquery.ui.mouse'));
     797          self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/jquery.ui.draggable.js', array('jquery.ui.position'));
     798          self::addHeaderJS('jquery.ui.sortable', 'themes/default/js/ui/jquery.ui.sortable.js', array('jquery.ui.draggable'));
     799          self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/jquery.ui.dialog.js', array('jquery.ui.sortable'));
     800          self::addHeaderJS('gpc.inputSortBox', GPC_PATH.'js/ui.inputSortBox.js', array('jquery.ui.dialog'));
     801          break;
    683802        case 'inputStatusBar':
    684803          self::addHeaderCSS('gpc.inputStatusBar', GPC_PATH.'css/inputStatusBar.css');
     
    695814          self::addHeaderJS('gpc.inputSwitchButton', GPC_PATH.'js/ui.inputSwitchButton.js', array('jquery.ui.widget'));
    696815          break;
     816        case 'inputTag':
     817          self::addHeaderCSS('gpc.inputTag', GPC_PATH.'css/inputTag.css');
     818          self::addHeaderCSS('gpc.inputTagT', sprintf($themeFile, 'inputTag'));
     819          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     820          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     821          self::addHeaderJS('gpc.inputTag', GPC_PATH.'js/ui.inputTag.js', array('jquery.ui.widget'));
     822          break;
    697823        case 'inputText':
    698824          self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css');
     
    708834          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
    709835          self::addHeaderJS('gpc.simpleTip', GPC_PATH.'js/simpleTip.js', array('jquery.ui.widget'));
     836          break;
     837        case 'dynamicTable':
     838          self::addHeaderCSS('gpc.inputNum', GPC_PATH.'css/inputNum.css');
     839          self::addHeaderCSS('gpc.inputNumT', sprintf($themeFile, 'inputNum'));
     840          self::addHeaderCSS('gpc.inputDate', GPC_PATH.'css/inputDate.css');
     841          self::addHeaderCSS('gpc.inputDateT', sprintf($themeFile, 'inputDate'));
     842          self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css');
     843          self::addHeaderCSS('gpc.inputTextT', sprintf($themeFile, 'inputText'));
     844          self::addHeaderCSS('gpc.inputList', GPC_PATH.'css/inputList.css');
     845          self::addHeaderCSS('gpc.inputListT', sprintf($themeFile, 'inputList'));
     846          self::addHeaderCSS('gpc.inputSortBox', GPC_PATH.'css/inputSortBox.css');
     847          self::addHeaderCSS('gpc.inputSortBoxT', sprintf($themeFile, 'inputSortBox'));
     848          self::addHeaderCSS('gpc.inputFilterBox', GPC_PATH.'css/inputFilterBox.css');
     849          self::addHeaderCSS('gpc.inputFilterBoxT', sprintf($themeFile, 'inputFilterBox'));
     850          self::addHeaderCSS('gpc.inputPages', GPC_PATH.'css/inputPages.css');
     851          self::addHeaderCSS('gpc.inputPagesT', sprintf($themeFile, 'inputPages'));
     852          self::addHeaderCSS('gpc.inputDynamicTable', GPC_PATH.'css/inputDynamicTable.css');
     853          self::addHeaderCSS('gpc.inputDynamicTableT', sprintf($themeFile, 'inputDynamicTable'));
     854
     855          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/jquery.ui.core.js', array('jquery'));
     856          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     857
     858          self::addHeaderJS('jquery.ui.widget', 'themes/default/js/ui/jquery.ui.widget.js', array('jquery.ui'));
     859          self::addHeaderJS('jquery.ui.mouse', 'themes/default/js/ui/jquery.ui.mouse.js', array('jquery.ui.widget'));
     860          self::addHeaderJS('jquery.ui.position', 'themes/default/js/ui/jquery.ui.position.js', array('jquery.ui.mouse'));
     861          self::addHeaderJS('jquery.ui.resizable', 'themes/default/js/ui/jquery.ui.resizable.js', array('jquery.ui.position'));
     862          self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/jquery.ui.draggable.js', array('jquery.ui.resizable'));
     863          self::addHeaderJS('jquery.ui.sortable', 'themes/default/js/ui/jquery.ui.sortable.js', array('jquery.ui.draggable'));
     864          self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/jquery.ui.dialog.js', array('jquery.ui.sortable'));
     865
     866          self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum.js', array('jquery.ui.dialog'));
     867          self::addHeaderJS('gpc.inputList', GPC_PATH.'js/ui.inputList.js', array('jquery.ui.dialog'));
     868          self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText.js', array('jquery.ui.dialog'));
     869          self::addHeaderJS('gpc.inputDate', GPC_PATH.'js/ui.inputDate.js', array('jquery.ui.dialog'));
     870          self::addHeaderJS('gpc.inputFilterBox', GPC_PATH.'js/ui.inputFilterBox.js', array('jquery.ui.dialog'));
     871          self::addHeaderJS('gpc.inputSortBox', GPC_PATH.'js/ui.inputSortBox.js', array('jquery.ui.dialog'));
     872          self::addHeaderJS('gpc.inputPages', GPC_PATH.'js/ui.inputPages.js', array('jquery.ui.dialog'));
     873          self::addHeaderJS('gpc.dynamicTable', GPC_PATH.'js/ui.dynamicTable.js', array('jquery.ui.dialog'));
    710874          break;
    711875      }
     
    8521016
    8531017
     1018 /**
     1019  * affect a valid token in a template var {$token}
     1020  */
     1021 static public function setTemplateToken()
     1022 {
     1023   global $template;
     1024
     1025   $template->assign('token', get_pwg_token());
     1026 }
     1027
     1028
    8541029} //class
    8551030
    856 //add_event_handler('loc_begin_page_header', array('GPCCore', 'applyHeaderItems'), 10);
    857 
    8581031GPCCore::init();
    8591032
  • extensions/GrumPluginClasses/classes/GPCPublicIntegration.class.inc.php

    r7449 r16012  
    4141class GPCPublicIntegration
    4242{
    43   var $section;         //section applied to the page viewed
    44   var $callback_page_function;        //called function to display page
     43  private $section;         //section applied to the page viewed
     44  private $callback_page_function;        //called function to display page
    4545
    4646  public function __construct($section)
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r15352 r16012  
    22/* -----------------------------------------------------------------------------
    33  class name: GCPRequestBuilder
    4   class version  : 1.1.6
    5   plugin version : 3.5.1
    6   date           : 2011-05-15
     4  class version  : 1.1.7
     5  plugin version : 3.5.2
     6  date           : 2012-06-24
    77
    88  ------------------------------------------------------------------------------
     
    8989|         |            |   . Request builder user interface don't work
    9090|         |            |
     91| 1.1.7   | 2012/06/24 | * use some GPCCore function instead of code
    9192|         |            |
    9293|         |            |
     
    539540
    540541    //$template->append('head_elements', '<link href="plugins/'.$baseName.'rbuilder.css" type="text/css" rel="stylesheet"/>');
    541     if(defined('IN_ADMIN')) GPCCore::addHeaderCSS('gpc.rbuilder', 'plugins/'.$baseName.'rbuilder_'.$template->get_themeconf('name').'.css', 26);
     542    if(defined('IN_ADMIN')) GPCCore::addHeaderCSS('gpc.rbuilderT', 'plugins/'.$baseName.'rbuilder_'.$template->get_themeconf('name').'.css', 26);
    542543    //$template->append('head_elements', '<link href="plugins/'.$baseName.'rbuilder_'.$template->get_themeconf('name').'.css" type="text/css" rel="stylesheet"/>');
    543544
     
    556557    GPCCore::addHeaderJS('gpc.rbCriteriaBuilder', 'plugins/'.$baseName.'rbCriteriaBuilder.js', array('gpc.external.inestedsortable'));
    557558
    558     $template->append('head_elements',
    559 "<script type=\"text/javascript\">
    560   requestBuilderOptions = {
    561     textAND:\"".l10n('gpc_rb_textAND')."\",
    562     textOR:\"".l10n('gpc_rb_textOR')."\",
    563     textNoCriteria:\"".l10n('There is no criteria ! At least, one criteria is required to do search...')."\",
    564     textSomethingWrong:\"".l10n('gpc_something_is_wrong_on_the_server_side')."\",
    565     textCaddieUpdated:\"".l10n('gpc_the_caddie_is_updated')."\",
    566     helpEdit:\"".l10n('gpc_help_edit_criteria')."\",
    567     helpDelete:\"".l10n('gpc_help_delete_criteria')."\",
    568     helpMove:\"".l10n('gpc_help_move_criteria')."\",
    569     helpSwitchCondition:\"".l10n('gpc_help_switch_condition')."\",
    570     ajaxUrl:'plugins/GrumPluginClasses/gpc_ajax.php',
    571   }
    572 </script>");
     559    GPCCore::addHeaderContent('js',
     560"
     561var requestBuilderOptions = {
     562      textAND:\"".l10n('gpc_rb_textAND')."\",
     563      textOR:\"".l10n('gpc_rb_textOR')."\",
     564      textNoCriteria:\"".l10n('There is no criteria ! At least, one criteria is required to do search...')."\",
     565      textSomethingWrong:\"".l10n('gpc_something_is_wrong_on_the_server_side')."\",
     566      textCaddieUpdated:\"".l10n('gpc_the_caddie_is_updated')."\",
     567      helpEdit:\"".l10n('gpc_help_edit_criteria')."\",
     568      helpDelete:\"".l10n('gpc_help_delete_criteria')."\",
     569      helpMove:\"".l10n('gpc_help_move_criteria')."\",
     570      helpSwitchCondition:\"".l10n('gpc_help_switch_condition')."\",
     571      ajaxUrl:'plugins/GrumPluginClasses/gpc_ajax.php',
     572      token:'".get_pwg_token()."'
     573    };
     574"
     575);
    573576  }
    574577
  • extensions/GrumPluginClasses/classes/GPCUserAgent.class.inc.php

    r15340 r16012  
    11<?php
    2 /* -----------------------------------------------------------------------------
    3   class name: GPCUserAgent
    4   class version  : 1.0.0
    5   plugin version : 3.5.2
    6   date           : 2012-05-25
    7   ------------------------------------------------------------------------------
    8   author: grum at piwog.org
    9   << May the Little SpaceFrog be with you >>
    10   ------------------------------------------------------------------------------
    11 
    12   this classes provides base functions to parse User Agent string and retrieve
    13   properties: Browser, OS, Engine
    14 
    15 
    16   (static public) function parse($userAgent)
    17 
    18 | release | date       |
    19 | 1.0.0   | 2012-05-25 | * implementation of the class
    20 |         |            |
    21 |         |            |
    22 |         |            |
    23 |         |            |
    24 |         |            |
    25 |         |            |
    26 
    27 ----------------------------------------------------------------------------- */
    282
    293require_once('GPCUserAgent.const.inc.php');
    30 
    314
    325class GPCUserAgent
    336{
    34   /**
    35    * returned result is ana array with the following properties:
    36    *  'os'              => Operating System id on which the browser run; integer => UA_OS_*
    37    *  'os_version'      => Version of the OS; string
    38    *
    39    *  'browser'         => browser id; integer => UA_BROWSER_*
    40    *  'brower_name'     => browser name; string
    41    *  'browser_type'    => browser type id (crawler, computer, mobile, ...); integer => UA_PROP_TYPE_*
    42    *  'browser_version' => browser version; string
    43    *
    44    *  'engine'          => engine used by the browser (gecko, khtml, ...); integer => UA_ENGINE_*
    45    *
    46    * @param String $userAgent: a user agent string
    47    * @return Array: array of properties
    48    */
    497  static public function parse($userAgent)
    508  {
     
    258216        if(is_array($result) and count($result)>2)
    259217        {
     218          if($browser==UA_BROWSER_SAFARI and preg_match('/iphone|ipad|ipod/i', $userAgent))
     219            $browser=UA_BROWSER_SAFARI_MOBILE;
     220
    260221          $returned=array(
    261222            'browser' => $browser,
  • extensions/GrumPluginClasses/classes/GPCUserAgent.const.inc.php

    r15340 r16012  
    117117define('UA_BROWSER_FIREFOX',          0x1034);
    118118define('UA_BROWSER_OPERA_WII',        0x1035);
     119define('UA_BROWSER_SAFARI_MOBILE',    0x1036);
    119120
    120121
     
    242243            UA_BROWSER_LINKS         => array(UA_PROP_NAME => 'Links',                  UA_PROP_TYPE=>UA_PROP_TYPE_BROWSER_COMPUTER, UA_PROP_URL => ''),
    243244            UA_BROWSER_LYNX          => array(UA_PROP_NAME => 'Lynx',                   UA_PROP_TYPE=>UA_PROP_TYPE_BROWSER_COMPUTER, UA_PROP_URL => ''),
    244             UA_BROWSER_SAFARI        => array(UA_PROP_NAME => 'Safari',                 UA_PROP_TYPE=>UA_PROP_TYPE_BROWSER_COMPUTER, UA_PROP_URL => '')
     245            UA_BROWSER_SAFARI        => array(UA_PROP_NAME => 'Safari',                 UA_PROP_TYPE=>UA_PROP_TYPE_BROWSER_COMPUTER, UA_PROP_URL => ''),
     246            UA_BROWSER_SAFARI_MOBILE => array(UA_PROP_NAME => 'Safari',                 UA_PROP_TYPE=>UA_PROP_TYPE_BROWSER_MOBILE, UA_PROP_URL => '')
    245247          ),
    246248
Note: See TracChangeset for help on using the changeset viewer.