aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-15 19:01:51 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-15 19:01:51 +0000
commiteb3f65345410313a6b87149fdea504d0a66e53af (patch)
treef2013a420db7d201634a6fea0d18761c1d5e3eb4 /mod
parentc852d9e9e0fd64d70dcaace105f2bf7e7d3c1b95 (diff)
downloadelgg-eb3f65345410313a6b87149fdea504d0a66e53af.tar.gz
elgg-eb3f65345410313a6b87149fdea504d0a66e53af.tar.bz2
Added ability for ECML keyword definitions to restrict themselves to specific views.
git-svn-id: http://code.elgg.org/elgg/trunk@5750 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-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>';