[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/tasks/ -> addedit_uncompressed.js (source)

   1  /* $Id: addedit_uncompressed.js 105 2008-03-20 00:33:54Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/tasks/addedit_uncompressed.js $ */
   2  var calendarField = '';
   3  var calWin = null;
   4  
   5  function setMilestoneEndDate(checked){
   6      if(checked){
   7          document.datesFrm.end_date.value      = document.datesFrm.start_date.value;
   8          document.datesFrm.task_end_date.value = document.datesFrm.task_start_date.value;
   9      } 
  10  }
  11  
  12  /**
  13  setTasksStartDate sets new task's start date value which is maximum end date of all dependend tasks
  14  to do: date format should be taken from config
  15  */
  16  function setTasksStartDate(form, datesForm) {
  17  
  18      var td = form.task_dependencies.length -1;
  19      var max_date = new Date('1970', '01', '01');
  20      var max_id = -1;
  21      
  22      if (form.set_task_start_date.checked == true) {    
  23          //build array of task dependencies
  24          for (td; td > -1; td--) {
  25              var i = form.task_dependencies.options[td].value;
  26              var val = projTasksWithEndDates[i][0]; //format 05/03/2004
  27              var sdate = new Date(val.substring(6,10),val.substring(3,5)-1, val.substring(0,2));
  28              if (sdate > max_date) {
  29                  max_date = sdate;
  30                  max_id = i;
  31              }
  32          }
  33          
  34          //check end date of parent task 
  35          // Why? Parent task is for updating dynamics or angle icon
  36          if ( 0 && form.task_parent.options.selectedIndex!=0) {
  37              var i = form.task_parent.options[form.task_parent.options.selectedIndex].value;    
  38              var val = projTasksWithEndDates[i][0]; //format 05/03/2004    
  39              var sdate = new Date(val.substring(6,10),val.substring(3,5)-1, val.substring(0,2));
  40              if (sdate > max_date) {
  41                  max_date = sdate;
  42                  max_id = i;        
  43              }
  44          }
  45          
  46          if (max_id != -1) {
  47              var hour  = projTasksWithEndDates[max_id][1];
  48              var minute = projTasksWithEndDates[max_id][2];
  49          
  50              datesForm.start_date.value = projTasksWithEndDates[max_id][0];
  51              datesForm.start_hour.value = hour;
  52              datesForm.start_minute.value = minute;
  53              
  54               var d = projTasksWithEndDates[max_id][0];
  55               //hardcoded date format Ymd
  56               datesForm.task_start_date.value = d.substring(6,10) + '' + d.substring(3,5) + '' + d.substring(0,2);     
  57          }    
  58            var urlst = 'index.php?m=public&a=date_format&dialog=1&field='+datesForm.name+'.start_date&date=' + datesForm.task_start_date.value;
  59            var threadst = window.frames['thread2']; //document.getElementById('thread2');
  60            threadst.location = urlst;
  61          setAMPM(datesForm.start_hour);
  62              calcFinish(datesForm);
  63      }
  64  }
  65  
  66  function popContacts() {
  67      window.open('./index.php?m=public&a=contact_selector&dialog=1&call_back=setContacts&selected_contacts_id='+selected_contacts_id, 'contacts','height=600,width=400,resizable,scrollbars=yes');
  68  }
  69  
  70  function setContacts(contact_id_string) {
  71      if(!contact_id_string) {
  72          contact_id_string = '';
  73      }
  74      task_contacts = document.getElementById('task_contacts');
  75      task_contacts.value = contact_id_string;
  76      selected_contacts_id = contact_id_string;
  77  }
  78  
  79  function submitIt(form){
  80      if (form.task_name.value.length < 3) {
  81              alert( task_name_msg );
  82              form.task_name.focus();
  83              return false;
  84      }
  85  
  86      // Check the sub forms
  87      for (var i = 0, i_cmp = subForm.length; i < i_cmp; i++) {
  88          if (!subForm[i].check())
  89              return false;
  90          // Save the subform, this may involve seeding this form
  91          // with data
  92          subForm[i].save();
  93      }
  94  
  95      form.submit();
  96  }
  97  
  98  function addUser(form) {
  99      var fl = form.resources.length -1;
 100      var au = form.assigned.length -1;
 101      //gets value of percentage assignment of selected resource
 102      var perc = form.percentage_assignment.options[form.percentage_assignment.selectedIndex].value;
 103  
 104      var users = 'x';
 105  
 106      //build array of assiged users
 107      for (au; au > -1; au--) {
 108          users = users + ',' + form.assigned.options[au].value + ','
 109      }
 110  
 111      //Pull selected resources and add them to list
 112      for (fl; fl > -1; fl--) {
 113          if (form.resources.options[fl].selected && users.indexOf( ',' + form.resources.options[fl].value + ',' ) == -1) {
 114              t = form.assigned.length;
 115              opt = new Option( form.resources.options[fl].text+' ['+perc+'%]', form.resources.options[fl].value);
 116              form.hperc_assign.value += form.resources.options[fl].value+'='+perc+';';
 117              form.assigned.options[t] = opt
 118          }
 119      }
 120  }
 121  
 122  function removeUser(form) {
 123      fl = form.assigned.length -1;
 124      for (fl; fl > -1; fl--) {
 125          if (form.assigned.options[fl].selected) {
 126              //remove from hperc_assign
 127              var selValue = form.assigned.options[fl].value;            
 128              var re = '.*('+selValue+'=[0-9]*;).*';
 129              var hiddenValue = form.hperc_assign.value;
 130              if (hiddenValue) {
 131                  var b = hiddenValue.match(re);
 132                  if (b[1]) {
 133                      hiddenValue = hiddenValue.replace(b[1], '');
 134                  }
 135                  form.hperc_assign.value = hiddenValue;
 136                  form.assigned.options[fl] = null;
 137              }
 138  //alert(form.hperc_assign.value);
 139          }
 140      }
 141  }
 142  
 143  //Check to see if None has been selected.
 144  function checkForTaskDependencyNone(obj){
 145      var td = obj.length -1;
 146      for (td; td > -1; td--) {
 147          if(obj.options[td].value==task_id){
 148              clearExceptFor(obj, task_id);
 149              break;
 150          }
 151      }
 152  }
 153  
 154  //If None has been selected, remove the existing entries.
 155  function clearExceptFor(obj, id){
 156      var td = obj.length -1;
 157      for (td; td > -1; td--) {
 158          if(obj.options[td].value != id){
 159              obj.options[td]=null;
 160          }
 161      }
 162  }
 163  
 164  function addTaskDependency(form, datesForm) {
 165      var at = form.all_tasks.length -1;
 166      var td = form.task_dependencies.length -1;
 167      var tasks = 'x';
 168  
 169      //Check to see if None is currently in the dependencies list, and if so, remove it.
 170  
 171      if(td>=0 && form.task_dependencies.options[0].value==task_id) {
 172          form.task_dependencies.options[0] = null;
 173          td = form.task_dependencies.length -1;
 174      }
 175  
 176      //build array of task dependencies
 177      for (td; td > -1; td--) {
 178          tasks = tasks + ',' + form.task_dependencies.options[td].value + ',';
 179      }
 180  
 181      //Pull selected resources and add them to list
 182      for (at; at > -1; at--) {
 183          if (form.all_tasks.options[at].selected && tasks.indexOf( ',' + form.all_tasks.options[at].value + ',' ) == -1) {
 184              t = form.task_dependencies.length;
 185              opt = new Option( form.all_tasks.options[at].text, form.all_tasks.options[at].value );
 186              form.task_dependencies.options[t] = opt;
 187          }
 188      }
 189      
 190      checkForTaskDependencyNone(form.task_dependencies);
 191      setTasksStartDate(form, datesForm);
 192  }
 193  
 194  function removeTaskDependency(form, datesForm) {
 195      td = form.task_dependencies.length -1;
 196  
 197      for (td; td > -1; td--) {
 198          if (form.task_dependencies.options[td].selected) {
 199              form.task_dependencies.options[td] = null;
 200          }
 201      }
 202      
 203      setTasksStartDate(form, datesForm);
 204  }
 205  
 206  function setAMPM( field) {
 207      ampm_field = document.getElementById(field.name + '_ampm');
 208      if (ampm_field) {
 209          if ( field.value > 11 ){
 210              ampm_field.value = 'pm';
 211          } else {
 212              ampm_field.value = 'am';
 213          }
 214      }
 215  }
 216  
 217  var hourMSecs = 3600*1000;
 218  
 219  /**
 220  * no comment needed
 221  */
 222  function isInArray(myArray, intValue) {
 223  
 224      for (var i = 0, i_cmp = myArray.length; i < i_cmp; i++) {
 225          if (myArray[i] == intValue) {
 226              return true;
 227          }
 228      }        
 229      return false;
 230  }
 231  
 232  /**
 233  * @modify_reason calculating duration does not include time information and cal_working_days stored in config.php
 234  */
 235  function calcDuration(f) {
 236  
 237      var int_st_date = new String(f.task_start_date.value + f.start_hour.value + f.start_minute.value);
 238      var int_en_date = new String(f.task_end_date.value + f.end_hour.value + f.end_minute.value);
 239  
 240      var sDate = new Date(int_st_date.substring(0,4),(int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10), int_st_date.substring(10,12));
 241      var eDate = new Date(int_en_date.substring(0,4),(int_en_date.substring(4,6)-1),int_en_date.substring(6,8), int_en_date.substring(8,10), int_en_date.substring(10,12));
 242      
 243      var s = Date.UTC(int_st_date.substring(0,4),(int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10), int_st_date.substring(10,12));
 244      var e = Date.UTC(int_en_date.substring(0,4),(int_en_date.substring(4,6)-1),int_en_date.substring(6,8), int_en_date.substring(8,10), int_en_date.substring(10,12));
 245      var durn = (e - s) / hourMSecs; //hours absolute diff start and end
 246      var durn_abs = durn;    
 247  
 248      //now we should subtract non-working days from durn variable
 249      var duration = durn  / 24;
 250      var weekendDays = 0;
 251          var myDate = new Date(int_st_date.substring(0,4), (int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10));
 252      for (var i = 0; i < duration; i++) {
 253          //var myDate = new Date(int_st_date.substring(0,4), (int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10));
 254          var myDay = myDate.getDate();
 255          if ( !isInArray(working_days, myDate.getDay()) ) {
 256              weekendDays++;
 257          }
 258          myDate.setDate(myDay + 1);
 259      }
 260      
 261      //calculating correct durn value
 262      durn = durn - weekendDays*24;    // total hours minus non-working days (work day hours)
 263  
 264      // check if the last day is a weekendDay
 265      // if so we subtracted some hours too much before, 
 266      // we have to fill up the last working day until cal_day_start + daily_working_hours
 267      if ( !isInArray(working_days, eDate.getDay()) && eDate.getHours() != cal_day_start) {
 268          durn = durn + Math.max(0, (cal_day_start + daily_working_hours - eDate.getHours()));
 269      }
 270      
 271      //could be 1 or 24 (based on TaskDurationType value)
 272      var durnType = parseFloat(f.task_duration_type.value);    
 273      durn /= durnType;
 274      //alert(durn);
 275      if (durnType == 1){
 276          // durn is absolute weekday hours
 277          
 278          //if first day equals last day we're already done
 279          if( durn_abs < daily_working_hours ) {
 280  
 281              durn = durn_abs;
 282  
 283          } else { //otherwise we need to process first and end day different;
 284      
 285              // Hours worked on the first day
 286              var first_day_hours = cal_day_end - sDate.getHours();
 287              if (first_day_hours > daily_working_hours) {
 288                  first_day_hours = daily_working_hours;
 289              }
 290  
 291              // Hours worked on the last day
 292              var last_day_hours = eDate.getHours() - cal_day_start;
 293              if (last_day_hours > daily_working_hours) {
 294                  last_day_hours = daily_working_hours;
 295              }
 296  
 297              // Total partial day hours
 298              var partial_day_hours = first_day_hours + last_day_hours;
 299  
 300              // Full work days
 301              var full_work_days = (durn - partial_day_hours) / 24;
 302  
 303              // Total working hours
 304              durn = Math.floor(full_work_days) * daily_working_hours + partial_day_hours;
 305              
 306              // check if the last day is a weekendDay
 307              // if so we subtracted some hours too much before, 
 308              // we have to fill up the last working day until cal_day_start + daily_working_hours
 309              if ( !isInArray(working_days, eDate.getDay()) && eDate.getHours() != cal_day_start) {
 310                  durn = durn + Math.max(0, (cal_day_start + daily_working_hours - eDate.getHours()));
 311              }
 312          }
 313  
 314      } else if (durnType == 24 ) {
 315          //we should talk about working days so a task duration of 41 hrs means 6 (NOT 5) days!!!
 316          if (durn > Math.round(durn)) {
 317              durn++;
 318          }
 319      }
 320  
 321      if ( s > e ) {
 322          alert( 'End date is before start date!');
 323          return false;
 324      } else {
 325          f.task_duration.value = Math.round(durn);
 326          return true;
 327      }
 328  }
 329  /**
 330  * Get the end of the previous working day 
 331  */
 332  function prev_working_day( dateObj ) {
 333      while ( ! isInArray(working_days, dateObj.getDay()) || dateObj.getHours() < cal_day_start ||
 334            (    dateObj.getHours() == cal_day_start && dateObj.getMinutes() == 0 ) ){
 335  
 336          dateObj.setDate(dateObj.getDate()-1);
 337          dateObj.setHours( cal_day_end );
 338          dateObj.setMinutes( 0 );
 339      }
 340  
 341      return dateObj;
 342  }
 343  /**
 344  * Get the start of the next working day 
 345  */
 346  function next_working_day( dateObj ) {
 347      while ( ! isInArray(working_days, dateObj.getDay()) || dateObj.getHours() >= cal_day_end ) {
 348          dateObj.setDate(dateObj.getDate()+1);
 349          dateObj.setHours( cal_day_start );
 350          dateObj.setMinutes( 0 );
 351      }
 352  
 353      return dateObj;
 354  }
 355  /**
 356  * @modify reason calcFinish does not use time info and working_days array 
 357  */
 358  function calcFinish(f) {
 359      //var int_st_date = new String(f.task_start_date.value);
 360      var int_st_date_time = new String(f.task_start_date.value + f.start_hour.value + f.start_minute.value);    
 361      var int_st_date = int_st_date_time;
 362      var e = new Date(int_st_date_time.substring(0,4),(int_st_date_time.substring(4,6)-1),int_st_date_time.substring(6,8), int_st_date_time.substring(8,10), int_st_date_time.substring(10,12));
 363  
 364      // The task duration
 365      var durn = parseFloat(f.task_duration.value);//hours
 366      var durnType = parseFloat(f.task_duration_type.value); //1 or 24
 367  
 368      //temporary variables
 369      var inc = Math.floor(durn);
 370      var hoursToAddToLastDay = 0;
 371      var hoursToAddToFirstDay = durn;
 372      var fullWorkingDays = 0;
 373      var int_st_hour = e.getHours();
 374      //catch the gap between the working hours and the open hours (like lunch periods)
 375      var workGap = cal_day_end - cal_day_start - workHours;
 376  
 377      // calculate the number of non-working days
 378      var k = 7 - working_days.length;
 379  
 380      var durnMins = (durn - inc) * 60;
 381      if ((e.getMinutes() + durnMins) >= 60) {
 382          inc++;
 383      }
 384  
 385      var mins = ( e.getMinutes() + durnMins ) % 60;
 386      if (mins > 38) {
 387          e.setMinutes( 45 );
 388      } else if (mins > 23) {
 389          e.setMinutes( 30 );
 390      } else if (mins > 8) {
 391          e.setMinutes( 15 );
 392      } else {
 393          e.setMinutes( 0 );
 394      }
 395      
 396      // jump over to the first working day
 397      for (var i = 0; i < k; i++){
 398          if ( !isInArray(working_days, e.getDay()) ) {
 399              e.setDate(e.getDate() + 1);
 400          }
 401      }
 402          
 403      if ( durnType==24 ) {
 404          if (e.getHours() == cal_day_start && e.getMinutes() == 0) {
 405                    fullWorkingDays = Math.ceil(inc);            
 406                e.setMinutes( 0 );
 407          } else {
 408          fullWorkingDays = Math.ceil(inc)+1;
 409          }            
 410  
 411          // Include start day as a working day (if it is one)
 412          if ( isInArray(working_days, e.getDay()) ) fullWorkingDays--;
 413  
 414           for (var i = 0; i < fullWorkingDays; i++)
 415          {
 416              e.setDate(e.getDate() + 1);
 417              if ( !isInArray(working_days, e.getDay()) ) i--;            
 418          }
 419          
 420          if (e.getHours() == cal_day_start && e.getMinutes() == 0) {
 421                   e.setHours(cal_day_end);
 422               f.end_hour.value = cal_day_end;
 423               f.end_minute.value = '00';
 424          } else {
 425          f.end_hour.value = f.start_hour.value;
 426               f.end_minute.value = f.start_minute.value;
 427           }
 428      } else {
 429          
 430          hoursToAddToFirstDay = inc;
 431          if ( e.getHours() + inc > (cal_day_end-workGap) ) {
 432              hoursToAddToFirstDay = (cal_day_end-workGap) - e.getHours();
 433          }
 434          if ( hoursToAddToFirstDay > workHours ) {
 435              hoursToAddToFirstDay = workHours;
 436          }
 437          inc -= hoursToAddToFirstDay;
 438          hoursToAddToLastDay = inc % workHours;
 439          fullWorkingDays = Math.floor((inc - hoursToAddToLastDay) / workHours);
 440  
 441          if (hoursToAddToLastDay <= 0 && !(hoursToAddToFirstDay==workHours)) {
 442              e.setHours(e.getHours()+hoursToAddToFirstDay);
 443          } else if (hoursToAddToLastDay == 0) {
 444              e.setHours(e.getHours()+hoursToAddToFirstDay+workGap);
 445          } else {
 446              e.setHours(cal_day_start+hoursToAddToLastDay);
 447              e.setDate(e.getDate() + 1);
 448          }
 449  
 450              
 451          if ((e.getHours() == cal_day_end || (e.getHours() - int_st_hour) == (workHours+workGap)) && mins > 0) {
 452              e.setDate(e.getDate() + 1);
 453              e.setHours(cal_day_start);
 454          }
 455              
 456          f.end_minute.value = (e.getMinutes() < 10 ? '0'+e.getMinutes() : e.getMinutes());
 457          
 458          // boolean for setting later if we just found a non-working day
 459          // and therefore do not have to add a day in the next loop
 460          // (which would have caused to not respecting multiple non-working days after each other)
 461          var g = false;
 462           for (var i = 0, i_cmp = Math.ceil(fullWorkingDays); i < i_cmp; i++){
 463              if (!g) {
 464                  e.setDate(e.getDate() + 1);
 465              }
 466              g = false;
 467              // calculate overriden non-working days
 468              if ( !isInArray(working_days, e.getDay()) ) {
 469                  e.setDate(e.getDate() + 1);
 470                  i--;
 471                  g = true;
 472              }
 473          }
 474          f.end_hour.value = (e.getHours() < 10 ? '0'+e.getHours() : e.getHours());
 475      }
 476      
 477      var tz1 = '';
 478      var tz2 = '';
 479  
 480      // if there was no fullworkingday we have to check whether the end day is a working day 
 481      // and in the negative case postpone the end date by appropriate days
 482      for (var i = 0, i_cmp = 7-working_days.length; i < i_cmp; i++){
 483          // override  possible non-working enddays
 484          if ( !isInArray(working_days, e.getDay()) ) {
 485              e.setDate(e.getDate() + 1);
 486          }
 487      }
 488  
 489      if ( e.getDate() < 10 ) tz1 = '0';
 490      if ( (e.getMonth()+1) < 10 ) tz2 = '0';
 491  
 492      f.task_end_date.value = e.getUTCFullYear()+tz2+(e.getMonth()+1)+tz1+e.getDate();
 493      //f.end_date.value = tz2+(e.getMonth()+1)+"/"+tz1+e.getDate()+"/"+e.getUTCFullYear(); // MM/DD/YY
 494      //f.end_date.value = tz1+e.getDate()+"/"+tz2+(e.getMonth()+1)+"/"+e.getUTCFullYear(); // DD/MM/YY
 495      var url = 'index.php?m=public&a=date_format&dialog=1&field='+f.name+'.end_date&date=' + f.task_end_date.value;
 496      thread = window.frames['thread']; //document.getElementById('thread');
 497      thread.location = url;
 498      setAMPM(f.end_hour);
 499  }
 500  
 501  function changeRecordType(value){
 502      // if the record type is changed, then hide everything
 503      hideAllRows();
 504      // and how only those fields needed for the current type
 505      eval('show'+task_types[value]+'();');
 506  }
 507  
 508  var subForm = new Array();
 509  
 510  function FormDefinition(id, form, check, save) {
 511      this.id = id;
 512      this.form = form;
 513      this.checkHandler = check;
 514      this.saveHandler = save;
 515      this.check = fd_check;
 516      this.save = fd_save;
 517      this.submit = fd_submit;
 518      this.seed = fd_seed;
 519  }
 520  
 521  function fd_check()
 522  {
 523      if (this.checkHandler) {
 524          return this.checkHandler(this.form);
 525      } else {
 526          return true;
 527      }
 528  }
 529  
 530  function fd_save()
 531  {
 532      if (this.saveHandler) {
 533          var copy_list = this.saveHandler(this.form);
 534          return copyForm(this.form, document.editFrm, copy_list);
 535      } else {
 536          return this.form.submit();
 537      }
 538  }
 539  
 540  function fd_submit()
 541  {
 542      if (this.saveHandler) {
 543          this.saveHandler(this.form);
 544      }
 545      return this.form.submit();
 546  }
 547  
 548  function fd_seed()
 549  {
 550      return copyForm(document.editFrm, this.form);
 551  }
 552  
 553  // Sub-form specific functions.
 554  function checkDates(form) {
 555      if (can_edit_time_information) {
 556          if (check_task_dates) {
 557              if (!form.task_start_date.value) {
 558                  alert( task_start_msg );
 559                  form.task_start_date.focus();
 560                  return false;
 561              }
 562              if (!form.task_end_date.value) {
 563                  alert( task_end_msg );
 564                  form.task_end_date.focus();
 565                  return false;
 566              }
 567          }
 568          //check if the start date is > then end date
 569          var int_st_date = new String(form.task_start_date.value + form.start_hour.value + form.start_minute.value);
 570          var int_en_date = new String(form.task_end_date.value + form.end_hour.value + form.end_minute.value);
 571  
 572          var s = Date.UTC(int_st_date.substring(0,4),(int_st_date.substring(4,6)-1),int_st_date.substring(6,8), int_st_date.substring(8,10), int_st_date.substring(10,12));
 573          var e = Date.UTC(int_en_date.substring(0,4),(int_en_date.substring(4,6)-1),int_en_date.substring(6,8), int_en_date.substring(8,10), int_en_date.substring(10,12));
 574          if ( s > e ) {
 575              if (form.task_start_date.value && form.task_end_date.value) {
 576                  alert( 'End date is before start date!');
 577                  return false;
 578              }
 579          }
 580      }
 581      return true;
 582  }
 583  
 584  function copyForm(form, to, extras) {
 585      // Grab all of the elements in the form, and copy them
 586      // to the main form.  Do not copy hidden fields.
 587      var h = new HTMLex;
 588      for (var i = 0, i_cmp = form.elements.length; i < i_cmp; i++) {
 589          var elem = form.elements[i];
 590          if (elem.type == 'hidden') {
 591              // If we have anything in the extras array we check to see if we
 592              // need to copy it across
 593              if (!extras) {
 594                  continue;
 595              }
 596              var found = false;
 597              for (var j = 0, j_cmp = extras.length; j < j_cmp; j++) {
 598                  if (extras[j] == elem.name) {
 599                    found = true;
 600                      break;
 601                  }
 602              }
 603              if (! found) {
 604                  continue;
 605              }
 606          }
 607          // Determine the node type, and determine the current value
 608          switch (elem.type) {
 609              case 'text':
 610              case 'textarea':
 611              case 'hidden':
 612                  to.appendChild(h.addHidden(elem.name, elem.value));
 613                  break;
 614              case 'select-one':
 615                  if (elem.options.length > 0) {
 616                      to.appendChild(h.addHidden(elem.name, elem.options[elem.selectedIndex].value));
 617                  }
 618                  break;
 619              case 'select-multiple':
 620                  var sel = to.appendChild(h.addSelect(elem.name, false, true));
 621                  for (var x = 0, x_cmp = elem.options.length; x < x_cmp; x++) {
 622                      if (elem.options[x].selected) {
 623                          sel.appendChild(h.addOption(elem.options[x].value, '', true));
 624                      }
 625                  }
 626                  break;
 627              case 'radio':
 628              case 'checkbox':
 629                  if (elem.checked) {
 630                      to.appendChild(h.addHidden(elem.name, elem.value));
 631                  }
 632                  break;
 633          }
 634      }
 635      return true;
 636  }
 637  
 638  function saveDates(form) {
 639      if (can_edit_time_information) {
 640          if ( form.task_start_date.value.length > 0 ) {
 641              form.task_start_date.value += form.start_hour.value + form.start_minute.value;
 642          }
 643          if ( form.task_end_date.value.length > 0 ) {
 644              form.task_end_date.value += form.end_hour.value + form.end_minute.value;
 645          }
 646      }
 647      
 648  
 649      return new Array('task_start_date', 'task_end_date');
 650  }
 651  
 652  function saveDepend(form) {
 653      var dl = form.task_dependencies.length -1;
 654      hd = form.hdependencies;
 655      hd.value = '';
 656      for (dl; dl > -1; dl--){
 657          hd.value += form.task_dependencies.options[dl].value + ((dl == 0) ? '' : ',');
 658      }
 659      return new Array('hdependencies');;
 660  }
 661  
 662  function checkDetail(form) {
 663      return true;
 664  }
 665  
 666  function saveDetail(form) {
 667      return null;
 668  }
 669  
 670  function checkResource(form) {
 671      return true;
 672  }
 673  
 674  function checkDepend(form) {
 675      return true;
 676  }
 677  
 678  function saveResource(form) {
 679      var fl = form.assigned.length -1;
 680      ha = form.hassign;
 681      ha.value = '';
 682      for (fl; fl > -1; fl--){
 683          ha.value += form.assigned.options[fl].value + ((fl == 0) ? '' : ',');
 684      }
 685      return new Array('hassign', 'hperc_assign');
 686  }


Generated: Thu Jan 8 03:00:03 2009 Cross-referenced by PHPXref 0.7