Connect masks to groups
authorJoey Schulze <joey@infodrom.org>
Sat, 27 Feb 2010 22:17:57 +0000 (23:17 +0100)
committerJoey Schulze <joey@infodrom.org>
Sat, 27 Feb 2010 22:17:57 +0000 (23:17 +0100)
masks/sys_group_mask.php [new file with mode: 0644]

diff --git a/masks/sys_group_mask.php b/masks/sys_group_mask.php
new file mode 100644 (file)
index 0000000..56b2ad9
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+
+$jscode[] = <<<EOC
+
+Rico.moduleDependencies['checkboxDB'] = ['+LiveGrid', '../ricoTableColumnDB.js'];
+Rico.loadModule('checkboxDB');
+
+function select_group_calback(data)
+{
+  grid_update(grid);
+}
+
+function select_group(obj)
+{
+  if (!obj.options[obj.selectedIndex].value.length)
+    val = -1;
+  else
+    val = obj.options[obj.selectedIndex].value;
+
+  ajax_request('setvar','source=sys_group_mask&name=group&value='+val,select_group_calback);
+
+  if (obj.options[obj.selectedIndex].value.length)
+    info('Gruppe ' + obj.options[obj.selectedIndex].innerHTML + ' ausgewählt');
+  else
+    info('');
+}
+EOC;
+
+if (empty($_SESSION['sys_group_mask.group'])) $_SESSION['sys_group_mask.group'] = 0;
+
+$mask = array(
+             'table' => 'sys_mask',
+             'title' => 'Berechtigungen',
+             'select' => array(
+                               'title' => 'Auswahl',
+                               'options' => 'SELECT id,name AS text FROM sys_group ORDER BY name',
+                               'default' => 'Gruppe wählen',
+                               'selected' => $_SESSION['sys_group_mask.group'],
+                               'onchange' => 'select_group(this)',
+                               ),
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'sql' => 'sys_mask.id',
+                                           'visible' => false,
+                                           ),
+                             'menutitle' => array(
+                                           'name' => 'Menüpunkt',
+                                           'sql' => 'sys_mask.menutitle',
+                                           ),
+                             'title' => array(
+                                           'name' => 'Beschreibung',
+                                           'width' => 150,
+                                           'sql' => 'sys_mask.title',
+                                           ),
+                             'edit' => array(
+                                           'name' => 'Edit',
+                                           'width' => 40,
+                                           'specs' => "ClassName: 'aligncenter'",
+                                           'sql' => 'sys_mask.edit',
+                                           ),
+                             'option' => array(
+                                           'name' => 'Menü',
+                                           'width' => 40,
+                                           'sql' => '(SELECT count(*) FROM sys_group_mask WHERE gid = '
+                                               . intval($_SESSION['sys_group_mask.group'])
+                                               . ' AND mask = sys_mask.id)',
+                                           'control' => "new Rico.TableColumn.checkboxDB(0, 'ajax/ricoUpdateConnection.php')",
+                                           'specs' => "filterUI: 'c'",
+                                           'update' => array('table' => 'sys_group_mask',
+                                                             'basecol' => 'gid',
+                                                             'baseval' => $_SESSION['sys_group_mask.group'],
+                                                             'refcol' => 'mask',
+                                                             'reftable' => 'sys_mask',
+                                                             'refid' => 'id',
+                                                             ),
+                                           ),
+                             ),
+             'rows' => 20,
+             'variables' => array(
+                                  'group' => array(),
+                                  ),
+             );
+
+?>