Code

Updated the Device class
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 12:43:44 +0000 (12:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 12:43:44 +0000 (12:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19712 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc

index 3c8634267eea5adb82f2e4b50bb20717bfc22184..f027ab1529f867887e8696f4a68c4f59bb6dd388 100644 (file)
@@ -33,6 +33,10 @@ class Device extends plugin
     
     private $resolvedNamesCache = array();
 
+
+    /*! \brief  Constructs the device object and keep some 
+     *           initial values.
+     */
     function __construct(&$config, $dn)
     {
         plugin::plugin($config, $dn);
@@ -41,15 +45,21 @@ class Device extends plugin
     }
 
     
+    /*! \brief  Generate a fake uuid, it is not a real uuid.
+     *  @return String  A fake uuid.
+     */
     function genFakeUuid()
     {
-        $strfmt = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
+        $strfmt = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
         for($i=0;$i<strlen($strfmt);$i++)
             if($strfmt[$i] == 'x') $strfmt[$i] = dechex(rand(0,15));
         return($strfmt);
     }
 
 
+    /*! \brief  Generate the plugins HTML content.
+     *  @return String  HTML content
+     */
     function execute()
     {
         plugin::execute();    
@@ -103,18 +113,27 @@ class Device extends plugin
     }   
     
  
+    /*! \brief  Detects and stores relevant values which where
+     *           currently transmitted via $_GET/$_POST.
+     */ 
     function save_object()
     {
         plugin::save_object();
 
+        // Change owner requested, initiate a user selection dialog.
         if(isset($_POST['editOwner'])){
             $this->currentUserSelect = "owner";
             $this->dialog = new singleUserSelect($this->config, get_userinfo());
         }
+
+        // Change manager requested, initiate a user selection dialog.
         if(isset($_POST['editManager'])){
             $this->currentUserSelect = "manager";
             $this->dialog = new singleUserSelect($this->config, get_userinfo());
         }
+
+        // The user selection dialog has send that it has finished its job.
+        // Store the posted user-dn as manager or owner. 
         if($this->dialog && $this->dialog instanceOf singleUserSelect && count($this->dialog->detectPostActions())){
             $users = $this->dialog->detectPostActions();
             if(isset($users['action']) && $users['action'] == 'userSelected' && isset($users['targets']) && count($users['targets'])){
@@ -125,14 +144,19 @@ class Device extends plugin
                 $this->dialog = NULL;
             }
         }
+        
+        // User selection canceled
         if(isset($_POST['add_users_cancel'])){
             $this->dialog = NULL;
         }
-       
+      
+        // Regenerate a new uuid 
         if(isset($_POST['reloadUUID']))  $this->deviceUUID = $this->genFakeUuid();
     }
 
 
+    /*! \brief  Save the modified object back to the ldap.
+     */ 
     function save()
     {
         plugin::save();