[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/projectdesigner/ -> vw_addtasks.php (source)

   1  <?php /* $Id: vw_addtasks.php 115 2008-03-21 17:20:33Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projectdesigner/vw_addtasks.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  global $AppUI, $w2Pconfig, $projects, $project_id;
   6  ?>
   7  
   8  <script language="JavaScript">
   9  function buildTaskName(id) {
  10      var f = document.editFrm;
  11      var taskNameObj = eval('f.add_task_name_'+id);
  12      var taskName = eval('f.add_task_name_'+id+'.value');
  13      //var oldProj = eval('oldProj');

  14      var oldType = eval('oldType_'+id);
  15      taskName = taskName.replace(oldProj, '');
  16      taskName = taskName.replace(oldType, '');
  17      //var projectName = f.project_name.value;

  18      var taskType = eval('f.add_task_type_'+id+'.options[f.add_task_type_'+id+'.selectedIndex].text');
  19      var newTaskName = oldProj+taskName+'-'+taskType;
  20      taskNameObj.value = newTaskName;
  21      oldTaskName = newTaskName;
  22      //eval("oldProj = "+projectName+"+':'");

  23      eval("oldType_"+id+" = '-'+'"+taskType+"'");
  24  }
  25  
  26  function addTasks() {
  27      var f = document.editFrm;
  28      var ok = true;
  29      for (i=0,i_cmp=f.length;i<i_cmp;i++){
  30          var tempobj=f.elements[i]
  31          if (tempobj.name.substring(0,14)=='add_task_name_'){
  32              if (((tempobj.type=='text'||tempobj.type=='textarea')&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=='s'&&tempobj.selectedIndex==-1)){
  33                  alert('<?php echo $AppUI->_('At least one task name is lacking.');?>');
  34                  f.elements[i].focus();
  35                  ok = false;
  36                  break;
  37              }
  38          }
  39      }                
  40      for (i=0,i_cmp=f.length;i<i_cmp;i++){
  41          var tempobj=f.elements[i]
  42          if (tempobj.name.substring(0,20)=='add_task_start_date_'){
  43              var int_st_date = new String(tempobj.name);
  44              var int_en_date = new String(int_st_date.replace(/start_date_/,'end_date_'));
  45              var st_date = new String(tempobj.name.replace(/add_task_/,''));
  46              var en_date = new String(st_date.replace(/start_date_/,'end_date_'));
  47              st_date = eval('f.'+st_date);
  48              en_date = eval('f.'+en_date);
  49              int_st_date = eval('f.'+int_st_date+'.value');
  50              int_en_date = eval('f.'+int_en_date+'.value');
  51              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));
  52              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));
  53              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));
  54              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));
  55              //alert(int_st_date);

  56              if (s > e && int_st_date.length>0 && int_en_date.length>0){
  57                  st_date.style.backgroundColor = 'red';
  58                  en_date.style.backgroundColor = 'red';
  59                  ok = false;
  60                  break;
  61              } else {
  62                  st_date.style.backgroundColor = '';
  63                  en_date.style.backgroundColor = '';
  64              }
  65          }
  66      }                
  67      if (ok) {
  68          f.submit();
  69      }
  70      
  71  }
  72  </script>
  73  
  74  <form name="editFrm" action="?m=<?php echo $m; ?>" method="post">
  75      <input type="hidden" name="dosql" value="do_addtasks_aed" />
  76      <input type="hidden" name="project" value="<?php echo $project_id; ?>" />
  77      <input type="hidden" name="project_name" value="<?php echo $obj->project_name; ?>" />
  78      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
  79      <input type="hidden" name="nrcomponents" value="0" />
  80      <input type="hidden" name="opt_view_project" value="<?php echo (isset($view_options[0]['pd_option_view_project']) ? $view_options[0]['pd_option_view_project'] : 1); ?>" />
  81      <input type="hidden" name="opt_view_gantt" value="<?php echo (isset($view_options[0]['pd_option_view_gantt']) ? $view_options[0]['pd_option_view_gantt'] : 1); ?>" />
  82      <input type="hidden" name="opt_view_tasks" value="<?php echo (isset($view_options[0]['pd_option_view_tasks']) ? $view_options[0]['pd_option_view_tasks'] : 1); ?>" />
  83      <input type="hidden" name="opt_view_actions" value="<?php echo (isset($view_options[0]['pd_option_view_actions']) ? $view_options[0]['pd_option_view_actions'] : 1); ?>" />
  84      <input type="hidden" name="opt_view_addtsks" value="<?php echo (isset($view_options[0]['pd_option_view_addtasks']) ? $view_options[0]['pd_option_view_addtasks'] : 1); ?>" />
  85      <input type="hidden" name="opt_view_files" value="<?php echo (isset($view_options[0]['pd_option_view_files']) ? $view_options[0]['pd_option_view_files'] : 1); ?>" />
  86  <table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl" >
  87  <tr>
  88      <td width="40%" valign="top" align="">
  89        <table width="100%">
  90        <tbody valign="top" id="tcomponents">
  91  <tr>
  92        <th>
  93            &nbsp;
  94        </th>
  95        <th>
  96            <b><?php echo $AppUI->_('Task Name'); ?></b>
  97        </th>
  98        <th>
  99            <b><?php echo $AppUI->_('Start'); ?></b>
 100        </th>
 101        <th>
 102            <b><?php echo $AppUI->_('End'); ?></b>
 103        </th>
 104        <th>
 105            <b><?php echo $AppUI->_('Duration'); ?></b>
 106        </th>
 107        <th>
 108            <b><?php echo $AppUI->_('Priority'); ?></b>
 109        </th>
 110        <th>
 111            <b><?php echo $AppUI->_('Type'); ?></b>
 112        </th>
 113        <th>
 114            <b><?php echo $AppUI->_('Access'); ?></b>
 115        </th>
 116        <th>
 117            <b><?php echo $AppUI->_('Extra'); ?></b>
 118        </th>
 119  </tr>
 120  </tbody>
 121  </table>
 122  <table width="100%">
 123  <tr>
 124      <td align="left" width="20">
 125           <?php echo w2PtoolTip('add tasks', 'click here to add a new task to this project'); ?><a href="javascript: void(0);" onclick="addComponent()">
 126              <img src="<?php echo w2PfindImage('add.png', $m); ?>" width="16" height="16" border="0" />
 127          </a><?php echo w2PendTip(); ?>
 128      </td>
 129  </tr>
 130  <tr>
 131      <td colspan="5" valign="bottom" align="right">
 132          <input type="button" class="button" value="<?php echo $AppUI->_('add'); ?>" onclick="addTasks()" />
 133      </td>
 134  </tr>
 135  </table>
 136  </td>
 137  </td>
 138  </tr>
 139  </tbody>
 140  </table>
 141  </form>
 142  <?php
 143  ?>


Generated: Fri Jan 9 03:00:02 2009 Cross-referenced by PHPXref 0.7