summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0f580e)
raw | patch | inline | side by side (parent: e0f580e)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Jan 2010 17:31:10 +0000 (17:31 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Jan 2010 17:31:10 +0000 (17:31 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15215 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/generic/class_user.inc | patch | blob | history | |
gosa-core/plugins/personal/generic/generic.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc
index cefc0113a4b38942c67177e2a6e62085f69d993e..a2b3b1db29d3e92947c8f5771b6e1544a47d4870 100644 (file)
var $ou= "";
var $departmentNumber= "";
var $gosaLoginRestriction= array();
+ var $gosaLoginRestrictionWidget;
var $employeeNumber= "";
var $employeeType= "";
var $roomNumber= "";
$this->gosaLoginRestriction[] = $this->attrs['gosaLoginRestriction'][$i];
}
}
+ $this->gosaLoginRestrictionWidget= new sortableListing($this->gosaLoginRestriction);
+ $this->gosaLoginRestrictionWidget->setDeleteable(true);
+ $this->gosaLoginRestrictionWidget->setColspecs(array('*'));
+ $this->gosaLoginRestrictionWidget->setWidth("320px");
+ $this->gosaLoginRestrictionWidget->setHeight("70px");
$this->orig_base = $this->base;
}
/* Call parent execute */
plugin::execute();
+ /* Let the lists update themselves */
+ $this->gosaLoginRestrictionWidget->setAcl($this->getacl('gosaLoginRestriction', (!is_object($this->parent) && !session::is_set('edit'))));
+ $this->gosaLoginRestrictionWidget->update();
+
/* Handle add/delete for restriction mode */
if (isset($_POST['add_res']) && isset($_POST['res'])) {
$val= validate($_POST['res']);
if (preg_match('/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/', $val) ||
preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/([0-9]+)$/', $val) ||
preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/', $val)) {
- $this->gosaLoginRestriction[]= $val;
+ $this->gosaLoginRestrictionWidget->addEntry($val);
} else {
msg_dialog::display(_("Error"), _("Please add a single IP address or a network/netmask combination!"), ERROR_DIALOG);
}
}
- if (isset($_POST['del_res']) && isset($_POST['restrictions'])) {
- $res= $_POST['restrictions'];
- if (!is_array($res)){
- $res= array($res);
- }
- foreach ($res as $restriction) {
- if (in_array($restriction, $this->gosaLoginRestriction)) {
- $this->gosaLoginRestriction= array_remove_entries(array($restriction), $this->gosaLoginRestriction);
- }
- }
- }
/* Log view */
if($this->is_account && !$this->view_logged){
$smarty= get_smarty();
$smarty->assign("usePrototype", "true");
+ $smarty->assign("gosaLoginRestrictionWidget", $this->gosaLoginRestrictionWidget->render());
/* Assign sex */
$sex= array(0 => " ", "F" => _("female"), "M" => _("male"));
$smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !session::is_set('edit'))));
}
- $smarty->assign("gosaLoginRestriction", $this->gosaLoginRestriction);
$smarty->assign("gosaLoginRestrictionACL", $this->getacl('gosaLoginRestriction', (!is_object($this->parent) && !session::is_set('edit'))));
$smarty->assign("pwmode", $pwd_methods);
$smarty->assign("pwmode_select", $this->pw_storage);
/* Parents save function */
plugin::save_object ();
+ /* Sync lists */
+ if ($this->gosaLoginRestrictionWidget->isModified()) {
+ $this->gosaLoginRestriction= $this->gosaLoginRestrictionWidget->getMaintainedData();
+ }
+
/* Save government mode attributes */
if ($this->governmentmode){
foreach ($this->govattrs as $val){
diff --git a/gosa-core/plugins/personal/generic/generic.tpl b/gosa-core/plugins/personal/generic/generic.tpl
index 9833e7b30a134dd58cfd40d58acebeca3251c8f6..34da9d013412015e451b4c4635c60dbf69c5f84e 100644 (file)
<td style='vertical-align:top'><label for="edit_perms">{t}Restrict login to{/t}</label></td>
<td>
{render acl=$gosaLoginRestrictionACL}
- <select size="3" multiple style='width:100%' id="restrictions" name="restrictions">
- {html_options values=$gosaLoginRestriction output=$gosaLoginRestriction}
- </select><br>
+ {$gosaLoginRestrictionWidget}
<input id="res" name="res" size=22 maxlength=33 value="{t}IP or network{/t}" onFocus='document.getElementById("res").value=""'>
- <input id="add_res" type="submit" name="add_res" value="+">
- <input id="del_res" type="submit" name="del_res" value="-">
+ <input id="add_res" type="submit" name="add_res" value="{t}Add{/t}">
+
{/render}
</td>
</tr>