Code

Updated baseSelectDialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 18 Jan 2010 10:50:06 +0000 (10:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 18 Jan 2010 10:50:06 +0000 (10:50 +0000)
-Added cancel button

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15167 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_baseSelectDialog.inc

index c3b09b6f375df8cafcf9e1818212bd20a32eb622..e8373d9b5dd9669724bee89fb119f7349dbffcac 100644 (file)
@@ -33,6 +33,7 @@ class baseSelectDialog extends management
 
   // #FIXME  -  Updated plugins to use a function instead of the public class var. 
   public $BaseToUse = "";
+  public $dialogClose = FALSE;
 
   function __construct (&$config,$parent,$onlyAllowThisBases = array())
   { 
@@ -53,6 +54,7 @@ class baseSelectDialog extends management
   $headpage->registerElementFilter("depLabel", "baseSelectDialog::filterDepLabel");
   $headpage->setFilter($filter);
   $this->registerAction("open","openEntry");
+  $this->registerAction("cancelBaseSelect","cancelBaseSelect");
   parent::__construct($config, $this->ui, "departments", $headpage);
   }
 
@@ -64,6 +66,16 @@ class baseSelectDialog extends management
     $headpage->setBase(array_pop($entry));
   }
 
+  function execute()
+  {
+    $str = management::execute();
+    $str.= "<p class='separator'>&nbsp;</p>
+      <p style=\"text-align:right\">
+      <input type=submit name=\"cancelBaseSelect\" value=\"".msgPool::cancelButton()."\">
+      </p>";
+    return($str);
+  }
+
 
   // A filter which allows to open a department by clicking on the departments name.
   static function filterDepLabel($row,$dn,$params,$ou,$pid,$base)
@@ -95,7 +107,7 @@ class baseSelectDialog extends management
 
   function isClosed()
   {
-    return(FALSE);
+    return($this->dialogClose);
   }
 
   function isSelected() 
@@ -108,6 +120,18 @@ class baseSelectDialog extends management
     $headpage = $this->getHeadpage();
     $headpage->setBase = $base;
   }
+
+  function cancelBaseSelect()
+  {
+    $this->dialogClose = TRUE;
+  }
+
+  function detectPostActions()
+  {
+    $action = management::detectPostActions();
+    if(isset($_POST['cancelBaseSelect']))  $action['action'] = "cancelBaseSelect";
+    return($action);
+  } 
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>