From: cajus Date: Thu, 17 Jan 2008 08:21:03 +0000 (+0000) Subject: Really moved X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dc32a939b95e215f086afb7bb19104a31d969950;p=gosa.git Really moved git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8427 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/dfs/addons/godfs/class_dfsManagment.inc b/gosa-plugins/dfs/addons/godfs/class_dfsManagment.inc new file mode 100644 index 000000000..28c6e924a --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/class_dfsManagment.inc @@ -0,0 +1,263 @@ +config = &$config; + $this->ui = &$ui; + + } + + /* Execute is the function all plugins need. It fills the plugin with life and produces the output. */ + function execute() { + + /* Normally you would react to user input here. */ + plugin::execute(); + + $action = ""; + $s_action= ""; + $options = ""; + $regex = ""; + + $icon = 'folder.gif'; + $expandedIcon = 'folder-expanded.gif'; + $base = get_base_from_people($this->ui->dn); + $smarty= get_smarty(); + + foreach ($_POST as $key => $val) { + # delete + if (preg_match("/dfs_del.*/", $key)) { + $s_action = "del"; + $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key); + $s_entry = preg_replace("/_.*$/", "", $s_entry); + $s_entry = base64_decode($s_entry); + # edit + } elseif (preg_match("/dfs_edit.*/", $key)) { + $s_action = "edit"; + $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key); + $s_entry = preg_replace("/_.*$/", "", $s_entry); + $s_entry = base64_decode($s_entry); + # new + } elseif (preg_match("/dfs_new.*/", $key)) { + $s_action = "new"; + # back + } elseif (preg_match("/dfs_back.*/", $key)) { + $s_action = "back"; + # home + } elseif (preg_match("/dfs_home.*/", $key)) { + $s_action = "home"; + # root + } elseif (preg_match("/dfs_root.*/", $key)) { + $s_action = "root"; + } + } + + $tree = new HTML_TreeMenu(); + + if ((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")) { + $s_action = "edit"; + $dfs_share = $_GET['id']; + } + + # new + if ($s_action == "new") { + $this->dn = "new"; + $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn); + } + + # edit + if (($_SERVER['REQUEST_METHOD'] == "POST") || ($_SERVER['REQUEST_METHOD'] == "GET")) { + if ($s_action == "edit") { + + $this->dn = $dfs_share; + + if (($user = get_lock($this->dn)) != "") { + return (gen_locked_message ($user, $this->dn)); + } else { + add_lock ($this->dn, $this->ui->dn); + } + + $this->acl = get_permissions($this->dn, $this->ui->subtreeACL); + + $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn); + $this->dfstab->set_acl($this->acl); + $this->dfstab->save_object(); + session::set('objectinfo',$this->dn); + } + } + + # save pressed + if (isset($_POST['edit_finish'])) { + $this->dfstab->last = $this->dfstab->current; + $this->dfstab->save_object(); + #$disp = $this->by_object['']; + #var_dump($disp); + + $message = $this->dfstab->check(); + + # any errors? + if (count($message) == 0) { + # write to ldap + $this->dfstab->save(); + } else { + show_errors($message); + } + } + + # cancel pressed + if (isset($_POST['edit_cancel'])) { + del_lock (session::get('objectinfo')); + unset ($this->dfstab); + $this->dfstab = NULL; + $this->dn = ""; + session::un_set('objectinfo'); + } + + # delete pressed + if (isset($_POST['edit_delete'])) { + + # get the current values + $this->sambasharename = $_POST['sambaShareName']; + $this->sharedescription = $_POST['description']; + $this->fileserver = $_POST['fileserver']; + $this->share = $_POST['fileservershare']; + $this->loc = $_POST['location']; + + $base = get_base_from_people($this->ui->dn); + $ou = get_ou("DFS"); + $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->basedn); + $ldap->rmdir($this->basedn); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of DFS share with dn '%s' failed."),$this->dn)); + + del_lock (session::get('objectinfo')); + unset ($this->dfstab); + $this->dfstab = NULL; + $this->dn = ""; + session::un_set('objectinfo'); + } + + # generate main page no tabs + + $ldap = $this->config->get_ldap_link(); + + $ou = get_ou("DFS"); + + $ldap->cd("$ou$base"); + $ldap->search(("ou=*"), array("dn")); + + if ($ldap->count() == 0) { + $message[] = _("No DFS entries found"); + show_errors ($message); + } else { + $have_tree= false; + while ($dfs = $ldap->fetch()) { + if (preg_match("/^ou=DFS.*/", $dfs["dn"])) { + $dfs_root_node = new HTML_TreeNode(array('text' => "DFS", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => false)); + $have_tree= true; + } elseif ($have_tree) { + preg_match("/^ou=(.*),/U", $dfs["dn"], $reg); + $loc = $reg[1]; + $node = $dfs_root_node->addItem(new HTML_TreeNode(array('text' => "$loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); + + $sub_node_ldap = $this->config->get_ldap_link(); + $sub_node_ldap->cd("ou=$loc, $ou$base"); + $sub_node_ldap->search("(objectclass=sambaShare)", array("sambaShareName", "description", "documentLocation")); + + while ($dfs_loc = $sub_node_ldap->fetch()) { + $share_name = $dfs_loc["sambaShareName"][0]; + $desc = $dfs_loc["description"][0]; + $srv_loc = preg_replace("/msdfs:/", "", $dfs_loc["documentLocation"][0]); + #$srv_loc = preg_replace("/\\/", "\\\\", $srv_loc); + $link = "main.php\?plug=".$_GET['plug']."\&id=$loc\/$share_name\&act=edit_entry"; + $share_node = &$node->addItem(new HTML_TreeNode(array('text' => "$share_name - $desc", 'link' => "$link", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); + $srv_loc_node = &$share_node->addItem(new HTML_TreeNode(array('text' => "$srv_loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); + } + } + } + } + + $tree->addItem($dfs_root_node); + + // Create the presentation class + $treeMenu = new HTML_TreeMenu_DHTML($tree, array('images' => 'images', 'defaultClass' => 'treeMenuDefault')); + $tree_html = $treeMenu->toHTML(); + + if ($this->dfstab === NULL) { + + if (($message = check_sizelimit()) != "") { + return ($message); + } + + $listhead = "
". + "  ". + "  ". + "  ". + "  ". + _("Base")." ". + "  
"; + + + /* Use the smarty templating engine here... */ + + $smarty->assign('tree', $tree_html); + $smarty->assign('search_image', get_template_path('images/search.png')); + $smarty->assign('infoimage', get_template_path('images/info.png')); + $smarty->assign('launchimage', get_template_path('images/launch.png')); + $smarty->assign('alphabet', generate_alphabet()); + $smarty->assign('hint', print_sizelimit_warning()); + $smarty->assign('apply', apply_filter()); + $smarty->assign('dfshead', $listhead); + + /* Let smarty fetch and process the page. Always seperate PHP and HTML as much as + you can. */ + return ($smarty->fetch (get_template_path('contents.tpl', TRUE))); + } + + /* TABS */ + + $display = $this->dfstab->execute(); + + $display .= "

\n"; + $display .= " \n"; + $display .= " \n"; + $display .= " \n"; + $display .= " \n"; + $display .= " \n"; + $display .= " \n"; + $display .= "
\n"; + $display .= " \n"; + $display .= "  \n"; + $display .= " \n"; + $display .= "
\n"; + $display .= "

\n"; + + return ($display); + + } + + function remove_lock() { + if (isset($this->dn)) { + del_lock ($this->dn); + } + } + +} +?> diff --git a/gosa-plugins/dfs/addons/godfs/class_dfsgeneric.inc b/gosa-plugins/dfs/addons/godfs/class_dfsgeneric.inc new file mode 100644 index 000000000..12a2ed2df --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/class_dfsgeneric.inc @@ -0,0 +1,223 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Needed values and lists */ + var $base = ""; + var $cn = ""; + + /* attribute list for save action */ + var $attributes = array(); + var $objectclasses = array(); + + function dfsgeneric(&$config, $dn) { + plugin::plugin($config, $dn); + $this->dn = $dn; + $this->orig_dn = $dn; + } + + function execute() { + /* Call parent execute */ + plugin::execute(); + + $smarty= get_smarty(); + + if (($this->dn == "new") || ($this->dn == "")) { + $smarty->assign("sambasharename", ""); + $smarty->assign("sharedescription", ""); + $smarty->assign("fileserver", ""); + $smarty->assign("fileservershare", ""); + $smarty->assign("location", ""); + $smarty->assign("dfsdescription", ""); + } else { + $ldap = $this->config->get_ldap_link(); + + $base = get_base_from_people($this->dn); + $ou = get_ou("DFS"); + + $tmp = preg_split('/\//', $this->dn, 2); + $this->loc = $tmp[0]; + $this->sambasharename = $tmp[1]; + + $ldap->cd("$ou $base"); + $ldap->search(("ou=$this->loc"), array("description")); + $dfs_desc = $ldap->fetch(); + $this->dfsdescription = $dfs_desc['description'][0]; + + $ldap->cd("ou=$this->loc, $ou $base"); + $ldap->search("(&(sambaShareName=$this->sambasharename)(objectclass=sambaShare))", array("description", "documentLocation")); + + $details = $ldap->fetch(); + $this->sharedescription = $details['description'][0]; + $tmp = preg_split('/\\\\/', $details['documentLocation'][0], 2); + + $this->fileserver = preg_replace("/msdfs:/", "", $tmp[0]); + $this->share = preg_replace("/\\\/", "", $tmp[1]); + + #var_dump($this->dn); + #echo "
\n"; + + /* Fill array */ + #$this->reload(); + $smarty->assign("sambasharename", $this->sambasharename); + $smarty->assign("sharedescription", $this->sharedescription); + $smarty->assign("fileserver", $this->fileserver); + $smarty->assign("fileservershare", $this->share); + $smarty->assign("location", $this->loc); + $smarty->assign("dfsdescription", $this->dfsdescription); + } + + /* Show main page */ + return ($smarty->fetch (get_template_path('generic.tpl', TRUE))); + #, dirname(__FILE__)))); + } + + function check() + { + plugin::check(); + $message = array(); + + ## permission + #if (chkacl($this->acl, "create") != "") { + # $message[] = _("You have no premissions to create a dfs share."); + #} + + # existance + + $ldap = $this->config->get_ldap_link(); + $base = get_base_from_people($this->ui->dn); + $ou = get_ou("DFS"); + $dn_explode = explode("/", $this->dn); + $sub_ou = $dn_explode[0]; + $sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3]; + $dn = "sambaShareName=$sambaShareName,ou=$sub_ou,$ou$base"; + $ldap->cat($dn); + $attrs = $ldap->fetch(); + + if ($this->orig_dn == "new" && !($attrs == FALSE)) { + $message[] = _("Dfs share already exists."); + } elseif ($this->orig_dn != $this->dn && !($attrs == FALSE)) { + $message[] = _("Dfs share already exists."); + } + + if ($this->dn == "new" || $this->dn == "") { + $this->sambasharename = $_POST['sambaShareName']; + $this->sharedescription = $_POST['description']; + $this->fileserver = $_POST['fileserver']; + $this->share = $_POST['fileservershare']; + $this->loc = $_POST['location']; + } + + # required fields set? + if ($this->sambasharename == "") { + $message[] = _("Required Field \"Name of dfs Share\" is not set."); + } + if ($this->sharedescription == "") { + $message[] = _("Required Field \"Description\" is not set."); + } + if ($this->fileserver == "") { + $message[] = _("Required Field \"Fileserver\" is not set."); + } + if ($this->share == "") { + $message[] = _("Required Field \"Share on fileserver\" is not set."); + } + if ($this->loc == "") { + $message[] = _("Required Field \"Location\" is not set."); + } + + return $message; + } + + function save() { + + plugin::save(); + + # get the current values + $this->sambasharename = $_POST['sambaShareName']; + $this->sharedescription = $_POST['description']; + $this->fileserver = $_POST['fileserver']; + $this->share = $_POST['fileservershare']; + $this->loc = $_POST['location']; + + # set the attribs + $this->attrs["sambaShareName"] = "$this->sambasharename,ou=$this->loc,$ou$base"; + $this->attrs["objectClass"][] = "top"; + $this->attrs["objectClass"][] = "SambaShare"; + $this->attrs["objectClass"][] = "extensibleObject"; + $this->attrs["sambaShareName"] = $this->sambasharename; + $this->attrs["description"] = $this->sharedescription; + $this->attrs["documentLocation"] = "msdfs:$this->fileserver\\\\$this->share"; + + $ldap = $this->config->get_ldap_link(); + + if ($this->dn == "new" || $this->dn == "") { + echo "new
\n"; + $base = get_base_from_people($this->ui->dn); + $ou = get_ou("DFS"); + $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; + $ldap->cd($this->basedn); + $ldap->add($this->attrs); + } else { + # try to find entry + $base = get_base_from_people($this->ui->dn); + $ou = get_ou("DFS"); + #$dn_explode = explode("/", $this->sambasharename); + #$sub_ou = $dn_explode[0]; + #$sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3]; + $dn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; + $ldap->cat($dn); + $attrs = $ldap->fetch(); + + $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; + $ldap->cd($this->basedn); + $nr = count($attrs); + + if (count($attrs)) { + # modify if found + $ldap->modify($this->attrs); + } else { + # add + $ldap->add($this->attrs); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving dfs/generic with dn '%s' failed."),$this->basedn)); + } + } + + function save_object() { + #if (isset($_POST['base'])) { + plugin::save_object(); + #echo "base = ".$_POST['base']."
\n"; + #} +# if (chkacl($this->acl, "create") == "") { + $this->base = $_POST['base']; +# } + } + + function delete() { + + plugin::delete(); + + # get the current values + $this->sambasharename = $_POST['sambaShareName']; + $this->sharedescription = $_POST['description']; + $this->fileserver = $_POST['fileserver']; + $this->share = $_POST['fileservershare']; + $this->loc = $_POST['location']; + + $base = get_base_from_people($this->ui->dn); + $ou = get_ou("DFS"); + $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; + echo "BASEDN: $this->basedn
\n"; + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->basedn); + $ldap->rmdir($this->basedn); + show_ldap_error($ldap->get_error(), sprintf(_("Removing dfs/generic with dn '%s' failed."),$this->basedn)); + } + + } + diff --git a/gosa-plugins/dfs/addons/godfs/contents.tpl b/gosa-plugins/dfs/addons/godfs/contents.tpl new file mode 100644 index 000000000..e5f2206ab --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/contents.tpl @@ -0,0 +1,54 @@ + + + + + + + +
+
+

+ {t}DFS Shares{/t} {$hint} +

+
+
+ {$dfshead} +
+
+
+ {$tree} + +
+
+
+

[i]{t}Information{/t}

+
+
+

+ {t}This menu allows you to create, delete and edit selected dfs shares. Having a large numbers of dfs shares, you might prefer the range selectors on top of the dfs share list.{/t} +

+
+
+
+

[F]{t}Filters{/t}

+
+
+ + {$alphabet} +
+ + + + + +
+ + + +
+ {$apply} +
+
+ + diff --git a/gosa-plugins/dfs/addons/godfs/generic.tpl b/gosa-plugins/dfs/addons/godfs/generic.tpl new file mode 100644 index 000000000..4f3ded4d2 --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/generic.tpl @@ -0,0 +1,52 @@ + + + + + + +
+

{t}DFS Properties{/t}

+ + + + + + + + + + + + + + + + + + +
{$must}
{$must}
{$must}
{$must}
+ +
+   + +

{t}DFS Location{/t}

+ + + + + + + + + + +
{$must}
+ +
+ + + diff --git a/gosa-plugins/dfs/addons/godfs/main.inc b/gosa-plugins/dfs/addons/godfs/main.inc new file mode 100644 index 000000000..2c9994e96 --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/main.inc @@ -0,0 +1,42 @@ +remove_lock(); + del_lock($ui->dn); + session::un_set('dfsManagment'); + } + } else { + # create dfsManagment object + if (!session::is_set('dfsManagment') || + (isset($_GET['reset']) && $_GET['reset'] == 1)) { + session::set('dfsManagment',new dfsManagment($config, $ui)); + } + $dfsManagment = session::get('dfsManagment'); + $output = $dfsManagment->execute(); + + # do we have to reset + if (isset($_GET['reset']) && $_GET['reset'] == 1) { + del_lock ($ui->dn); + session::un_set('dfsManagment'); + } + + # create page header + if (session::is_set('objectinfo')) { + $display = print_header(get_template_path('images/dfs.png'), + _("Distributed File System Administration"), + "\"\" ".session::get('objectinfo')); + } else { + $display = print_header(get_template_path('images/dfs.png'), + _("Distributed File System Administration")); + } + + $display.= $output; + + # show page + session::set('dfsManagment',$dfsManagment); + } + +?> diff --git a/gosa-plugins/dfs/addons/godfs/tabs_dfs.inc b/gosa-plugins/dfs/addons/godfs/tabs_dfs.inc new file mode 100644 index 000000000..ef5950ebe --- /dev/null +++ b/gosa-plugins/dfs/addons/godfs/tabs_dfs.inc @@ -0,0 +1,39 @@ +base = $this->by_object['dfsManagment']->base; + } + + #function save_object() { + # if (isset($_POST['base'])) { + # plugin::save_object(); + # } else { + # $this->base = $_POST['base']; + # } + #} + + + + + function check($ignore_account= FALSE) { + return (tabs::check(TRUE)); + } + + function save($ignore_account= FALSE) + { + $baseobject = $this->by_object['dfsManagment']; + return tabs::save(TRUE); + } + + function del() { + $baseobject = $this->by_object['dfsManagment']; + return tabs::delete(TRUE); + } + +} + +?> diff --git a/gosa-plugins/dfs/godfs/class_dfsManagment.inc b/gosa-plugins/dfs/godfs/class_dfsManagment.inc deleted file mode 100644 index 28c6e924a..000000000 --- a/gosa-plugins/dfs/godfs/class_dfsManagment.inc +++ /dev/null @@ -1,263 +0,0 @@ -config = &$config; - $this->ui = &$ui; - - } - - /* Execute is the function all plugins need. It fills the plugin with life and produces the output. */ - function execute() { - - /* Normally you would react to user input here. */ - plugin::execute(); - - $action = ""; - $s_action= ""; - $options = ""; - $regex = ""; - - $icon = 'folder.gif'; - $expandedIcon = 'folder-expanded.gif'; - $base = get_base_from_people($this->ui->dn); - $smarty= get_smarty(); - - foreach ($_POST as $key => $val) { - # delete - if (preg_match("/dfs_del.*/", $key)) { - $s_action = "del"; - $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key); - $s_entry = preg_replace("/_.*$/", "", $s_entry); - $s_entry = base64_decode($s_entry); - # edit - } elseif (preg_match("/dfs_edit.*/", $key)) { - $s_action = "edit"; - $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key); - $s_entry = preg_replace("/_.*$/", "", $s_entry); - $s_entry = base64_decode($s_entry); - # new - } elseif (preg_match("/dfs_new.*/", $key)) { - $s_action = "new"; - # back - } elseif (preg_match("/dfs_back.*/", $key)) { - $s_action = "back"; - # home - } elseif (preg_match("/dfs_home.*/", $key)) { - $s_action = "home"; - # root - } elseif (preg_match("/dfs_root.*/", $key)) { - $s_action = "root"; - } - } - - $tree = new HTML_TreeMenu(); - - if ((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")) { - $s_action = "edit"; - $dfs_share = $_GET['id']; - } - - # new - if ($s_action == "new") { - $this->dn = "new"; - $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn); - } - - # edit - if (($_SERVER['REQUEST_METHOD'] == "POST") || ($_SERVER['REQUEST_METHOD'] == "GET")) { - if ($s_action == "edit") { - - $this->dn = $dfs_share; - - if (($user = get_lock($this->dn)) != "") { - return (gen_locked_message ($user, $this->dn)); - } else { - add_lock ($this->dn, $this->ui->dn); - } - - $this->acl = get_permissions($this->dn, $this->ui->subtreeACL); - - $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn); - $this->dfstab->set_acl($this->acl); - $this->dfstab->save_object(); - session::set('objectinfo',$this->dn); - } - } - - # save pressed - if (isset($_POST['edit_finish'])) { - $this->dfstab->last = $this->dfstab->current; - $this->dfstab->save_object(); - #$disp = $this->by_object['']; - #var_dump($disp); - - $message = $this->dfstab->check(); - - # any errors? - if (count($message) == 0) { - # write to ldap - $this->dfstab->save(); - } else { - show_errors($message); - } - } - - # cancel pressed - if (isset($_POST['edit_cancel'])) { - del_lock (session::get('objectinfo')); - unset ($this->dfstab); - $this->dfstab = NULL; - $this->dn = ""; - session::un_set('objectinfo'); - } - - # delete pressed - if (isset($_POST['edit_delete'])) { - - # get the current values - $this->sambasharename = $_POST['sambaShareName']; - $this->sharedescription = $_POST['description']; - $this->fileserver = $_POST['fileserver']; - $this->share = $_POST['fileservershare']; - $this->loc = $_POST['location']; - - $base = get_base_from_people($this->ui->dn); - $ou = get_ou("DFS"); - $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; - - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->basedn); - $ldap->rmdir($this->basedn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of DFS share with dn '%s' failed."),$this->dn)); - - del_lock (session::get('objectinfo')); - unset ($this->dfstab); - $this->dfstab = NULL; - $this->dn = ""; - session::un_set('objectinfo'); - } - - # generate main page no tabs - - $ldap = $this->config->get_ldap_link(); - - $ou = get_ou("DFS"); - - $ldap->cd("$ou$base"); - $ldap->search(("ou=*"), array("dn")); - - if ($ldap->count() == 0) { - $message[] = _("No DFS entries found"); - show_errors ($message); - } else { - $have_tree= false; - while ($dfs = $ldap->fetch()) { - if (preg_match("/^ou=DFS.*/", $dfs["dn"])) { - $dfs_root_node = new HTML_TreeNode(array('text' => "DFS", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => false)); - $have_tree= true; - } elseif ($have_tree) { - preg_match("/^ou=(.*),/U", $dfs["dn"], $reg); - $loc = $reg[1]; - $node = $dfs_root_node->addItem(new HTML_TreeNode(array('text' => "$loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); - - $sub_node_ldap = $this->config->get_ldap_link(); - $sub_node_ldap->cd("ou=$loc, $ou$base"); - $sub_node_ldap->search("(objectclass=sambaShare)", array("sambaShareName", "description", "documentLocation")); - - while ($dfs_loc = $sub_node_ldap->fetch()) { - $share_name = $dfs_loc["sambaShareName"][0]; - $desc = $dfs_loc["description"][0]; - $srv_loc = preg_replace("/msdfs:/", "", $dfs_loc["documentLocation"][0]); - #$srv_loc = preg_replace("/\\/", "\\\\", $srv_loc); - $link = "main.php\?plug=".$_GET['plug']."\&id=$loc\/$share_name\&act=edit_entry"; - $share_node = &$node->addItem(new HTML_TreeNode(array('text' => "$share_name - $desc", 'link' => "$link", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); - $srv_loc_node = &$share_node->addItem(new HTML_TreeNode(array('text' => "$srv_loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); - } - } - } - } - - $tree->addItem($dfs_root_node); - - // Create the presentation class - $treeMenu = new HTML_TreeMenu_DHTML($tree, array('images' => 'images', 'defaultClass' => 'treeMenuDefault')); - $tree_html = $treeMenu->toHTML(); - - if ($this->dfstab === NULL) { - - if (($message = check_sizelimit()) != "") { - return ($message); - } - - $listhead = "
". - "  ". - "  ". - "  ". - "  ". - _("Base")." ". - "  
"; - - - /* Use the smarty templating engine here... */ - - $smarty->assign('tree', $tree_html); - $smarty->assign('search_image', get_template_path('images/search.png')); - $smarty->assign('infoimage', get_template_path('images/info.png')); - $smarty->assign('launchimage', get_template_path('images/launch.png')); - $smarty->assign('alphabet', generate_alphabet()); - $smarty->assign('hint', print_sizelimit_warning()); - $smarty->assign('apply', apply_filter()); - $smarty->assign('dfshead', $listhead); - - /* Let smarty fetch and process the page. Always seperate PHP and HTML as much as - you can. */ - return ($smarty->fetch (get_template_path('contents.tpl', TRUE))); - } - - /* TABS */ - - $display = $this->dfstab->execute(); - - $display .= "

\n"; - $display .= " \n"; - $display .= " \n"; - $display .= " \n"; - $display .= " \n"; - $display .= " \n"; - $display .= " \n"; - $display .= "
\n"; - $display .= " \n"; - $display .= "  \n"; - $display .= " \n"; - $display .= "
\n"; - $display .= "

\n"; - - return ($display); - - } - - function remove_lock() { - if (isset($this->dn)) { - del_lock ($this->dn); - } - } - -} -?> diff --git a/gosa-plugins/dfs/godfs/class_dfsgeneric.inc b/gosa-plugins/dfs/godfs/class_dfsgeneric.inc deleted file mode 100644 index 12a2ed2df..000000000 --- a/gosa-plugins/dfs/godfs/class_dfsgeneric.inc +++ /dev/null @@ -1,223 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Needed values and lists */ - var $base = ""; - var $cn = ""; - - /* attribute list for save action */ - var $attributes = array(); - var $objectclasses = array(); - - function dfsgeneric(&$config, $dn) { - plugin::plugin($config, $dn); - $this->dn = $dn; - $this->orig_dn = $dn; - } - - function execute() { - /* Call parent execute */ - plugin::execute(); - - $smarty= get_smarty(); - - if (($this->dn == "new") || ($this->dn == "")) { - $smarty->assign("sambasharename", ""); - $smarty->assign("sharedescription", ""); - $smarty->assign("fileserver", ""); - $smarty->assign("fileservershare", ""); - $smarty->assign("location", ""); - $smarty->assign("dfsdescription", ""); - } else { - $ldap = $this->config->get_ldap_link(); - - $base = get_base_from_people($this->dn); - $ou = get_ou("DFS"); - - $tmp = preg_split('/\//', $this->dn, 2); - $this->loc = $tmp[0]; - $this->sambasharename = $tmp[1]; - - $ldap->cd("$ou $base"); - $ldap->search(("ou=$this->loc"), array("description")); - $dfs_desc = $ldap->fetch(); - $this->dfsdescription = $dfs_desc['description'][0]; - - $ldap->cd("ou=$this->loc, $ou $base"); - $ldap->search("(&(sambaShareName=$this->sambasharename)(objectclass=sambaShare))", array("description", "documentLocation")); - - $details = $ldap->fetch(); - $this->sharedescription = $details['description'][0]; - $tmp = preg_split('/\\\\/', $details['documentLocation'][0], 2); - - $this->fileserver = preg_replace("/msdfs:/", "", $tmp[0]); - $this->share = preg_replace("/\\\/", "", $tmp[1]); - - #var_dump($this->dn); - #echo "
\n"; - - /* Fill array */ - #$this->reload(); - $smarty->assign("sambasharename", $this->sambasharename); - $smarty->assign("sharedescription", $this->sharedescription); - $smarty->assign("fileserver", $this->fileserver); - $smarty->assign("fileservershare", $this->share); - $smarty->assign("location", $this->loc); - $smarty->assign("dfsdescription", $this->dfsdescription); - } - - /* Show main page */ - return ($smarty->fetch (get_template_path('generic.tpl', TRUE))); - #, dirname(__FILE__)))); - } - - function check() - { - plugin::check(); - $message = array(); - - ## permission - #if (chkacl($this->acl, "create") != "") { - # $message[] = _("You have no premissions to create a dfs share."); - #} - - # existance - - $ldap = $this->config->get_ldap_link(); - $base = get_base_from_people($this->ui->dn); - $ou = get_ou("DFS"); - $dn_explode = explode("/", $this->dn); - $sub_ou = $dn_explode[0]; - $sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3]; - $dn = "sambaShareName=$sambaShareName,ou=$sub_ou,$ou$base"; - $ldap->cat($dn); - $attrs = $ldap->fetch(); - - if ($this->orig_dn == "new" && !($attrs == FALSE)) { - $message[] = _("Dfs share already exists."); - } elseif ($this->orig_dn != $this->dn && !($attrs == FALSE)) { - $message[] = _("Dfs share already exists."); - } - - if ($this->dn == "new" || $this->dn == "") { - $this->sambasharename = $_POST['sambaShareName']; - $this->sharedescription = $_POST['description']; - $this->fileserver = $_POST['fileserver']; - $this->share = $_POST['fileservershare']; - $this->loc = $_POST['location']; - } - - # required fields set? - if ($this->sambasharename == "") { - $message[] = _("Required Field \"Name of dfs Share\" is not set."); - } - if ($this->sharedescription == "") { - $message[] = _("Required Field \"Description\" is not set."); - } - if ($this->fileserver == "") { - $message[] = _("Required Field \"Fileserver\" is not set."); - } - if ($this->share == "") { - $message[] = _("Required Field \"Share on fileserver\" is not set."); - } - if ($this->loc == "") { - $message[] = _("Required Field \"Location\" is not set."); - } - - return $message; - } - - function save() { - - plugin::save(); - - # get the current values - $this->sambasharename = $_POST['sambaShareName']; - $this->sharedescription = $_POST['description']; - $this->fileserver = $_POST['fileserver']; - $this->share = $_POST['fileservershare']; - $this->loc = $_POST['location']; - - # set the attribs - $this->attrs["sambaShareName"] = "$this->sambasharename,ou=$this->loc,$ou$base"; - $this->attrs["objectClass"][] = "top"; - $this->attrs["objectClass"][] = "SambaShare"; - $this->attrs["objectClass"][] = "extensibleObject"; - $this->attrs["sambaShareName"] = $this->sambasharename; - $this->attrs["description"] = $this->sharedescription; - $this->attrs["documentLocation"] = "msdfs:$this->fileserver\\\\$this->share"; - - $ldap = $this->config->get_ldap_link(); - - if ($this->dn == "new" || $this->dn == "") { - echo "new
\n"; - $base = get_base_from_people($this->ui->dn); - $ou = get_ou("DFS"); - $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; - $ldap->cd($this->basedn); - $ldap->add($this->attrs); - } else { - # try to find entry - $base = get_base_from_people($this->ui->dn); - $ou = get_ou("DFS"); - #$dn_explode = explode("/", $this->sambasharename); - #$sub_ou = $dn_explode[0]; - #$sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3]; - $dn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; - $ldap->cat($dn); - $attrs = $ldap->fetch(); - - $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; - $ldap->cd($this->basedn); - $nr = count($attrs); - - if (count($attrs)) { - # modify if found - $ldap->modify($this->attrs); - } else { - # add - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error(), sprintf(_("Saving dfs/generic with dn '%s' failed."),$this->basedn)); - } - } - - function save_object() { - #if (isset($_POST['base'])) { - plugin::save_object(); - #echo "base = ".$_POST['base']."
\n"; - #} -# if (chkacl($this->acl, "create") == "") { - $this->base = $_POST['base']; -# } - } - - function delete() { - - plugin::delete(); - - # get the current values - $this->sambasharename = $_POST['sambaShareName']; - $this->sharedescription = $_POST['description']; - $this->fileserver = $_POST['fileserver']; - $this->share = $_POST['fileservershare']; - $this->loc = $_POST['location']; - - $base = get_base_from_people($this->ui->dn); - $ou = get_ou("DFS"); - $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base"; - echo "BASEDN: $this->basedn
\n"; - - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->basedn); - $ldap->rmdir($this->basedn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing dfs/generic with dn '%s' failed."),$this->basedn)); - } - - } - diff --git a/gosa-plugins/dfs/godfs/contents.tpl b/gosa-plugins/dfs/godfs/contents.tpl deleted file mode 100644 index e5f2206ab..000000000 --- a/gosa-plugins/dfs/godfs/contents.tpl +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -
-
-

