Changeset 295
- Timestamp:
- 02/10/10 14:56:13 (6 months ago)
- Location:
- trunk/server/www/app
- Files:
-
- 8 modified
-
config/sql/schema.php (modified) (3 diffs)
-
controllers/jobs_controller.php (modified) (4 diffs)
-
controllers/requests_controller.php (modified) (6 diffs)
-
models/job.php (modified) (1 diff)
-
models/request.php (modified) (1 diff)
-
views/requests/admin_add.ctp (modified) (1 diff)
-
views/requests/admin_edit.ctp (modified) (1 diff)
-
views/requests/admin_view.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/www/app/config/sql/schema.php
r293 r295 1 1 <?php 2 2 /* SVN FILE: $Id$ */ 3 /* App schema generated on: 2010-02- 08 17:02:52 : 1265644912*/3 /* App schema generated on: 2010-02-10 15:02:05 : 1265810465*/ 4 4 class AppSchema extends CakeSchema { 5 5 var $name = 'App'; … … 99 99 'application_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 100 100 'version' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 32), 101 'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 101 102 'result_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 102 103 'factory_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), … … 149 150 'root' => array('type' => 'text', 'null' => false, 'default' => NULL), 150 151 'mimetype_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 151 'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),152 152 'page_start' => array('type' => 'integer', 'null' => false, 'default' => '1'), 153 153 'page_end' => array('type' => 'integer', 'null' => false, 'default' => '0'), -
trunk/server/www/app/controllers/jobs_controller.php
r291 r295 322 322 LEFT JOIN `requests` AS `Request` ON (`Job`.`request_id` = `Request`.`id`) 323 323 LEFT JOIN `applications` AS `Application` ON (`Job`.`application_id` = `Application`.`id`) 324 LEFT JOIN `formats` AS `Format` ON (` Request`.`format_id` = `Format`.`id`)324 LEFT JOIN `formats` AS `Format` ON (`Job`.`format_id` = `Format`.`id`) 325 325 LEFT JOIN `mimetypes` AS `Mimetype` on (`Request`.`mimetype_id` = `Mimetype`.`id`) 326 326 LEFT JOIN `doctypes` AS `Doctype` on (`Mimetype`.`doctype_id` = `Doctype`.`id`) … … 330 330 AND `Job`.`application_id` = '" . $worker['application_id'] . "' 331 331 AND `Job`.`version` = '" . $worker['version'] . "' 332 AND `Job`.`format_id` IN (" . implode(', ', $formats) . ") 332 333 AND `Request`.`state` = " . Request::STATE_QUEUED . " 333 334 AND `Request`.`expire` > '" . date('Y-m-d H:i:s') . "' 334 335 AND `Mimetype`.`doctype_id` IN (" . implode(', ', $doctypes) . ") 335 AND `Request`.`format_id` IN (" . implode(', ', $formats) . ")336 336 AND (`Request`.`own_factory` = 0 337 337 OR (`Request`.`own_factory` = 1 AND `Request`.`user_id` = '" . $this->AuthCert->user('id') . "') … … 447 447 'contain' => array( 448 448 'Request', 449 ' Request.Format',449 'Format', 450 450 'Application', 451 451 'Platform', … … 462 462 463 463 // Check the return format 464 $format = $this->Job-> Request->Format->find('first', array(464 $format = $this->Job->Format->find('first', array( 465 465 'recursive' => -1, 466 466 'conditions' => array('Format.code' => $format_code), 467 467 )); 468 468 469 if (!$format || ($job[' Request']['format_id'] && $job['Request']['Format']['code'] != $format_code)) {469 if (!$format || ($job['Job']['format_id'] && $job['Format']['code'] != $format_code)) { 470 470 return array('faultCode' => 1, 'faultString' => 'Wrong document format.'); 471 471 } -
trunk/server/www/app/controllers/requests_controller.php
r294 r295 31 31 32 32 /** @var array Add Request and Worker model */ 33 public $uses = array('Request', 'Worker', 'Mimetype', 'User' );33 public $uses = array('Request', 'Worker', 'Mimetype', 'User', 'Format'); 34 34 35 35 /** @var array Set default sort order for paginate */ … … 72 72 73 73 $this->Request->contain(array( 74 'Format',75 74 'Mimetype', 76 75 'Mimetype.Doctype', … … 222 221 // Add the jobs to the request 223 222 $jobs = array(); 223 $format_id = $this->data['Request']['format_id']; 224 224 foreach ($this->data['Request']['App'] as $app) { 225 225 list($platform_id, $doctype_code, $application_id, $version) = explode('_', $app); 226 $jobs[] = compact('platform_id', 'application_id', 'version' );226 $jobs[] = compact('platform_id', 'application_id', 'version', 'format_id'); 227 227 } 228 228 … … 263 263 $platforms = $this->Worker->Factory->Operatingsystem->Platform->find('all'); 264 264 $doctypes = $this->Worker->Application->Doctype->find('all'); 265 $formats = $this-> Request->Format->find('list');265 $formats = $this->Format->find('list'); 266 266 $mimetypes = $this->Mimetype->find('all'); 267 267 … … 409 409 $users = $this->Request->User->find('list'); 410 410 $mimetypes = $this->Request->Mimetype->find('list'); 411 $formats = $this->Request->Format->find('list');412 411 $this->set(compact('users','mimetypes','formats')); 413 412 } … … 442 441 $users = $this->Request->User->find('list'); 443 442 $mimetypes = $this->Request->Mimetype->find('list'); 444 $formats = $this->Request->Format->find('list');445 443 $this->set(compact('users','mimetypes','formats')); 446 444 } -
trunk/server/www/app/models/job.php
r293 r295 34 34 */ 35 35 public $belongsTo = array('Request' => array('counterCache' => true), 36 'Platform', 'Application', 'Factory', 'Result' );36 'Platform', 'Application', 'Factory', 'Result', 'Format'); 37 37 38 38 /** @var array Job queries can be quite complex, so use Containable */ -
trunk/server/www/app/models/request.php
r294 r295 41 41 42 42 /** @var array Every request belongs to a user and is associated with a document type and a desired output format */ 43 public $belongsTo = array('User' , 'Format');43 public $belongsTo = array('User'); 44 44 45 45 /** @var string A request consists of multiple jobs and has multiple ODF validators */ -
trunk/server/www/app/views/requests/admin_add.ctp
r221 r295 6 6 echo $form->input('user_id'); 7 7 echo $form->input('ip_address'); 8 echo $form->input('format_id', array('empty' => true));9 8 echo $form->input('filename'); 10 9 echo $form->input('path'); -
trunk/server/www/app/views/requests/admin_edit.ctp
r221 r295 7 7 echo $form->input('user_id'); 8 8 echo $form->input('ip_address'); 9 echo $form->input('format_id', array('empty' => true));10 9 echo $form->input('filename'); 11 10 echo $form->input('path'); -
trunk/server/www/app/views/requests/admin_view.ctp
r221 r295 1 1 <div class="requests view"> 2 2 <h2><?php __('Request');?></h2> 3 <dl> <?php $i = 0; $class = ' class="altrow"';?>4 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>5 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>3 <dl> 4 <dt><?php __('Id'); ?></dt> 5 <dd<> 6 6 <?php echo $request['Request']['id']; ?> 7 7 8 8 </dd> 9 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>10 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>9 <dt><?php __('User'); ?></dt> 10 <dd<> 11 11 <?php echo $html->link($request['User']['email_address'], array('controller'=> 'users', 'action'=>'view', $request['User']['id'])); ?> 12 12 13 13 </dd> 14 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('IP address'); ?></dt>15 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>14 <dt><?php __('IP address'); ?></dt> 15 <dd<> 16 16 <?php echo inet_dtop($request['Request']['ip_address']); ?> 17 17 18 18 </dd> 19 <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Format'); ?></dt> 20 <dd<?php if ($i++ % 2 == 0) echo $class;?>> 21 <?php echo $html->link($request['Format']['name'], array('controller'=> 'formats', 'action'=>'view', $request['Format']['id'])); ?> 22 23 </dd> 24 <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Filename'); ?></dt> 25 <dd<?php if ($i++ % 2 == 0) echo $class;?>> 19 <dt><?php __('Filename'); ?></dt> 20 <dd<> 26 21 <?php echo $request['Request']['filename']; ?> 27 22 28 23 </dd> 29 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('Path'); ?></dt>30 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>24 <dt><?php __('Path'); ?></dt> 25 <dd<> 31 26 <?php echo $request['Request']['path']; ?> 32 27 33 28 </dd> 34 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('Mimetype'); ?></dt>35 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>29 <dt><?php __('Mimetype'); ?></dt> 30 <dd<> 36 31 <?php echo $html->link($request['Mimetype']['name'], array('controller'=> 'mimetypes', 'action'=>'view', $request['Mimetype']['id'])); ?> 37 32 38 33 </dd> 39 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>40 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>34 <dt><?php __('Created'); ?></dt> 35 <dd<> 41 36 <?php echo $request['Request']['created']; ?> 42 37 43 38 </dd> 44 <dt <?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>45 <dd< ?php if ($i++ % 2 == 0) echo $class;?>>39 <dt><?php __('Modified'); ?></dt> 40 <dd<> 46 41 <?php echo $request['Request']['modified']; ?> 47 42
