diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 72abdb947..69a081557 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ -| $Revision: 1.25 $ -| $Date: 2009-07-07 02:43:14 $ +| $Revision: 1.26 $ +| $Date: 2009-07-07 06:26:50 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -33,6 +33,7 @@ require_once("auth.php"); require_once(e_HANDLER.'plugin_class.php'); require_once(e_HANDLER.'file_class.php'); require_once(e_HANDLER."form_handler.php"); +require_once (e_HANDLER.'message_handler.php'); $plugin = new e107plugin; @@ -53,14 +54,16 @@ class pluginManager{ function pluginManager() { - global $user_pref,$admin_log; + global $user_pref,$admin_log,$ns; $tmp = explode('.', e_QUERY); $this -> action = $tmp[0]; $this -> id = intval($tmp[1]); + $this-> fields = array( - // "plugin_status" => array("title" => "Status", "type"=>"image", "width" => "5%", "thclass" => "center", "url" => ""), + + "plugin_checkboxes" => array("title" => "", "forced"=>TRUE, "width"=>"3%"), "plugin_icon" => array("title" => EPL_ADLAN_82, "type"=>"image", "width" => "5%", "thclass" => "middle center", "url" => ""), "plugin_name" => array("title" => EPL_ADLAN_10, "type"=>"text", "width" => "30", "thclass" => "middle", "url" => ""), "plugin_version" => array("title" => EPL_ADLAN_11, "type"=>"numeric", "width" => "5%", "thclass" => "middle", "url" => ""), @@ -85,33 +88,52 @@ class pluginManager{ save_prefs('user'); } - $this -> fieldpref = (is_array($user_pref['admin_pluginmanager_columns'])) ? $user_pref['admin_pluginmanager_columns'] : array("plugin_icon","plugin_name","plugin_version","plugin_description","plugin_author","plugin_website","plugin_notes"); + $this -> fieldpref = (is_array($user_pref['admin_pluginmanager_columns'])) ? $user_pref['admin_pluginmanager_columns'] : array("plugin_icon","plugin_name","plugin_version","plugin_description","plugin_author","plugin_website","plugin_notes"); - if($this->action == "" || $this->action == "installed" || $this->action == "avail") + if(isset($_POST['install-selected'])) { + foreach($_POST['plugin_checkbox'] as $val) + { + $this -> id = intval($val); + $this -> pluginInstall(); + } + $this -> action = "installed"; + } + +/* if(isset($_POST['uninstall-selected'])) + { + foreach($_POST['plugin_checkbox'] as $val) + { + $this -> id = intval($val); + $this -> pluginUninstall(); + } + $this -> action = "installed"; $this -> pluginRenderList(); - } + return; + + // Complicated, as each uninstall system is different. + }*/ if($this->action == "uninstall") { + $this -> pluginUninstall(); $this -> action = "installed"; - $this -> pluginRenderList(); } if($this->action == "install") { $this -> pluginInstall(); $this -> action = "installed"; - $this -> pluginRenderList(); } + + if($this->action == "upgrade") { $this -> pluginUpgrade(); $this -> action = "installed"; - $this -> pluginRenderList(); } if($this->action == "refresh") @@ -122,6 +144,23 @@ class pluginManager{ { $this -> pluginUpload(); } + + if($emessage->hasMessage) // Would prefer a method like this, but it doesn't work. + { + $emessage = &eMessage::getInstance(); + $ns->tablerender(NWSLAN_4, $emessage->render()); + } + + if($this->action != 'avail') + { + unset($this-> fields['plugin_checkboxes']); + } + + if($this->action !='upload') + { + $this -> pluginRenderList(); + } + } @@ -269,7 +308,9 @@ class pluginManager{ } $plugin->save_addon_prefs(); - $ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($plug['plugin_name'], "", "defs,emotes_off,no_make_clickable"), $text); + + $this->show_message($text, E_MESSAGE_SUCCESS); + // $ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($plug['plugin_name'], "", "defs,emotes_off,no_make_clickable"), $text); $text = ''; } @@ -386,14 +427,16 @@ class pluginManager{ $text = $plugin->install_plugin($this->id); if ($text === FALSE) { // Tidy this up - $ns->tablerender(LAN_INSTALL_FAIL, "Error messages above this line"); + $this->show_message("Error messages above this line", E_MESSAGE_ERROR); + // $ns->tablerender(LAN_INSTALL_FAIL, ); } else { $plugin ->save_addon_prefs(); // if($eplug_conffile){ $text .= " [".LAN_CONFIGURE."]"; } $admin_log->log_event('PLUGMAN_01', $this->id.':'.$eplug_folder, E_LOG_INFORMATIVE, ''); - $ns->tablerender(EPL_ADLAN_33, $text); + $this->show_message($text, E_MESSAGE_SUCCESS); + // $ns->tablerender(EPL_ADLAN_33, $text); } } @@ -626,22 +669,35 @@ class pluginManager{ $installed = $plugin->getall(1); $caption = EPL_ADLAN_22; $text .= $this->pluginRenderPlugin($installed); + $button_mode = "uninstall-selected"; + $button_caption = EPL_ADLAN_85; + $button_action = "delete"; } if($this->action == "avail") { $uninstalled = $plugin->getall(0); $caption = EPL_ADLAN_23; $text .= $this->pluginRenderPlugin($uninstalled); + $button_mode = "install-selected"; + $button_caption = EPL_ADLAN_84; + $button_action = "update"; } $text .= " - + "; + + if($this->action == "avail") + { + $text .= "
".$frm->admin_button($button_mode, $button_caption, $button_action)."
"; + } + $text .= " "; - $ns->tablerender(EPL_ADLAN_16." : ".$caption, $text); + $emessage = &eMessage::getInstance(); + $ns->tablerender(EPL_ADLAN_16." : ".$caption,$emessage->render(). $text); } @@ -649,7 +705,7 @@ class pluginManager{ function pluginRenderPlugin($pluginList) { - global $tp, $imode, $plugin; + global $tp, $imode, $plugin, $frm; if (empty($pluginList)) return ''; @@ -699,6 +755,13 @@ class pluginManager{ } $text .= ""; + + if(is_array($this-> fields['plugin_checkboxes'])) + { + $rowid = "plugin_checkbox[".$plug['plugin_id']."]"; + $text .= "".$frm->checkbox($rowid, $plug['plugin_id'])."\n"; + } + // $text .= (in_array("plugin_status",$this->fieldpref)) ? "".$img."" : ""; $text .= (in_array("plugin_icon",$this->fieldpref)) ? "".$plugin_icon."" : ""; $text .= (in_array("plugin_name",$this->fieldpref)) ? "".$plugName."" : ""; @@ -900,7 +963,14 @@ class pluginManager{ {$del_text} -    + "; + + $text .= "   + "; + + // $frm->admin_button($name, $value, $action = 'submit', $label = '', $options = array()); + + $text .= " @@ -910,7 +980,12 @@ class pluginManager{ exit; } - + function show_message($message, $type = E_MESSAGE_INFO, $session = false) + { + // ##### Display comfort --------- + $emessage = &eMessage::getInstance(); + $emessage->add($message, $type, $session); + } } // end of Class. diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index fafdc93c4..8c6f1b13b 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -9,8 +9,8 @@ * Form Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ - * $Revision: 1.28 $ - * $Date: 2009-07-07 02:43:14 $ + * $Revision: 1.29 $ + * $Date: 2009-07-07 06:26:50 $ * $Author: e107coders $ * */ @@ -583,14 +583,17 @@ class e_form foreach($columnsArray as $key=>$fld) { - $checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE; - $text .= $this->checkbox('e-columns[]', $key, $checked). $fld['title']."
"; + if($fld['forced'] !== TRUE) + { + $checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE; + $text .= $this->checkbox('e-columns[]', $key, $checked). $fld['title']."
\n"; + } } - $text .= "
"; // has issues with the checkboxes. + $text .= "
\n"; // has issues with the checkboxes. $text .= $this->admin_button('submit-e-columns','Save','Save'); - $text .= "
"; + $text .= "
\n"; $text .= ""; return $text; } @@ -600,9 +603,9 @@ class e_form foreach($fieldarray as $key=>$val) { - if(in_array($key,$columnPref)) + if(in_array($key,$columnPref) || $key=='options' || $val['forced']==TRUE) { - $text .= "\n"; + $text .= "\n"; } } return $text; @@ -613,11 +616,11 @@ class e_form foreach($fieldarray as $key=>$val) { - if(in_array($key,$columnPref) || $key == "options") + if(in_array($key,$columnPref) || $key == "options" || ($val['forced']==TRUE)) { $cl = ($val['thclass']) ? "class='".$val['thclass']."'" : ""; $text .= "\n\t"; - $text .= ($val['url']) ? "" : ""; + $text .= ($val['url']) ? "" : ""; // Really this column-sorting link should be auto-generated, or be autocreated via unobtrusive js. $text .= $val['title']; $text .= ($key == "options") ? $this->columnSelector($fieldarray,$columnPref) : ""; diff --git a/e107_languages/English/admin/lan_plugin.php b/e107_languages/English/admin/lan_plugin.php index a79ad3e36..84b9253bb 100644 --- a/e107_languages/English/admin/lan_plugin.php +++ b/e107_languages/English/admin/lan_plugin.php @@ -4,8 +4,8 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $ -| $Revision: 1.9 $ -| $Date: 2009-07-07 02:22:57 $ +| $Revision: 1.10 $ +| $Date: 2009-07-07 06:26:51 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -100,8 +100,8 @@ define ('EPL_ADLAN_80','Delete extended user fields created by plugin:'); define ('EPL_ADLAN_81','Xhtml'); define ('EPL_ADLAN_82','Icon'); define ('EPL_ADLAN_83','Notes'); -define ('EPL_ADLAN_84',''); -define ('EPL_ADLAN_85',''); +define ('EPL_ADLAN_84','Install Selected'); +define ('EPL_ADLAN_85','Uninstall Selected'); define('LAN_UPGRADE_SUCCESSFUL', 'Upgrade Successful');