- {t}DFS Shares{/t} {$hint} -

-
-
- {$dfshead} -
-
-
- {$tree} - -
-
-
-

[i]{t}Information{/t}

-
-
-

- {t}This menu allows you to create, delete and edit selected dfs shares. Having a large numbers of dfs shares, you might prefer the range selectors on top of the dfs share list.{/t} -

-
-
-
-

[F]{t}Filters{/t}

-
-
- - {$alphabet} -
- - - - - -
- - - -
- {$apply} -
-
- - diff --git a/gosa-plugins/dfs/godfs/generic.tpl b/gosa-plugins/dfs/godfs/generic.tpl deleted file mode 100644 index 4f3ded4d2..000000000 --- a/gosa-plugins/dfs/godfs/generic.tpl +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - -
-

{t}DFS Properties{/t}

- - - - - - - - - - - - - - - - - - -
{$must}
{$must}
{$must}
{$must}
- -
-   - -

{t}DFS Location{/t}

- - - - - - - - - - -
{$must}
- -
- - - diff --git a/gosa-plugins/dfs/godfs/main.inc b/gosa-plugins/dfs/godfs/main.inc deleted file mode 100644 index 2c9994e96..000000000 --- a/gosa-plugins/dfs/godfs/main.inc +++ /dev/null @@ -1,42 +0,0 @@ -remove_lock(); - del_lock($ui->dn); - session::un_set('dfsManagment'); - } - } else { - # create dfsManagment object - if (!session::is_set('dfsManagment') || - (isset($_GET['reset']) && $_GET['reset'] == 1)) { - session::set('dfsManagment',new dfsManagment($config, $ui)); - } - $dfsManagment = session::get('dfsManagment'); - $output = $dfsManagment->execute(); - - # do we have to reset - if (isset($_GET['reset']) && $_GET['reset'] == 1) { - del_lock ($ui->dn); - session::un_set('dfsManagment'); - } - - # create page header - if (session::is_set('objectinfo')) { - $display = print_header(get_template_path('images/dfs.png'), - _("Distributed File System Administration"), - "\"\" ".session::get('objectinfo')); - } else { - $display = print_header(get_template_path('images/dfs.png'), - _("Distributed File System Administration")); - } - - $display.= $output; - - # show page - session::set('dfsManagment',$dfsManagment); - } - -?> diff --git a/gosa-plugins/dfs/godfs/tabs_dfs.inc b/gosa-plugins/dfs/godfs/tabs_dfs.inc deleted file mode 100644 index ef5950ebe..000000000 --- a/gosa-plugins/dfs/godfs/tabs_dfs.inc +++ /dev/null @@ -1,39 +0,0 @@ -base = $this->by_object['dfsManagment']->base; - } - - #function save_object() { - # if (isset($_POST['base'])) { - # plugin::save_object(); - # } else { - # $this->base = $_POST['base']; - # } - #} - - - - - function check($ignore_account= FALSE) { - return (tabs::check(TRUE)); - } - - function save($ignore_account= FALSE) - { - $baseobject = $this->by_object['dfsManagment']; - return tabs::save(TRUE); - } - - function del() { - $baseobject = $this->by_object['dfsManagment']; - return tabs::delete(TRUE); - } - -} - -?>