Modules: List view updates.
This commit is contained in:
parent
98ce23272a
commit
c34fbe9b4e
|
|
@ -306,7 +306,6 @@
|
|||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-action-start'],'title'=>$text['button-start'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('start'); list_form_submit('form_list')"]);
|
||||
echo " </td>\n";
|
||||
// echo " <td><a href='gateways.php?a=start&gateway=".urlencode($row["gateway_uuid"])."&profile=".urlencode($row["profile"])."' alt='".$text['label-action-start']."'>".$text['label-action-start']."</a></td>\n";
|
||||
}
|
||||
echo " <td> </td>\n";
|
||||
}
|
||||
|
|
@ -320,7 +319,6 @@
|
|||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-action-stop'],'title'=>$text['button-stop'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('stop'); list_form_submit('form_list')"]);
|
||||
echo " </td>\n";
|
||||
// echo " <td><a href='gateways.php?a=stop&gateway=".urlencode($row["gateway_uuid"])."&profile=".urlencode($row["profile"])."' alt='".$text['label-action-stop']."'>".$text['label-action-stop']."</a></td>\n";
|
||||
}
|
||||
echo " <td>".escape($state)."</td>\n"; //REGED, NOREG, UNREGED
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,26 +61,6 @@ $text['title-module_add']['ru-ru'] = "Добавить Модуль";
|
|||
$text['title-module_add']['sv-se'] = "Lägg Till Modul";
|
||||
$text['title-module_add']['uk-ua'] = "Додавання модуля";
|
||||
|
||||
$text['label-unload_module']['en-us'] = "Unload Module";
|
||||
$text['label-unload_module']['ar-eg'] = "";
|
||||
$text['label-unload_module']['de-at'] = "Modul deaktivieren"; //copied from de-de
|
||||
$text['label-unload_module']['de-ch'] = "Modul deaktivieren"; //copied from de-de
|
||||
$text['label-unload_module']['de-de'] = "Modul deaktivieren";
|
||||
$text['label-unload_module']['es-cl'] = "Descargar Módulo";
|
||||
$text['label-unload_module']['es-mx'] = "Descargar Módulo"; //copied from es-cl
|
||||
$text['label-unload_module']['fr-ca'] = "Décharger le Module"; //copied from fr-fr
|
||||
$text['label-unload_module']['fr-fr'] = "Décharger le Module";
|
||||
$text['label-unload_module']['he-il'] = "";
|
||||
$text['label-unload_module']['it-it'] = "Disattiva Modulo";
|
||||
$text['label-unload_module']['nl-nl'] = "Module uitzetten";
|
||||
$text['label-unload_module']['pl-pl'] = "Wyłącz moduł";
|
||||
$text['label-unload_module']['pt-br'] = "Desativar Módulo";
|
||||
$text['label-unload_module']['pt-pt'] = "Desactivar Módulo";
|
||||
$text['label-unload_module']['ro-ro'] = "";
|
||||
$text['label-unload_module']['ru-ru'] = "Выгрузка Модулей";
|
||||
$text['label-unload_module']['sv-se'] = "Ladda av Modul";
|
||||
$text['label-unload_module']['uk-ua'] = "Вивантажити модуль";
|
||||
|
||||
$text['label-unknown']['en-us'] = "Unknown";
|
||||
$text['label-unknown']['ar-eg'] = "";
|
||||
$text['label-unknown']['de-at'] = "Unbekannt"; //copied from de-de
|
||||
|
|
@ -281,26 +261,6 @@ $text['label-message']['ru-ru'] = "Уведомление";
|
|||
$text['label-message']['sv-se'] = "Meddelande";
|
||||
$text['label-message']['uk-ua'] = "Повідомлення";
|
||||
|
||||
$text['label-load_module']['en-us'] = "Load Module";
|
||||
$text['label-load_module']['ar-eg'] = "";
|
||||
$text['label-load_module']['de-at'] = "Modul laden"; //copied from de-de
|
||||
$text['label-load_module']['de-ch'] = "Modul laden"; //copied from de-de
|
||||
$text['label-load_module']['de-de'] = "Modul laden";
|
||||
$text['label-load_module']['es-cl'] = "Cargar Módulo";
|
||||
$text['label-load_module']['es-mx'] = "Cargar Módulo"; //copied from es-cl
|
||||
$text['label-load_module']['fr-ca'] = "charger le Module"; //copied from fr-fr
|
||||
$text['label-load_module']['fr-fr'] = "charger le Module";
|
||||
$text['label-load_module']['he-il'] = "";
|
||||
$text['label-load_module']['it-it'] = "Attivare Modulo";
|
||||
$text['label-load_module']['nl-nl'] = "Module laden";
|
||||
$text['label-load_module']['pl-pl'] = "Włącz moduł";
|
||||
$text['label-load_module']['pt-br'] = "Carregar Módulo"; //copied from pt-pt
|
||||
$text['label-load_module']['pt-pt'] = "Carregar Módulo";
|
||||
$text['label-load_module']['ro-ro'] = "";
|
||||
$text['label-load_module']['ru-ru'] = "Загрузка Модулей";
|
||||
$text['label-load_module']['sv-se'] = "Ladda Modul";
|
||||
$text['label-load_module']['uk-ua'] = "Завантажити модуль";
|
||||
|
||||
$text['label-label']['en-us'] = "Label";
|
||||
$text['label-label']['ar-eg'] = "";
|
||||
$text['label-label']['de-at'] = "Kennzeichnung"; //copied from de-de
|
||||
|
|
@ -461,4 +421,84 @@ $text['error-event-socket']['ru-ru'] = "Подключение к сокету
|
|||
$text['error-event-socket']['sv-se'] = "Kontakten till 'Event Socket' misslyckades.";
|
||||
$text['error-event-socket']['uk-ua'] = "Помилка підключення до сокета подій";
|
||||
|
||||
$text['message-module_started']['en-us'] = "Module(s) Started";
|
||||
$text['message-module_started']['ar-eg'] = "";
|
||||
$text['message-module_started']['de-at'] = "Modul laden"; //copied from de-de
|
||||
$text['message-module_started']['de-ch'] = "Modul laden"; //copied from de-de
|
||||
$text['message-module_started']['de-de'] = "Modul laden";
|
||||
$text['message-module_started']['es-cl'] = "Cargar Módulo";
|
||||
$text['message-module_started']['es-mx'] = "Cargar Módulo"; //copied from es-cl
|
||||
$text['message-module_started']['fr-ca'] = "charger le Module"; //copied from fr-fr
|
||||
$text['message-module_started']['fr-fr'] = "charger le Module";
|
||||
$text['message-module_started']['he-il'] = "";
|
||||
$text['message-module_started']['it-it'] = "Attivare Modulo";
|
||||
$text['message-module_started']['nl-nl'] = "Module laden";
|
||||
$text['message-module_started']['pl-pl'] = "Włącz moduł";
|
||||
$text['message-module_started']['pt-br'] = "Carregar Módulo"; //copied from pt-pt
|
||||
$text['message-module_started']['pt-pt'] = "Carregar Módulo";
|
||||
$text['message-module_started']['ro-ro'] = "";
|
||||
$text['message-module_started']['ru-ru'] = "Загрузка Модулей";
|
||||
$text['message-module_started']['sv-se'] = "Ladda Modul";
|
||||
$text['message-module_started']['uk-ua'] = "Завантажити модуль";
|
||||
|
||||
$text['message-module_stopped']['en-us'] = "Module(s) Stopped";
|
||||
$text['message-module_stopped']['ar-eg'] = "";
|
||||
$text['message-module_stopped']['de-at'] = "Modul deaktivieren"; //copied from de-de
|
||||
$text['message-module_stopped']['de-ch'] = "Modul deaktivieren"; //copied from de-de
|
||||
$text['message-module_stopped']['de-de'] = "Modul deaktivieren";
|
||||
$text['message-module_stopped']['es-cl'] = "Descargar Módulo";
|
||||
$text['message-module_stopped']['es-mx'] = "Descargar Módulo"; //copied from es-cl
|
||||
$text['message-module_stopped']['fr-ca'] = "Décharger le Module"; //copied from fr-fr
|
||||
$text['message-module_stopped']['fr-fr'] = "Décharger le Module";
|
||||
$text['message-module_stopped']['he-il'] = "";
|
||||
$text['message-module_stopped']['it-it'] = "Disattiva Modulo";
|
||||
$text['message-module_stopped']['nl-nl'] = "Module uitzetten";
|
||||
$text['message-module_stopped']['pl-pl'] = "Wyłącz moduł";
|
||||
$text['message-module_stopped']['pt-br'] = "Desativar Módulo";
|
||||
$text['message-module_stopped']['pt-pt'] = "Desactivar Módulo";
|
||||
$text['message-module_stopped']['ro-ro'] = "";
|
||||
$text['message-module_stopped']['ru-ru'] = "Выгрузка Модулей";
|
||||
$text['message-module_stopped']['sv-se'] = "Ladda av Modul";
|
||||
$text['message-module_stopped']['uk-ua'] = "Вивантажити модуль";
|
||||
|
||||
$text['confirm-start_modules']['en-us'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['ar-eg'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['de-at'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['de-ch'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['de-de'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['es-cl'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['es-mx'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['fr-ca'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['fr-fr'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['he-il'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['it-it'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['nl-nl'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['pl-pl'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['pt-br'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['pt-pt'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['ro-ro'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['ru-ru'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['sv-se'] = "Are you sure you wish to START these modules?";
|
||||
$text['confirm-start_modules']['uk-ua'] = "Are you sure you wish to START these modules?";
|
||||
|
||||
$text['confirm-stop_modules']['en-us'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['ar-eg'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['de-at'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['de-ch'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['de-de'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['es-cl'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['es-mx'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['fr-ca'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['fr-fr'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['he-il'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['it-it'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['nl-nl'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['pl-pl'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['pt-br'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['pt-pt'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['ro-ro'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['ru-ru'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['sv-se'] = "Are you sure you wish to STOP these modules?";
|
||||
$text['confirm-stop_modules']['uk-ua'] = "Are you sure you wish to STOP these modules?";
|
||||
|
||||
?>
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('module_view')) {
|
||||
|
|
@ -42,37 +43,59 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get includes and the title
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-modules'];
|
||||
require_once "resources/paging.php";
|
||||
//get posted data
|
||||
if (is_array($_POST['modules'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$modules = $_POST['modules'];
|
||||
}
|
||||
|
||||
//get the http values ans set as variables
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//start or stop a module
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if (strlen($_GET["a"]) > 0) {
|
||||
if ($_GET["a"] == "stop") {
|
||||
$module_name = $_GET["m"];
|
||||
if ($fp) {
|
||||
$cmd = "api unload $module_name";
|
||||
$response = trim(event_socket_request($fp, $cmd));
|
||||
$msg = "<strong>".$text['label-unload_module'].":</strong> <pre>".$response."</pre>";
|
||||
}
|
||||
}
|
||||
if ($_GET["a"] == "start") {
|
||||
$module_name = $_GET["m"];
|
||||
if ($fp) {
|
||||
$cmd = "api load $module_name";
|
||||
$response = trim(event_socket_request($fp, $cmd));
|
||||
$msg = "<strong>".$text['label-load_module'].":</strong> <pre>".$response."</pre>";
|
||||
}
|
||||
}
|
||||
header('Location: modules.php');
|
||||
//toggle the modules
|
||||
if (permission_exists('module_edit')) {
|
||||
if ($action == 'toggle' && is_array($modules) && @sizeof($modules) != 0) {
|
||||
//toggle
|
||||
$obj = new modules;
|
||||
$obj->toggle($modules);
|
||||
//redirect
|
||||
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the modules
|
||||
if (permission_exists('module_delete')) {
|
||||
if ($action == 'delete' && is_array($modules) && @sizeof($modules) != 0) {
|
||||
//delete
|
||||
$obj = new modules;
|
||||
$obj->delete($modules);
|
||||
//redirect
|
||||
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
|
||||
//control the modules
|
||||
if ($fp && is_array($modules) && @sizeof($modules) != 0) {
|
||||
if ($action == 'start') {
|
||||
//start
|
||||
$obj = new modules;
|
||||
$obj->start($modules);
|
||||
//redirect
|
||||
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
if ($action == 'stop') {
|
||||
//stop
|
||||
$obj = new modules;
|
||||
$obj->stop($modules);
|
||||
//redirect
|
||||
header('Location: modules.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//check connection status
|
||||
$esl_alive = false;
|
||||
|
|
@ -81,19 +104,9 @@
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
//Warning if FS not start
|
||||
if(!$esl_alive){
|
||||
$msg = "<div align='center'>".$text['error-event-socket']."<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th align='left'>".$text['label-message']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
//warn if switch not running
|
||||
if (!$fp) {
|
||||
message::add($text['error-event-socket'], 'negative', 5000);
|
||||
}
|
||||
|
||||
//use the module class to get the list of modules from the db and add any missing modules
|
||||
|
|
@ -101,155 +114,169 @@
|
|||
$module->db = $db;
|
||||
$module->dir = $_SESSION['switch']['mod']['dir'];
|
||||
$module->get_modules();
|
||||
$result = $module->modules;
|
||||
$module_count = count($result);
|
||||
$modules = $module->modules;
|
||||
$module_count = count($modules);
|
||||
$module->synch();
|
||||
$module->xml();
|
||||
$msg = $module->msg;
|
||||
|
||||
//show the msg
|
||||
if ($msg) {
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th align='left'>".$text['label-message']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='row_style1'>$msg</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
message::add($msg, 'negative', 5000);
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//get includes and the title
|
||||
$document['title'] = $text['title-modules'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>\n";
|
||||
echo "<td align='left' nowrap><b>".$text['header-modules']."</b></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left'>".$text['description-modules']."</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
$tmp_module_header = "\n";
|
||||
$tmp_module_header .= "<tr>\n";
|
||||
$tmp_module_header .= "<th>".$text['label-label']."</th>\n";
|
||||
$tmp_module_header .= "<th>".$text['label-status']."</th>\n";
|
||||
$tmp_module_header .= "<th>".$text['label-action']."</th>\n";
|
||||
$tmp_module_header .= "<th>".$text['label-enabled']."</th>\n";
|
||||
$tmp_module_header .= "<th>".$text['label-description']."</th>\n";
|
||||
$tmp_module_header .= "<td class='list_control_icons'>";
|
||||
$tmp_module_header .= "<a href='module_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
$tmp_module_header .= "</td>\n";
|
||||
$tmp_module_header .= "<tr>\n";
|
||||
|
||||
if ($module_count > 0) {
|
||||
$prev_module_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($prev_module_category != $row["module_category"]) {
|
||||
$c=0;
|
||||
if (strlen($prev_module_category) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-modules']." (".$module_count.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('module_edit') && $modules && $fp) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-stop'],'icon'=>$_SESSION['theme']['button_icon_stop'],'onclick'=>"if (confirm('".$text['confirm-stop_modules']."')) { list_action_set('stop'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-start'],'icon'=>$_SESSION['theme']['button_icon_start'],'onclick'=>"if (confirm('".$text['confirm-start_modules']."')) { list_action_set('start'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'style'=>'margin-right: 15px;','link'=>'modules.php']);
|
||||
if (permission_exists('module_add')) {
|
||||
echo " <a href='module_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'module_edit.php']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('module_edit') && $modules) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
echo "<tr><td colspan='4' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>".$row["module_category"]."</b> </td></tr>\n";
|
||||
echo $tmp_module_header;
|
||||
if (permission_exists('module_delete') && $modules) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
$tr_link = (permission_exists('module_edit')) ? "href='module_edit.php?id=".escape($row["module_uuid"])."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
echo $text['description-modules']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
function write_header($modifier) {
|
||||
global $fp, $text, $modules;
|
||||
$modifier = str_replace('/', '', $modifier);
|
||||
$modifier = str_replace(' ', ' ', $modifier);
|
||||
$modifier = str_replace(' ', '_', $modifier);
|
||||
$modifier = strtolower(trim($modifier));
|
||||
echo "\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('module_edit') || permission_exists('module_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$modifier."' name='checkbox_all_".$modifier."' onclick=\"list_all_toggle('".$modifier."');\" ".($modules ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th>".$text['label-label']."</th>\n";
|
||||
echo "<th class='hide-sm-dn'>".$text['label-status']."</th>\n";
|
||||
if ($fp) {
|
||||
echo "<th class='center'>".$text['label-action']."</th>\n";
|
||||
}
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>\n";
|
||||
echo "<th class='hide-sm-dn' style='min-width: 40%;'>".$text['label-description']."</th>\n";
|
||||
if (permission_exists('module_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo "<td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
if (is_array($modules) && @sizeof($modules) != 0) {
|
||||
$previous_category = '';
|
||||
foreach ($modules as $x => $row) {
|
||||
//write category and column headings
|
||||
if ($previous_category != $row["module_category"]) {
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='7' class='no-link'>\n";
|
||||
echo ($previous_category != '' ? '<br />' : null)."<b>".$row["module_category"]."</b>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
write_header($row["module_category"]);
|
||||
}
|
||||
if (permission_exists('module_edit')) {
|
||||
echo "<a href='module_edit.php?id=".escape($row["module_uuid"])."'>".escape($row["module_label"])."</a>";
|
||||
$list_row_url = "module_edit.php?id=".urlencode($row['module_uuid']);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('module_edit') || permission_exists('module_delete')) {
|
||||
$modifier = strtolower(trim($row["module_category"]));
|
||||
$modifier = str_replace('/', '', $modifier);
|
||||
$modifier = str_replace(' ', ' ', $modifier);
|
||||
$modifier = str_replace(' ', '_', $modifier);
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='modules[$x][checked]' id='checkbox_".$x."' class='checkbox_".$modifier."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_".$modifier."').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='modules[$x][uuid]' value='".escape($row['module_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>";
|
||||
if (permission_exists('module_edit')) {
|
||||
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['module_label'])."</a>";
|
||||
}
|
||||
else {
|
||||
echo $row["module_label"];
|
||||
echo escape($row['module_label']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
if($esl_alive) {
|
||||
if ($fp) {
|
||||
if ($module->active($row["module_name"])) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-running']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'><a href='modules.php?a=stop&m=".escape($row["module_name"])."' alt='".$text['label-stop']."'>".$text['label-stop']."</a></td>\n";
|
||||
}
|
||||
else {
|
||||
if ($row['module_enabled']=="true") {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'><b>".$text['label-stopped']."</b></td>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-stopped']." ".escape($notice)."</td>\n";
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'><a href='modules.php?a=start&m=".escape($row["module_name"])."' alt='".$text['label-start']."'>".$text['label-start']."</a></td>\n";
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-unknown']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-none']."</td>\n";
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if ($row["module_enabled"] == "true") {
|
||||
echo $text['option-true'];
|
||||
}
|
||||
else if ($row["module_enabled"] == "false") {
|
||||
echo $text['option-false'];
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo " <td valign='top' class='row_stylebg'>".escape($row["module_description"])." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo " <td class='hide-sm-dn'>".$text['label-running']."</td>\n";
|
||||
if (permission_exists('module_edit')) {
|
||||
echo "<a href='module_edit.php?id=".escape($row["module_uuid"])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-stop'],'title'=>$text['button-stop'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('stop'); list_form_submit('form_list')"]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
if (permission_exists('module_delete')) {
|
||||
echo "<a href='module_delete.php?id=".escape($row["module_uuid"])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
else {
|
||||
echo " <td class='hide-sm-dn'>\n";
|
||||
echo $row['module_enabled'] == 'true' ? "<strong style='color: red;'>".$text['label-stopped']."</strong>" : $text['label-stopped']." ".escape($notice);
|
||||
echo " </td>\n";
|
||||
if (permission_exists('module_edit')) {
|
||||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-start'],'title'=>$text['button-start'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('start'); list_form_submit('form_list')"]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo " <td class='hide-sm-dn'>".$text['label-unknown']."</td>\n";
|
||||
}
|
||||
if (permission_exists('module_edit')) {
|
||||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['module_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>";
|
||||
echo $text['label-'.$row['module_enabled']];
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$prev_module_category = $row["module_category"];
|
||||
$c = $c ? 0 : 1;
|
||||
}
|
||||
unset($sql, $modules, $row_count);
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('module_add')) {
|
||||
echo "<a href='module_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
}
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row["module_description"])." </td>\n";
|
||||
if (permission_exists('module_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
$previous_category = $row["module_category"];
|
||||
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
unset($modules);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
//show the footer
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
@ -17,22 +17,64 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010 - 2016
|
||||
All Rights Reserved.
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
|
||||
//define the modules class
|
||||
if (!class_exists('modules')) {
|
||||
class modules {
|
||||
//define the variables
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $dir;
|
||||
public $fp;
|
||||
public $modules;
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $app_name;
|
||||
private $app_uuid;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//assign private variables
|
||||
$this->app_name = 'modules';
|
||||
$this->app_uuid = '5eb9cba1-8cb6-5d21-e36a-775475f16b5e';
|
||||
$this->permission_prefix = 'module_';
|
||||
$this->list_page = 'modules.php';
|
||||
$this->table = 'modules';
|
||||
$this->uuid_prefix = 'module_';
|
||||
$this->toggle_field = 'module_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* called when there are no references to a particular object
|
||||
* unset the variables used in the class
|
||||
*/
|
||||
public function __destruct() {
|
||||
foreach ($this as $key => $value) {
|
||||
unset($this->$key);
|
||||
}
|
||||
}
|
||||
|
||||
//get the additional information about a specific module
|
||||
public function info($name) {
|
||||
$module_label = substr($name, 4);
|
||||
|
|
@ -776,6 +818,299 @@ class modules {
|
|||
$_SESSION["reload_xml"] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* start modules
|
||||
*/
|
||||
public function start($records) {
|
||||
$this->control('start', $records);
|
||||
}
|
||||
|
||||
/**
|
||||
* start modules
|
||||
*/
|
||||
public function stop($records) {
|
||||
$this->control('stop', $records);
|
||||
}
|
||||
|
||||
/**
|
||||
* control (load/unload) modules
|
||||
*/
|
||||
private function control($action, $records) {
|
||||
if (permission_exists($this->permission_prefix.'edit')) {
|
||||
|
||||
//set local variables
|
||||
switch ($action) {
|
||||
case 'start':
|
||||
$action = 'load';
|
||||
$response_message = 'message-module_started';
|
||||
break;
|
||||
case 'stop':
|
||||
$action = 'unload';
|
||||
$response_message = 'message-module_stopped';
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//control the checked modules
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//filter out unchecked modules, build where clause for below
|
||||
foreach($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
|
||||
//get module details
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, module_name as module, module_enabled as enabled from v_".$this->table." ";
|
||||
$sql .= "where ( ".implode(' or ', $record_uuids)." ) ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$modules[$row['uuid']]['name'] = $row['module'];
|
||||
$modules[$row['uuid']]['enabled'] = $row['enabled'];
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
if (is_array($modules) && @sizeof($modules) != 0) {
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
|
||||
if ($fp) {
|
||||
//control modules
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($module['enabled'] == 'true') {
|
||||
$cmd = 'api '.$action.' '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
}
|
||||
else {
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = $text['label-disabled'];
|
||||
}
|
||||
}
|
||||
|
||||
//set message
|
||||
$message = $text[$response_message];
|
||||
if (is_array($responses) && @sizeof($responses) != 0) {
|
||||
foreach ($responses as $response) {
|
||||
$message .= "<br><strong>".$response['module']."</strong>: ".$response['message'];
|
||||
}
|
||||
}
|
||||
message::add($message, 'positive', 7000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete modules
|
||||
*/
|
||||
private function delete($records) {
|
||||
if (permission_exists($this->permission_prefix.'edit')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//delete the checked modules
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//filter out unchecked modules, build where clause for below
|
||||
foreach($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
|
||||
//get module details
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, module_name as module from v_".$this->table." ";
|
||||
$sql .= "where ( ".implode(' or ', $record_uuids)." ) ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$modules[$row['uuid']]['name'] = $row['module'];
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//build the delete array
|
||||
$x = 0;
|
||||
if (is_array($modules) && @sizeof($modules) != 0) {
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $module_uuid;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
|
||||
//stop modules
|
||||
if ($fp) {
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($module['enabled'] == 'true') {
|
||||
$cmd = 'api unload '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//rewrite mod
|
||||
$this->xml();
|
||||
|
||||
//set message
|
||||
$message = $text['message-delete'];
|
||||
if (is_array($responses) && @sizeof($responses) != 0) {
|
||||
foreach ($responses as $response) {
|
||||
$message .= "<br><strong>".$response['module']."</strong>: ".$response['message'];
|
||||
}
|
||||
}
|
||||
message::add($message, 'positive', 7000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle records
|
||||
*/
|
||||
public function toggle($records) {
|
||||
if (permission_exists($this->permission_prefix.'edit')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//toggle the checked records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get current toggle state
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as state, module_name as name from v_".$this->table." ";
|
||||
$sql .= "where ( ".implode(' or ', $record_uuids)." ) ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
$modules[$row['uuid']]['state'] = $row['state'];
|
||||
$modules[$row['uuid']]['name'] = $row['name'];
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
}
|
||||
|
||||
//build update array
|
||||
$x = 0;
|
||||
if (is_array($modules) && @sizeof($modules) != 0) {
|
||||
foreach($modules as $uuid => $module) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||
$array[$this->table][$x][$this->toggle_field] = $module['state'] == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//save the changes
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//save the array
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
|
||||
//stop modules if active
|
||||
if ($fp) {
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($this->active($module['name'])) {
|
||||
$cmd = 'api unload '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//rewrite mod
|
||||
$this->xml();
|
||||
|
||||
//set message
|
||||
$message = $text['message-toggle'];
|
||||
if (is_array($responses) && @sizeof($responses) != 0) {
|
||||
foreach ($responses as $response) {
|
||||
$message .= "<br><strong>".$response['module']."</strong>: ".$response['message'];
|
||||
}
|
||||
}
|
||||
message::add($message, 'positive', 7000);
|
||||
|
||||
}
|
||||
unset($records, $modules);
|
||||
}
|
||||
|
||||
}
|
||||
} //method
|
||||
|
||||
|
||||
} //class
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -411,14 +411,27 @@ echo "<script language='JavaScript' type='text/javascript' src='<!--{project_pat
|
|||
}
|
||||
|
||||
//list functions
|
||||
function list_all_toggle() {
|
||||
function list_all_toggle(modifier) {
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
if (modifier !== undefined) {
|
||||
var checkbox_checked = document.getElementById('checkbox_all_'+modifier).checked;
|
||||
}
|
||||
else {
|
||||
var checkbox_checked = document.getElementById('checkbox_all').checked;
|
||||
}
|
||||
for (var i = 0, max = inputs.length; i < max; i++) {
|
||||
if (modifier !== undefined) {
|
||||
if (inputs[i].type === 'checkbox' && inputs[i].className === 'checkbox_'+modifier) {
|
||||
inputs[i].checked = checkbox_checked;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (inputs[i].type === 'checkbox') {
|
||||
inputs[i].checked = checkbox_checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (document.getElementById('btn_check_all') && document.getElementById('btn_check_none')) {
|
||||
if (checkbox_checked) {
|
||||
document.getElementById('btn_check_all').style.display = 'none';
|
||||
document.getElementById('btn_check_none').style.display = '';
|
||||
|
|
@ -428,6 +441,7 @@ echo "<script language='JavaScript' type='text/javascript' src='<!--{project_pat
|
|||
document.getElementById('btn_check_none').style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function list_all_check() {
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
|
|
|
|||
Loading…
Reference in New Issue