- Timestamp:
- 02/23/10 14:09:15 (11 years ago)
- Location:
- trunk/server/www/app
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/www/app/config/core.php.default
r297 r298 361 361 Configure::write('Testsuite.user_id', ''); 362 362 Configure::write('Testsuite.group_id', ''); 363 /** 364 * Size limit for galleries. Galleries with more than these amount of requests will be shown in abbreviated form 365 */ 366 Configure::write('Gallery.abbreviate', 25); 363 367 ?> -
trunk/server/www/app/controllers/galleries_controller.php
r297 r298 155 155 )); 156 156 157 // Find out how many requests this gallery has. This determins the type of view 158 $requestCount = $this->Gallery->requestCount($gallery['Gallery']['id'], true); 159 $abbreviate = ($requestCount >= Configure::read('Gallery.abbreviate')); 160 157 161 // Get the children of this gallery 158 // TODO: Do this without recursion below Request because it generates ridiculous amounts of159 // duplicate queries that slow the system *a lot*160 162 $children = $this->Gallery->find('all', array( 161 163 'conditions' => array( … … 174 176 )); 175 177 176 $request['Job'] = $this->Request->Job->find('all', array( 177 'conditions' => array('Job.request_id' => $request['id']), 178 'contain' => array( 179 'Application', 180 'Format', 181 'Platform', 182 'Result', 183 'Result.Validator' 184 ), 185 'order' => array( 186 'Application.name ASC', 187 'Job.version ASC', 188 'Platform.name ASC', 189 'Format.name ASC', 190 ), 191 )); 192 193 // Fix array layout to match a regular query layout 194 foreach ($request['Job'] as &$job) { 195 foreach ($job['Job'] as $attr => $value) { 196 $job[$attr] = $value; 178 if (!$abbreviate) { 179 $request['Job'] = $this->Request->Job->find('all', array( 180 'conditions' => array('Job.request_id' => $request['id']), 181 'contain' => array( 182 'Application', 183 'Format', 184 'Platform', 185 'Result', 186 'Result.Validator' 187 ), 188 'order' => array( 189 'Application.name ASC', 190 'Job.version ASC', 191 'Platform.name ASC', 192 'Format.name ASC', 193 ), 194 )); 195 196 // Fix array layout to match a regular query layout 197 foreach ($request['Job'] as &$job) { 198 foreach ($job['Job'] as $attr => $value) { 199 $job[$attr] = $value; 200 } 201 unset($job['Job']); 197 202 } 198 unset($job['Job']);199 203 } 200 204 } … … 209 213 // Check access 210 214 $access = $this->_checkAccess($slug); 211 $this->set(compact('gallery', 'path', 'access' ));215 $this->set(compact('gallery', 'path', 'access', 'abbreviate')); 212 216 } 213 217 -
trunk/server/www/app/views/elements/gallery.ctp
r297 r298 3 3 <td class="subgallery-name" style="padding-left: <?php echo $indent;?>em"><?php echo $html->link($child['Gallery']['name'] . '/', array('action' => 'view', $child['Gallery']['slug']));?></td> 4 4 <td> </td> 5 <?php if ($abbreviate): ?> 6 <td>-</td> 7 <?php endif; ?> 5 8 <td>-</td> 6 9 <td>-</td> … … 13 16 <?php foreach ($gallery['Request'] as $request):?> 14 17 <tr class="request"> 15 <td class="request-name" style="padding-left: <?php echo $indent;?>em"><?php echo $html->link($request['filename'], array('controller'=> 'requests', 'action'=>'view', $request['id'])); ?></td> 18 <td class="request-name" style="padding-left: <?php echo $indent;?>em"> 19 <?php echo $html->link($request['filename'], array('controller'=> 'requests', 'action'=>'view', $request['id'])); ?> 20 </td> 16 21 <td><?php foreach ($request['Validator'] as $validator) { echo $validatorModel->getStateIcon($validator) . ' '; } ?></td> 22 <?php if ($abbreviate): ?> 23 <td> 24 <?php echo $request['result_count'] . '/' . $request['job_count']; ?> 25 </td> 26 <?php endif; ?> 17 27 <td><?php echo $request['created'];?></td> 18 28 <td><?php echo $requestModel->getState($request); ?></td> … … 23 33 <?php endif;?> 24 34 </tr> 25 <?php foreach ($request['Job'] as $job):?> 26 <tr class="result<?php if (!$job['Result'] || !$job['Result']['id']) { echo ' expired'; } ?>"> 27 <td class="job-name" style="padding-left: <?php echo $indent + 2;?>em"> 28 <?php 29 echo $jobModel->getFormatIcon($job); 30 if ($job['Result'] && $job['Result']['id']) { 31 echo $html->link($job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')', array('controller'=> 'results', 'action'=>'view', $job['Result']['id'])); 32 } else { 33 echo $job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')'; 34 } 35 ?> 36 </td> 37 <td> 38 <?php 39 if (isset($job['Result']['Validator'])) { 40 foreach ($job['Result']['Validator'] as $validator) { 41 echo $validatorModel->getStateIcon($validator) . ' '; 35 <?php if (!$abbreviate): ?> 36 <?php foreach ($request['Job'] as $job):?> 37 <tr class="result<?php if (!$job['Result'] || !$job['Result']['id']) { echo ' expired'; } ?>"> 38 <td class="job-name" style="padding-left: <?php echo $indent + 2;?>em"> 39 <?php 40 echo $jobModel->getFormatIcon($job); 41 if ($job['Result'] && $job['Result']['id']) { 42 echo $html->link($job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')', array('controller'=> 'results', 'action'=>'view', $job['Result']['id'])); 43 } else { 44 echo $job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')'; 42 45 } 43 } 44 ?> 45 </td> 46 <td><?php echo isset($job['Result']['created']) ? $job['Result']['created'] : $job['created']; ?></td> 47 <td><?php echo $jobModel->getState($job, $request['state']); ?></td> 48 <?php if ($access):?> 49 <td class="actions"> </td> 50 <?php endif;?> 51 </tr> 52 <?php endforeach; ?> 46 ?> 47 </td> 48 <td> 49 <?php 50 if (isset($job['Result']['Validator'])) { 51 foreach ($job['Result']['Validator'] as $validator) { 52 echo $validatorModel->getStateIcon($validator) . ' '; 53 } 54 } 55 ?> 56 </td> 57 <td><?php echo isset($job['Result']['created']) ? $job['Result']['created'] : $job['created']; ?></td> 58 <td><?php echo $jobModel->getState($job, $request['state']); ?></td> 59 <?php if ($access):?> 60 <td class="actions"> </td> 61 <?php endif;?> 62 </tr> 63 <?php endforeach; ?> 64 <?php endif; ?> 53 65 <?php endforeach; ?> 54 66 <?php endif; ?> -
trunk/server/www/app/views/galleries/view.ctp
r293 r298 18 18 <th><?php __('File'); ?></th> 19 19 <th><?php __('Validators'); ?></th> 20 <?php if ($abbreviate): ?> 21 <th><?php __('Jobs'); ?></th> 22 <?php endif; ?> 20 23 <th><?php __('Created'); ?></th> 21 24 <th><?php __('State'); ?></th>
Note: See TracChangeset
for help on using the changeset viewer.