Changeset 8961 for extensions/GrumPluginClasses/classes
- Timestamp:
- Jan 28, 2011, 4:54:02 PM (13 years ago)
- Location:
- extensions/GrumPluginClasses/classes
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GrumPluginClasses/classes/CommonPlugin.class.inc.php
r7310 r8961 8 8 ------------------------------------------------------------------------------ 9 9 Author : Grum 10 email : grum@ grum.dnsalias.com11 website : http://photos.grum. dnsalias.com10 email : grum@piwigo.org 11 website : http://photos.grum.fr 12 12 PWG user : http://forum.phpwebgallery.net/profile.php?id=3706 13 13 -
extensions/GrumPluginClasses/classes/GPCCore.class.inc.php
r7387 r8961 3 3 /* ----------------------------------------------------------------------------- 4 4 class name : GPCCore 5 class version : 1.3. 16 plugin version : 3. 3.27 date : 201 0-10-205 class version : 1.3.2 6 plugin version : 3.4.0 7 date : 2011-01-28 8 8 ------------------------------------------------------------------------------ 9 9 author: grum at piwigo.org … … 28 28 | | | extended description function if present 29 29 | | | 30 | | | * implement the getPiwigoSystemPath function 31 | | | 32 | | | * implement the rmDir function 30 | | | * implement the getPiwigoSystemPath() function 31 | | | 32 | | | * implement the rmDir() function 33 | | | 34 | 1.3.2 | 2011/01/28 | * implement the addUI() function 35 | | | 36 | | | * implement getMinified() & setMinifiedState() functions 37 | | | 33 38 | | | 34 39 | | | … … 47 52 - static function addHeaderCSS 48 53 - static function addHeaderJS 54 - static function addUI 55 - static function getMinified 56 - static function setMinifiedState 49 57 - static function getUserLanguageDesc 50 58 - static function getPiwigoSystemPath … … 58 66 { 59 67 static private $piwigoSystemPath; 68 static private $minified='.min'; 60 69 61 70 static public $pluginName = "GPCCore"; … … 79 88 Array('name' => "CommonPlugin", 'version' => "2.2.0"), 80 89 Array('name' => "GPCAjax", 'version' => "3.0.0"), 81 Array('name' => "GPCCore", 'version' => "1.3.1"), 90 Array('name' => "GPCCategorySelector", 'version' => "1.0.1"), 91 Array('name' => "GPCCore", 'version' => "1.3.2"), 82 92 Array('name' => "GPCCss", 'version' => "3.0.0"), 83 Array('name' => "GPCPagesNavigation s", 'version' => "2.0.0"),93 Array('name' => "GPCPagesNavigation", 'version' => "2.0.0"), 84 94 Array('name' => "GPCPublicIntegration", 'version' => "2.0.0"), 85 Array('name' => "GPCRequestBuilder", 'version' => "1.1. 0"),95 Array('name' => "GPCRequestBuilder", 'version' => "1.1.2"), 86 96 Array('name' => "GPCTables", 'version' => "1.5.0"), 87 97 Array('name' => "GPCTabSheet", 'version' => "1.1.1"), 88 Array('name' => "GPCTranslate", 'version' => "2.1. 0"),89 Array('name' => "GPCUsersGroups", 'version' => "2. 0.0"),98 Array('name' => "GPCTranslate", 'version' => "2.1.1"), 99 Array('name' => "GPCUsersGroups", 'version' => "2.1.0") 90 100 ) 91 101 ); … … 365 375 { 366 376 global $template; 377 $dummy1=null; 378 $dummy2=null; 367 379 368 380 foreach(self::$headerItems['css'] as $file) … … 373 385 foreach(self::$headerItems['js'] as $file) 374 386 { 375 $template->append('head_elements', '<script type="text/javascript" src="'.$file.'"></script>'); 376 } 377 } 387 //$template->append('head_elements', '<script type="text/javascript" src="'.$file.'"></script>'); 388 $template->block_html_head(null, '<script type="text/javascript" src="'.$file.'"></script>', $dummy1, $dummy2); 389 } 390 } 391 392 /** 393 * add a ui component ; css & js dependencies are managed 394 * 395 * @param Array $list : possibles values are 396 * - inputCheckbox 397 * - inputColorPicker 398 * - inputColorsFB 399 * - inputConsole 400 * - inputDotArea 401 * - inputList 402 * - inputNum 403 * - inputPosition 404 * - inputRadio 405 * - inputStatusBar 406 * - inputText 407 * - categorySelector 408 */ 409 static public function addUI($list) 410 { 411 global $template; 412 413 if(is_string($list)) $list=explode(',', $list); 414 if(!is_array($list)) return(false); 415 416 if(defined('IN_ADMIN')) 417 { 418 $themeFile=GPC_PATH.'css/%s_'.$template->get_themeconf('name').'.css'; 419 } 420 else 421 { 422 $themeFile='themes/'.$template->get_themeconf('name').'/css/GPC%s.css'; 423 } 424 425 foreach($list as $ui) 426 { 427 switch($ui) 428 { 429 case 'googleTranslate': 430 self::addHeaderJS('google.jsapi', 'http://www.google.com/jsapi'); 431 self::addHeaderJS('gpc.googleTranslate', 'plugins/GrumPluginClasses/js/google_translate'.self::$minified.'.js'); 432 case 'categorySelector': 433 self::addHeaderCSS('gpc.categorySelector', GPC_PATH.'css/categorySelector.css'); 434 self::addHeaderCSS('gpc.categorySelectorT', sprintf($themeFile, 'categorySelector')); 435 self::addHeaderJS('gpc.categorySelector', GPC_PATH.'js/ui.categorySelector'.self::$minified.'.js'); 436 break; 437 case 'inputCheckbox': 438 self::addHeaderCSS('gpc.inputCheckbox', GPC_PATH.'css/inputCheckbox.css'); 439 self::addHeaderJS('gpc.inputCheckbox', GPC_PATH.'js/ui.inputCheckbox'.self::$minified.'.js'); 440 break; 441 case 'inputColorPicker': 442 self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css'); 443 self::addHeaderCSS('gpc.inputNum', GPC_PATH.'css/inputNum.css'); 444 self::addHeaderCSS('gpc.inputColorsFB', GPC_PATH.'css/inputColorsFB.css'); 445 self::addHeaderCSS('gpc.inputDotArea', GPC_PATH.'css/inputDotArea.css'); 446 self::addHeaderCSS('gpc.inputColorPicker', GPC_PATH.'css/inputColorPicker.css'); 447 self::addHeaderCSS('gpc.inputTextT', sprintf($themeFile, 'inputText')); 448 self::addHeaderCSS('gpc.inputNumT', sprintf($themeFile, 'inputNum')); 449 self::addHeaderCSS('gpc.inputColorsFBT', sprintf($themeFile, 'inputColorsFB')); 450 self::addHeaderCSS('gpc.inputDotAreaT', sprintf($themeFile, 'inputDotArea')); 451 self::addHeaderCSS('gpc.inputColorPickerT', sprintf($themeFile, 'inputColorPicker')); 452 self::addHeaderJS('jquery.ui', 'themes/default/js/ui/packed/ui.core.packed.js'); 453 self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/packed/ui.slider.packed.js'); 454 self::addHeaderJS('jquery.ui.draggable', 'themes/default/js/ui/packed/ui.draggable.packed.js'); 455 self::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/packed/ui.slider.dialog.js'); 456 self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js'); 457 self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js'); 458 self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js'); 459 self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js'); 460 self::addHeaderJS('gpc.inputColorPicker', GPC_PATH.'js/ui.inputColorPicker'.self::$minified.'.js'); 461 break; 462 case 'inputColorsFB': 463 self::addHeaderCSS('gpc.inputColorsFB', GPC_PATH.'css/inputColorsFB.css'); 464 self::addHeaderCSS('gpc.inputColorsFBT', sprintf($themeFile, 'inputColorsFB')); 465 self::addHeaderJS('gpc.inputColorsFB', GPC_PATH.'js/ui.inputColorsFB'.self::$minified.'.js'); 466 break; 467 case 'inputConsole': 468 self::addHeaderCSS('gpc.inputConsole', GPC_PATH.'css/inputConsole.css'); 469 self::addHeaderCSS('gpc.inputConsoleT', sprintf($themeFile, 'inputConsole')); 470 self::addHeaderJS('gpc.inputConsole', GPC_PATH.'js/ui.inputConsole'.self::$minified.'.js'); 471 break; 472 case 'inputDotArea': 473 self::addHeaderCSS('gpc.inputDotArea', GPC_PATH.'css/inputDotArea.css'); 474 self::addHeaderCSS('gpc.inputDotAreaT', sprintf($themeFile, 'inputDotArea')); 475 self::addHeaderJS('gpc.inputDotArea', GPC_PATH.'js/ui.inputDotArea'.self::$minified.'.js'); 476 break; 477 case 'inputList': 478 self::addHeaderCSS('gpc.inputList', GPC_PATH.'css/inputList.css'); 479 self::addHeaderCSS('gpc.inputListT', sprintf($themeFile, 'inputList')); 480 self::addHeaderJS('gpc.inputList', GPC_PATH.'js/ui.inputList'.self::$minified.'.js'); 481 break; 482 case 'inputNum': 483 self::addHeaderCSS('gpc.inputNum', GPC_PATH.'css/inputNum.css'); 484 self::addHeaderCSS('gpc.inputNumT', sprintf($themeFile, 'inputNum')); 485 self::addHeaderJS('jquery.ui', 'themes/default/js/ui/packed/ui.core.packed.js'); 486 self::addHeaderJS('jquery.ui.slider', 'themes/default/js/ui/packed/ui.slider.packed.js'); 487 self::addHeaderJS('gpc.inputNum', GPC_PATH.'js/ui.inputNum'.self::$minified.'.js'); 488 break; 489 case 'inputPosition': 490 self::addHeaderCSS('gpc.inputPosition', GPC_PATH.'css/inputPosition.css'); 491 self::addHeaderCSS('gpc.inputPositionT', sprintf($themeFile, 'inputPosition')); 492 self::addHeaderJS('gpc.inputPosition', GPC_PATH.'js/ui.inputPosition'.self::$minified.'.js'); 493 break; 494 case 'inputRadio': 495 self::addHeaderJS('gpc.inputRadio', GPC_PATH.'js/ui.inputRadio'.self::$minified.'.js'); 496 break; 497 case 'inputStatusBar': 498 self::addHeaderCSS('gpc.inputStatusBar', GPC_PATH.'css/inputStatusBar.css'); 499 self::addHeaderCSS('gpc.inputStatusBarT', sprintf($themeFile, 'inputStatusBar')); 500 self::addHeaderJS('gpc.inputStatusBar', GPC_PATH.'js/ui.inputStatusBar'.self::$minified.'.js'); 501 break; 502 case 'inputText': 503 self::addHeaderCSS('gpc.inputText', GPC_PATH.'css/inputText.css'); 504 self::addHeaderCSS('gpc.inputTextT', sprintf($themeFile, 'inputText')); 505 self::addHeaderJS('gpc.inputText', GPC_PATH.'js/ui.inputText'.self::$minified.'.js'); 506 break; 507 } 508 } 509 } 510 511 /** 512 * return the minified value 513 * 514 * @return String 515 */ 516 static public function getMinified() 517 { 518 return(self::$minified); 519 } 520 521 /** 522 * set the minified state 523 * 524 * @param Bool $state 525 * @return Bool 526 */ 527 static public function setMinifiedState($state) 528 { 529 if($state) 530 { 531 self::$minified='.min'; 532 } 533 else 534 { 535 self::$minified=''; 536 } 537 return(self::$minified!=''); 538 } 539 378 540 379 541 /** -
extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php
r7451 r8961 2 2 /* ----------------------------------------------------------------------------- 3 3 class name: GCPRequestBuilder 4 class version : 1.1. 15 plugin version : 3.3. 24 class version : 1.1.2 5 plugin version : 3.3.3 6 6 date : 2010-09-08 7 7 … … 75 75 | | | * fix bug on user level access to picture 76 76 | | | 77 | | | 78 | | | 77 | 1.1.2 | 2010/11/01 | * mantis bug:1984 78 | | | . RBuilder returns an error message when one picture 79 | | | have multiple categories 79 80 | | | 80 81 | | | … … 522 523 GPCCore::addHeaderJS('gpc.interface', 'plugins/'.$baseName.'external/interface/interface.js'); 523 524 GPCCore::addHeaderJS('gpc.inestedsortable', 'plugins/'.$baseName.'external/inestedsortable.pack.js'); 524 GPCCore::addHeaderJS('gpc.rbCriteriaBuilder', 'plugins/'.$baseName.'rbCriteriaBuilder .packed.js');525 GPCCore::addHeaderJS('gpc.rbCriteriaBuilder', 'plugins/'.$baseName.'rbCriteriaBuilder'.GPCCore::getMinified().'.js'); 525 526 526 527 $template->append('head_elements', … … 829 830 'SELECT' => Array( 830 831 'RB_PIT' => "pit.id AS imageId, pit.name AS imageName, pit.path AS imagePath", // from the piwigo's image table 831 'RB_PIC' => "GROUP_CONCAT( DISTINCTpic.category_id SEPARATOR ',') AS imageCategoriesId", // from the piwigo's image_category table832 'RB_PCT' => "GROUP_CONCAT( DISTINCTCASE WHEN pct.name IS NULL THEN '' ELSE pct.name END SEPARATOR '#sep#') AS imageCategoriesNames,833 GROUP_CONCAT( DISTINCTCASE WHEN pct.permalink IS NULL THEN '' ELSE pct.permalink END SEPARATOR '#sep#') AS imageCategoriesPLink,834 GROUP_CONCAT( DISTINCTCASE WHEN pct.dir IS NULL THEN 'V' ELSE 'P' END) AS imageCategoriesDir", //from the piwigo's categories table832 'RB_PIC' => "GROUP_CONCAT( pic.category_id SEPARATOR ',') AS imageCategoriesId", // from the piwigo's image_category table 833 'RB_PCT' => "GROUP_CONCAT( CASE WHEN pct.name IS NULL THEN '' ELSE pct.name END SEPARATOR '#sep#') AS imageCategoriesNames, 834 GROUP_CONCAT( CASE WHEN pct.permalink IS NULL THEN '' ELSE pct.permalink END SEPARATOR '#sep#') AS imageCategoriesPLink, 835 GROUP_CONCAT( CASE WHEN pct.dir IS NULL THEN 'V' ELSE 'P' END) AS imageCategoriesDir", //from the piwigo's categories table 835 836 ), 836 837 'FROM' => Array( … … 1374 1375 $filter=array_flip($filter); 1375 1376 1377 GPCCore::addHeaderJS('jquery.ui', 'themes/default/js/ui/packed/ui.core.packed.js'); 1378 GPCCore::addHeaderJS('jquery.ui.dialog', 'themes/default/js/ui/packed/ui.dialog.packed.js'); 1379 GPCCore::addHeaderJS('gpc.pagesNavigator', 'plugins/'.$baseName.'/js/pagesNavigator'.GPCCore::getMinified().'.js'); 1380 GPCCore::addHeaderJS('gpc.rbSearch', 'plugins/'.$baseName.'/js/rbSearch'.GPCCore::getMinified().'.js'); 1381 1382 1376 1383 $template->set_filename('gpc_search_page', 1377 1384 dirname(dirname(__FILE__)).'/templates/GPCRequestBuilder_search.tpl'); -
extensions/GrumPluginClasses/classes/GPCTranslate.class.inc.php
r5550 r8961 3 3 /* ----------------------------------------------------------------------------- 4 4 class name : GPCTranslate 5 class version : 2.1. 06 plugin version : 3. 0.07 date : 201 0-03-315 class version : 2.1.1 6 plugin version : 3.4.0 7 date : 2011-01-28 8 8 ------------------------------------------------------------------------------ 9 9 author: grum at piwigo.org 10 10 << May the Little SpaceFrog be with you >> 11 11 ------------------------------------------------------------------------------ 12 13 12 14 13 ------------------------------------------------------------------------------ … … 19 18 | 2.1.0 | 2010/03/31 | * update class & functions names 20 19 | | | 20 | 2.1.1 | 2011/01/09 | * fixbug on js loading 21 21 | | | 22 | | | 22 | | | * use GPCCore::addUI function (the class is kept for 23 | | | compatibility with older plugins) 23 24 | | | 24 25 | | | 25 26 26 27 ------------------------------------------------------------------------------ 27 28 29 28 class call API in HTML header, and provide a .js file manage API call 30 29 >> http://code.google.com/apis/ajaxlanguage/ 31 30 32 31 - constructor 33 34 32 ---------------------------------------------------------------------- */ 35 33 class GPCTranslate … … 37 35 public function __construct() 38 36 { 39 add_event_handler('loc_end_page_header', array(&$this, 'loadJS'));37 GPCCore::addUI('googleTranslate'); 40 38 } 41 42 public function loadJS()43 {44 global $template;45 46 $googleload='47 <script type="text/javascript" src="http://www.google.com/jsapi"></script>48 <script type="text/javascript" src="plugins/'.basename(dirname(__FILE__)).'/google_translate.js"></script>';49 50 $template->append('head_elements', $googleload);51 }52 53 39 } //class 54 40 -
extensions/GrumPluginClasses/classes/GPCUsersGroups.class.inc.php
r5550 r8961 3 3 /* ----------------------------------------------------------------------------- 4 4 class name: GPCAllowedAccess, GPCGroups, GPCUsers 5 class version : 2. 0.06 plugin version : 3. 0.05 class version : 2.1.0 6 plugin version : 3.4.0 7 7 date : 2010-03-30 8 8 ------------------------------------------------------------------------------ … … 14 14 groups and users classes extends GPCAllowedAccess classes 15 15 16 - constructor GPCAllowedAccess($alloweds ="")17 - constructor groups($alloweds ="")18 - constructor users($alloweds ="")16 - constructor GPCAllowedAccess($alloweds = array(), $accessMode='a') 17 - constructor groups($alloweds = array(), $accessMode='a') 18 - constructor users($alloweds = array(), $accessMode='a') 19 19 - (public) function getList() 20 20 - (public) function setAllowed($id, $allowed) 21 - (public) function setAlloweds( )22 - (public) function getAlloweds( $return_type)21 - (public) function setAlloweds($idList, $allowed) 22 - (public) function getAlloweds() 23 23 - (public) function isAllowed($id) 24 - (public) function htmlView($sep=", ", $empty="")25 - (public) function htmlForm($basename)26 24 - (private) function initList() 27 25 … … 34 32 | | | * update classes & functions names 35 33 | | | 34 | 2.1.0 | 2011/01/15 | * remove html function 35 | | | 36 | | | * implement accessMode 37 | | | 36 38 | | | 37 39 … … 39 41 class GPCAllowedAccess 40 42 { 41 public $access_list; 42 43 /* 44 constructor initialize the groups_getListgetListlist 45 */ 46 public function __construct($alloweds = "") 43 protected $accessList; 44 protected $accessMode='a'; // 'a' : allowed, 'n' : not allowed 45 46 /** 47 * constructor initialize default values 48 * 49 * @param Array $alloweds : list of items 50 * String $alloweds : list of items (separator : '/') 51 * 52 * @param String $accessMode : 'a' = access is allowed by default for all values, $allowed param is a list of not allowed values 53 * 'n' = access is not allowed by default for all values, $allowed param is a list of allowed values 54 * priority is given to the $allowed value 55 */ 56 public function __construct($alloweds = array(), $accessMode='a') 47 57 { 48 58 $this->initList(); 49 $this->setAlloweds($alloweds );59 $this->setAlloweds($alloweds, $accessMode=='n'); 50 60 } 51 61 52 62 public function __destruct() 53 63 { 54 unset($this->access _list);55 } 56 57 /* 58 initializethe groups list59 */64 unset($this->accessList); 65 } 66 67 /** 68 * destroy the groups list 69 */ 60 70 protected function initList() 61 71 { 62 $this->access_list=array(); 63 } 64 65 /* 66 returns list (as an array) 67 */ 72 $this->accessList=array(); 73 } 74 75 /** 76 * returns list of items (as an array) 77 * each array item is an array : 78 * 'id' : (String) id of item 79 * 'name' : (String) name of item 80 * 'allowed' : (Bool) access is allowed or not 81 * 82 * @return Array 83 */ 68 84 function getList() 69 85 { 70 return($this->access_list); 71 } 72 73 /* 74 set element an allowed state 75 */ 86 return($this->accessList); 87 } 88 89 /** 90 * set allowed value for an item 91 * 92 * @param String $id : id of item 93 * @param Bool $allowed : access allowed or not 94 */ 76 95 function setAllowed($id, $allowed) 77 96 { 78 if(isset($this->access_list[$id])) 79 { 80 $this->access_list[$id]['allowed']=$allowed; 81 } 82 } 83 84 /* 85 set a group enabled/disabled state 86 */ 87 function setState($id, $enabled) 88 { 89 if(isset($this->access_list[$id])) 90 { 91 $this->access_list[$id]['enabled']=$enabled; 92 } 93 } 94 95 /* 96 set alloweds list 97 $list is string of id, separated with "/" 98 */ 99 function setAlloweds($list) 100 { 101 $alloweds=explode("/", $list); 102 $alloweds=array_flip($alloweds); 103 foreach($this->access_list as $key => $val) 104 { 105 if(isset($alloweds[$key])) 97 if(isset($this->accessList[$id])) 98 { 99 $this->accessList[$id]['allowed']=$allowed; 100 } 101 } 102 103 104 /** 105 * set alloweds items (can be given as an array or a string with separator '/') 106 * according to the 107 * 108 * @param Array $idList : list of items to set 109 * @param String $idList 110 * @param Bool $allowed : access allowed or not 111 */ 112 function setAlloweds($idList, $allowed) 113 { 114 if(!is_array($idList)) $idList=explode("/", $idList); 115 116 $idList=array_flip($idList); 117 118 foreach($this->accessList as $key => $val) 119 { 120 if(isset($idList[$key])) 106 121 { 107 $this->access _list[$key]['allowed']=true;122 $this->accessList[$key]['allowed']=$allowed; 108 123 } 109 124 else 110 125 { 111 $this->access _list[$key]['allowed']=false;126 $this->accessList[$key]['allowed']=!$allowed; 112 127 } 113 128 } 114 129 } 115 130 116 /* 117 get alloweds list 118 return a string of groups, separated with "/" 119 */ 120 function getAlloweds($return_type = 'name') 121 { 122 $returned=""; 123 foreach($this->access_list as $key => $val) 124 { 125 if($val['allowed']) 126 { $returned.=$val[$return_type]."/"; } 131 132 /** 133 * return list of alloweds items 134 * 135 * @return Array 136 */ 137 function getAlloweds() 138 { 139 $returned=Array(); 140 141 foreach($this->accessList as $key => $val) 142 { 143 if($val['allowed']) $returned[]=$val; 127 144 } 128 145 return($returned); … … 130 147 131 148 132 /* 133 returns true if is allowed 134 */ 149 /** 150 * returns true if is allowed 151 * 152 * @param String $id : item id 153 * @retrun Bool 154 */ 135 155 function isAllowed($id) 136 156 { 137 if(isset($this->access_list[$id])) 138 { return($this->access_list[$id]['allowed']); } 157 if(isset($this->accessList[$id])) 158 { 159 return($this->accessList[$id]['allowed']); 160 } 139 161 else 140 { return(false); } 141 } 142 143 /* 144 returns true if all or one is allowed 145 ids is an array 146 */ 147 function areAllowed($ids, $all=false) 148 { 149 foreach($ids as $val) 150 { 151 if($all) 152 { 153 if(!$this->isAllowed($val)) 154 { 155 return(false); 156 } 157 } 158 else 159 { 160 if($this->isAllowed($val)) 161 { 162 return(true); 163 } 164 } 165 } 166 return(false); 167 } 168 169 /* 170 returns an HTML list with label rather than id 171 */ 172 function htmlView($sep=", ", $empty="") 173 { 174 $returned=""; 175 foreach($this->access_list as $key => $val) 176 { 177 if($val['allowed']) 178 { 179 if($returned!="") 180 { 181 $returned.=$sep; 182 } 183 $returned.=$val['name']; 184 } 185 } 186 if($returned=="") 187 { 188 $returned=$empty; 189 } 190 return($returned); 191 } 192 /* 193 returns a generic HTML form to manage the groups access 194 */ 195 function htmlForm($basename) 196 { 197 /* 198 <!-- BEGIN allowed_group_row --> 199 <label><input type="checkbox" name="fmypolls_att_allowed_groups_{allowed_group_row.ID}" {allowed_group_row.CHECKED}/> {allowed_group_row.NAME}</label> 200 <!-- END allowed_group_row --> 201 */ 202 $text=''; 203 foreach($this->access_list as $key => $val) 204 { 205 if($val['allowed']) 206 { 207 $checked=' checked'; 208 } 209 else 210 { 211 $checked=''; 212 } 213 214 if($val['enabled']) 215 { 216 $enabled=''; 217 } 218 else 219 { 220 $enabled=' disabled'; 221 } 222 223 $text.='<label><input type="checkbox" name="'.$basename.$val['id'].'" '.$checked.$enabled.'/> 224 '.$val['name'].'</label> '; 225 } 226 return($text); 227 } 162 { 163 return($this->accessMode=='a'); 164 } 165 } 166 228 167 } //GPCAllowedAccess 229 168 … … 235 174 236 175 237 /* ---------------------------------------------------------------------- 238 this class provides base functions to manage groups access 239 initList redefined to initialize access_list from database GROUPS 240 ---------------------------------------------------------------------- */ 176 /** 177 * ---------------------------------------------------------------------------- 178 * this class provides base functions to manage groups access 179 * initList redefined to initialize accessList from database GROUPS 180 * ---------------------------------------------------------------------------- 181 */ 241 182 class GPCGroups extends GPCAllowedAccess 242 183 { 243 /* 244 initialize the groups list245 */184 /** 185 * initialize the groups list 186 */ 246 187 protected function initList() 247 188 { 248 $this->access _list=array();189 $this->accessList=array(); 249 190 $sql="SELECT id, name FROM ".GROUPS_TABLE." ORDER BY name"; 250 191 $result=pwg_query($sql); … … 253 194 while($row=pwg_db_fetch_assoc($result)) 254 195 { 255 $this->access _list[$row['id']] =256 array('id' => $row['id'],257 258 'allowed' => false,259 'enabled' => true);196 $this->accessList[$row['id']]=array( 197 'id' => $row['id'], 198 'name' => $row['name'], 199 'allowed' => ($this->accessMode=='a') 200 ); 260 201 } 261 202 } … … 270 211 271 212 272 /* ----------------------------------------------------------------------------- 273 this class provides base functions to manage users access 274 ----------------------------------------------------------------------------- */ 213 /** 214 * ---------------------------------------------------------------------------- 215 * this class provides base functions to manage users access 216 * initList redefined to initialize accessList from piwigo's predefined values 217 * ---------------------------------------------------------------------------- 218 */ 275 219 class GPCUsers extends GPCAllowedAccess 276 220 { 277 /* 278 constructor 279 */ 280 public function __construct($alloweds = "") 281 { 282 parent::__construct($alloweds); 283 $this->setState('admin', false); 284 $this->setAllowed('admin', true); 285 } 286 287 /* 288 initialize the groups list 289 */ 221 /** 222 * initialize the users list 223 */ 290 224 protected function initList() 291 225 { 292 $users _list = array('guest', 'generic', 'normal', 'webmaster', 'admin');293 $this->access _list=array();294 foreach($users _list as $val)295 { 296 $this->access _list[$val] =297 array('id' => $val,298 299 'allowed' => false,300 'enabled' => true);226 $usersList = array('guest', 'generic', 'normal', 'webmaster', 'admin'); 227 $this->accessList=array(); 228 foreach($usersList as $val) 229 { 230 $this->accessList[$val]=array( 231 'id' => $val, 232 'name' => l10n('user_status_'.$val), 233 'allowed' => ($this->accessMode=='a') 234 ); 301 235 } 302 236 } -
extensions/GrumPluginClasses/classes/genericjs.class.inc.php
r5958 r8961 1 1 <?php 2 3 /* ----------------------------------------------------------------------------- 4 class name: genericjs 5 class version: 2.0 6 date: 2008-07-20 7 ------------------------------------------------------------------------------ 8 author: grum at grum.dnsalias.com 9 << May the Little SpaceFrog be with you >> 10 ------------------------------------------------------------------------------ 11 12 this classes provides base functions to add genericjs.js file into html page 13 14 > see genericjs.js file to know javascript functions added 15 16 - constructor genericjs() 17 ---------------------------------------------------------------------- */ 18 19 20 class genericjs 21 { 22 function genericjs() 23 { 24 add_event_handler('loc_end_page_header', array(&$this, 'load_JS')); 25 } 26 27 function load_JS() 28 { 29 global $template; 30 31 $name='plugins/'.basename(dirname(dirname(__FILE__))).'/js/genericjs.js'; 32 33 $template->append('head_elements', '<script src="'.$name.'" type="text/javascript"></script>'); 34 35 } 36 37 } //class 38 39 $genericjs=new genericjs(); 40 2 /* 3 * dummy file to avoid compatibility problem with older plugin. 4 * 5 * this file have to be removed on the next release. 6 */ 41 7 ?>
Note: See TracChangeset
for help on using the changeset viewer.