[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Calendar/ -> script.js (source)

   1  /*********************************************************************************
   2  
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   ********************************************************************************/
  10  
  11  function DisableSharing()
  12  {
  13  
  14          x = document.SharedList.selected_id.length;
  15          idstring = "";
  16          xx = 0;
  17          if ( x == undefined)
  18          {
  19  
  20                  if (document.SharedList.selected_id.checked)
  21                  {
  22                          document.SharedList.idlist.value=document.SharedList.selected_id.value;
  23                  }
  24                  else
  25                  {
  26                          alert("Please select at least one user");
  27                          return false;
  28                  }
  29          }
  30          else
  31          {
  32                  for(i = 0; i < x ; i++)
  33                  {
  34                          if(document.SharedList.selected_id[i].checked)
  35                          {
  36                                  idstring = document.SharedList.selected_id[i].value +";"+idstring
  37                          xx++
  38                          }
  39                  }
  40                  if (xx != 0)
  41                  {
  42                          document.SharedList.idlist.value=idstring;
  43                  }
  44                  else
  45                  {
  46                          alert("Please select at least one user");
  47                          return false;
  48                  }
  49          }
  50          if(confirm("Are you sure you want to disable sharing for selected "+xx+" user(s) ?"))
  51          {
  52                  document.SharedList.action="index.php?module=Calendar&action=disable_sharing&return_module=Calendar&return_action=calendar_share";
  53          }
  54          else
  55          {
  56                  return false;
  57          }
  58  }
  59  
  60  
  61  
  62  function showhide(argg)
  63  {
  64      var x=document.getElementById(argg).style;
  65      if (x.display=="none") 
  66      {
  67          x.display="block"
  68      
  69      }
  70      else {
  71              x.display="none"
  72            }
  73  }
  74  
  75  
  76  function showhideRepeat(argg1,argg2)
  77  {
  78      var x=document.getElementById(argg2).style;
  79      var y=document.getElementById(argg1).checked;
  80      
  81      if (y)
  82      {
  83          x.display="block";
  84      }
  85      else {
  86          x.display="none";
  87      }
  88      
  89  }
  90  
  91  
  92  
  93  function gshow(argg1,type,startdate,enddate,starthr,startmin,startfmt,endhr,endmin,endfmt,viewOption,subtab)
  94  {
  95      var y=document.getElementById(argg1).style;
  96      
  97          if(type == 'call' || type == 'meeting')
  98          {
  99              if(type == 'call')
 100                              document.EditView.activitytype[0].checked = true;
 101                      if(type == 'meeting')
 102                              document.EditView.activitytype[1].checked = true;
 103  
 104              document.EditView.date_start.value = startdate;
 105              document.EditView.due_date.value = enddate;
 106              document.EditView.starthr.value = starthr;
 107              document.EditView.startmin.value = startmin;
 108              document.EditView.startfmt.value = startfmt;
 109              document.EditView.endhr.value = endhr;
 110              document.EditView.endmin.value = endmin;
 111              document.EditView.endfmt.value = endfmt;
 112              document.EditView.viewOption.value = viewOption;
 113                          document.EditView.subtab.value = subtab;
 114          }
 115          if(type == 'todo')
 116          {
 117              document.createTodo.task_date_start.value = startdate;
 118              document.createTodo.task_due_date.value = enddate;
 119              document.createTodo.starthr.value = starthr;
 120                          document.createTodo.startmin.value = startmin;
 121                          document.createTodo.startfmt.value = startfmt;
 122              document.createTodo.viewOption.value = viewOption;
 123                          document.createTodo.subtab.value = subtab;
 124          }
 125      if (y.display=="none")
 126          {
 127          y.display="block";
 128      }
 129  }
 130  
 131  function Taskshow(argg1,type,startdate,starthr,startmin,startfmt)
 132  {
 133      var y=document.getElementById(argg1).style;
 134      if (y.display=="none")
 135          {
 136                  document.EditView.date_start.value = startdate;
 137                  document.EditView.starthr.value = starthr;
 138                  document.EditView.startmin.value = startmin;
 139                  document.EditView.startfmt.value = startfmt;
 140          y.display="block";
 141      }
 142  }
 143  
 144  function ghide(argg2)
 145  {
 146      var z=document.getElementById(argg2).style;
 147      if (z.display=="block" ) 
 148      {
 149          z.display="none"
 150      
 151      }
 152  }
 153  
 154   function moveMe(arg1) {
 155      var posx = 0;
 156      var posy = 0;
 157      var e=document.getElementById(arg1);
 158      
 159      if (!e) var e = window.event;
 160      
 161      if (e.pageX || e.pageY)
 162      {
 163          posx = e.pageX;
 164          posy = e.pageY;
 165      }
 166      else if (e.clientX || e.clientY)
 167      {
 168          posx = e.clientX + document.body.scrollLeft;
 169          posy = e.clientY + document.body.scrollTop;
 170      }
 171   }
 172  
 173  function switchClass(myModule,toStatus) {
 174      var x=document.getElementById(myModule);
 175      if (toStatus=="on") {
 176          x.className="dvtSelectedCell";
 177          }
 178      if (toStatus=="off") {
 179          x.className="dvtUnSelectedCell";
 180          }
 181          
 182  }
 183  
 184  function enableCalstarttime()
 185  {
 186      if(document.SharingForm.sttime_check.checked == true)
 187          document.SharingForm.start_hour.disabled = false;
 188      else    
 189          document.SharingForm.start_hour.disabled = true;
 190  }
 191  function maincheck_form()
 192  {
 193      formSelectColumnString('inviteesid');
 194      starthour = document.EditView.starthr.value;
 195          startmin  = document.EditView.startmin.value;
 196          startformat = document.EditView.startfmt.value;
 197      endhour = document.EditView.endhr.value;
 198      endmin  = document.EditView.endmin.value;
 199      endformat = document.EditView.endfmt.value;    
 200      if(formValidate())
 201      {
 202          if(startformat != '')
 203          {
 204              if(startformat == 'pm')
 205              {
 206                  if(starthour == '12')
 207                      starthour = 12;
 208                  else
 209                      starthour = eval(starthour) + 12;
 210                  startmin  = startmin;
 211              }
 212              else
 213              {
 214                  if(starthour == '12')
 215                                          starthour = 0;
 216                  else
 217                      starthour = starthour;
 218                  startmin  = startmin;
 219              }
 220          }
 221          if(endformat != '')
 222          {
 223              if(endformat == 'pm')
 224              {
 225                  if(endhour == '12')
 226                      endhour = 12;
 227                  else
 228                      endhour = eval(endhour) + 12;
 229                  endmin = endmin;
 230              }
 231              else
 232              {
 233                  if(endhour == '12')
 234                      endhour = 0;
 235                  else
 236                      endhour = endhour;
 237                  endmin = endmin;
 238              }
 239          }
 240          var dateval1=getObj('date_start').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
 241              var dateval2=getObj('due_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
 242          var dateelements1=splitDateVal(dateval1)
 243                var dateelements2=splitDateVal(dateval2)
 244  
 245              dd1=dateelements1[0]
 246              mm1=dateelements1[1]
 247              yyyy1=dateelements1[2]
 248  
 249              dd2=dateelements2[0]
 250              mm2=dateelements2[1]
 251              yyyy2=dateelements2[2]
 252          var date1=new Date()
 253              var date2=new Date()
 254  
 255              date1.setYear(yyyy1)
 256              date1.setMonth(mm1-1)
 257              date1.setDate(dd1)
 258  
 259              date2.setYear(yyyy2)
 260              date2.setMonth(mm2-1)
 261              date2.setDate(dd2)
 262          if (date2<=date1)
 263          {
 264              if((eval(endhour)*60+eval(endmin)) <= (eval(starthour)*60+eval(startmin)))
 265              {
 266                  alert("End Time should be greater than Start Time ");
 267                  document.EditView.endhr.focus();
 268                  return false;
 269              }
 270              else
 271              {
 272                  durationinmin = (eval(endhour)*60+eval(endmin)) - (eval(starthour)*60+eval(startmin));
 273                          if(durationinmin >= 60)
 274                            {
 275                                hour = durationinmin/60;
 276                                  minute = durationinmin%60;
 277                          }
 278                          else
 279                          {
 280                                  hour = 0;
 281                                  minute = durationinmin;
 282                          }
 283                  document.EditView.duration_hours.value = hour;
 284                          document.EditView.duration_minutes.value = minute;
 285              }
 286          }
 287          document.EditView.time_start.value = starthour+':'+startmin;
 288          document.EditView.time_end.value = endhour+':'+endmin;
 289          return true;
 290      }
 291      else return false;
 292  
 293  
 294  }
 295  function check_form()
 296  {
 297      formSelectColumnString('inviteesid');
 298          if(trim(document.EditView.subject.value) == "")
 299          {
 300                  alert("Missing Event Name");
 301                  document.EditView.subject.focus()
 302                  return false;
 303          }
 304          else
 305          {
 306          if(document.EditView.record.value != '')
 307                  {
 308                          document.EditView.mode.value = 'edit';
 309                  }
 310          else
 311          {
 312              document.EditView.mode.value = 'create';
 313          }
 314          starthour = document.EditView.starthr.value;
 315          startmin  = document.EditView.startmin.value;
 316          startformat = document.EditView.startfmt.value;
 317          endhour = document.EditView.endhr.value;
 318                  endmin  = document.EditView.endmin.value;
 319                  endformat = document.EditView.endfmt.value;
 320          if(startformat != '')
 321          {
 322              if(startformat == 'pm')
 323              {
 324                  if(starthour == '12')
 325                      starthour = 12;
 326                  else
 327                      starthour = eval(starthour) + 12;
 328                  startmin  = startmin;
 329              }
 330              else
 331              {
 332                  if(starthour == '12')
 333                                      starthour = 0;
 334                  else
 335                      starthour = starthour;
 336                  startmin  = startmin;
 337              }
 338          }
 339          if(endformat != '')
 340          {
 341              if(endformat == 'pm')
 342                          {
 343                  if(endhour == '12')
 344                                          endhour = 12;
 345                                  else
 346                                          endhour = eval(endhour) + 12;
 347                  endmin = endmin;
 348                          }
 349              else
 350              {
 351                  if(endhour == '12')
 352                      endhour == 0;
 353                  else
 354                      endhour = endhour;
 355                  endmin = endmin;
 356              }
 357          }
 358          if(!dateValidate('date_start','Start date','OTH'))
 359          {
 360              return false;
 361          }
 362          if(!dateValidate('due_date','End date','OTH'))
 363          {
 364              return false;
 365          }
 366          if(dateComparison('due_date','End date','date_start','Start date','GE'))
 367          {
 368              var dateval1=getObj('date_start').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
 369                      var dateval2=getObj('due_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
 370                      var dateelements1=splitDateVal(dateval1)
 371                      var dateelements2=splitDateVal(dateval2)
 372  
 373                      dd1=dateelements1[0]
 374                      mm1=dateelements1[1]
 375                      yyyy1=dateelements1[2]
 376  
 377                      dd2=dateelements2[0]
 378                      mm2=dateelements2[1]
 379                      yyyy2=dateelements2[2]
 380                      var date1=new Date()
 381                      var date2=new Date()
 382  
 383                      date1.setYear(yyyy1)
 384                      date1.setMonth(mm1-1)
 385                      date1.setDate(dd1)
 386  
 387                      date2.setYear(yyyy2)
 388                      date2.setMonth(mm2-1)
 389                      date2.setDate(dd2)
 390                      if (date2<=date1)
 391                      {
 392                              if((eval(endhour)*60+eval(endmin)) <= (eval(starthour)*60+eval(startmin)))
 393                            {
 394                                      alert("End Time should be greater than Start Time ");
 395                                      document.EditView.endhr.focus();
 396                                       return false;
 397                              }
 398                  durationinmin = (eval(endhour)*60+eval(endmin)) - (eval(starthour)*60+eval(startmin));
 399                              if(durationinmin >= 60)
 400                              {
 401                                      hour = durationinmin/60;
 402                                      minute = durationinmin%60;
 403                              }
 404                              else
 405                              {
 406                                      hour = 0;
 407                                      minute = durationinmin;
 408                              }
 409                  document.EditView.duration_hours.value = hour;
 410                              document.EditView.duration_minutes.value = minute;
 411  
 412                     }
 413          }    
 414          else
 415              return false;
 416          document.EditView.time_start.value = starthour+':'+startmin;
 417          document.EditView.time_end.value = endhour+':'+endmin;
 418          if(document.EditView.recurringcheck.checked == false)
 419                  {
 420                          document.EditView.recurringtype.value = '--None--';
 421                  }
 422                  return true;
 423          }
 424  }
 425  
 426  function task_check_form()
 427  {
 428      starthour = document.createTodo.starthr.value;
 429      startmin  = document.createTodo.startmin.value;
 430          startformat = document.createTodo.startfmt.value;
 431      if(startformat != '')
 432      {
 433              if(startformat == 'pm')
 434                  {
 435              if(starthour == '12')
 436                  starthour = 12;
 437              else
 438                          starthour = eval(starthour) + 12;
 439              
 440                          startmin  = startmin;
 441                  }
 442                  else
 443                  {
 444              if(starthour == '12')
 445                  starthour = 0;
 446              else
 447                  starthour = starthour;
 448                          startmin  = startmin;
 449                  }
 450          }
 451      document.createTodo.task_time_start.value = starthour+':'+startmin;
 452      if(document.createTodo.record.value != '')
 453          {
 454              document.createTodo.mode.value = 'edit';
 455          }
 456          else
 457          {
 458              document.createTodo.mode.value = 'create';
 459          }
 460  
 461  }
 462  
 463  
 464  function maintask_check_form()
 465  {
 466          starthour = document.EditView.starthr.value;
 467          startmin  = document.EditView.startmin.value;
 468          startformat = document.EditView.startfmt.value;
 469          if(startformat != '')
 470          {
 471                  if(startformat == 'pm')
 472                  {
 473              if(starthour == '12')
 474                  starthour = 12;
 475              else
 476                  starthour = eval(starthour) + 12;
 477                          startmin  = startmin;
 478                  }
 479                  else
 480                  {
 481              if(starthour == '12')
 482                                  starthour = 0;
 483                          else
 484                                  starthour = starthour;
 485                          startmin  = startmin;
 486                  }
 487          }
 488          document.EditView.time_start.value = starthour+':'+startmin;
 489  }
 490  
 491  
 492  var moveupLinkObj,moveupDisabledObj,movedownLinkObj,movedownDisabledObj;
 493  function setObjects()
 494  {
 495          availListObj=getObj("availableusers")
 496          selectedColumnsObj=getObj("selectedusers")
 497  
 498  }
 499  
 500  
 501  
 502  function addColumn()
 503  {
 504          var selectlength=selectedColumnsObj.length
 505          var availlength=availListObj.length
 506          var s=0
 507          for (i=0;i<selectlength;i++)
 508          {
 509                  selectedColumnsObj.options[i].selected=false
 510          }
 511          for (i=0;i<availlength;i++)
 512          {
 513                  if (availListObj.options[s].selected==true)
 514                  {
 515                          for (j=0;j<selectlength;j++)
 516                          {
 517                                  if (selectedColumnsObj.options[j].value==availListObj.options[s].value)
 518                                  {
 519                                          var rowFound=true
 520                                          var existingObj=selectedColumnsObj.options[j]
 521                                          breaK;
 522                                  }
 523                          }
 524                          if (rowFound!=true)
 525                          {
 526                                  var newColObj=document.createElement("OPTION")
 527                                          newColObj.value=availListObj.options[s].value
 528                                          if (browser_ie) newColObj.innerText=availListObj.options[s].innerText
 529                                          else if (browser_nn4 || browser_nn6) newColObj.text=availListObj.options[s].text
 530                                                  selectedColumnsObj.appendChild(newColObj)
 531                                          availListObj.removeChild(availListObj.options[s])
 532                                          newColObj.selected=true
 533                                          rowFound=false
 534                          }
 535                          else
 536                          {
 537                                  existingObj.selected=true
 538                          }
 539                  }
 540          else
 541                          s++
 542          }
 543  }
 544  
 545  function delColumn()
 546  {
 547          var selectlength=selectedColumnsObj.length
 548          var availlength=availListObj.length
 549          var s=0
 550          for (i=0;i<availlength;i++)
 551          {
 552                  availListObj.options[i].selected=false
 553          }
 554          for (i=0;i<selectlength;i++)
 555          {
 556                  if (selectedColumnsObj.options[s].selected==true)
 557                  {
 558                          for (j=0;j<availlength;j++)
 559                          {
 560                                  if (availListObj.options[j].value==selectedColumnsObj.options[s].value)
 561                                  {
 562                                          var rowFound=true
 563                                          var existingObj=availListObj.options[j]
 564                                          breaK;
 565                                  }
 566                          }
 567  
 568                          if (rowFound!=true)
 569                          {
 570                                  var newColObj=document.createElement("OPTION")
 571                                          newColObj.value=selectedColumnsObj.options[s].value
 572                                          if (browser_ie) newColObj.innerText=selectedColumnsObj.options[s].innerText
 573                                          else if (browser_nn4 || browser_nn6) newColObj.text=selectedColumnsObj.options[s].text
 574                                                  availListObj.appendChild(newColObj)
 575                                          selectedColumnsObj.removeChild(selectedColumnsObj.options[s])
 576                                          newColObj.selected=true
 577                                          rowFound=false
 578                          }
 579                          else
 580                          {
 581                                  existingObj.selected=true
 582                          }
 583                  }
 584          else
 585                          s++
 586          }
 587  }
 588  
 589  function formSelectColumnString(usr)
 590  {
 591      usr_id = document.getElementById(usr);
 592      var selectedColStr = "";
 593          for (i=0;i<selectedColumnsObj.options.length;i++)
 594          {
 595              selectedColStr += selectedColumnsObj.options[i].value + ";";
 596          }
 597      usr_id.value = selectedColStr;
 598  }
 599  
 600  function fnRedirect() {
 601          var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
 602      if(OptionData == 'listview')
 603      {
 604          document.EventViewOption.action.value = "index";
 605          window.document.EventViewOption.submit();
 606      }
 607      if(OptionData == 'hourview')
 608      {
 609          document.EventViewOption.action.value = "index";
 610          window.document.EventViewOption.submit();
 611      }
 612  }
 613  
 614  function fnAddEvent(obj,CurrObj,start_date,end_date,start_hr,start_min,start_fmt,end_hr,end_min,end_fmt,viewOption,subtab){
 615      var tagName = document.getElementById(CurrObj);
 616      var left_Side = findPosX(obj);
 617      var top_Side = findPosY(obj);
 618      tagName.style.left= left_Side  + 'px';
 619      tagName.style.top= top_Side + 22+ 'px';
 620      tagName.style.display = 'block';
 621      document.getElementById("addcall").href="javascript:gshow('addEvent','call','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"','"+viewOption+"','"+subtab+"');fnRemoveEvent();";
 622      document.getElementById("addmeeting").href="javascript:gshow('addEvent','meeting','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"','"+viewOption+"','"+subtab+"');fnRemoveEvent();";
 623      document.getElementById("addtodo").href="javascript:gshow('createTodo','todo','"+start_date+"','"+end_date+"','"+start_hr+"','"+start_min+"','"+start_fmt+"','"+end_hr+"','"+end_min+"','"+end_fmt+"','"+viewOption+"','"+subtab+"');fnRemoveEvent();";
 624      
 625  }
 626      
 627  function fnRemoveEvent(){
 628      var tagName = document.getElementById('addEventDropDown').style.display= 'none';
 629  }
 630  
 631  function fnShowEvent(){
 632          var tagName = document.getElementById('addEventDropDown').style.display= 'block';
 633  }
 634  
 635  function getMiniCal(url){
 636      if(url == undefined)
 637          url = 'module=Calendar&action=ActivityAjax&type=minical&ajax=true';
 638      else
 639           url = 'module=Calendar&action=ActivityAjax&'+url+'&type=minical&ajax=true';
 640          new Ajax.Request(
 641                  'index.php',
 642                  {queue: {position: 'end', scope: 'command'},
 643                          method: 'post',
 644                          postBody: url,
 645                          onComplete: function(response) {
 646                                  $("miniCal").innerHTML=response.responseText;
 647                          }
 648                  }
 649  
 650            );
 651  }
 652  
 653  function getCalSettings(url){
 654          new Ajax.Request(
 655                  'index.php',
 656                  {queue: {position: 'end', scope: 'command'},
 657                          method: 'post',
 658                          postBody: 'module=Calendar&action=ActivityAjax&'+url+'&type=settings&ajax=true',
 659                          onComplete: function(response) {
 660                                  $("calSettings").innerHTML=response.responseText;
 661                          }
 662                  }
 663  
 664            );
 665  }
 666  
 667  function updateStatus(record,status,view,hour,day,month,year,type){
 668      if(type == 'event')
 669      {
 670          var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
 671          
 672          new Ajax.Request(
 673                      'index.php',
 674                      {queue: {position: 'end', scope: 'command'},
 675                              method: 'post',
 676                              postBody: 'module=Calendar&action=ActivityAjax&record='+record+'&'+status+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_status&viewOption='+OptionData+'&subtab=event&ajax=true',
 677                              onComplete: function(response) {
 678                      if(OptionData == 'listview')
 679                          $("listView").innerHTML=response.responseText;
 680                                      if(OptionData == 'hourview')
 681                                      $("hrView").innerHTML=response.responseText;
 682                              }
 683                      }
 684          );
 685      }
 686      if(type == 'todo')
 687          {
 688          new Ajax.Request(
 689                          'index.php',
 690              {queue: {position: 'end', scope: 'command'},
 691                                  method: 'post',
 692                  postBody: 'module=Calendar&action=ActivityAjax&record='+record+'&'+status+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_status&subtab=todo&ajax=true',
 693                                  onComplete: function(response) {
 694                                          $("mnuTab2").innerHTML=response.responseText;
 695                                  }
 696                          }
 697                  )
 698      }
 699  }
 700  
 701  function getcalAction(obj,Lay,id,view,hour,day,month,year,type){
 702      var tagName = document.getElementById(Lay);
 703      var leftSide = findPosX(obj);
 704      var topSide = findPosY(obj);
 705      var maxW = tagName.style.width;
 706      var widthM = maxW.substring(0,maxW.length-2);
 707      var getVal = eval(leftSide) + eval(widthM);
 708      if(getVal  > window.innerWidth ){
 709          leftSide = eval(leftSide) - eval(widthM);
 710          tagName.style.left = leftSide + 'px';
 711      }
 712      else
 713          tagName.style.left= leftSide + 'px';
 714      tagName.style.top= topSide + 'px';
 715      tagName.style.display = 'block';
 716      tagName.style.visibility = "visible";
 717      if(type == 'event')
 718      {
 719      var heldstatus = "eventstatus=Held";
 720      var notheldstatus = "eventstatus=Not Held";
 721          var activity_mode = "Events";
 722      var complete = document.getElementById("complete");
 723      var pending = document.getElementById("pending");
 724      var postpone = document.getElementById("postpone");
 725      var actdelete =    document.getElementById("actdelete");
 726      var changeowner = document.getElementById("changeowner");
 727      var OptionData = document.getElementById('view_Option').options[document.getElementById('view_Option').selectedIndex].value;
 728      
 729      }
 730      if(type == 'todo')
 731      {
 732      var heldstatus = "status=Completed";
 733          var notheldstatus = "status=Deferred";
 734      var activity_mode = "Task";
 735      var complete = document.getElementById("taskcomplete");
 736          var pending = document.getElementById("taskpending");
 737          var postpone = document.getElementById("taskpostpone");
 738          var actdelete = document.getElementById("taskactdelete");
 739          var changeowner = document.getElementById("taskchangeowner");
 740      var OptionData = '';
 741      }
 742      document.getElementById("idlist").value = id;
 743      document.change_owner.hour.value = hour;
 744      document.change_owner.day.value = day;
 745      document.change_owner.view.value = view;
 746      document.change_owner.month.value = month;
 747      document.change_owner.year.value = year;
 748      document.change_owner.subtab.value = type;
 749      complete.href="javascript:updateStatus("+id+",'"+heldstatus+"','"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
 750      pending.href="javascript:updateStatus("+id+",'"+notheldstatus+"','"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
 751      postpone.href="index.php?module=Calendar&action=EditView&record="+id+"&activity_mode="+activity_mode;
 752      actdelete.href="javascript:delActivity("+id+",'"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
 753      changeowner.href="javascript:dispLayer('act_changeowner');";
 754  
 755  }
 756  
 757  function dispLayer(lay)
 758  {
 759      var tagName = document.getElementById(lay);
 760          tagName.style.visibility = 'visible';
 761          tagName.style.display = 'block';
 762  }
 763  
 764  function calendarChangeOwner()
 765  {
 766      var user_id = document.getElementById('activity_owner').options[document.getElementById('activity_owner').options.selectedIndex].value;
 767      var idlist = document.change_owner.idlist.value;
 768          var view   = document.change_owner.view.value;
 769          var day    = document.change_owner.day.value;
 770          var month  = document.change_owner.month.value;
 771          var year   = document.change_owner.year.value;
 772          var hour   = document.change_owner.hour.value;
 773      var subtab = document.change_owner.subtab.value;
 774      if(subtab == 'event')
 775      {
 776          var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
 777           new Ajax.Request(
 778                      'index.php',
 779                      {queue: {position: 'end', scope: 'command'},
 780                              method: 'post',
 781                              postBody: 'module=Users&action=updateLeadDBStatus&return_module=Calendar&return_action=ActivityAjax&user_id='+user_id+'&idlist='+idlist+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_owner&viewOption='+OptionData+'&subtab=event&ajax=true',
 782                              onComplete: function(response) {
 783                      if(OptionData == 'listview')
 784                           $("listView").innerHTML=response.responseText;
 785                      if(OptionData == 'hourview')
 786                                              $("hrView").innerHTML=response.responseText;
 787                              }
 788                      }
 789          );
 790      }
 791      if(subtab == 'todo')
 792          {
 793                  new Ajax.Request(
 794                          'index.php',
 795                          {queue: {position: 'end', scope: 'command'},
 796                                  method: 'post',
 797                                  postBody: 'module=Users&action=updateLeadDBStatus&return_module=Calendar&return_action=ActivityAjax&user_id='+user_id+'&idlist='+idlist+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_owner&subtab=todo&ajax=true',
 798                                  onComplete: function(response) {
 799                                          $("mnuTab2").innerHTML=response.responseText;
 800                                  }
 801                          }
 802                  );
 803          }
 804  
 805  }
 806  
 807  function delActivity(id,view,hour,day,month,year,subtab)
 808  {
 809      if(subtab == 'event')
 810      {
 811          var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
 812               new Ajax.Request(
 813                      'index.php',
 814                      {queue: {position: 'end', scope: 'command'},
 815                              method: 'post',
 816                              postBody: 'module=Users&action=massdelete&return_module=Calendar&return_action=ActivityAjax&idlist='+id+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=activity_delete&viewOption='+OptionData+'&subtab=event&ajax=true',
 817                              onComplete: function(response) {
 818                      if(OptionData == 'listview')
 819                                              $("listView").innerHTML=response.responseText;
 820                                      if(OptionData == 'hourview')
 821                                              $("hrView").innerHTML=response.responseText;
 822                              }
 823                      }
 824          );
 825      }
 826      if(subtab == 'todo')
 827          {
 828                  new Ajax.Request(
 829                          'index.php',
 830                          {queue: {position: 'end', scope: 'command'},
 831                                  method: 'post',
 832                                  postBody: 'module=Users&action=massdelete&return_module=Calendar&return_action=ActivityAjax&idlist='+id+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=activity_delete&subtab=todo&ajax=true',
 833                                  onComplete: function(response) {
 834                                          $("mnuTab2").innerHTML=response.responseText;
 835                                  }
 836                          }
 837                  );
 838          }
 839  
 840  }
 841  
 842  
 843  /*
 844  * javascript function to display the div tag
 845  * @param divId :: div tag ID
 846  */
 847  function cal_show(divId)
 848  
 849  {
 850  
 851      var id = document.getElementById(divId);
 852  
 853      id.style.visibility = 'visible';
 854  
 855  }
 856  
 857  function fnAssignTo(){
 858          var option_Box = document.getElementById('parent_type');
 859          var option_select = option_Box.options[option_Box.selectedIndex].value;
 860          if(option_select == "Leads" || option_select == "Leads&action=Popup")
 861          {
 862              document.getElementById('leadLay').style.visibility = 'visible';
 863          }
 864          else if(option_select == "Accounts" || option_select == "Accounts&action=Popup")
 865          {
 866              document.getElementById('leadLay').style.visibility = 'visible';
 867          }
 868          else if(option_select == "Potentials" || option_select == "Potentials&action=Popup")
 869          {
 870              document.getElementById('leadLay').style.visibility = 'visible';
 871          }
 872          else if(option_select == "Quotes&action=Popup" || option_select == "Quotes&action=Popup")
 873                  {
 874                          document.getElementById('leadLay').style.visibility = 'visible';
 875                  }
 876          else if(option_select == "PurchaseOrder" || option_select == "PurchaseOrder&action=Popup")
 877                  {
 878                          document.getElementById('leadLay').style.visibility = 'visible';
 879                  }
 880          else if(option_select == "SalesOrder" || option_select == "SalesOrder&action=Popup")
 881                  {
 882                          document.getElementById('leadLay').style.visibility = 'visible';
 883                  }
 884          else if(option_select == "Invoice" || option_select == "Invoice&action=Popup")
 885                  {
 886                          document.getElementById('leadLay').style.visibility = 'visible';
 887                  }
 888          else if(option_select == "Campaigns" || option_select == "Campaigns&action=Popup")
 889                  {
 890                          document.getElementById('leadLay').style.visibility = 'visible';
 891                  }
 892          else{
 893              document.getElementById('leadLay').style.visibility = 'hidden';
 894          }
 895      }
 896      
 897  function fnShowPopup(){
 898      document.getElementById('popupLay').style.display = 'block';
 899  }
 900      
 901  function fnHidePopup(){
 902      document.getElementById('popupLay').style.display = 'none';
 903  }
 904  
 905  function getValidationarr(id,activity_mode,opmode,subtab,viewOption)
 906  {
 907       new Ajax.Request(
 908                          'index.php',
 909                          {queue: {position: 'end', scope: 'command'},
 910                                  method: 'post',
 911                                  postBody: 'module=Calendar&action=ActivityAjax&record='+id+'&activity_mode='+activity_mode+'&ajax=true&type=view&file=DetailView',
 912                                  onComplete: function(response) {
 913                                          $("dataArray").innerHTML=response.responseText;
 914                      setFieldvalues(opmode,subtab,viewOption);
 915                                  }
 916                          }
 917                  );
 918  
 919  }
 920  
 921  function setFieldvalues(opmode,subtab,viewOption)
 922  {
 923      var st = document.getElementById('activity_cont');
 924      eval(st.innerHTML);
 925      if(activity_type == 'Events')
 926      {
 927          document.EditView.viewOption.value = viewOption;
 928                  document.EditView.subtab.value = subtab;
 929          for(x=0;x<key.length;x++)
 930          {    
 931              if(document.EditView[key[x]] != undefined)
 932              {
 933  
 934                  if(key[x] == 'visibility' && data[x] == 'Public')
 935                      document.EditView.visibility.checked = true;
 936                  if(key[x] == 'visibility' && data[x] == 'Private')
 937                      document.EditView.visibility.checked = false;
 938                  if(key[x] == 'activitytype' && data[x] == 'Call')
 939                  {
 940                      document.EditView.activitytype[0].checked = true;
 941                  }
 942                  else
 943                  {
 944                      document.EditView.activitytype[1].checked = true;
 945                  }
 946                  if(key[x] == 'set_reminder' && data[x] == 'Yes')
 947                  {
 948                      document.EditView.remindercheck.checked = true;
 949                      document.getElementById('reminderOptions').style.display = 'block';
 950                  }
 951                  if(key[x] == 'recurringcheck' && data[x] == 'on')
 952                  {
 953                      document.EditView.recurringcheck.checked = true;
 954                      document.getElementById('repeatOptions').style.display = 'block';
 955                  }
 956                  if(key[x] == 'recurringtype')
 957                  {    
 958                      if(data[x] == 'Weekly')
 959                          document.getElementById('repeatWeekUI').style.display = 'block';
 960                      else
 961                          document.getElementById('repeatWeekUI').style.display = 'none';
 962                      if(data[x] == 'Monthly')
 963                          document.getElementById('repeatMonthUI').style.display = 'block';
 964                      else
 965                          document.getElementById('repeatMonthUI').style.display = 'none';
 966                  }
 967                  if(key[x] == 'parent_name')
 968                  {
 969                      if(data[x] != '')
 970                          document.getElementById('leadLay').style.visibility = 'visible';
 971                      else
 972                          document.getElementById('leadLay').style.display = 'hidden';
 973                  }
 974                  document.EditView[key[x]].value = data[x];
 975              //}    
 976              }
 977          }
 978          document.getElementById('addEvent').style.display = 'block';
 979      }
 980      else
 981      {
 982          document.createTodo.viewOption.value = viewOption;
 983                  document.createTodo.subtab.value = subtab;
 984          for(x=0;x<key.length;x++)
 985                  {
 986              if(document.createTodo[key[x]] != undefined)
 987              {
 988                                  document.createTodo[key[x]].value = data[x];
 989              }
 990          }
 991          document.getElementById('createTodo').style.display = 'block';
 992      }
 993  }
 994  
 995  function doNothing()
 996  {
 997  }
 998  
 999  /** This is Javascript Function which is used to toogle between
1000    * assigntype user and group/team select options while assigning owner to Task.
1001    */
1002  function toggleTaskAssignType(currType)
1003  {
1004          if (currType=="U")
1005          {
1006                  getObj("task_assign_user").style.display="block"
1007                  getObj("task_assign_team").style.display="none"
1008          }
1009          else
1010          {
1011                  getObj("task_assign_user").style.display="none"
1012                  getObj("task_assign_team").style.display="block"
1013          }
1014  }
1015  


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7