From 8ebc64552a0acf7a96a5b05be0228c35aa1e8ea7 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 31 Mar 2010 10:03:15 +0000 Subject: [PATCH] Added new kind of base selector git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17432 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 39 ++++++++++++++----- .../class_applicationManagement.inc | 9 +++-- .../goto/admin/applications/generic.tpl | 23 ++++------- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc index 59a67c8b8..a8aa74c78 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc @@ -28,6 +28,8 @@ class application extends plugin var $objectclasses= array("top", "gosaApplication"); var $FAIstate =""; + var $baseSelector; + function application (&$config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); @@ -63,6 +65,12 @@ class application extends plugin $this->orig_cn = $this->cn; $this->orig_base = $this->base; $this->gosaApplicationFlags = preg_replace("/[^GDLMO]/","",$this->gosaApplicationFlags); + + /* Instanciate base selector */ + $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base); + $this->baseSelector->setSubmitButton(false); + $this->baseSelector->setHeight(300); + $this->baseSelector->update(true); } @@ -115,6 +123,9 @@ class application extends plugin $smarty= get_smarty(); + /* Assign base ACL */ + $smarty->assign("base", $this->baseSelector->render()); + $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate))); @@ -274,6 +285,20 @@ class application extends plugin plugin::save_object(); $this->base = $base_tmp; + /* Refresh base */ + if(!$this->is_release()){ + if ($this->acl_is_moveable($this->base)){ + if (!$this->baseSelector->update()) { + msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG); + } + if ($this->base != $this->baseSelector->getBase()) { + $this->base= $this->baseSelector->getBase(); + $this->is_modified= TRUE; + } + } + } + + /* Save attributes */ parent::save_object(); @@ -360,15 +385,6 @@ class application extends plugin /* Activate new picture */ $this->set_picture($_FILES['picture_file']['tmp_name']); } - - if(!$this->is_release()){ - $tmp = $this->get_allowed_bases(); - if(isset($_POST['base'])){ - if(isset($tmp[$_POST['base']])){ - $this->base= $_POST['base']; - } - } - } } } @@ -383,6 +399,11 @@ class application extends plugin $message[]=msgPool::invalid(_("Execute path"),"","","/some/path"); } + // Check if a wrong base was supplied + if(!$this->baseSelector->checkLastBaseUpdate()){ + $message[]= msgPool::check_base();; + } + /* Permissions for that base? */ if ($this->base != ""){ $new_dn= "cn=".$this->cn.",".get_ou('applicationRDN').$this->base; diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc index 301d1f3eb..de94ad62d 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc @@ -58,7 +58,7 @@ class applicationManagement extends management } // Build filter - if (0 && session::global_is_set(get_class($this)."_filter")){ + if (session::global_is_set(get_class($this)."_filter")){ $filter= session::global_get(get_class($this)."_filter"); } else { $filter = new filter(get_template_path($filter_xml, true)); @@ -99,7 +99,7 @@ class applicationManagement extends management $errors = $disallowed = array(); $headpage = $this->getHeadpage(); foreach($target as $dn){ - + $obj = $headpage->getEntry($dn); $acl = $this->ui->get_permissions($obj['dn'],"application/application"); if(!preg_match("/d/",$acl)){ @@ -112,7 +112,8 @@ class applicationManagement extends management } if(count($errors)){ msg_dialog::display(_("Branch locked"), - sprintf(_("The following entries are locked, you can't remove them %s."),msgPool::buildList($errors)), INFO_DIALOG); + sprintf(_("The following entries are locked, you can't remove them %s."), + msgPool::buildList($errors)),INFO_DIALOG); } if(count($disallowed)){ msg_dialog::display(_("Permission error"), msgPool::permDelete($disallowed), ERROR_DIALOG); @@ -121,7 +122,7 @@ class applicationManagement extends management } - /*! \brief This method opens an existing object or a list of existing objects to be edited. + /*! \brief This method opens an existing object or a list of existing objects to be edited. * * * @param String 'action' The name of the action which was the used as trigger. diff --git a/gosa-plugins/goto/admin/applications/generic.tpl b/gosa-plugins/goto/admin/applications/generic.tpl index 4baf39262..3c84c9289 100644 --- a/gosa-plugins/goto/admin/applications/generic.tpl +++ b/gosa-plugins/goto/admin/applications/generic.tpl @@ -38,24 +38,15 @@ {if !$isReleaseApplikation} -
- - - + +
{$must} + +
{render acl=$baseACL} - -{/render} -{if !$isReleaseApplikation} -{render acl=$baseACL disable_picture='images/lists/folder_grey.png'} - {image path="images/lists/folder.png" action="chooseBase" title="{t}Select a base{/t}"} - + {$base} {/render} -{/if} - - + + {/if} -- 2.30.2