Ignore:
Timestamp:
Oct 13, 2010, 5:22:04 PM (14 years ago)
Author:
grum
Message:

Packing js files + add categorySelector functionnalities

Location:
extensions/GrumPluginClasses/classes
Files:
1 added
2 edited

Legend:

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

    r6948 r7175  
    33/* -----------------------------------------------------------------------------
    44  class name     : GPCCore
    5   class version  : 1.2.0
    6   plugin version : 3.2.0
     5  class version  : 1.3.0
     6  plugin version : 3.3.0
    77  date           : 2010-07-28
    88  ------------------------------------------------------------------------------
     
    2020| 1.2.0   | 2010/07/28 | * add the loadConfigFromFile function
    2121|         |            |
    22 |         |            |
     22| 1.3.0   | 2010/10/13 | * add the addHeaderCSS, addHeaderJS functions
    2323|         |            |
    2424|         |            |
     
    3535    - static function unregister
    3636    - static function BBtoHTML
     37    - static function addHeaderCSS
     38    - static function addHeaderJS
    3739   ---------------------------------------------------------------------- */
    3840
     
    4244{
    4345  static public $pluginName = "GPCCore";
     46  static protected $headerItems = array(
     47    'css' => array(),
     48    'js'  => array()
     49  );
    4450
    4551  /* ---------------------------------------------------------------------------
     
    305311  }
    306312
     313  /**
     314   * used to add a css file in the header
     315   *
     316   * @param String $id : a unique id for the file
     317   * @param String $file : the css file
     318   */
     319  static public function addHeaderCSS($id, $file)
     320  {
     321    if(!array_key_exists($file, self::$headerItems['css']))
     322    {
     323      self::$headerItems['css'][$id]=$file;
     324    }
     325  }
     326  static public function addHeaderJS($id, $file)
     327  {
     328    global $template;
     329
     330    if(!array_key_exists($id,  $template->known_scripts) and !array_key_exists($file, self::$headerItems['js']))
     331    {
     332     $template->known_scripts[$id]=$url;
     333     self::$headerItems['js'][$id]=$file;
     334    }
     335  }
     336
     337  /**
     338   * declared as public to be accessible by the event manager, but this funcion
     339   * is not aimed to be used directly
     340   */
     341  static public function applyHeaderItems()
     342  {
     343    global $template;
     344
     345    foreach(self::$headerItems['css'] as $file)
     346    {
     347      $template->block_html_head(null, '<link rel="stylesheet" type="text/css" href="'.$file.'"/>', $template->smarty, $false);
     348    }
     349
     350    foreach(self::$headerItems['js'] as $file)
     351    {
     352      $template->block_html_head(null, '<script type="text/javascript" src="'.$file.'"></script>', $template->smarty, $false);
     353    }
     354  }
     355
    307356} //class
    308357
     358add_event_handler('loc_end_page_header', array('GPCCore', 'applyHeaderItems'));
     359
     360
    309361?>
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r6975 r7175  
    466466    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'external/interface/interface.js"></script>');
    467467    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'external/inestedsortable.pack.js"></script>');
    468     $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'criteriaBuilder.js"></script>');
     468    $template->append('head_elements', '<script type="text/javascript" src="plugins/'.$baseName.'criteriaBuilder.packed.js"></script>');
    469469    $template->append('head_elements',
    470470"<script type=\"text/javascript\">
Note: See TracChangeset for help on using the changeset viewer.