From: cajus Date: Fri, 30 Nov 2007 13:43:12 +0000 (+0000) Subject: Reverted dojo stuff X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=58c2952d9d5bc72b5e75ae5860015a72e58bee91;p=gosa.git Reverted dojo stuff git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7963 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index f67b555fc..21930a5b8 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -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['-']= "- "; - $months= array(_("January"), _("February"), _("March"), _("April"), - _("May"), _("June"), _("July"), _("August"), _("September"), - _("October"), _("November"), _("December"), '-' => '- '); - $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['-']= "- "; + $months= array(_("January"), _("February"), _("March"), _("April"), + _("May"), _("June"), _("July"), _("August"), _("September"), + _("October"), _("November"), _("December"), '-' => '- '); + $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 => " ", "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); diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl index 6336385f5..f96d764b2 100644 --- a/plugins/personal/generic/generic.tpl +++ b/plugins/personal/generic/generic.tpl @@ -47,23 +47,23 @@ {if $is_template ne "true"} - {render acl=$snACL}{/render} + {render acl=$snACL}{/render} {else} - {render acl=$snACL}{/render} + {render acl=$snACL}{/render} {/if} {if $is_template ne "true"} - {render acl=$givenNameACL}{/render} + {render acl=$givenNameACL}{/render} - {render acl=$uidACL}{/render} + {render acl=$uidACL}{/render} {/if} @@ -75,7 +75,7 @@
{render acl=$personalTitleACL} - + {/render} @@ -83,7 +83,7 @@ {render acl=$academicTitleACL} - + {/render} @@ -95,9 +95,6 @@
{render acl=$dateOfBirthACL} - {if $dojo} - - {else} {if $use_dob eq 1} {/if} - {/if} {/render} @@ -179,7 +175,7 @@ {render acl=$homePhoneACL} - + {/render} @@ -187,7 +183,7 @@ {render acl=$labeledURIACL} - + {/render} @@ -215,7 +211,7 @@ {render acl=$CertificatesACL mode=read_active} - + {/render} @@ -248,7 +244,7 @@ {render acl=$oACL} - + {/render} @@ -256,7 +252,7 @@ {render acl=$ouACL} - + {/render} @@ -264,7 +260,7 @@ {render acl=$departmentNumberACL} - + {/render} @@ -272,7 +268,7 @@ {render acl=$employeeNumberACL} - + {/render} @@ -280,7 +276,7 @@ {render acl=$employeeTypeACL} - + {/render} @@ -298,7 +294,7 @@ {render acl=$roomNumberACL} - + {/render} @@ -307,7 +303,7 @@ {render acl=$telephoneNumberACL} - + {/render} @@ -316,7 +312,7 @@ {render acl=$mobileACL} - + {/render} @@ -324,7 +320,7 @@ {render acl=$pagerACL} - + {/render} @@ -332,7 +328,7 @@ {render acl=$facsimileTelephoneNumberACL} - + {/render} @@ -350,7 +346,7 @@ {render acl=$lACL} - + {/render} @@ -358,7 +354,7 @@ {render acl=$stACL} - + {/render} @@ -532,27 +528,11 @@ -{if $dojo} -{literal} - - -{/literal} -{else} -{/if}