- Timestamp:
- 03/17/10 12:20:11 (11 years ago)
- Location:
- trunk/server/www/app
- Files:
-
- 8 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/www/app/config/sql/schema.php
r314 r324 1 1 <?php 2 2 /* SVN FILE: $Id$ */ 3 /* App schema generated on: 2010-03-1 0 12:03:56 : 1268219576*/3 /* App schema generated on: 2010-03-17 11:03:05 : 1268821265*/ 4 4 class AppSchema extends CakeSchema { 5 5 var $name = 'App'; … … 216 216 'version' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 32), 217 217 'development' => array('type' => 'boolean', 'null' => false, 'default' => NULL), 218 'testsuite' => array('type' => 'boolean', 'null' => false, 'default' => '0'), 218 219 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 219 220 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), -
trunk/server/www/app/controllers/factories_controller.php
r111 r324 99 99 $this->set(array( 100 100 'factory' => $factory, 101 ' isOwner' => ($factory['Factory']['user_id'] == $this->AuthCert->user('id')),101 'canEdit' => ($factory['Factory']['user_id'] == $this->AuthCert->user('id')), 102 102 )); 103 103 } … … 163 163 164 164 /** 165 * Delete a factory 166 * 167 * @param string $id The factory ID 168 * @return void 169 */ 170 public function delete($id = null) 171 { 172 if (!$id) { 173 $this->Session->setFlash(__('Invalid id for Factory', true)); 174 $this->redirect(array('action'=>'index')); 175 } 176 177 $this->Factory->id = $id; 178 if ($this->Factory->field('user_id') != $this->AuthCert->user('id')) { 179 $this->Session->setFlash(__('Invalid Factory', true)); 180 $this->redirect(array('action'=>'index')); 181 } 182 183 if ($this->Factory->del($id)) { 184 $this->Session->setFlash(__('Factory deleted', true)); 185 $this->redirect(array('action'=>'index')); 186 } 187 } 188 189 165 * Show a list of all factories 166 * @param return void 167 */ 190 168 public function admin_index() 191 169 { 192 $this->Factory->recursive = 0; 193 $this->set('factories', $this->paginate()); 194 } 195 170 $this->index(); 171 $this->render('index'); 172 } 173 174 /** 175 * View a list of all active factories 176 * @param return void 177 */ 178 public function admin_active() 179 { 180 $this->active(); 181 $this->render('index'); 182 } 183 184 /** 185 * View a single factory 186 * @param string $id The factory ID 187 * @param return void 188 */ 196 189 public function admin_view($id = null) 197 190 { 198 if (!$id) { 199 $this->Session->setFlash(__('Invalid Factory.', true)); 200 $this->redirect(array('action'=>'index')); 201 } 202 $this->set('factory', $this->Factory->read(null, $id)); 203 } 204 191 $this->view($id); 192 $this->set('canEdit', true); 193 $this->render('view'); 194 } 195 196 /** 197 * Add a new factory 198 * @param return void 199 */ 205 200 public function admin_add() 206 201 { 207 202 if (!empty($this->data)) { 208 203 $this->Factory->create(); 209 if ($this->Factory->save($this->data)) { 210 $this->Session->setFlash(__('The Factory has been saved', true)); 211 $this->redirect(array('action'=>'index')); 212 } else { 213 $this->Session->setFlash(__('The Factory could not be saved. Please, try again.', true)); 214 } 215 } 204 $this->data['Factory']['user_id'] = $this->AuthCert->user('id'); 205 206 if ($this->Factory->save($this->data)) { 207 $this->Session->setFlash(__('The Factory has been saved', true)); 208 $this->redirect(array('action'=>'view', $this->Factory->id)); 209 } else { 210 $this->Session->setFlash(__('The Factory could not be saved. Please, try again.', true)); 211 } 212 } 213 216 214 $users = $this->Factory->User->find('list'); 217 $operatingsystems = $this->Factory->Operatingsystem->find(' list');215 $operatingsystems = $this->Factory->Operatingsystem->find('all', array('recursive' => -1)); 218 216 $this->set(compact('users', 'operatingsystems')); 219 } 220 217 $this->render('edit'); 218 } 219 220 /** 221 * Edit a factory 222 * @param string $id The factory ID 223 * @param return void 224 */ 221 225 public function admin_edit($id = null) 222 226 { … … 225 229 $this->redirect(array('action'=>'index')); 226 230 } 231 227 232 if (!empty($this->data)) { 228 233 if ($this->Factory->save($this->data)) { … … 233 238 } 234 239 } 240 235 241 if (empty($this->data)) { 236 242 $this->data = $this->Factory->read(null, $id); 237 243 } 244 238 245 $users = $this->Factory->User->find('list'); 239 $operatingsystems = $this->Factory->Operatingsystem->find(' list');246 $operatingsystems = $this->Factory->Operatingsystem->find('all', array('recursive' => -1)); 240 247 $this->set(compact('users','operatingsystems')); 241 } 242 243 public function admin_delete($id = null) 244 { 245 if (!$id) { 246 $this->Session->setFlash(__('Invalid id for Factory', true)); 247 $this->redirect(array('action'=>'index')); 248 } 249 if ($this->Factory->del($id)) { 250 $this->Session->setFlash(__('Factory deleted', true)); 251 $this->redirect(array('action'=>'index')); 252 } 253 } 254 248 $this->render('edit'); 249 } 255 250 } 251 256 252 ?> -
trunk/server/www/app/controllers/jobs_controller.php
r297 r324 304 304 foreach ($formats as &$format) { $format = "'" . $format . "'"; } 305 305 foreach ($doctypes as &$doctype) { $doctype = "'" . $doctype . "'"; } 306 307 $sqlWhere = ''; 308 if ($worker['testsuite'] == 0) { 309 $sqlWhere = 'AND `Request`.`priority` < 10'; 310 } 306 311 307 312 $jobSet = $this->Job->query("SELECT -
trunk/server/www/app/controllers/workers_controller.php
r234 r324 32 32 /** 33 33 * Redirect worker index to factory index 34 *35 34 * @return void 36 35 */ … … 42 41 /** 43 42 * Add a new worker to a factory 44 *45 43 * @param string $factory_id The factory ID to add the worker to 46 44 * @return void … … 84 82 /** 85 83 * Edit a worker 86 *87 84 * @param string $id The worker ID 88 85 * @return void … … 144 141 } 145 142 146 143 /** 144 * View a list of all workers 145 */ 147 146 public function admin_index() 148 147 { … … 151 150 } 152 151 153 public function admin_view($id = null) 154 { 155 if (!$id) { 156 $this->Session->setFlash(__('Invalid Worker.', true)); 157 $this->redirect(array('action'=>'index')); 158 } 159 $this->set('worker', $this->Worker->read(null, $id)); 160 } 161 162 public function admin_add() 163 { 152 /** 153 * Add a new worker to a factory 154 * @param string $factory_id The factory ID to add the worker to 155 * @return void 156 */ 157 public function admin_add($factory_id = null) 158 { 159 if ($factory_id == null && !empty($this->data)) { 160 $factory_id = $this->data['Worker']['factory_id']; 161 } 162 163 if (!$factory_id) { 164 $this->Session->setFlash(__('Invalid Factory ID', true)); 165 $this->redirect(array('controller' => 'factories', 'action'=>'index')); 166 } 167 $this->Worker->Factory->id = $factory_id; 168 164 169 if (!empty($this->data)) { 165 170 $this->Worker->create(); 166 171 if ($this->Worker->save($this->data)) { 167 172 $this->Session->setFlash(__('The Worker has been saved', true)); 168 $this->redirect(array(' action'=>'index'));173 $this->redirect(array('controller' => 'factories', 'action'=>'view', $factory_id)); 169 174 } else { 170 175 $this->Session->setFlash(__('The Worker could not be saved. Please, try again.', true)); 171 176 } 172 177 } 173 $formats = $this->Worker->Format->find('list'); 174 $factories = $this->Worker->Factory->find('list'); 175 $applications = $this->Worker->Application->find('list'); 176 $this->set(compact('formats', 'factories', 'applications')); 177 } 178 178 179 $this->data['Worker']['factory_id'] = $factory_id; 180 $this->data['Factory']['name'] = $this->Worker->Factory->field('name'); 181 $formats = $this->Worker->Format->find('list'); 182 $applications = $this->Worker->Application->find('list'); 183 $this->set(compact('formats', 'applications')); 184 185 $this->render('edit'); 186 } 187 188 /** 189 * Edit a worker 190 * @param string $id The worker ID 191 * @return void 192 */ 179 193 public function admin_edit($id = null) 180 194 { 181 if (!$id && empty($this->data)) { 182 $this->Session->setFlash(__('Invalid Worker', true)); 183 $this->redirect(array('action'=>'index')); 184 } 185 if (!empty($this->data)) { 186 if ($this->Worker->save($this->data)) { 187 $this->Session->setFlash(__('The Worker has been saved', true)); 188 $this->redirect(array('action'=>'index')); 189 } else { 190 $this->Session->setFlash(__('The Worker could not be saved. Please, try again.', true)); 191 } 192 } 193 if (empty($this->data)) { 195 if (!$id) { 196 $this->Session->setFlash(__('Invalid application for this factory', true)); 197 $this->redirect(array('action'=>'index')); 198 } 199 200 $this->Worker->id = $id; 201 $this->Worker->Factory->id = $this->Worker->field('factory_id'); 202 203 if (!empty($this->data)) { 204 if ($this->Worker->save($this->data)) { 205 $this->Session->setFlash(__('The application has been saved', true)); 206 $this->redirect(array('controller' => 'factories', 'action'=>'view', $this->Worker->Factory->id)); 207 } else { 208 $this->Session->setFlash(__('The application could not be saved. Please, try again.', true)); 209 } 210 } else { 194 211 $this->data = $this->Worker->read(null, $id); 195 212 } 196 $formats = $this->Worker->Format->find('list'); 197 $factories = $this->Worker->Factory->find('list'); 198 $applications = $this->Worker->Application->find('list'); 199 $this->set(compact('formats','factories','applications')); 200 } 201 213 214 $formats = $this->Worker->Format->find('list'); 215 $applications = $this->Worker->Application->find('list'); 216 $this->set(compact('formats','applications')); 217 $this->render('edit'); 218 } 219 220 /** 221 * Delete a worker 222 * 223 * @param string $id The worker ID 224 * @return void 225 */ 202 226 public function admin_delete($id = null) 203 227 { 204 228 if (!$id) { 205 $this->Session->setFlash(__('Invalid id for Worker', true)); 206 $this->redirect(array('action'=>'index')); 207 } 229 $this->Session->setFlash(__('Invalid application id', true)); 230 $this->redirect(array('action'=>'index')); 231 } 232 233 $this->Worker->id = $id; 234 $this->Worker->Factory->id = $this->Worker->field('factory_id'); 235 208 236 if ($this->Worker->del($id)) { 209 $this->Session->setFlash(__('Worker deleted', true)); 210 $this->redirect(array('action'=>'index')); 211 } 212 } 213 237 $this->Session->setFlash(__('The application has been deleted from this factory', true)); 238 $this->redirect(array('controller' => 'factories', 'action'=>'view', $this->Worker->Factory->id)); 239 } 240 } 214 241 } 242 215 243 ?> -
trunk/server/www/app/models/worker.php
r297 r324 55 55 /** 56 56 * Get a list of all active worker types. That is, unique combinations of Platform, Doctype and Application 57 * @param boolean $stable If true, return only stable factories 57 * @param boolean $stable If true, return only stable factories that want to participate in test suites 58 58 * @return array 59 59 */ … … 66 66 $stableTime = date('Y-m-d H:i:s', time() - Configure::read('Factory.stabletime')); 67 67 $sqlWhere = "AND `Factory`.`active_since` != '0000-00-00 00:00:00' 68 69 AND `Worker`.`development` = 0";68 AND `Factory`.`active_since` < '$stableTime' 69 AND `Worker`.`testsuite` = 1"; 70 70 } else { 71 71 $sqlWhere = ''; -
trunk/server/www/app/views/factories/edit.ctp
r93 r324 3 3 <fieldset> 4 4 <legend> 5 <?php if ($this->action == 'add' ) {5 <?php if ($this->action == 'add' || $this->action == 'admin_add') { 6 6 __('Add a new factory'); 7 7 } else { … … 11 11 </legend> 12 12 <?php 13 if ($this->params['prefix'] == 'admin') { 14 echo $form->input('user_id'); 15 } 13 16 echo $form->input('name'); 14 17 echo $form->input('hardware'); … … 32 35 </select> 33 36 </div> 37 <?php 38 if ($this->params['prefix'] == 'admin') { 39 echo $form->input('last_poll', array('empty' => true)); 40 echo $form->input('active_since', array('empty' => true)); 41 } 42 ?> 34 43 </fieldset> 35 44 <?php echo $form->end('Submit');?> -
trunk/server/www/app/views/factories/index.ctp
r291 r324 3 3 <div class="actions"> 4 4 <ul> 5 <?php if ($this->action == 'index' ): ?>5 <?php if ($this->action == 'index' || $this->action == 'admin_index'): ?> 6 6 <li><?php __('View all'); ?></li> 7 7 <li><?php echo $html->link(__('View active', true), array('action'=>'active')); ?> </li> -
trunk/server/www/app/views/factories/view.ctp
r291 r324 32 32 </dd> 33 33 </dl> 34 <?php if ($ isOwner): ?>34 <?php if ($canEdit): ?> 35 35 <p><?php echo $html->link(__('Edit this factory', true), array('controller'=> 'factories', 'action'=>'edit', $factory['Factory']['id']));?> </li> 36 36 <?php endif; ?> … … 45 45 <th><?php __('Development'); ?></th> 46 46 <th><?php __('Output formats'); ?></th> 47 <?php if ($isOwner): ?> 47 <th><?php __('Use for test suites'); ?></th> 48 <?php if ($canEdit): ?> 48 49 <th class="actions"><?php __('Actions');?></th> 49 50 <?php endif; ?> … … 55 56 <td><?php if ($worker['development']) { __('Unstable'); } else { __('Stable'); } ?></td> 56 57 <td><?php echo implode(', ', Set::extract('/Format/name', $worker));?></td> 57 <?php if ($isOwner): ?> 58 <td><?php echo $worker['testsuite'] ? __('Yes', true) : __('No', true);?></td> 59 <?php if ($canEdit): ?> 58 60 <td class="actions"> 59 61 <?php echo $html->link(__('Edit', true), array('controller'=> 'workers', 'action'=>'edit', $worker['id'])); ?> … … 66 68 <?php endif; ?> 67 69 68 <?php if ($ isOwner): ?>70 <?php if ($canEdit): ?> 69 71 <p><?php echo $html->link(__('Add an application', true), array('controller'=> 'workers', 'action'=>'add', $factory['Factory']['id']));?> </li> 70 72 <?php endif; ?> -
trunk/server/www/app/views/workers/admin_index.ctp
r166 r324 9 9 <table cellpadding="0" cellspacing="0"> 10 10 <tr> 11 <th><?php echo $paginator->sort('id');?></th>12 11 <th><?php echo $paginator->sort('factory_id');?></th> 13 12 <th><?php echo $paginator->sort('application_id');?></th> … … 27 26 ?> 28 27 <tr<?php echo $class;?>> 29 <td>30 <?php echo $worker['Worker']['id']; ?>31 </td>32 28 <td> 33 29 <?php echo $html->link($worker['Factory']['name'], array('controller'=> 'factories', 'action'=>'view', $worker['Factory']['id'])); ?> … … 49 45 </td> 50 46 <td class="actions"> 51 <?php echo $html->link(__('View', true), array('action'=>'view', $worker['Worker']['id'])); ?>52 47 <?php echo $html->link(__('Edit', true), array('action'=>'edit', $worker['Worker']['id'])); ?> 53 48 <?php echo $html->link(__('Delete', true), array('action'=>'delete', $worker['Worker']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $worker['Worker']['id'])); ?> … … 62 57 <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> 63 58 </div> 64 <div class="actions">65 <ul>66 <li><?php echo $html->link(__('New Worker', true), array('action'=>'add')); ?></li>67 <li><?php echo $html->link(__('List Factories', true), array('controller'=> 'factories', 'action'=>'index')); ?> </li>68 <li><?php echo $html->link(__('New Factory', true), array('controller'=> 'factories', 'action'=>'add')); ?> </li>69 <li><?php echo $html->link(__('List Applications', true), array('controller'=> 'applications', 'action'=>'index')); ?> </li>70 <li><?php echo $html->link(__('New Application', true), array('controller'=> 'applications', 'action'=>'add')); ?> </li>71 <li><?php echo $html->link(__('List Formats', true), array('controller'=> 'formats', 'action'=>'index')); ?> </li>72 <li><?php echo $html->link(__('New Format', true), array('controller'=> 'formats', 'action'=>'add')); ?> </li>73 </ul>74 </div> -
trunk/server/www/app/views/workers/edit.ctp
r166 r324 4 4 <legend> 5 5 <?php 6 if ($this->action == 'add' ) {6 if ($this->action == 'add' || $this->action == 'admin_add') { 7 7 printf(__('Add an application to factory "%s"', true), $this->data['Factory']['name']); 8 8 } else { … … 12 12 </legend> 13 13 <?php 14 if ($this->action == 'add' ) {14 if ($this->action == 'add' || $this->action == 'admin_add') { 15 15 echo $form->hidden('factory_id'); 16 16 } … … 19 19 echo $form->input('version'); 20 20 echo $form->input('development', array('label' => __('This is an unstable development version, beta or release candidate', true))); 21 echo $form->input('testsuite', array('label' => __('Participate in rendering the ODF test suites (Note: This can be hundreds of jobs)', true))); 21 22 echo $form->input('Format', array('label' => __('Supported output formats', true), 'type' => 'select', 'multiple' => 'checkbox')); 22 23 ?>
Note: See TracChangeset
for help on using the changeset viewer.