Changeset 11276 for extensions
- Timestamp:
- Jun 9, 2011, 3:52:13 PM (13 years ago)
- Location:
- extensions/set_plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/set_plugins/admin.tpl
r11249 r11276 10 10 {else} 11 11 var no_affiche = false; 12 12 {/if} 13 13 </script> 14 <div> 14 {if !isset($liste_plugins)} 15 <div class="infos"></div> 16 <div class="errors"></div> 17 {/if} 15 18 {if isset($liste_plugins)} 16 19 {foreach from=$plugin_states item=plugin_state} 17 20 {if $plugin_state==$state} 18 </div>19 21 <fieldset > 20 22 <legend> 21 {if $plugin_state == 'active'} {'Last '|@translate} {'Active Plugins'|@translate} 22 {elseif $plugin_state == 'inactive'} {'Last '|@translate} {'Inactive Plugins'|@translate} 23 {if $plugin_state == 'active'} 24 {'Last '|@translate} {'Active Plugins'|@translate} 25 {elseif $plugin_state == 'inactive'} 26 {'Last '|@translate} {'Inactive Plugins'|@translate} 23 27 {/if} 24 25 </legend> 28 </legend> 26 29 <form action="{$action}" method="post" name="form_set_plugins" id="form_set_plugins"> 27 30 <input name="unset_plugins" type="submit" value="{'Deactivate'|@translate}" /> 28 31 <input name="set_plugins" type="submit" value="{'Activate'|@translate}" /> 29 32 <input name="nb" type="text" value="{$nb}" /> 33 <input name="list_visible" id="list_visible" type="hidden" value="{$list_visible}" /> 30 34 </form> 31 35 <p> 32 </p>33 {foreach from=$liste_plugins item=plugin name=plugins_loop}34 {if $plugin.STATE == $plugin_state}35 36 36 <div class="pluginBox"> 37 <table> 38 <tr> 39 <td name="plugins_name" class="pluginBoxNameCell{if $plugin.INCOMPATIBLE} warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}{/if}"> 40 {$plugin.NAME} 41 </td> 42 <td>{$plugin.DESC}</td> 43 </tr> 44 <tr> 45 <td> 46 {if $plugin.STATE == 'active'} 47 <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> 37 {foreach from=$liste_plugins item=plugin name=plugins_loop} 38 <div class="pluginBox" id="{$plugin.NAME}"> 39 <table width="100%" > <tr> 40 <td width="50%" align="left" name="plugins_name" rel="actif" class="pluginBoxNameCell" > 41 {if $plugin.STATE == 'active'} 42 {$plugin.NAME} 43 {else} 44 {/if} 45 </td> 48 46 49 {elseif $plugin_state == 'inactive'} 50 <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> 51 | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> 47 <td width="50%" align="left" name="plugins_name" rel="inactif" class="pluginBoxNameCell"> 48 {if $plugin.STATE == 'inactive'} 49 {$plugin.NAME} 50 {else} 51 {/if} 52 </td> 53 </tr> 54 <tr> 52 55 56 <td width="50%" align="left" rel="actif"> 57 {if $plugin.STATE == 'active'} 58 <a href="{$plugin.U_ACTION}&action=deactivate"> 59 {'Deactivate'|@translate}</a> 60 {else} {/if} 61 </td> 62 <td width="50%" align="left" rel="inactif"> 63 {if $plugin.STATE == 'inactive'} 64 <a href="{$plugin.U_ACTION}&action=activate" >{'Activate'|@translate}</a> 65 66 {else} {/if} 67 </td> 68 </tr> 69 70 </table> 53 71 54 {/if} 55 </td> 56 <td> 57 {'Version'|@translate} {$plugin.VERSION} 58 {if not empty($plugin.AUTHOR)} 59 {if not empty($plugin.AUTHOR_URL)} 60 {assign var='author' value='<a href="%s">%s</a>'|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} 61 {else} 62 {assign var='author' value=$plugin.AUTHOR} 63 {/if} 64 | {'By %s'|@translate|@sprintf:$author} 65 {/if} 66 67 {if not empty($plugin.VISIT_URL)} 68 | <a class="externalLink" href="{$plugin.VISIT_URL}">{'Visit plugin site'|@translate}</a> 69 {/if} 70 </td> 71 </tr> 72 </table> 73 </div> 74 75 {/if} 76 {/foreach} 72 </div> 73 {/foreach} 74 </p> 75 77 76 </fieldset> 78 77 {/if} -
extensions/set_plugins/include/affiche.php
r11249 r11276 1 1 <?php 2 2 //================================================================================================= 3 global $conf ; 4 $nb="10"; 3 global $conf ; 4 global $list_visible, $val_state,$liste_plugins,$nb,$infos_message,$erreur_message,$page; 5 5 6 if (isset($conf['set_plugins'])) 6 7 $set_plugins_parametres = unserialize($conf['set_plugins']); 7 8 9 $nb="10"; 8 10 if(isset($set_plugins_parametres) && isset($set_plugins_parametres['nb'])) 9 11 $nb=$set_plugins_parametres['nb']; 12 $nb=isset($_POST['nb'])?$_POST['nb']:$nb ; 13 10 14 $liste=array(); 11 if(isset($set_plugins_parametres['list'])) 12 $liste=$set_plugins_parametres['list']; 15 if(isset($set_plugins_parametres['list'])) 16 $liste=$set_plugins_parametres['list']; 17 $liste=isset($_POST['liste'])?$_POST['liste']:$liste ; 13 18 19 $state="active"; 14 20 if(isset($set_plugins_parametres['state'])) 15 21 $state =$set_plugins_parametres['state']; 22 $state=isset($_POST['state'])?$_POST['state']:$state ; 16 23 17 $state=isset($state)?$state:"active"; 24 $list_visible="on,on,on,on"; 25 if(isset($set_plugins_parametres['list_visible'])) 26 $list_visible =$set_plugins_parametres['list_visible']; 27 $list_visible=(isset($_POST['list_visible']))?$_POST['list_visible']:$list_visible ; 18 28 19 $set=isset($_POST['set'])?$_POST['set']:"true"; 20 $list="test1,test2,test2"; 29 $set=isset($_POST['set'])?$_POST['set']:"true"; 21 30 22 $template->assign( array( 'list'=>$list, 23 'nb' => isset($_POST['nb'])?$_POST['nb']:$nb, 24 'state' => $state , 25 'set' => $set, 26 'cl_plugins' => $cl_set_plugins_plugin , 27 'cl_version' => $cl_set_plugins_plugin['version'] , 28 'name' => $cl_set_plugins_plugin['name'] , 29 'Version_pwg' => PHPWG_VERSION, 30 'SET_PLUGINS_PATH' => SET_PLUGINS_PATH 31 $liste_plugins=$set=isset($_POST['liste_plugins'])?$_POST['liste_plugins']:$liste; 32 33 34 35 36 37 if (isset($_POST['set']) || isset($_POST['list_visible']) || isset($_POST['nb'])){ 38 save_config(); 39 } 40 $template->assign( array( 41 'nb' => $nb, 42 'state' => $state , 43 'set' => $set, 44 'cl_plugins' => $cl_set_plugins_plugin , 45 'cl_version' => $cl_set_plugins_plugin['version'] , 46 'name' => $cl_set_plugins_plugin['name'] , 47 'Version_pwg' => PHPWG_VERSION, 48 'SET_PLUGINS_PATH' => SET_PLUGINS_PATH, 49 'list_visible' => $list_visible 31 50 ) 32 51 ); … … 48 67 } 49 68 69 //========================================================== 70 $liste_tpl=array(); 50 71 51 52 $liste_tpl=array();53 //==========================================================54 72 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { 55 73 //==== test si $plugin_id fait partie de $liste_plugins ============== … … 100 118 101 119 ) 102 ); 103 120 ); 121 122 //================================================================ 123 if (!isset($infos_message)){ 124 $infos_message = ""; 125 } 126 if ($infos_message != "") { 127 array_push($page['infos'], $infos_message); 128 $infos_message=""; 129 } 130 if (!isset($erreur_message)){ 131 $erreur_message = ""; 132 } 133 if ($erreur_message != "") { 134 135 array_push($page['errors'], $erreur_message); 136 $erreur_message=""; 137 138 139 } 140 141 //================================================================ 142 function save_config(){ 143 global $list_visible, $val_state,$liste_plugins,$nb,$page ; 144 global $infos_message; 145 $infos_message=l10n("save_config"); 146 $config=array(); 147 $config = array( 148 'list_visible' => $list_visible, 149 'state' => $val_state, 150 'list'=>$liste_plugins, 151 'nb' =>$nb 152 ); 153 conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config))); 154 } 104 155 //========================================================================================== 105 156 ?> -
extensions/set_plugins/js/field_set.js
r11249 r11276 1 jQuery("fieldset").hide(); 2 jQuery(document).ready(function () { 3 jQuery(window).unload(function () { 4 // jQuery("#form_set_plugins").submit(); 5 }); 6 7 if (typeof plus_path == "undefined") { 8 var plus_path = './plugins/set_plugins/js/icon/plus.png'; 9 var minus_path = './plugins/set_plugins/js/icon/minus.png'; 10 } 11 var h_min = 0; 12 13 jQuery(window).load(function () { 14 if (jQuery("fieldset").length >= 1) { 15 16 jQuery("div.titrePage h2").parent().hide(); 17 18 var reg = new RegExp("[,]", "g"); 19 liste_visible = jQuery("input[name=list_visible]").val(); 20 n1 = liste_visible; 21 liste = n1.split(reg); 22 reg = new RegExp("['off']", "g"); 23 jQuery("fieldset").each( 24 function (i) { 25 26 id0 = jQuery(this).attr("id"); 27 if (id0 == "") jQuery(this).attr("id", "fieldset_" + i); 28 jQuery(this).attr("rel", i); 29 30 if (!jQuery(this).hasClass("field_set")) 31 jQuery(this).addClass("field_set"); 1 32 2 33 34 if (liste[i] == "off") { 35 liste[i] = "off"; 3 36 4 jQuery(document).ready(function () { 5 if (jQuery("fieldset").length >= 1) { 6 jQuery("div .titrePage h2").remove(); 37 h_min = jQuery("#" + this.id + ' legend').height(); 38 jQuery(this).height(h_min + 5); 7 39 8 jQuery("fieldset").each(9 function (i) {10 id0 = jQuery(this).attr("id");11 if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);12 if (!jQuery(this).hasClass("field_set"))13 jQuery(this).addClass("field_set");14 if (i > 0)15 jQuery(this).height(0);16 else17 jQuery(this).addClass("visible");18 jQuery("#" + this.id + ' legend').css('cursor', 'pointer');19 id0 = jQuery(this).attr("id");40 jQuery("#" + this.id + ' legend').prepend( 41 '<img alt = "" title = ""' + 42 'src = "' + plus_path + '"' + '> ' 43 ); 44 } else { 45 liste[i] = "on"; 46 jQuery(this).addClass("visible"); 47 jQuery("#" + this.id + ' legend').prepend( 48 '<img alt = "" title = ""' + 49 'src = "' + minus_path + '"' + '> ' 50 ); 51 } 20 52 21 jQuery("#" + this.id + ' legend').click(function (event) { 22 n = jQuery(this).parent().hasClass("visible"); 23 24 if (n) { 25 jQuery(this).parent().height(0); 26 jQuery(this).parent().removeClass("visible"); 27 } 28 else { 29 jQuery(this).parent().css("height", "auto"); 30 jQuery(this).parent().addClass("visible"); 31 } 32 }); 33 }) 34 35 } 53 jQuery("#" + this.id + ' legend').css('cursor', 'pointer'); 36 54 37 55 56 id0 = jQuery(this).attr("id"); 57 jQuery("#" + id0 + ' legend').click(function (event) { 38 58 39 jQuery(document).ready(function () { 40 if (jQuery(".field_set").length >= 1) 41 jQuery(".field_set").each( 42 function (i) { 59 n = jQuery(this).parent().hasClass("visible"); 60 jQuery(this).css("color", "red"); 43 61 44 id0 = jQuery(this).attr("id"); 62 i = jQuery(jQuery(this).parent()).attr("rel"); 63 liste_visible = jQuery("input[name=list_visible]").val(); 64 liste = liste_visible.split(","); 65 if (n) { 66 jQuery(this).parent().height(h_min + 5); 67 jQuery(this).parent().removeClass("visible"); 68 liste[i] = "off"; 69 } 70 else { 71 jQuery(this).parent().css("height", "auto"); 72 jQuery(this).parent().addClass("visible"); 73 liste[i] = "on"; 74 } 45 75 46 76 77 val = liste.join(","); 78 jQuery("input[name=list_visible]").val(val); 47 79 48 }); 80 jQuery.ajax({ 81 type: "POST", 82 async: true, 83 data: "list_visible=" + val, 84 success: function (msg) { 85 jQuery("#form_set_plugins").submit(); 86 } 87 }); 49 88 50 });89 }); // click 51 90 52 91 92 }); //each 93 var liste_action = { active: "", deactive: "" }; 94 95 jQuery(".pluginBox a").each( 96 function (i) { 97 jQuery(this).click(function (event) { 98 jQuery(this).css("color", "red"); 99 action = jQuery(this).attr('rel'); 100 if (action == "Deactivate") 101 liste_plugins = jQuery(this).parent().parent().text(); 102 else if (action == "Activate") 103 liste_plugins = jQuery(this).parent().parent().text(); 104 105 }); // click 106 107 }); //each 108 109 jQuery("input[name=list_visible]").val(liste.join(",")); 110 jQuery("fieldset").show(); 111 } // fielset 112 //==================================================================== 113 jQuery("td a").click(function (event) { 114 l1 = jQuery('#liste').text(); 115 l = l1.split(new RegExp("\n", "g")); 116 117 list = jQuery('liste_plugins'); 118 119 var reg = new RegExp("[?]", "g"); 120 ret_args = new Array; 121 var args = event.target.href.split(reg)[1]; 122 reg = new RegExp("[&]", "g"); 123 var tableau = args.split(reg); 124 for (i = 0; i < tableau.length; i++) { 125 vals = tableau[i].split("="); 126 ret_args[vals[0]] = vals[1]; 127 } 128 if (ret_args['action'] == "deactivate") { 129 130 list = jQuery('list'); 131 n = 1; 132 } else if (ret_args['action'] == "activate") { 133 134 list = jQuery('liste_plugins'); 135 n = 0; 136 } 53 137 54 138 139 }) 55 140 56 57 jQuery("td a").click(function (event) { 58 l1 = jQuery('td[name="plugins_name"]'); 59 60 var reg = new RegExp("[&]", "g"); 61 var tableau = event.target.href.split(reg); 62 63 64 if (event.target.nameProp.match(RegExp("deactivate", "g"))) { 65 n = 1; 66 } else if (event.target.nameProp.match(RegExp("activate", "g"))) { 67 n = 0; 68 } 69 70 71 72 }) 73 }) 74 75 141 }); // load 142 }); //ready 76 143 -
extensions/set_plugins/main.inc.php
r11249 r11276 51 51 if ($page['tab']!="installed") return ; 52 52 Affiche_set_plugins(); 53 54 53 break; 55 54 … … 70 69 global $user, $template, $val,$page,$conf; 71 70 include_once(SET_PLUGINS_PATH."include/constants.php"); 72 include_once(SET_PLUGINS_PATH.'include/affiche.php');73 $all_tpl_vars = $template->get_template_vars('plugins');74 75 if(!$all_tpl_vars) return;76 77 $val_state="";78 71 79 if( isset($_POST['unset_plugins']) || isset($_POST['set_plugins']) ){ 80 if(isset($_POST['unset_plugins']) ) 72 $all_tpl_vars = $template->get_template_vars('plugins'); 73 if(!$all_tpl_vars) return; 74 75 include_once(SET_PLUGINS_PATH.'include/affiche.php'); 76 $val_state=""; 77 if( isset($_POST['unset_plugins']) || isset($_POST['set_plugins']) ){ 78 if(isset($_POST['unset_plugins']) ) 81 79 $val_state='inactive'; 82 80 elseif(isset($_POST['set_plugins']) ) 83 81 $val_state='active'; 84 $nb=isset($_POST['nb'])?$_POST['nb']:$nb ;85 82 83 86 84 if($val_state!=""){ 87 if($val_state=="activate") 88 $sens ="DESC"; 89 else 90 $sens="ASC"; 91 85 if($val_state=="activate") 86 $sens ="DESC"; 87 else 88 $sens="ASC"; 92 89 //==== pré-liste === 93 90 $query = 'SELECT * … … 97 94 LIMIT '.$nb.' 98 95 '; 99 $result = pwg_query($query); 100 101 102 96 $result = pwg_query($query); 97 103 98 $query = ' 104 99 UPDATE '.PLUGINS_TABLE.' … … 106 101 WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '" 107 102 ORDER BY `id` '.$sens.' 108 LIMIT '.$nb.' 109 ;'; 103 LIMIT '.$nb.';'; 104 pwg_query($query); 105 //===================================== 110 106 111 pwg_query($query); 112 113 $data = array(); 114 if($result) 115 while ($row = pwg_db_fetch_assoc($result)) 116 { 117 118 $url = $row['id'] ;$vers= $row['version']; 119 array_push($data, array('plugin' => $url,'version'=>$vers) ); 107 $liste_plugins = array(); 108 if($result) 109 while ($row = pwg_db_fetch_assoc($result)) { 110 111 $url = $row['id'] ; 112 $vers= $row['version']; 113 $state=$row['state']; 114 array_push($liste_plugins, array('plugin' => $url,'version'=>$vers,'state' =>$state ) ); 115 } 116 //===================================== 117 118 119 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 120 save_config(); 121 unset ($_POST); 122 redirect($redirect_url); 123 } 120 124 } 121 122 unset ($_POST);123 $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];124 $config=array();125 $config = array(126 'state' => $val_state,127 'list'=>$data,128 'nb' =>$nb129 );130 131 conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config)));132 redirect($redirect_url);133 }134 }135 136 137 125 $template->set_filenames( 138 126 array(
Note: See TracChangeset
for help on using the changeset viewer.