Code

Next checkin for multiple user edits.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Oct 2007 14:03:03 +0000 (14:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Oct 2007 14:03:03 +0000 (14:03 +0000)
Not working!

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

plugins/personal/generic/class_user.inc
plugins/personal/generic/multiple_generic.tpl [new file with mode: 0644]

index bfd6bd462344fa05948a0664ff7081f006122ea9..3e8e1e3d778965a5d318fc0e56bfe06261c4fd3f 100644 (file)
@@ -83,7 +83,7 @@ class user extends plugin
 
   /* variables to trigger password changes */
   var $pw_storage= "crypt";
-  var $last_pw_storage= "crypt";
+  var $last_pw_storage= "unset";
   var $had_userCertificate= FALSE;
 
   var $view_logged = FALSE;
@@ -105,8 +105,8 @@ class user extends plugin
       "functionalTitle", "certificateSerialNumber", "publicVisible", "street", "role",
       "postalCode");
 
-  var $multiple_support =TRUE;
-
+  var $multiple_support = TRUE;
+  var $multiple_handle  = FALSE;
 
   /* constructor, if 'dn' is set, the node loads the given
      'dn' from LDAP */
@@ -119,9 +119,10 @@ class user extends plugin
       $this->attributes=array_merge($this->attributes,$this->govattrs);
     }
 
-    $this->dn = $dn;
     if(is_array($dn)){
-      return;
+      $this->dn = $dn;
+      $this->multiple_handle = TRUE;
+      return($this->construct_multiple());
     }
 
     /* Load base attributes */
@@ -225,14 +226,51 @@ class user extends plugin
   }
 
 
