aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/ecml/ecml_functions.php6
-rw-r--r--mod/ecml/views/default/ecml/admin/ecml_admin.php14
2 files changed, 16 insertions, 4 deletions
diff --git a/mod/ecml/ecml_functions.php b/mod/ecml/ecml_functions.php
index 58395aa7b..7a30cde16 100644
--- a/mod/ecml/ecml_functions.php
+++ b/mod/ecml/ecml_functions.php
@@ -203,6 +203,12 @@ function ecml_is_valid_keyword($keyword, $view = NULL) {
return FALSE;
}
+ // this keyword is restricted to certain views
+ if (isset($CONFIG->ecml_keywords[$keyword]['restricted'])
+ && !in_array($view, $CONFIG->ecml_keywords[$keyword]['restricted'])) {
+ return FALSE;
+ }
+
$views = $CONFIG->ecml_permissions;
// this is a blacklist, so return TRUE by default.
diff --git a/mod/ecml/views/default/ecml/admin/ecml_admin.php b/mod/ecml/views/default/ecml/admin/ecml_admin.php
index bb2cd7f05..2a5663327 100644
--- a/mod/ecml/views/default/ecml/admin/ecml_admin.php
+++ b/mod/ecml/views/default/ecml/admin/ecml_admin.php
@@ -40,11 +40,17 @@ foreach ($views as $view => $desc) {
<td class=\"ecml_view_desc\">$desc</td>
";
foreach ($keywords as $keyword => $info) {
- $checked = (in_array($keyword, $perms[$view])) ? 'checked="checked"' : '';
+ // if this is restricted and we're not on the specified view don't allow changes
+ // since we don't save this, no need to pass a name
+ if (isset($info['restricted']) && !in_array($view, $info['restricted'])) {
+ $form_body .= "<td><input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\"/></td>";
+ } else {
+ $checked = (in_array($keyword, $perms[$view])) ? 'checked="checked"' : '';
- // ooook. input/checkboxes isn't overly useful.
- // do it ourself.
- $form_body .= "<td><input type=\"checkbox\" name=\"perms[$view][]\" value=\"$keyword\" $checked /></td>";
+ // ooook. input/checkboxes isn't overly useful.
+ // do it ourself.
+ $form_body .= "<td><input type=\"checkbox\" name=\"perms[$view][]\" value=\"$keyword\" $checked /></td>";
+ }
}
$form_body .= '</tr>';