Ignore:
Timestamp:
04/10/11 19:43:01 (9 years ago)
Author:
grum
Message:

bug:2149
Compatibility with Piwigo 2.2

File:
1 edited

Legend:

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

    r9066 r10246  
    33/* ----------------------------------------------------------------------------- 
    44  class name     : GPCCore 
    5   class version  : 1.3.3 
    6   plugin version : 3.4.4 
    7   date           : 2011-02-02 
     5  class version  : 1.4.0 
     6  plugin version : 3.5.0 
     7  date           : 2011-04-10 
    88  ------------------------------------------------------------------------------ 
    99  author: grum at piwigo.org 
     
    5353|         |            |     with Lightbox, GMaps & ASE plugins (and probably other) 
    5454|         |            | 
     55| 1.4.0   | 2011/04/10 | * Updated for piwigo 2.2 
    5556|         |            | 
    5657|         |            | 
     
    107108        Array('name' => "GPCAjax", 'version' => "3.0.0"), 
    108109        Array('name' => "GPCCategorySelector", 'version' => "1.0.1"), 
    109         Array('name' => "GPCCore", 'version' => "1.3.4"), 
    110         Array('name' => "GPCCss", 'version' => "3.0.0"), 
     110        Array('name' => "GPCCore", 'version' => "1.4.0"), 
     111        Array('name' => "GPCCss", 'version' => "3.1.0"), 
    111112        Array('name' => "GPCPagesNavigation", 'version' => "2.0.0"), 
    112113        Array('name' => "GPCPublicIntegration", 'version' => "2.0.0"), 
    113         Array('name' => "GPCRequestBuilder", 'version' => "1.1.4"), 
     114        Array('name' => "GPCRequestBuilder", 'version' => "1.1.2"), 
    114115        Array('name' => "GPCTables", 'version' => "1.5.0"), 
    115116        Array('name' => "GPCTabSheet", 'version' => "1.1.1"), 
     
    369370   * @param String $file : the css file 
    370371   */ 
    371   static public function addHeaderCSS($id, $file) 
    372   { 
     372  static public function addHeaderCSS($id, $file, $order=0) 
     373  { 
     374    global $template; 
     375 
    373376    if(!array_key_exists($file, self::$headerItems['css'])) 
    374377    { 
    375378      self::$headerItems['css'][$id]=$file; 
    376     } 
    377   } 
    378   static public function addHeaderJS($id, $file) 
     379      $template->func_combine_css(array('path'=>$file, 'order'=>$order), $template->smarty); 
     380    } 
     381  } 
     382  static public function addHeaderJS($id, $file, $require=array()) 
    379383  { 
    380384    global $template; 
    381385 
    382     if(!isset($template->known_scripts)) $template->known_scripts=array(); 
    383  
    384     if(!array_key_exists($id,  $template->known_scripts) and !array_key_exists($file, self::$headerItems['js'])) 
    385     { 
    386       $dummy=null; 
    387  
    388       $template->func_known_script( 
    389         array('id'=>$id, 
    390               'src'=>$file), 
    391         $dummy); 
    392      //$template->known_scripts[$id]=$file; 
    393      self::$headerItems['js'][$id]=$file; 
    394     } 
    395   } 
    396  
    397   /** 
    398    * declared as public to be accessible by the event manager, but this funcion 
    399    * is not aimed to be used directly 
    400    */ 
    401   static public function applyHeaderItems() 
    402   { 
    403     global $template; 
    404     $dummy1=null; 
    405     $dummy2=null; 
    406  
    407     foreach(self::$headerItems['css'] as $file) 
    408     { 
    409       $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.$file.'"/>'); 
    410     } 
    411 /* 
    412     foreach(self::$headerItems['js'] as $file) 
    413     { 
    414       //$template->append('head_elements', '<script type="text/javascript" src="'.$file.'"></script>'); 
    415       $template->block_html_head(null, '<script type="text/javascript" src="'.$file.'"></script>', $dummy1, $dummy2); 
    416     } 
    417 */ 
     386    if(!array_key_exists($file, self::$headerItems['js'])) 
     387    { 
     388      self::$headerItems['js'][$id]=$file; 
     389      $template->scriptLoader->add($id, 'header', $require, $file, 0); 
     390    } 
    418391  } 
    419392 
     
    457430        case 'googleTranslate': 
    458431          self::addHeaderJS('google.jsapi', 'http://www.google.com/jsapi'); 
    459           self::addHeaderJS('gpc.googleTranslate', 'plugins/GrumPluginClasses/js/google_translate'.self::$minified.'.js'); 
     432          self::addHeaderJS('gpc.googleTranslate', 'plugins/GrumPluginClasses/js/google_translate'.self::$minified.'.js', array('jquery', 'google.jsapi')); 
    460433        case 'categorySelector': 
    461434          self::addHeaderCSS('gpc.categorySelector', GPC_PATH.'css/categorySelector.css'); 
    462435          self::addHeaderCSS('gpc.categorySelectorT', sprintf($themeFile, 'categorySelector')); 
    463           self::addHeaderJS('gpc.categorySelector', GPC_PATH.'js/ui.categorySelector'.self::$minified.'.js'); 
     436          self::addHeaderJS('gpc.categorySelector', GPC_PATH.'js/ui.categorySelector'.self::$minified.'.js', array('jquery')); 
    464437          break; 
    465438        case 'inputCheckbox': 
    466439          self::addHeaderCSS('gpc.inputCheckbox', GPC_PATH.'css/inputCheckbox.css'); 
    467           self::addHeaderJS('gpc.inputCheckbox', GPC_PATH.'js/ui.inputCheckbox'.self::$minified.'.js'); 
     440          self::addHeaderJS('gpc.inputCheckbox', GPC_PATH.'js/ui.inputCheckbox'.self::$minified.'.js', array('jquery')); 
    468441          break; 
    469442        case 'inputColorPicker': 
     
    478451          self::addHeaderCSS('gpc.inputDotAreaT', sprintf($themeFile, 'inputDotArea')); 
    479452          self::addHeaderCSS('gpc.inputColorPickerT', sprintf($themeFile, 'inputColorPicker')); 
    480           self::addHeaderJS('jquery.ui', 'themes/default/js/ui/packed/ui.core.packed.js'); 
    481           self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/packed/ui.slider.packed.js'); 
    482           self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/packed/ui.draggable.packed.js'); 
    483           self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/packed/ui.dialog.packed.js'); 
    484           self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js'); 
    485           self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js'); 
    486           self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js'); 
    487           self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js'); 
    488           self::addHeaderJS('gpc.inputColorPicker', GPC_PATH.'js/ui.inputColorPicker'.self::$minified.'.js'); 
     453          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); 
     454          self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/minified/jquery.ui.slider.min.js', array('jquery.ui')); 
     455          self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/minified/jquery.ui.draggable.min.js', array('jquery.ui')); 
     456          self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/minified/jquery.ui.slider.dialog.js', array('jquery.ui')); 
     457          self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js', array('jquery')); 
     458          self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js', array('jquery')); 
     459          self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js', array('jquery')); 
     460          self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js', array('jquery')); 
     461          self::addHeaderJS('gpc.inputColorPicker', GPC_PATH.'js/ui.inputColorPicker'.self::$minified.'.js', array('jquery.ui.slider','gpc.inputText','gpc.inputNum','gpc.inputColorsFB','gpc.inputDotArea')); 
    489462          break; 
    490463        case 'inputColorsFB': 
    491464          self::addHeaderCSS('gpc.inputColorsFB', GPC_PATH.'css/inputColorsFB.css'); 
    492465          self::addHeaderCSS('gpc.inputColorsFBT', sprintf($themeFile, 'inputColorsFB')); 
    493           self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js'); 
     466          self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js', array('jquery')); 
    494467          break; 
    495468        case 'inputConsole': 
    496469          self::addHeaderCSS('gpc.inputConsole', GPC_PATH.'css/inputConsole.css'); 
    497470          self::addHeaderCSS('gpc.inputConsoleT', sprintf($themeFile, 'inputConsole')); 
    498           self::addHeaderJS('gpc.inputConsole', GPC_PATH.'js/ui.inputConsole'.self::$minified.'.js'); 
     471          self::addHeaderJS('gpc.inputConsole', GPC_PATH.'js/ui.inputConsole'.self::$minified.'.js', array('jquery')); 
    499472          break; 
    500473        case 'inputDotArea': 
    501474          self::addHeaderCSS('gpc.inputDotArea', GPC_PATH.'css/inputDotArea.css'); 
    502475          self::addHeaderCSS('gpc.inputDotAreaT', sprintf($themeFile, 'inputDotArea')); 
    503           self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js'); 
     476          self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js', array('jquery')); 
    504477          break; 
    505478        case 'inputList': 
    506479          self::addHeaderCSS('gpc.inputList', GPC_PATH.'css/inputList.css'); 
    507480          self::addHeaderCSS('gpc.inputListT', sprintf($themeFile, 'inputList')); 
    508           self::addHeaderJS('gpc.inputList', GPC_PATH.'js/ui.inputList'.self::$minified.'.js'); 
     481          self::addHeaderJS('gpc.inputList', GPC_PATH.'js/ui.inputList'.self::$minified.'.js', array('jquery')); 
    509482          break; 
    510483        case 'inputNum': 
    511484          self::addHeaderCSS('gpc.inputNum', GPC_PATH.'css/inputNum.css'); 
    512485          self::addHeaderCSS('gpc.inputNumT', sprintf($themeFile, 'inputNum')); 
    513           self::addHeaderJS('jquery.ui', 'themes/default/js/ui/packed/ui.core.packed.js'); 
    514           self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/packed/ui.slider.packed.js'); 
    515           self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js'); 
     486          self::addHeaderJS('jquery.ui', 'themes/default/js/ui/minified/jquery.ui.core.min.js', array('jquery')); 
     487          self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/minified/jquery.ui.slider.min.js', array('jquery.ui')); 
     488          self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js', array('jquery','jquery.ui.slider')); 
    516489          break; 
    517490        case 'inputPosition': 
    518491          self::addHeaderCSS('gpc.inputPosition', GPC_PATH.'css/inputPosition.css'); 
    519492          self::addHeaderCSS('gpc.inputPositionT', sprintf($themeFile, 'inputPosition')); 
    520           self::addHeaderJS('gpc.inputPosition', GPC_PATH.'js/ui.inputPosition'.self::$minified.'.js'); 
     493          self::addHeaderJS('gpc.inputPosition', GPC_PATH.'js/ui.inputPosition'.self::$minified.'.js', array('jquery')); 
    521494          break; 
    522495        case 'inputRadio': 
    523           self::addHeaderJS('gpc.inputRadio', GPC_PATH.'js/ui.inputRadio'.self::$minified.'.js'); 
     496          self::addHeaderJS('gpc.inputRadio', GPC_PATH.'js/ui.inputRadio'.self::$minified.'.js', array('jquery')); 
    524497          break; 
    525498        case 'inputStatusBar': 
    526499          self::addHeaderCSS('gpc.inputStatusBar', GPC_PATH.'css/inputStatusBar.css'); 
    527500          self::addHeaderCSS('gpc.inputStatusBarT', sprintf($themeFile, 'inputStatusBar')); 
    528           self::addHeaderJS('gpc.inputStatusBar', GPC_PATH.'js/ui.inputStatusBar'.self::$minified.'.js'); 
     501          self::addHeaderJS('gpc.inputStatusBar', GPC_PATH.'js/ui.inputStatusBar'.self::$minified.'.js', array('jquery')); 
    529502          break; 
    530503        case 'inputText': 
    531504          self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css'); 
    532505          self::addHeaderCSS('gpc.inputTextT', sprintf($themeFile, 'inputText')); 
    533           self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js'); 
     506          self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js', array('jquery')); 
    534507          break; 
    535508      } 
     
    707680} //class 
    708681 
    709 add_event_handler('loc_begin_page_header', array('GPCCore', 'applyHeaderItems'), 10); 
     682//add_event_handler('loc_begin_page_header', array('GPCCore', 'applyHeaderItems'), 10); 
    710683 
    711684GPCCore::init(); 
Note: See TracChangeset for help on using the changeset viewer.