[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/files/ -> co.php (source)

   1  <?php /* $Id: co.php 40 2008-02-11 12:11:44Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/files/co.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  $file_id = intval(w2PgetParam($_GET, 'file_id', 0));
   7  // check permissions for this record

   8  $perms = &$AppUI->acl();
   9  
  10  $canEdit = $perms->checkModuleItem($m, 'edit', $file_id);
  11  if (!$canEdit) {
  12      $AppUI->redirect('m=public&a=access_denied');
  13  }
  14  $canAdmin = $perms->checkModule('system', 'edit');
  15  
  16  // load the companies class to retrieved denied companies

  17  require_once ($AppUI->getModuleClass('projects'));
  18  
  19  $file_parent = intval(w2PgetParam($_GET, 'file_parent', 0));
  20  
  21  // check if this record has dependencies to prevent deletion

  22  $msg = '';
  23  $obj = new CFile();
  24  
  25  // load the record data

  26  if ($file_id > 0 && !$obj->load($file_id)) {
  27      $AppUI->setMsg('File');
  28      $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
  29      $AppUI->redirect();
  30  }
  31  
  32  // setup the title block

  33  $titleBlock = new CTitleBlock('Checkout', 'folder5.png', $m, "$m.$a");
  34  $titleBlock->addCrumb('?m=files', 'files list');
  35  $titleBlock->show();
  36  
  37  if ($obj->file_project) {
  38      $file_project = $obj->file_project;
  39  }
  40  if ($obj->file_task) {
  41      $file_task = $obj->file_task;
  42      $task_name = $obj->getTaskName();
  43  } elseif ($file_task) {
  44      $q = new DBQuery;
  45      $q->addTable('tasks');
  46      $q->addQuery('task_name');
  47      $q->addWhere('task_id=' . (int)$file_task);
  48      $task_name = $q->loadResult();
  49      $q->clear();
  50  } else {
  51      $task_name = '';
  52  }
  53  
  54  $extra = array('where' => 'project_active<>0');
  55  $project = new CProject();
  56  $projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects');
  57  $projects = arrayMerge(array('0' => $AppUI->_('All')), $projects);
  58  ?>
  59  
  60  <script language='javascript'>
  61  function popFile( params ) {
  62      fileloader = window.open("fileviewer.php?"+params,"mywindow","location=1,status=1,scrollbars=0,width=80,height=80");
  63      fileloader.moveTo(0,0);
  64  }
  65  </script>
  66  
  67  <table width="100%" border="0" cellpadding="3" cellspacing="3" class="std">
  68  
  69  <form name="coFrm" action="?m=files" method="post">
  70      <input type="hidden" name="dosql" value="do_file_co" />
  71      <input type="hidden" name="del" value="0" />
  72      <input type="hidden" name="file_id" value="<?php echo $file_id; ?>" />
  73      <input type="hidden" name="file_checkout" value="<?php echo $AppUI->user_id; ?>" />
  74      <input type="hidden" name="file_version_id" value="<?php echo $obj->file_version_id; ?>" />
  75          
  76  
  77  <tr>
  78      <td width="100%" valign="top" align="center">
  79          <table cellspacing="1" cellpadding="2" width="60%">
  80      <?php if ($file_id) { ?>
  81          <tr>
  82              <td align="right" nowrap="nowrap"><?php echo $AppUI->_('File Name'); ?>:</td>
  83              <td align="left" class="hilite"><?php echo strlen($obj->file_name) == 0 ? "n/a" : $obj->file_name; ?></td>
  84          </tr>
  85          <tr valign="top">
  86              <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Type'); ?>:</td>
  87              <td align="left" class="hilite"><?php echo $obj->file_type; ?></td>
  88          </tr>
  89          <tr>
  90              <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Size'); ?>:</td>
  91              <td align="left" class="hilite"><?php echo $obj->file_size; ?></td>
  92          </tr>
  93          <tr>
  94              <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Uploaded By'); ?>:</td>
  95              <td align="left" class="hilite"><?php echo $obj->getOwner(); ?></td>
  96          </tr>
  97      <?php } ?>
  98          <tr>
  99              <td align="right" nowrap="nowrap"><?php echo $AppUI->_('CO Reason'); ?>:</td>
 100              <td align="left">
 101                  <textarea name="file_co_reason" class="textarea" rows="4" style="width:270px"><?php echo $obj->file_co_reason; ?></textarea>
 102              </td>
 103          </tr>
 104  
 105          <tr>
 106              <td align="right" nowrap="nowrap">&nbsp;</td>
 107              <td align="left"><input type="checkbox" name="notify" id="notify" checked="checked" /><label for="notify"><?php echo $AppUI->_('Notify Assignees of Task or Project Owner by Email'); ?></label></td>        
 108          </tr>
 109  
 110          <tr>
 111              <td align="right" nowrap="nowrap">&nbsp;</td>
 112              <td align="left"><input type="checkbox" name="notify_contacts" id="notify_contacts" checked="checked" /><label for="notify_contacts"><?php echo $AppUI->_('Notify Project and Task Contacts'); ?></label></td>        
 113          </tr>
 114          
 115          </table>
 116      </td>
 117  </tr>
 118  <tr>
 119      <td>
 120          <input class="button" type="button" name="cancel" value="<?php echo $AppUI->_('cancel'); ?>" onclick="javascript:if(confirm('<?php echo $AppUI->_('Are you sure you want to cancel?', UI_OUTPUT_JS); ?>')){location.href = './index.php?m=files';}" />
 121      </td>
 122      <td align="right">
 123          <input type="submit" class="button" value="<?php echo $AppUI->_('submit'); ?>" />
 124      </td>
 125  </tr>
 126  </form>
 127  </table>


Generated: Wed Jan 7 03:00:01 2009 Cross-referenced by PHPXref 0.7