+  function construct_multiple()
+  {
+    /* Configuration is fine, allways */
+    $this->multiple_attrs = array();
+    foreach($this->dn as $dn){
+      $this->multiple_attrs[] = new user($this->config,$dn);
+    } 
+  }
+
+  
+  function execute_multiple()
+  {
+    $smarty =get_smarty(); 
+
+    $u_attrs = array();
+    $d_attrs = array();
+    foreach($this->attributes as $attr){
+      foreach($this->multiple_attrs as $class){
+        if(!isset($u_attrs[$attr]) && !empty($class->$attr)){
+          $u_attrs[$attr] = $class->$attr;
+        }elseif(isset($u_attrs[$attr]) && !empty($class->$attr)){
+          $d_attrs[$attr] = TRUE;
+        }
+      }
+    }
+    print_a(array($u_attrs,$d_attrs));
+    foreach($this->attributes as $attr){
+      if(!isset($u_attrs[$attr])){
+        $u_attrs[$attr] = "empty";
+      }
+      $smarty->assign($attr,$u_attrs[$attr]);
+    }
+    return($smarty->fetch (get_template_path('multiple_generic.tpl', TRUE, dirname(__FILE__))));
+  }
+
+
   /* execute generates the html output for this node */
   function execute()
   {
     /* Call parent execute */
     plugin::execute();
 
-    if(is_array($this->dn)){
-      return("Still not supported.");
+    if($this->multiple_handle){
+      return($this->execute_multiple());
     }
     /* Log view */
     if($this->is_account && !$this->view_logged){
diff --git a/plugins/personal/generic/multiple_generic.tpl b/plugins/personal/generic/multiple_generic.tpl
new file mode 100644 (file)
index 0000000..ce2e242
--- /dev/null
@@ -0,0 +1,366 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <tr>
+  <td colspan="4">
+   <h2><img alt="" align="middle" src="images/head.png" class="center"> {t}Personal information{/t}</h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top">
+
+   <table>
+    <tr>
+     <td width="147" height="200" bgcolor="gray">
+      <img class='center' border="0" width="100%" src="images/default.jpg" alt="{t}Personal picture{/t}">
+     </td>
+    </tr>
+   </table>
+
+  </td>
+  <td style="vertical-align:top;">
+
+   <table>
+    <tr>
+     <td>
+      <label for="academicTitle">{t}Academic title{/t}</label>
+     </td>
+     <td>
+      <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="preferredLanguage">{t}Preferred langage{/t}</label>
+     </td>
+     <td>
+      <select size="1" id="preferredLanguage" name="preferredLanguage">
+       {html_options options=$preferredLanguage_list selected=$preferredLanguage}
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <div style="height:10px;"></div>
+      <label for="base">{t}Base{/t}</label>
+     </td>
+     <td>
+      <div style="height:10px;"></div>
+               <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
+                       {html_options options=$bases selected=$base_select}
+               </select>
+               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+     </td>
+    </tr>
+   </table>
+
+  </td>
+  <td style="vertical-align:top;">
+
+   <!-- Address, ... -->
+   <table summary="" style="width:100%"> 
+    <tr>
+     <td style="vertical-align:top;"><label for="homePostalAddress">{t}Address{/t}</label></td>
+      <td>
+            <textarea id="homePostalAddress" name="homePostalAddress" rows="3" style="width:100%">{$homePostalAddress}</textarea>
+     </td>
+    </tr>
+    <tr>
+     <td><label for="homePhone">{t}Private phone{/t}</label>
+     </td><td>
+            <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="labeledURI">{t}Homepage{/t}</label></td>
+     <td>
+               <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      <div style="height:20px;"></div>
+     </td>
+    </tr>
+    <tr>
+     <td><label for="pw_storage">{t}Password storage{/t}</label></td>
+     <td>
+             <select size="1" id="pw_storage" name="pw_storage" onchange='document.mainform.submit()'>
+              {html_options values=$pwmode output=$pwmode selected=$pwmode_select}
+             </select>
+       {if $pw_configurable eq "true"}
+             &nbsp; <input id="edit_pw_method" type="submit" name="edit_pw_method" value="{t}Configure{/t}...">
+       {/if}
+     </td>
+    </tr>
+
+    {if $is_template ne "true"}
+    <tr>
+     <td><label for="edit_cert">{t}Certificates{/t}</label></td>
+     <td>
+               <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
+     </td>
+    </tr>
+    {/if}
+
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" class="line" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+
+ <!-- Headline container -->
+ <tr>
+  <td colspan="3">
+   <h2><img alt="" align="middle" src="images/house.png" class="center">&nbsp;{t}Organizational information{/t}</h2>
+  </td>
+ </tr>
+
+ <!-- Base 2 container -->
+ <tr>
+
+  {if $governmentmode ne "true"}
+  <!-- Company, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="o">{t}Organization{/t}</label></td>
+     <td>      
+               <input id="o" name="o" size=22 maxlength=60 value="{$o}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="ou">{t}Department{/t}</label></td>
+     <td>
+               <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="departmentNumber">{t}Department No.{/t}</label></td>
+     <td>
+             <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="employeeNumber">{t}Employee No.{/t}</label></td>
+     <td>
+               <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="employeeType">{t}Employee type{/t}</label></td>
+     <td>
+               <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
+     </td>
+    </tr>
+   </table>
+  </td>
+   
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
+     <td>
+               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+     </td>
+    </tr>
+    {if $has_phoneaccount ne "true"}
+    <tr>
+     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
+     <td>
+               <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+     </td>
+    </tr>
+    {/if}
+    <tr>
+     <td><label for="mobile">{t}Mobile{/t}</label></td>
+     <td>
+               <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="pager">{t}Pager{/t}</label></td>
+     <td>
+               <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
+     <td>
+               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary="" style="width:100%"> 
+    <tr>
+     <td><label for="l">{t}Location{/t}</label></td>
+     <td>
+               <input id="l" name="l" size=22 maxlength=60 value="{$l}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="st">{t}State{/t}</label></td>
+     <td>
+               <input id="st" name="st" size=22 maxlength=60 value="{$st}">
+     </td>
+    </tr>
+    <tr>
+     <td style="vertical-align:top;"><label for="postalAddress">{t}Address{/t}</label></td>
+     <td>
+               <textarea id="postalAddress" name="postalAddress" rows=3 style="width:100%">{$postalAddress}</textarea>
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  {else} 
+
+  <!-- Beschreibung, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary=""> 
+    <tr>
+     <td><label for="vocation">{t}Vocation{/t}</label></td>
+     <td>
+               <input id="vocation" name="vocation" size=22 maxlength=60 value="{$vocation}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnitDescription">{t}Unit description{/t}</label></td>
+     <td>
+               <input id="gouvernmentOrganizationalUnitDescription" name="gouvernmentOrganizationalUnitDescription" size=22 maxlength=60
+               value="{$gouvernmentOrganizationalUnitDescription}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnitSubjectArea">{t}Subject area{/t}</label></td>
+     <td>
+               <input id="gouvernmentOrganizationalUnitSubjectArea" name="gouvernmentOrganizationalUnitSubjectArea" size=22 maxlength=60
+               value="{$gouvernmentOrganizationalUnitSubjectArea}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="functionalTitle">{t}Functional title{/t}</label></td>
+     <td>
+               <input name="functionalTitle" id="functionalTitle"  size=22 maxlength=60
+               value="{$functionalTitle}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="role">{t}Role{/t}</label></td>
+     <td>
+               <input id="role" name="role" size=22 maxlength=60 value="{$role}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary=""> 
+    <tr>
+     <td><label for="gouvernmentOrganizationalPersonLocality">{t}Person locality{/t}</label></td>
+     <td>
+               <input id="gouvernmentOrganizationalPersonLocality" name="gouvernmentOrganizationalPersonLocality" size=22 maxlength=60
+                value="{$gouvernmentOrganizationalPersonLocality}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnit">{t}Unit{/t}</label></td>
+     <td>
+               <input id="gouvernmentOrganizationalUnit" name="gouvernmentOrganizationalUnit" size=22 maxlength=60 
+               value="{$gouvernmentOrganizationalUnit}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="street">{t}Street{/t}</label></td>
+     <td>
+               <input name="street" id="street" size=22 maxlength=60 value="{$street}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="postalCode">{t}Postal code{/t}</label></td>
+     <td> 
+               <input name="postalCode" id="postalCode" size=22 maxlength=60 value="{$postalCode}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="houseIdentifier">{t}House identifier{/t}</label></td>
+     <td>
+               <input id="houseIdentifier" name="houseIdentifier" size=22 maxlength=60
+               value="{$houseIdentifier}">
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
+     <td>
+               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
+     <td>
+             {if $has_phoneaccount ne "true"}
+                       <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+             {else}
+                       <i>{t}Please use the phone tab{/t}</i>
+             {/if}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
+     <td>
+               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 
+                value="{$facsimileTelephoneNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="ivbbLastDeliveryCollective">{t}Last delivery{/t}</label></td>
+     <td>
+               <input name="ivbbLastDeliveryCollective" size=22 maxlength=60 id="ivbbLastDeliveryCollective" 
+               value="{$ivbbLastDeliveryCollective}">
+     </td>
+    </tr>
+    <tr>
+     <td><label for="publicVisible">{t}Public visible{/t}</label></td>
+     <td>
+             <select size="1" id="publicVisible" name="publicVisible">
+              {html_options values=$ivbbmodes output=$ivbbmodes selected=$publicVisible}
+             </select>
+     </td>
+    </tr>
+   </table>
+  </td>
+ {/if} 
+ </tr>
+</table>
+
+<input type=hidden name="generic">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('sn');
+       if (document.mainform.yearSel != "")
+                               populate(document.mainform,document.mainform.dateOfBirth);
+  -->
+</script>