diff options
Diffstat (limited to 'modules-available')
5 files changed, 27 insertions, 8 deletions
diff --git a/modules-available/eventlog/lang/de/template-tags.json b/modules-available/eventlog/lang/de/template-tags.json index 8919d248..286f3f1c 100644 --- a/modules-available/eventlog/lang/de/template-tags.json +++ b/modules-available/eventlog/lang/de/template-tags.json @@ -41,6 +41,7 @@ "lang_messageTemplate": "Nachrichtenvorlage", "lang_messageTemplateHelp": "Sie k\u00f6nnen mittels der Platzhalter %0%, %1%, etc. Bezug auf die Filter oben nehmen. F\u00fcr Filter vom Typ \"regex\" k\u00f6nnen Sie sich mittels %n:1%, %n:2% etc. auf die \"Capture Groups\" des Regul\u00e4ren Ausdrucks beziehen. Des Weiteren k\u00f6nnen numerische Werte durch Suffixe formatiert\/in lesbare Form umgewandelt werden. Geben Sie durch das Suffix an, welche Einheit die zu formatierende Zahl hat: \"b\", \"kb\", \"mb\", \"gb\" f\u00fcr Bytes (resp. Kilo, Mega, etc.), \"ts\" als Unix-Timestamp, \"d\" als Dauer in Sekunden, \"L\" f\u00fcr eine Location-ID.", "lang_noMailConfig": "Keine EMail-Konfiguration", + "lang_noticeEditingExample": "Dies ist ein Beispielfilter. Es wird empfohlen, diese Regel nicht zu editieren oder zu l\u00f6schen, sondern stattdessen eine Kopie zu erstellen.", "lang_optionalDescription": "Beschreibung (als Referenz, wird nicht f\u00fcr die Verarbeitung verwendet)", "lang_port": "Port", "lang_postUseSUBJECTandTEXThint": "Sie k\u00f6nnen die Platzhalter %SUBJECT% und %TEXT% verwenden, die entsprechend des ausgew\u00e4hlten POST-Formats escaped werden.", diff --git a/modules-available/eventlog/lang/en/template-tags.json b/modules-available/eventlog/lang/en/template-tags.json index 1e92eb68..e4cad4a1 100644 --- a/modules-available/eventlog/lang/en/template-tags.json +++ b/modules-available/eventlog/lang/en/template-tags.json @@ -41,6 +41,7 @@ "lang_messageTemplate": "Message template", "lang_messageTemplateHelp": "You can refer to the matched rules above by using their index in percentage-signs, like %0%, %1%, etc. If you use a regex with capture groups, you can refer to them individually by using %n:1%, %n:2% etc. Furthermode, you can format raw numbers by appending \"b\", \"kb\", \"mb\", \"gb\" to interpret the given value as bytes (or kilobytes, megabytes, etc.), \"ts\" if the input value is a unix timestamp, \"d\" to turn a duration in seconds into human readable format, and \"L\" to turn a location id into the according location name.", "lang_noMailConfig": "No mail config", + "lang_noticeEditingExample": "This is an example filter. It's recommended you don't edit or delete it, but instead create a copy first.", "lang_optionalDescription": "Description (for reference only)", "lang_port": "Port", "lang_postUseSUBJECTandTEXThint": "Use %SUBJECT% and %TEXT% placeholders which will be escaped properly, according to chosen POST format.", diff --git a/modules-available/eventlog/pages/rules.inc.php b/modules-available/eventlog/pages/rules.inc.php index 7b43cfdb..ca39b15b 100644 --- a/modules-available/eventlog/pages/rules.inc.php +++ b/modules-available/eventlog/pages/rules.inc.php @@ -96,12 +96,13 @@ class SubPage } else { // LIST $data = []; - $data['filters'] = Database::queryAll('SELECT ruleid, type, title, datafilter, + $data['filters'] = Database::queryAll('SELECT ruleid, type, title, description, datafilter, Count(transportid) AS useCount FROM notification_rule LEFT JOIN notification_rule_x_transport sfxb USING (ruleid) GROUP BY ruleid, title - ORDER BY title, ruleid'); + ORDER BY SIGN(Count(transportid)) DESC, title, ruleid'); + //usort($data['filters']) Permission::addGlobalTags($data['perms'], null, ['filter.rules.edit']); Render::addTemplate('page-filters-rules', $data); } @@ -117,15 +118,17 @@ class SubPage $filterIdx = 0; $knownIdxList = []; if ($id !== 0) { - $data = Database::queryFirst('SELECT ruleid, title, description, type, datafilter, subject, message + $data = Database::queryFirst('SELECT ruleid, title, description, type, datafilter, subject, message, predefid FROM notification_rule WHERE ruleid = :id', ['id' => $id]); if ($data === false) { Message::addError('invalid-rule-id', $id); Util::redirect('?do=eventlog&show=rules'); } + $data['edit_warn'] = $data['predefid'] !== null; if (Request::get('copy', false, 'bool')) { $data['ruleid'] = 0; $data['title'] = ''; + $data['edit_warn'] = false; } $list = json_decode($data['datafilter'], true); if (!is_array($list['list'])) { diff --git a/modules-available/eventlog/templates/page-filters-edit-rule.html b/modules-available/eventlog/templates/page-filters-edit-rule.html index 42d601f2..1ffd73c7 100644 --- a/modules-available/eventlog/templates/page-filters-edit-rule.html +++ b/modules-available/eventlog/templates/page-filters-edit-rule.html @@ -6,6 +6,14 @@ {{lang_createFilter}} {{/ruleid}} </h2> +{{#edit_warn}} + <div class="alert alert-info"> + <a class="pull-right btn btn-xs btn-default" href="?do=eventlog&show=rules&id={{ruleid}}&copy=1" title="{{lang_copy}}"> + <span class="glyphicon glyphicon-duplicate" aria-label="{{lang_copy}}"></span> + </a> + {{lang_noticeEditingExample}} + </div> +{{/edit_warn}} <h3>{{title}}</h3> <p>{{lang_filterExampleHelpText}}</p> diff --git a/modules-available/eventlog/templates/page-filters-rules.html b/modules-available/eventlog/templates/page-filters-rules.html index 56bf0871..680b71d8 100644 --- a/modules-available/eventlog/templates/page-filters-rules.html +++ b/modules-available/eventlog/templates/page-filters-rules.html @@ -7,7 +7,6 @@ <th class="slx-smallcol">{{lang_id}}</th> <th class="slx-smallcol">{{lang_type}}</th> <th>{{lang_title}}</th> - <!--th>{{lang_details}}</th--> <th class="slx-smallcol"></th> <th class="slx-smallcol">{{lang_edit}}</th> </tr> @@ -15,10 +14,17 @@ <tbody> {{#filters}} <tr> - <td>{{ruleid}}</td> - <td>{{type}}</td> - <td class="text-nowrap">{{title}}</td> - <td><span class="badge">{{useCount}}</span></td> + <td class="text-right">{{ruleid}}</td> + <td class="text-nowrap">{{type}}</td> + <td class="text-nowrap"> + {{title}} + <table class="slx-ellipsis"><tr><td class="small text-muted">{{description}}</td></tr></table> + </td> + <td class="text-right"> + {{#useCount}} + <span class="badge">{{useCount}}</span> + {{/useCount}} + </td> <td class="slx-smallcol"> <a class="btn btn-xs btn-default {{perms.filter.rules.edit.disabled}}" href="?do=eventlog&show=rules&id={{ruleid}}" title="{{lang_edit}}"> |