summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c79cf7)
raw | patch | inline | side by side (parent: 3c79cf7)
author | dradon <dradon@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Apr 2011 07:56:41 +0000 (07:56 +0000) | ||
committer | dradon <dradon@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 13 Apr 2011 07:56:41 +0000 (07:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20718 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/posix/class_posixAccount.inc | patch | blob | history | |
gosa-core/plugins/personal/posix/generic.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc
index 9e4adc8b53d128a9db020cf053304a2b16110eeb..2befb7ed11cc070e472d959a395da88fb4569170 100644 (file)
var $multiple_support = TRUE;
var $groupMembership_some = array();
+ // group SortableListing
+ var $groupList = null;
+ var $groupListData = null;
+
/* constructor, if 'dn' is set, the node loads the given
'dn' from LDAP */
function posixAccount (&$config, $dn= NULL, $parent =NULL)
/* Load bases attributes */
plugin::plugin($config, $dn, $parent);
+ $groupImage = image('plugins/groups/images/select_group.png');
+
$this->trustModeDialog = new trustModeDialog($this->config, $this->dn, $parent);
$this->trustModeDialog->setAcl('users/posixAccount');
}
/* Get group membership */
+ $this->groupListData = array();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("cn", "description"));
while ($attrs= $ldap->fetch()){
if (!isset($attrs["description"][0])){
$entry= $attrs["cn"][0];
+ $this->groupListData[$ldap->getDN()] = array($groupImage, $attrs["cn"][0], "");
} else {
$entry= $attrs["cn"][0]." [".$attrs["description"][0]."]";
+ $this->groupListData[$ldap->getDN()] = array($groupImage, $attrs["cn"][0], $attrs["description"][0]);
}
$this->groupMembership[$ldap->getDN()]= $entry;
}
asort ($this->secondaryGroups);
$this->ui = get_userinfo();
+
+
+ // Create group-list
+ $this->groupList = new sortableListing(array(), array());
+ $this->groupList->setHeader(array(_("~"), _("Group"), _("Description")));
+ $this->groupList->setEditable(false);
+ $this->groupList->setDeleteable(true);
+ $this->groupList->setInstantDelete(false);
+ $this->groupList->setEditable(false);
+ $this->groupList->setReorderable(false);
+ $this->groupList->setDefaultSortColumn(1);
+ $this->groupList->setWidth("100%");
+ $this->groupList->setHeight("150px");
+ $this->groupList->setAcl("rwcdm");
}
$this->groupSelect= NULL;
}
+ // Remove groups that were removed by list
+ $this->groupList->save_object();
+ $actionL = $this->groupList->getAction();
+ if($actionL['action'] == "delete") {
+ $key = $this->groupList->getData($actionL['targets'][0]);
+ $this->delGroup(array($key));
+ }
+
// Remove groups from currently selected groups.
if (isset($_POST['delete_groupmembership']) &&
isset($_POST['group_list']) && count($_POST['group_list'])){
$this->delGroup (get_post('group_list'));
}
+ // Build group-list data
+ $dDisp = array();
+ $dData = array();
+
+ foreach($this->groupListData as $key => $value) {
+ $dData[$key] = $key;
+ $dDisp[$key] = array('data' => $value);
+ }
+
+ $this->groupList->setListData($dData, $dDisp);
+ $this->groupList->update();
+
/* Templates now! */
- $smarty= get_smarty();
+ $smarty = get_smarty();
+
+ $smarty->assign("groupList", $this->groupList->render());
+
// Handle trust mode dialog
$trustModeDialog = $this->trustModeDialog->execute();
{
/* include global link_info */
$ldap= $this->config->get_ldap_link();
+ $groupImage = image("plugins/groups/images/select_group.png");
/* Walk through groups and add the descriptive entry if not exists */
foreach ($groups as $value){
if (!array_key_exists($value, $this->groupMembership)){
$ldap->cat($value, array('cn', 'description', 'dn'));
$attrs= $ldap->fetch();
+ $dsc = " ";
error_reporting (0);
if (!isset($attrs['description'][0])){
$entry= $attrs["cn"][0];
if(obj_is_writable($attrs['dn'],"groups/group","memberUid")){
$this->groupMembership[$attrs['dn']]= $entry;
+
+ /* Add new group to groupList */
+ $this->groupListData[$attrs['dn']] = array();
+ $this->groupListData[$attrs['dn']][] = $groupImage;
+ $this->groupListData[$attrs['dn']][] = $attrs['cn'][0];
+ if(isset($attrs["description"])) {
+ $this->groupListData[$attrs['dn']][] = $attrs['description'][0];
+ } else {
+ $this->groupListData[$attrs['dn']][] = "";
+ }
+ if($this->multiple_support_active) {
+ $this->groupListData[$attrs['dn']][] = _("all");
+ }
+
if($this->multiple_support_active && isset($this->groupMembership_some[$attrs['dn']])){
unset($this->groupMembership_some[$attrs['dn']]);
}
foreach($groups as $dn_to_del){
if(isset($this->groupMembership[$dn_to_del]) && obj_is_writable($dn_to_del,"groups/group","memberUid")){
unset($this->groupMembership[$dn_to_del]);
+ unset($this->groupListData[$dn_to_del]);
}
if($this->multiple_support_active){
if(isset($this->groupMembership_some[$dn_to_del]) && obj_is_writable($dn_to_del,"groups/group","memberUid")){
unset($this->groupMembership_some[$dn_to_del]);
+ unset($this->groupListData[$dn_to_del]);
}
}
}
plugin::init_multiple_support($attrs,$all);
$this->trustModeDialog->init_multiple_support($attrs,$all);
+ // set header for multiple support
+ $this->groupList->setHeader(array(_("~"), _("Group"), _("Description"), _("Members")));
+
/* Some dummy values */
$groups_some = array();
$groups_all = array();
$uids = array();
$first = TRUE;
+ $groupImage = image('plugins/groups/images/select_group.png');
+
/* Get all groups used by currently edited users */
$uid_filter="";
for($i =0; $i < $this->multi_attrs_all['uid']['count'] ; $i ++){
$uid_filter = "(&(objectClass=posixGroup)(|".$uid_filter."))";
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->search($uid_filter,array("dn","cn","memberUid"));
+ $ldap->search($uid_filter,array("dn","cn","memberUid","description"));
while($group = $ldap->fetch()){
$groups_some[$group['dn']] = $group['cn'][0];
+
+ $desc = " ";
+ if(isset($group['description'])) $desc = $group['description'][0];
+
+ $this->groupListData[$group['dn']] = array($groupImage,
+ $group['cn'][0],
+ $desc,
+ _("some"));
+
for($i = 0 ; $i < $group['memberUid']['count'] ; $i++){
$groups_uid[$group['dn']][] = $group['memberUid'][$i];
}
$this->groupMembership = $groups_all;
/* Create an array of all grouops used by all users */
- foreach( $groups_all as $dn => $cn){
- if(isset($groups_some[$dn])){
+ foreach($groups_all as $dn => $cn) {
+ if(isset($groups_some[$dn])) {
unset($groups_some[$dn]);
+ $this->groupListData[$dn][3] = _("all");
}
}
+
+
$this->groupMembership_some = $groups_some;
$this->primaryGroup = $this->gidNumber;
diff --git a/gosa-core/plugins/personal/posix/generic.tpl b/gosa-core/plugins/personal/posix/generic.tpl
index e260263bc0b70817587d459eaad01e59679622dd..1a19b1a19fb84c70873fe7d31efe2f1658f4a67d 100644 (file)
<br>
{/if}
{render acl=$groupMembershipACL}
- <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple >
- {if !$multiple_support}
- {html_options options=$groupMembership}
- {else}
- {foreach from=$groupMembership item=group key=key}
- <option value="{$key}">{$group} ({t}Common group{/t})</option>
- {/foreach}
- {foreach from=$groupMembership_some item=group key=key}
- <option value="{$key}"
- style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;'>{$group} ({t}Groups differ{/t})</option>
- {/foreach}
- {/if}
- </select>
+ {$groupList}
{/render}
- <br>
{render acl=$groupMembershipACL}
<button type='submit' name='edit_groupmembership'>{msgPool type=addButton}</button>
- {/render}
- {render acl=$groupMembershipACL}
- <button type='submit' name='delete_groupmembership'>{msgPool type=delButton}</button>
-
{/render}
</td>
</tr>