diff --git a/emhttp/plugins/dynamix/NotificationAgents.page b/emhttp/plugins/dynamix/NotificationAgents.page index 2ec66f7e4..4855028d6 100644 --- a/emhttp/plugins/dynamix/NotificationAgents.page +++ b/emhttp/plugins/dynamix/NotificationAgents.page @@ -2,7 +2,7 @@ Menu="Notifications:3" Title="Notification Agents" Tag="rss-square" --- - + -Language) ) { - $guiLanguage = ($locale == "" ) ? "en_US" : $locale; - $acceptedLanguages = explode(" ",$xml->Language); - if ( ! in_array($guiLanguage,$acceptedLanguages) ) + $xml = @simplexml_load_file($xml_file); + if (! $xml) { continue; } - $name = str_replace(' ','_',$xml->Name); + + if (isset($xml->Language)) { + $guiLanguage = ($locale == "") ? "en_US" : $locale; + $acceptedLanguages = explode(" ", $xml->Language); + if (! in_array($guiLanguage, $acceptedLanguages)) { + continue; + } + } + $name = str_replace(' ', '_', $xml->Name); + $titleId = 'agent-' . strtolower($name); $enabledAgent = agent_fullname("$name.sh", "enabled"); $disabledAgent = agent_fullname("$name.sh", "disabled"); if (is_file($disabledAgent)) { - $file = $disabledAgent; - if (is_file($enabledAgent)) unlink($enabledAgent); + $file = $disabledAgent; + if (is_file($enabledAgent)) { + unlink($enabledAgent); + } } else { - $file = $enabledAgent; + $file = $enabledAgent; } $values = []; $script = ""; if (is_file($file)) { - preg_match("/[#]{6,100}([^#]*?)[#]{6,100}/si", file_get_contents($file), $match); - if (isset($match[1])) { - foreach (explode(PHP_EOL, $match[1]) as $line) { - if (strpos($line, "=")) { - [$k, $v] = my_explode("=",str_replace("\"", "", $line),2); - $values[$k] = $v; - } + preg_match("/[#]{6,100}([^#]*?)[#]{6,100}/si", file_get_contents($file), $match); + if (isset($match[1])) { + foreach (explode(PHP_EOL, $match[1]) as $line) { + if (strpos($line, "=")) { + [$k, $v] = my_explode("=", str_replace("\"", "", $line), 2); + $values[$k] = $v; + } + } } - } } - foreach (explode(PHP_EOL,(String) $xml->Script) as $line) if (trim($line)) $script .= trim($line)."{1}"; - echo '
'.str_replace('_',' ',$name).''.(is_file($enabledAgent) ? ''._("Enabled").'' : ''._("Disabled").'').'
'; - echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo '
'._("Agent function").':
'; - echo ''; - foreach ($xml->Variables->children() as $v) { - $vName = preg_replace('#\[([^\]]*)\]#', '<$1>', (string) $v); - $vDesc = ucfirst(strtolower(preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Desc))); - $vDefault = preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Default); - $vHelp = preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Help); - echo "
$vDesc:
"; - if (preg_match('/title|message/', $vDesc)) { - echo ''; - } else { - echo ''; - } - echo '
'; - if ($vHelp) echo '
'.$vHelp.'
'; + foreach (explode(PHP_EOL, (string) $xml->Script) as $line) { + if (trim($line)) { + $script .= trim($line)."{1}"; + } } - echo '
 
'; - echo ''; - if (is_file($file)) { - echo ''; - echo '' : ' disabled>'); - } - echo '
'; - + + $displayName = str_replace('_', ' ', $name); + $iconPath = "/plugins/dynamix/icons/" . strtolower(str_replace('_', '', $name)) . ".png"; + $isEnabled = is_file($enabledAgent); + $statusClass = $isEnabled ? 'green' : 'red'; + $statusText = $isEnabled ? _("Enabled") : _("Disabled"); + ?> + +
+ + + + + + + +
+ +
+ + + + + + + +
+
:
+
+ +
+
+ + + + Variables->children() as $v): + $vName = preg_replace('#\[([^\]]*)\]#', '<$1>', (string) $v); + $vDesc = ucfirst(strtolower(preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Desc))); + $vDefault = preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Default); + $vHelp = preg_replace('#\[([^\]]*)\]#', '<$1>', $v->attributes()->Help); + $currentValue = isset($values[$vName]) ? $values[$vName] : $vDefault; + $isTitleOrMessage = preg_match('/title|message/', $vDesc); + ?> +
+
:
+
+ + + + + +
+
+ + +
+ + + +
+
 
+
+
+ " onclick="prepareService(this, '')" disabled> + " onclick="done()"> + + + " onclick="execCmd('delete','')"> + " onclick="testService('')"' : ' disabled>' ?> + +
+
+
+
+ + diff --git a/emhttp/plugins/dynamix/styles/default-base.css b/emhttp/plugins/dynamix/styles/default-base.css index e11a028c9..85fb18b04 100644 --- a/emhttp/plugins/dynamix/styles/default-base.css +++ b/emhttp/plugins/dynamix/styles/default-base.css @@ -197,10 +197,11 @@ a.button, } /* necessary evil until we re-write button styles */ -.buttons-no-margin { +.buttons-no-margin, +.button-group { display: flex; flex-wrap: wrap; - gap: 1rem; + gap: 1.2rem; input[type="button"], input[type="reset"],