Code

Reverted dojo stuff
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 Nov 2007 13:43:12 +0000 (13:43 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 Nov 2007 13:43:12 +0000 (13:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7963 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/generic/class_user.inc
plugins/personal/generic/generic.tpl

index f67b555fc0040344d09f3d113a7d0d780b82576e..21930a5b83a059dd3cf520e2e18a545f68cccf67 100644 (file)
@@ -204,16 +204,14 @@ class user extends plugin
     }
 
     /* Generate dateOfBirth entry */
-    if (!$_SESSION['DOJO']){
-      if (isset ($this->attrs['dateOfBirth'])){
-        /* This entry is ISO 8601 conform */
-        list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
-      
-        $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
-        $this->use_dob= "1";
-      } else {
-        $this->use_dob= "0";
-      }
+    if (isset ($this->attrs['dateOfBirth'])){
+      /* This entry is ISO 8601 conform */
+      list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
+    
+      $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
+      $this->use_dob= "1";
+    } else {
+      $this->use_dob= "0";
     }
 
     /* Put gender attribute to upper case */
@@ -245,61 +243,49 @@ class user extends plugin
     $smarty= get_smarty();
 
     /* Fill calendar */
-    if ($_SESSION['DOJO']){
-      $smarty->assign('dateOfBirth', $this->dateOfBirth);
+    if ($this->dateOfBirth == "0"){
+      $date= getdate();
     } else {
-      if ($this->dateOfBirth == "0"){
-        $date= getdate();
-      } else {
-        if(is_array($this->dateOfBirth)){
-          $date = $this->dateOfBirth;
-    
-          // Trigger on dates like 1985-04-01, getdate only understands timestamps
-        } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
-          $date= getdate(strtotime($this->dateOfBirth));
-
-        } else {
-          $date = getdate($this->dateOfBirth);
-        }
-      }
+      if(is_array($this->dateOfBirth)){
+        $date = $this->dateOfBirth;
+  
+        // Trigger on dates like 1985-04-01, getdate only understands timestamps
+      } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
+        $date= getdate(strtotime($this->dateOfBirth));
 
-      $days= array();
-      for($d= 1; $d<32; $d++){
-        $days[$d]= $d;
+      } else {
+        $date = getdate($this->dateOfBirth);
       }
-      $years= array();
+    }
 
-      if(($date['year']-100)<1901){
-        $start = 1901;
-      }else{
-        $start = $date['year']-100;
-      }
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[$d]= $d;
+    }
+    $years= array();
 
-      $end = $start +100;
-      
-      for($y= $start; $y<=$end; $y++){
-        $years[]= $y;
-      }
-      $years['-']= "-&nbsp;";
-      $months= array(_("January"), _("February"), _("March"), _("April"),
-          _("May"), _("June"), _("July"), _("August"), _("September"),
-          _("October"), _("November"), _("December"), '-' => '-&nbsp;');
-      $smarty->assign("day", $date["mday"]);
-      $smarty->assign("days", $days);
-      $smarty->assign("months", $months);
-      $smarty->assign("month", $date["mon"]-1);
-      $smarty->assign("years", $years);
-      $smarty->assign("year", $date["year"]);
-    }
-
-    /* Assign uid regex for dojo */
-    $smarty->assign("uid_regex", get_uid_regexp());
-    if (strict_uid_mode()){
-      $smarty->assign("uid_invalid_message", _("Please use only a-z, 0-9, _ or - as valid characters"));
-    } else {
-      $smarty->assign("uid_invalid_message", _("Please use only a-z, A-Z, 0-9, ., space, _ or - as valid characters"));
+    if(($date['year']-100)<1901){
+      $start = 1901;
+    }else{
+      $start = $date['year']-100;
     }
 
+    $end = $start +100;
+    
+    for($y= $start; $y<=$end; $y++){
+      $years[]= $y;
+    }
+    $years['-']= "-&nbsp;";
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"), '-' => '-&nbsp;');
+    $smarty->assign("day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("year", $date["year"]);
+
     /* Assign sex */
     $sex= array(0 => "&nbsp;", "F" => _("female"), "M" => _("male"));
     $smarty->assign("gender_list", $sex);
@@ -784,12 +770,10 @@ class user extends plugin
     /* First use parents methods to do some basic fillup in $this->attrs */
     plugin::save ();
 
-    if (!$_SESSION['DOJO']){
-      if ($this->use_dob == "1"){
-        /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
-        if(!is_array($this->attrs['dateOfBirth'])) {
-          $this->attrs['dateOfBirth'] = date("Y-m-d", $this->dateOfBirth);
-        }
+    if ($this->use_dob == "1"){
+      /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
+      if(!is_array($this->attrs['dateOfBirth'])) {
+        $this->attrs['dateOfBirth'] = date("Y-m-d", $this->dateOfBirth);
       }
     }
 
@@ -851,14 +835,12 @@ class user extends plugin
       $remove_userCertificate= true;
     }
 
-    if (!$_SESSION['DOJO']){
-      /* Special handling for dateOfBirth value */
-      if ($this->use_dob != "1"){
-        if ($this->is_new) {
-          unset($this->attrs["dateOfBirth"]);
-        } else {
-          $this->attrs["dateOfBirth"]= array();
-        }
+    /* Special handling for dateOfBirth value */
+    if ($this->use_dob != "1"){
+      if ($this->is_new) {
+        unset($this->attrs["dateOfBirth"]);
+      } else {
+        $this->attrs["dateOfBirth"]= array();
       }
     }
     if (!$this->gender){
@@ -1096,13 +1078,6 @@ class user extends plugin
       }
     }
 
-    /* Date in dojo mode... */
-    if ($_SESSION['DOJO']){
-      if (!preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/', $_POST['dateOfBirth'])){
-        $message[]= _("Please provide a valid date of birth.");
-      }
-    }
-
     /* Set the new acl base */
     if($this->dn == "new") {
       $this->set_acl_base($this->base);
index 6336385f50fd2f00f4e73d618d8538fea1223a74..f96d764b25c193ac38dffde37df0ea855c03002c 100644 (file)
     {if $is_template ne "true"}
     <tr>
      <td><label for="sn">{t}Last name{/t}{$must}</label></td>
-     <td>{render acl=$snACL}<input id="sn" name="sn" size="25" maxLength="60" value="{$sn}" dojoType="dijit.form.ValidationTextBox" propercase="true" trim="true" promptMessage="{t}This field is required{/t}" invalidMessage="{t}The field should not contain \\ characters{/t}" regExp="[^\\\\]+" required="true">{/render}</td>
+     <td>{render acl=$snACL}<input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">{/render}</td>
     </tr>
     {else}
     <tr>
      <td><label for="sn">{t}Template name{/t}{$must}</label></td>
-     <td>{render acl=$snACL}<input id="sn" name="sn" maxLength="60" value="{$sn}" dojoType="dijit.form.ValidationTextBox" trim="true" required="true" promptMessage="{t}This field is required{/t}" invalidMessage="{t}The field should not contain \\ characters{/t}" regExp="[^\\\\]+">{/render}</td>
+     <td>{render acl=$snACL}<input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">{/render}</td>
     </tr>
     {/if}
 
     {if $is_template ne "true"}
     <tr>
      <td><label for="givenName">{t}First name{/t}{$must}</label></td>
-     <td>{render acl=$givenNameACL}<input id="givenName" size="25" name="givenName" maxLength="60" value="{$givenName}" dojoType="dijit.form.ValidationTextBox" trim="true" required="true" promptMessage="{t}This field is required{/t}" invalidMessage="{t}Please specify the first name{/t}" regExp="[^\\\\]+">{/render}</td>
+     <td>{render acl=$givenNameACL}<input id="givenName" name="givenName" size=25 maxlength=60 value="{$givenName}">{/render}</td>
     </tr>
     <tr>
      <td><label for="uid">{t}Login{/t}{$must}</label></td>
-     <td>{render acl=$uidACL}<input id="uid" name="uid" size="25" maxLength="60"  value="{$uid}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="true" promptMessage="{t}This field is required{/t}" invalidMessage="{$uid_invalid_message}" regExp="{$uid_regex}">{/render}</td>
+     <td>{render acl=$uidACL}<input id="uid" name="uid" size=25 maxlength=60  value="{$uid}">{/render}</td>
     </tr>
     {/if}
       
@@ -75,7 +75,7 @@
      <td>
       <div style="height:10px;"></div>
        {render acl=$personalTitleACL}
-               <input id="personalTitle" name="personalTitle" dojoType="dijit.form.TextBox" size=25 maxLength=60 value="{$personalTitle}">
+               <input id="personalTitle" name="personalTitle" size=25 maxlength=60 value="{$personalTitle}">
        {/render}
      </td>
     </tr>
@@ -83,7 +83,7 @@
      <td><label for="academicTitle">{t}Academic title{/t}</label></td>
      <td>
        {render acl=$academicTitleACL}
-             <input id="academicTitle" name="academicTitle" size=25 dojoType="dijit.form.TextBox" maxLength=60 value="{$academicTitle}">
+             <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
        {/render}
      </td>
     </tr>
@@ -95,9 +95,6 @@
      <td>
       <div style="height:10px;"></div>
        {render acl=$dateOfBirthACL}
-       {if $dojo}
-             <input id="dateOfBirth" name="dateOfBirth" size=11 dojoType="dijit.form.DateTextBox" maxLength=11 value="{$dateOfBirth}">
-       {else}
              {if $use_dob eq 1}
              <select id="day" name=day onChange="createResult(this.form,this.form.dateOfBirth);"> 
               {html_options values=$days output=$days selected=$day}
              {else}
              <input type="submit" name="set_dob" value="{t}Set{/t}" >
              {/if}
-       {/if}
        {/render}
      </td>
     </tr>
      <td><label for="homePhone">{t}Private phone{/t}</label>
      </td><td>
        {render acl=$homePhoneACL}
-            <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid phone number{/t}" regExp="^[0-9/+ ()-]*$">
+            <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
        {/render}
      </td>
     </tr>
      <td><label for="labeledURI">{t}Homepage{/t}</label></td>
      <td>
        {render acl=$labeledURIACL}
-               <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid URL{/t}" regExp="^(ftp|http|https):\/\/(\w+:\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$">
+               <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
        {/render}
      </td>
     </tr>
      <td><label for="edit_cert">{t}Certificates{/t}</label></td>
      <td>
        {render acl=$CertificatesACL mode=read_active}
-         <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}..." >
+               <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
        {/render}
      </td>
     </tr>
      <td><label for="o">{t}Organization{/t}</label></td>
      <td>      
        {render acl=$oACL}
-               <input class="text" id="o" name="o" size=22 maxlength=60 value="{$o}">
+               <input id="o" name="o" size=22 maxlength=60 value="{$o}">
        {/render}
      </td>
     </tr>
      <td><label for="ou">{t}Department{/t}</label></td>
      <td>
        {render acl=$ouACL}
-               <input class="text" id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
+               <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
        {/render}
      </td>
     </tr>
      <td><label for="departmentNumber">{t}Department No.{/t}</label></td>
      <td>
        {render acl=$departmentNumberACL}
-             <input class="text" id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
+             <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
        {/render}
      </td>
     </tr>
      <td><label for="employeeNumber">{t}Employee No.{/t}</label></td>
      <td>
        {render acl=$employeeNumberACL}
-               <input class="text" id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
+               <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
        {/render}
      </td>
     </tr>
      <td><label for="employeeType">{t}Employee type{/t}</label></td>
      <td>
        {render acl=$employeeTypeACL}
-               <input class="text" id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
+               <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
        {/render}
      </td>
     </tr>
      <td><label for="roomNumber">{t}Room No.{/t}</label></td>
      <td>
        {render acl=$roomNumberACL}
-               <input class="text" id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
        {/render}
      </td>
     </tr>
      <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
      <td>
        {render acl=$telephoneNumberACL}
-               <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid phone number{/t}" regExp="^[0-9/+ ()-]*$">
+               <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
        {/render}
      </td>
     </tr>
      <td><label for="mobile">{t}Mobile{/t}</label></td>
      <td>
        {render acl=$mobileACL}
-               <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid phone number{/t}" regExp="^[0-9/+ ()-]*$">
+               <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
        {/render}
      </td>
     </tr>
      <td><label for="pager">{t}Pager{/t}</label></td>
      <td>
        {render acl=$pagerACL}
-               <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid phone number{/t}" regExp="^[0-9/+ ()-]*$">
+               <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
        {/render}
      </td>
     </tr>
      <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
      <td>
        {render acl=$facsimileTelephoneNumberACL}
-               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}" dojoType="dijit.form.ValidationTextBox" propercase="false" trim="true" required="false" invalidMessage="{t}Please enter a valid phone number{/t}" regExp="^[0-9/+ ()-]*$">
+               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
        {/render}
      </td>
     </tr>
      <td><label for="l">{t}Location{/t}</label></td>
      <td>
        {render acl=$lACL}
-               <input class="text" id="l" name="l" size=22 maxlength=60 value="{$l}">
+               <input id="l" name="l" size=22 maxlength=60 value="{$l}">
        {/render}
      </td>
     </tr>
      <td><label for="st">{t}State{/t}</label></td>
      <td>
        {render acl=$stACL}
-               <input class="text" id="st" name="st" size=22 maxlength=60 value="{$st}">
+               <input id="st" name="st" size=22 maxlength=60 value="{$st}">
        {/render}
      </td>
     </tr>
 
 <input type=hidden name="generic">
 
-{if $dojo}
-{literal}
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       var init = function(){
-               dijit.byId('sn').focus();
-       };
-        dojo.addOnLoad(init);
-       if (document.mainform.yearSel != "")
-                               populate(document.mainform,document.mainform.dateOfBirth);
-  -->
-</script>
-{/literal}
-{else}
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
   <!-- // First input field on page
-        focus_field('sn');
+       focus_field('sn');
        if (document.mainform.yearSel != "")
                                populate(document.mainform,document.mainform.dateOfBirth);
   -->
 </script>
-{/if}