Index: /trunk/server/www/app/models/job.php
===================================================================
--- /trunk/server/www/app/models/job.php (revision 293)
+++ /trunk/server/www/app/models/job.php (revision 295)
@@ -34,5 +34,5 @@
 	 */
 	public $belongsTo = array('Request' => array('counterCache' => true),
-	                          'Platform', 'Application', 'Factory', 'Result');
+	                          'Platform', 'Application', 'Factory', 'Result', 'Format');
 
 	/** @var array Job queries can be quite complex, so use Containable */
Index: /trunk/server/www/app/models/request.php
===================================================================
--- /trunk/server/www/app/models/request.php (revision 294)
+++ /trunk/server/www/app/models/request.php (revision 295)
@@ -41,5 +41,5 @@
 
 	/** @var array Every request belongs to a user and is associated with a document type and a desired output format */
-	public $belongsTo = array('User', 'Format');
+	public $belongsTo = array('User');
 
 	/** @var string A request consists of multiple jobs and has multiple ODF validators */
Index: /trunk/server/www/app/config/sql/schema.php
===================================================================
--- /trunk/server/www/app/config/sql/schema.php (revision 293)
+++ /trunk/server/www/app/config/sql/schema.php (revision 295)
@@ -1,5 +1,5 @@
 <?php 
 /* SVN FILE: $Id$ */
-/* App schema generated on: 2010-02-08 17:02:52 : 1265644912*/
+/* App schema generated on: 2010-02-10 15:02:05 : 1265810465*/
 class AppSchema extends CakeSchema {
 	var $name = 'App';
@@ -99,4 +99,5 @@
 			'application_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
 			'version' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 32),
+			'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
 			'result_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
 			'factory_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
@@ -149,5 +150,4 @@
 			'root' => array('type' => 'text', 'null' => false, 'default' => NULL),
 			'mimetype_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
-			'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
 			'page_start' => array('type' => 'integer', 'null' => false, 'default' => '1'),
 			'page_end' => array('type' => 'integer', 'null' => false, 'default' => '0'),
Index: /trunk/server/www/app/controllers/jobs_controller.php
===================================================================
--- /trunk/server/www/app/controllers/jobs_controller.php (revision 291)
+++ /trunk/server/www/app/controllers/jobs_controller.php (revision 295)
@@ -322,5 +322,5 @@
 					LEFT JOIN `requests` AS `Request` ON (`Job`.`request_id` = `Request`.`id`)
 					LEFT JOIN `applications` AS `Application` ON (`Job`.`application_id` = `Application`.`id`)
-					LEFT JOIN `formats` AS `Format` ON (`Request`.`format_id` = `Format`.`id`)
+					LEFT JOIN `formats` AS `Format` ON (`Job`.`format_id` = `Format`.`id`)
 					LEFT JOIN `mimetypes` AS `Mimetype` on (`Request`.`mimetype_id` = `Mimetype`.`id`)
 					LEFT JOIN `doctypes` AS `Doctype` on (`Mimetype`.`doctype_id` = `Doctype`.`id`)
@@ -330,8 +330,8 @@
 					AND `Job`.`application_id` = '" . $worker['application_id'] . "'
 					AND `Job`.`version` = '" . $worker['version'] . "'
+					AND `Job`.`format_id` IN  (" . implode(', ', $formats) . ")
 					AND `Request`.`state` = " . Request::STATE_QUEUED . "
 					AND `Request`.`expire` > '" . date('Y-m-d H:i:s') . "'
 					AND `Mimetype`.`doctype_id` IN (" . implode(', ', $doctypes) . ")
