summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2d9628)
raw | patch | inline | side by side (parent: f2d9628)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 10 Jan 2006 12:21:54 +0000 (12:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 10 Jan 2006 12:21:54 +0000 (12:21 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2432 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiManagement.inc | patch | blob | history | |
plugins/admin/fai/headpage.tpl | patch | blob | history |
index 8a1e69e155be93fadfabab8c5b0b56379e8f20c1..c9c2363e5d6e103c1927fe7307e2679f6688d206 100644 (file)
var $dialog = array(); // This object contains every dialog we have currently opened
var $objects = array(); // This array contains all available objects shown in divlist
- var $is_dialog = false;
+ var $is_dialog = false;
+
+ var $dispNewBranch= false;
+ var $dispNewFreeze= false;
/* construction/reconstruction
* The Filter ($faifilter stored in $_SESSION['faifilter']) defines the last
* Create new tab ich new_xx is posted
*/
foreach($_POST as $key => $val){
- if(preg_match("/create_partition/i",$key)){
+ if(preg_match("/remove_branch/",$key)){
+ $s_action = "remove_branch";
+ }elseif(preg_match("/branch_branch/",$key)){
+ $s_action = "branch_branch";
+ }elseif(preg_match("/freeze_branch/",$key)){
+ $s_action = "freeze_branch";
+ }elseif(preg_match("/create_partition/i",$key)){
$s_action = "new_partition";
}elseif(preg_match("/create_script/i",$key)){
$s_action = "new_script";
}
- /* Dialog handling */
+ /* Branch handling
+ 09.01.2006
+ */
+
+ /* Create new branch */
+ if((isset($_POST['UseBranchName']))&&($this->dispNewBranch)){
+
+ /* Check branch name */
+ $name = $_POST['BranchName'];
+ $is_ok = true;
+
+ $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+
+ /* Check used characters */
+ 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'])){
+ print_red(_("This name is already in use."));
+ $this->is_ok = false;
+ }
+
+ if($is_ok){
+ /* Create it know */
+
+ $ldap = $this->config->get_ldap_link();
+
+// $ldap->cd ("ou=".$name.",".$base);
+// $ldap->recursive_remove();
+
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->copy_recursive($base,"ou=".$name.",".$base);
+
+
+
+ print "created new branch .... bla";
+ $this->dispNewBranch = false;
+ }
+ }
+
+ /* Abort creating new branch */
+ if(isset($_POST['CancelBranchName'])){
+ $this->dispNewBranch = false;
+ }
+
+ /* Open dialog to insert new branch name */
+ if(($s_action == "branch_branch")||($this->dispNewBranch)){
+ $this->dispNewBranch=true;
+ $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+ $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+ return($display);
+ }
+
+ /* Remove branch */
+ if($s_action == "remove_branch"){
+ $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+ /* Load permissions for selected 'dn' and check if
+ we're allowed to remove this 'dn' */
+ $acl= get_permissions ($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));
+ 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 ";
+ }
+
+ if($s_action == "freeze_branch"){
+ $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($base);
+
+ $attrs = $ldap->fetch($ldap->cat ($base));
+
+ if(!in_array("FAIbranch",$attrs)){
+ $attrs['objectClass'][] = "FAIbranch";
+ }
+
+ if((!isset($attrs['FAIstate']))||($attrs['FAIstate'] != "frozen")){
+ $attrs['FAIstate']= "frozen";
+ }
+
+ print "Freeze ";
+
+
+
+
+
+ }
+
+ /* ENDE Branch handling
+ */
+
+ /* Dialog handling */
if($s_action == "new_partition"){
$this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpartitionTable");
}
}
/* Assign all reguired vars to template engine */
+
+ $smarty->assign("branchKeys",array());
+ $smarty->assign("branches",array());
+
$smarty->assign("faihead" , $faihead);
$smarty->assign("failist" , $divlist->DrawList());
$smarty->assign("regex" , $faifilter['regex']);
return ($display);
}
+ function getBranches()
+ {
+ $ldap = $this->config->get_ldap_link();
+
+ $ldap->cd($this->config->current['BASE']);
+
+ $ldap->search("(objectClass=FAIbranch)",array("FAIstate","cn","ou"));
+
+ while($attrs = $ldap->fetch()){
+ print_a($attrs);
+ }
+ }
function reload()
{
}
}
-}
+ function checknewbranchname($name){
+
+ return(true);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
index 9c5b87b421acee14750c71b2e05878f7e2437c21..506ad012d0dd8b8c57014c43d099b582838953c0 100644 (file)
<div class="contentboxh">
<p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
</div>
+ <div class="contentboxb" style="padding:3px;">
+
+ <select name="select_branch" >
+ {html_options values=$branchKeys output=$branches }
+ </select>
+ <br>
+ {t}Delete this branch.{/t}
+ <input type="image" value="delete" name="remove_branch" src="images/edittrash.png">
+ <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>
+ <div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+ </div>
<div class="contentboxb">
<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
{$alphabet}