summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 714dd9c)
raw | patch | inline | side by side (parent: 714dd9c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 Jan 2006 14:58:37 +0000 (14:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 Jan 2006 14:58:37 +0000 (14:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2450 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiManagement.inc | patch | blob | history | |
plugins/admin/fai/faiNewBranch.tpl | patch | blob | history | |
plugins/admin/fai/headpage.tpl | patch | blob | history |
index 17971a305dda1423d352b9bca4d7944e0c133f18..099905f380034c6620da3a3b0b0e79c3b5ed80d7 100644 (file)
$display = "";
$smarty = get_smarty();
- $s_action = "";
+ $smarty->assign("BranchName","");
+ $s_action = "";
$s_entry = "";
/* filter management
* Filter will be changed if POST['regex'] or $_GET['search'] isset
* New Filter will be stored in session and is used to generate list contents
*/
$faifilter = $_SESSION['faifilter'];
+
+ if((isset($_POST['select_branch']))&&(!empty($_POST['select_branch']))){
+ $faifilter['branch'] = $_POST['select_branch'];
+ }
/* Filter is posted by apply button
* Check every single chkbox
}
}
- if((isset($_POST['select_branch']))&&(!empty($_POST['select_branch']))){
- $faifilter['branch'] = $_POST['select_branch'];
- }
-
- $smarty->assign("select_branch",$_SESSION['faifilter']['branch']);
/* Check ImageButton posts
* Create new tab ich new_xx is posted
}elseif(preg_match("/^entry_delete_.*/",$key)){
$s_entry = preg_replace("/^entry_delete_/","",$key);
$s_entry = preg_replace("/_.*$/","",$s_entry);
- $s_action = "delete";
- }elseif(preg_match("/dep_back.*/i",$key)){
- $s_action="back";
- }elseif(preg_match("/dep_home.*/i",$key)){
- $s_action="home";
- }elseif(preg_match("/dep_root.*/i",$key)){
- $s_action="root";
- }
+ $s_action = "delete";
+ }elseif(preg_match("/dep_back.*/i",$key)){
+ $faifilter['branch'] = "main";
+ $s_action="back";
+ }elseif(preg_match("/dep_home.*/i",$key)){
+ $faifilter['branch'] = "main";
+ $s_action="home";
+ }elseif(preg_match("/dep_root.*/i",$key)){
+ $faifilter['branch'] = "main";
+ $s_action="root";
+ }
- }
+ }
if($s_action=="root"){
$faifilter['base']=($this->config->current['BASE']);
/* Create new branch */
if((isset($_POST['UseBranchName']))&&($this->dispNewBranch)){
-
+
/* Check branch name */
$name = $_POST['BranchName'];
$is_ok = true;
+ $smarty->assign("BranchName",$name);
$base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
/* Check used characters */
- if(preg_match("/[^0-9a-z]/i",$name)){
+ if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
print_red(_("Specified branch name is invalid."));
$is_ok = false;
}
/* Check if this name is already in use */
- if(!$this->CheckNewBranchName($_POST['BranchName'])){
+ if(!$this->CheckNewBranchName($_POST['BranchName'],$faifilter['branch'])){
print_red(_("This name is already in use."));
- $this->is_ok = false;
+ $is_ok = false;
}
if($is_ok){
/* Abort creating new branch */
if(isset($_POST['CancelBranchName'])){
$this->dispNewBranch = false;
+ $this->dispNewFreeze = false;
}
/* Open dialog to insert new branch name */
/* Remove branch */
if($s_action == "remove_branch"){
- $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+ $base= $faifilter['branch'];
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
- $acl= get_permissions ($base, $this->ui->subtreeACL);
+ $acl= get_permissions ($faifilter['base'], $this->ui->subtreeACL);
$this->acl= get_module_permission($acl, "fai", $base);
if (chkacl($this->acl, "delete") == ""){
- $smarty->assign("warning", sprintf(_("You're about to delete a fai branch / freeze '%s'."), $base));
+ $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze '%s'."), $faifilter['branch']));
return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
} else {
print_red (_("You are not allowed to delete this user!"));
/* Delete this entry */
if(isset($_POST['delete_branch_confirm'])){
- print "branch removed ";
- }
+ $bb = $faifilter['branch'];
+ if(!isset($ldap)){
+ $ldap = $this->config->get_ldap_link();
+ }
- if($s_action == "freeze_branch"){
- $this->dispNewFreeze = true;
- $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
- return($display);
+ $br = $this->getBranches();
+
+ if(isset($br[$bb])){
+ $ldap->cd($bb);
+ $ldap->recursive_remove();
+ $faifilter['branch'] = "main";
+ }
}
+
if((isset($_POST['UseBranchName']))&&($this->dispNewFreeze)){
/* Check branch name */
$name = $_POST['BranchName'];
$is_ok = true;
+ $smarty->assign("BranchName",$name);
+
$base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
/* Check used characters */
- if(preg_match("/[^0-9a-z]/i",$name)){
+ if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
print_red(_("Specified branch name is invalid."));
$is_ok = false;
}
/* Check if this name is already in use */
- if(!$this->CheckNewBranchName($_POST['BranchName'])){
+ if(!$this->CheckNewBranchName($_POST['BranchName'],$faifilter['branch'])){
print_red(_("This name is already in use."));
- $this->is_ok = false;
+ $is_ok = false;
}
if($is_ok){
}
}
+ if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
+ $this->dispNewFreeze = true;
+ $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+ return($display);
+ }
/* ENDE Branch handling
*/
if((isset($_POST['base']))&&($s_action=="")){
$faifilter['base']=$_POST['base'];
}
+
+
+ $br = $this->getBranches();
+ if(!isset($br[$faifilter['branch']])){
+ $faifilter['branch'] = "main";
+ }
+
+ $smarty->assign("select_branch",$faifilter['branch']);
/* remove double asterisks and save new filter */
$faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']);
$smarty->assign("failist" , $divlist->DrawList());
$smarty->assign("regex" , $faifilter['regex']);
$smarty->assign("infoimage" , get_template_path('images/info.png'));
+ $smarty->assign("branchimage" , get_template_path('images/action.png'));
$smarty->assign("launchimage" , get_template_path('images/launch.png'));
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("apply" , apply_filter());
}
}
- function CheckNewBranchName($name){
- if(in_array($name,$this->getBranches())) {
+ function CheckNewBranchName($name,$base){
+ $f = $_SESSION['faifilter']['branch'];
+
+ if($f == "main"){
+ $f = $_SESSION['faifilter']['base'];
+ }
+
+ if(in_array($name,$this->getBranches($f))) {
+ return(false);
+ }
+
+ if(empty($name)){
return(false);
}
return(true);
index e3ec48045fda9142f81f3e2c2d1b48b1d440a77f..183c6a3e94475e436c91a057157b786feb508b95 100755 (executable)
</tr>
<tr>
<td>
- {t}Branch name{/t} <input type="text" name="BranchName" value="" style="width:120px;">
+ {t}Branch name{/t} <input type="text" name="BranchName" value="{$BranchName}" style="width:120px;">
</td>
</tr>
</table>
index e8ccfbf03271d5530869bf6ad4aaaa7535f8c3d6..d035268f516cd077366b093ec3fd8c171c6b7335 100644 (file)
</div>
<br>
<div class="contentboxh">
- <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
</div>
<div class="contentboxb" style="padding:3px;">
-
+ {t}Selected branch{/t}
<select name="select_branch" onChange="document.mainform.submit();">
{html_options values=$branchKeys output=$branches selected=$select_branch}
</select>
+ {if $select_branch != "main"}
<br>
{t}Delete this branch.{/t}
+
<input type="image" value="delete" name="remove_branch" src="images/edittrash.png">
+ {/if}
<br>
{t}Create a new branch{/t}
+
<input type="image" value="delete" name="branch_branch" src="images/crossref.png">
<br>
{t}Freeze this{/t}
+
<input type="image" value="delete" name="freeze_branch" src="images/flag.png">
</div>
<br>