-					AND `Request`.`format_id` IN  (" . implode(', ', $formats) . ")
 					AND (`Request`.`own_factory` = 0
 						OR (`Request`.`own_factory` = 1 AND `Request`.`user_id` = '" . $this->AuthCert->user('id') . "')
@@ -447,5 +447,5 @@
 			'contain' => array(
 				'Request',
-				'Request.Format',
+				'Format',
 				'Application',
 				'Platform',
@@ -462,10 +462,10 @@
 
 		// Check the return format
-		$format = $this->Job->Request->Format->find('first', array(
+		$format = $this->Job->Format->find('first', array(
 			'recursive' => -1,
 			'conditions' => array('Format.code' => $format_code),
 		));
 
-		if (!$format || ($job['Request']['format_id'] && $job['Request']['Format']['code'] != $format_code)) {
+		if (!$format || ($job['Job']['format_id'] && $job['Format']['code'] != $format_code)) {
 			return array('faultCode' => 1, 'faultString' => 'Wrong document format.');
 		}
Index: /trunk/server/www/app/controllers/requests_controller.php
===================================================================
--- /trunk/server/www/app/controllers/requests_controller.php (revision 294)
+++ /trunk/server/www/app/controllers/requests_controller.php (revision 295)
@@ -31,5 +31,5 @@
 
 	/** @var array Add Request and Worker model */
-	public $uses = array('Request', 'Worker', 'Mimetype', 'User');
+	public $uses = array('Request', 'Worker', 'Mimetype', 'User', 'Format');
 
 	/** @var array Set default sort order for paginate */
@@ -72,5 +72,4 @@
 		
 		$this->Request->contain(array(
-			'Format',
 			'Mimetype',
 			'Mimetype.Doctype',
@@ -222,7 +221,8 @@
 			// Add the jobs to the request
 			$jobs = array();
+			$format_id = $this->data['Request']['format_id'];
 			foreach ($this->data['Request']['App'] as $app) {
 				list($platform_id, $doctype_code, $application_id, $version) = explode('_', $app);
-				$jobs[] = compact('platform_id', 'application_id', 'version');
+				$jobs[] = compact('platform_id', 'application_id', 'version', 'format_id');
 			}
 
@@ -263,5 +263,5 @@
 		$platforms = $this->Worker->Factory->Operatingsystem->Platform->find('all');
 		$doctypes = $this->Worker->Application->Doctype->find('all');
-		$formats = $this->Request->Format->find('list');
+		$formats = $this->Format->find('list');
 		$mimetypes = $this->Mimetype->find('all');
 
@@ -409,5 +409,4 @@
 		$users = $this->Request->User->find('list');
 		$mimetypes = $this->Request->Mimetype->find('list');
-		$formats = $this->Request->Format->find('list');
 		$this->set(compact('users','mimetypes','formats'));
 	}
@@ -442,5 +441,4 @@
 		$users = $this->Request->User->find('list');
 		$mimetypes = $this->Request->Mimetype->find('list');
-		$formats = $this->Request->Format->find('list');
 		$this->set(compact('users','mimetypes','formats'));
 	}
Index: /trunk/server/www/app/views/requests/admin_edit.ctp
===================================================================
--- /trunk/server/www/app/views/requests/admin_edit.ctp (revision 221)
+++ /trunk/server/www/app/views/requests/admin_edit.ctp (revision 295)
@@ -7,5 +7,4 @@
 		echo $form->input('user_id');
 		echo $form->input('ip_address');
-		echo $form->input('format_id', array('empty' => true));
 		echo $form->input('filename');
 		echo $form->input('path');
Index: /trunk/server/www/app/views/requests/admin_add.ctp
===================================================================
--- /trunk/server/www/app/views/requests/admin_add.ctp (revision 221)
+++ /trunk/server/www/app/views/requests/admin_add.ctp (revision 295)
@@ -6,5 +6,4 @@
 		echo $form->input('user_id');
 		echo $form->input('ip_address');
-		echo $form->input('format_id', array('empty' => true));
 		echo $form->input('filename');
 		echo $form->input('path');
Index: /trunk/server/www/app/views/requests/admin_view.ctp
===================================================================
--- /trunk/server/www/app/views/requests/admin_view.ctp (revision 221)
+++ /trunk/server/www/app/views/requests/admin_view.ctp (revision 295)
@@ -1,47 +1,42 @@
 <div class="requests view">
 <h2><?php  __('Request');?></h2>
-	<dl><?php $i = 0; $class = ' class="altrow"';?>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+	<dl>
+		<dt><?php __('Id'); ?></dt>
+		<dd<>
 			<?php echo $request['Request']['id']; ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('User'); ?></dt>
+		<dd<>
 			<?php echo $html->link($request['User']['email_address'], array('controller'=> 'users', 'action'=>'view', $request['User']['id'])); ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('IP address'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('IP address'); ?></dt>
+		<dd<>
 			<?php echo inet_dtop($request['Request']['ip_address']); ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Format'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
-			<?php echo $html->link($request['Format']['name'], array('controller'=> 'formats', 'action'=>'view', $request['Format']['id'])); ?>
-			&nbsp;
-		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Filename'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('Filename'); ?></dt>
+		<dd<>
 			<?php echo $request['Request']['filename']; ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Path'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('Path'); ?></dt>
+		<dd<>
 			<?php echo $request['Request']['path']; ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Mimetype'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('Mimetype'); ?></dt>
+		<dd<>
 			<?php echo $html->link($request['Mimetype']['name'], array('controller'=> 'mimetypes', 'action'=>'view', $request['Mimetype']['id'])); ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('Created'); ?></dt>
+		<dd<>
 			<?php echo $request['Request']['created']; ?>
 			&nbsp;
 		</dd>
-		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
-		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+		<dt><?php __('Modified'); ?></dt>
+		<dd<>
 			<?php echo $request['Request']['modified']; ?>
 			&nbsp;
