summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 16cd081)
raw | patch | inline | side by side (parent: 16cd081)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 1 Jun 2010 10:26:28 +0000 (10:26 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 1 Jun 2010 10:26:28 +0000 (10:26 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18811 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc | patch | blob | history | |
gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl | patch | blob | history |
diff --git a/gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc b/gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc
index 4f9a8990f34ddffbb88364f7762707d3468d9205..35a925ec6f11e7785d86a86c8c68cc76d3955539 100644 (file)
* array of this plugin.
* @var string
*/
- public $labeledURI = 'ldap:///dc=example,dc=com?memberUid?sub?(objectClass=posixGroup)';
+ public $labeledURI = array();
+ public $labeledURIparsed = array();
+ public $labeledURIdefault = 'ldap:///dc=example,dc=com?memberUid?sub?(objectClass=posixGroup)';
/**
* Store values of memberUrl.
{
parent::__construct($config, $dn);
- // Preset the labeled URI with a valid value.
+ // Load labeledURI values.
+ $this->labeledURI = array();
if(!$this->is_account){
- $attr_label = $this->attributes[0];
- $this->$attr_label = str_replace('dc=example,dc=com', LDAP::fix($this->dn), $this->$attr_label);
+ $this->labeledURI[] = str_replace('dc=example,dc=com', LDAP::fix($this->dn), $this->labeledURIdefault);
+ }elseif(isset($this->attrs['labeledURI'])){
+ for($i =0; $i < $this->attrs['labeledURI']['count']; $i++) {
+ $this->labeledURI[] = $this->attrs['labeledURI'][$i];
+ }
}
+ // Parse labeledURI entries
+ $this->labeledURIparsed = array();
+ foreach($this->labeledURI as $entry){
+ list($base,$attr,$scope,$filter) = preg_split("/\?/",$entry);
+
+ // Ignore entries that do not have a valid scope value (one,base,sub)
+ if(!in_array($scope,array('base','one','sub'))) continue;
+
+ // Append parsed uri
+ $this->labeledURIparsed[] = array('base' => $base, 'attr' => $attr, 'scope' => $scope,'filter' => $filter);
+ }
+
+ // Save dn, to be able the check for object movements - put this in plugin::move
$this->orig_dn = $this->dn;
}
+
public function check ()
{
return Array();
}
$display = $this->show_disable_header(msgPool::removeFeaturesButton(_("Dynamic Group")), msgPool::featuresEnabled(_("Dynamic Group")));
- //
- // Now, we search for current attributes, and display them.
- //
- $attr_label = $this->attributes[0];
- $attr_value = $this->$attr_label;
-
// Display values.
//
$smarty = get_smarty();
- $smarty->assign('memberURLAttributeLabel', $attr_label);
- $smarty->assign('memberURLAttributeValue', $attr_value);
+ $smarty->assign('labeledURIparsed', $this->labeledURIparsed);
+ $smarty->assign('scopes', array('base','one','sub'));
$display .= $smarty->fetch(get_template_path('dyngroup.tpl', TRUE, dirname(__FILE__)));
return $display;
}
public function save_object ()
{
parent::save_object();
+
+ // Add a new labeled Uri
+ if(isset($_POST['addUri'])){
+ $this->labeledURIparsed[] =
+ array(
+ 'base' => 'ldap:///'.$this->dn,
+ 'attr' => 'memberUid',
+ 'scope' => 'sub',
+ 'filter' => 'objectClass=posixGroup');
+ }
+
+ // Remove a labeled Uri and get posts
+ foreach($this->labeledURIparsed as $key => $data){
+ foreach(array('scope','attr','filter','base') as $attr){
+ if(isset($_POST[$attr.'_'.$key])){
+ $this->labeledURIparsed[$key][$attr] = get_post($attr.'_'.$key);
+ }
+ }
+
+ // Remove labeled uri if requested
+ if(isset($_POST['delUri_'.$key])){
+ unset($this->labeledURIparsed[$key]);
+ }
+ }
+ $this->labeledURIparsed = array_values($this->labeledURIparsed);
}
*/
public function save ()
{
+ // Build up labeledUri entries
+ $this->labeledURI = array();
+ foreach($this->labeledURIparsed as $entry){
+ $this->labeledURI[] = "{$entry['base']}?{$entry['attr']}?{$entry['scope']}?{$entry['filter']}";
+ }
+
parent::save();
$this->cleanup();
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->dn);
$ldap->modify($this->attrs);
+
if(!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
}
diff --git a/gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl b/gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl
index 842dd28421996f0dc6494289e70a468bb9105894..c50aa14df7472337d0565afa62a5a447f6eb5625 100644 (file)
<h3>{t}Generic{/t}</h3>
-<label for="{$memberURLAttributeLabel}">{t}{$memberURLAttributeLabel}{/t}</label>
-{foreach item=line from=$memberURLAttributeValue}
- <input size=70 name="{$memberURLAttributeLabel}" value="{$line}">
+
+
+<table summary="{t}Labeled uri definitions{/t}" style='width:100%'>
+ <tr>
+ <td>{t}Base{/t}</td>
+ <td></td>
+ <td>{t}Attribute{/t}</td>
+ <td>{t}Filter{/t}</td>
+ <td></td>
+ </tr>
+{foreach item=item key=key from=$labeledURIparsed}
+ <tr>
+ <td>
+ <input type='text' value='{$item.base}'>
+ </td>
+ <td>
+ <select name='scope' size='1'>
+ {html_options options=$scopes selected=$item.scope}
+ </select>
+ </td>
+ <td><input type='text' name='attr_{$key}' value='{$item.attr}'></td>
+ <td style='width:50%;'><input name='filter_{$key}' type='text' style='width:98%;' value='{$item.filter}'></td>
+ <td><button name='delUri_{$key}'>{msgPool type='delButton'}</button></td>
+ </tr>
{/foreach}
+ <tr>
+ <td colspan="4"></td>
+ <td><button name='addUri'>{msgPool type='addButton'}</button></td>
+ </tr>
+</table>