Changeset 292
- Timestamp:
- 02/03/10 13:24:54 (11 years ago)
- Location:
- trunk/server/www/app
- Files:
-
- 1 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/www/app/config/sql/schema.php
r291 r292 1 1 <?php 2 2 /* SVN FILE: $Id$ */ 3 /* App schema generated on: 2010-0 1-28 12:01:40 : 1264676740*/3 /* App schema generated on: 2010-02-03 13:02:23 : 1265200163*/ 4 4 class AppSchema extends CakeSchema { 5 5 var $name = 'App'; … … 57 57 ); 58 58 var $galleries = array( 59 'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'), 59 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 60 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'key' => 'index'), 61 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'key' => 'index'), 62 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'key' => 'index'), 60 63 'name' => array('type' => 'string', 'null' => false, 'default' => NULL), 61 64 'slug' => array('type' => 'string', 'null' => false, 'default' => NULL, 'key' => 'index'), … … 66 69 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), 67 70 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), 68 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'slug' => array('column' => 'slug', 'unique' => 0) )71 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'slug' => array('column' => 'slug', 'unique' => 0), 'parent_id' => array('column' => 'parent_id', 'unique' => 0), 'lft' => array('column' => 'lft', 'unique' => 0), 'rght' => array('column' => 'rght', 'unique' => 0)) 69 72 ); 70 73 var $galleries_requests = array( 71 74 'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'), 72 'gallery_id' => array('type' => ' string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'index'),75 'gallery_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'), 73 76 'request_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'index'), 74 77 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'gallery_id' => array('column' => 'gallery_id', 'unique' => 0), 'request_id' => array('column' => 'request_id', 'unique' => 0)) … … 143 146 'ip_address' => array('type' => 'float', 'null' => false, 'default' => NULL, 'length' => 39, 'key' => 'index'), 144 147 'filename' => array('type' => 'string', 'null' => false, 'default' => NULL), 145 'path' => array('type' => ' string', 'null' => false, 'default' => NULL),146 'root' => array('type' => ' string', 'null' => false, 'default' => NULL),148 'path' => array('type' => 'text', 'null' => false, 'default' => NULL), 149 'root' => array('type' => 'text', 'null' => false, 'default' => NULL), 147 150 'mimetype_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 148 151 'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), … … 167 170 'format_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 168 171 'filename' => array('type' => 'string', 'null' => false, 'default' => NULL), 169 'path' => array('type' => ' string', 'null' => false, 'default' => NULL),172 'path' => array('type' => 'text', 'null' => false, 'default' => NULL), 170 173 'mimetype_id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36), 171 174 'state' => array('type' => 'integer', 'null' => false, 'default' => '1'), -
trunk/server/www/app/controllers/galleries_controller.php
r282 r292 78 78 { 79 79 $this->Gallery->contain(array('User', 'Request')); 80 $this->set('galleries', $this->paginate()); 80 $galleries = $this->paginate('Gallery', array('Gallery.parent_id' => null)); 81 82 foreach ($galleries as &$gallery) { 83 $num_documents = $this->Request->query('SELECT COUNT(*) as `count` 84 FROM `requests` AS `Request` 85 LEFT JOIN `galleries_requests` AS `GalleriesRequest` 86 ON `Request`.`id` = `GalleriesRequest`.`request_id` 87 LEFT JOIN `galleries` AS `Gallery` 88 ON `GalleriesRequest`.`gallery_id` = `Gallery`.`id` 89 WHERE 90 `Gallery`.`id` > ' . $gallery['Gallery']['lft'] . ' 91 AND `Gallery`.`id` < ' . $gallery['Gallery']['rght']); 92 $gallery['Gallery']['num_documents'] = sizeof($gallery['Request']) + $num_documents[0][0]['count']; 93 } 94 95 $this->set('galleries', $galleries); 81 96 } 82 97 … … 92 107 } 93 108 109 // Get the gallery 94 110 $gallery = $this->Gallery->find('first', array( 95 111 'conditions' => array('Gallery.slug' => $slug), … … 105 121 )); 106 122 107 $this->set('gallery', $gallery); 123 // Get the children of this gallery 124 $children = $this->Gallery->find('threaded', array( 125 'conditions' => array( 126 'Gallery.id >' => $gallery['Gallery']['lft'], 127 'Gallery.id <' => $gallery['Gallery']['rght'], 128 ), 129 'contain' => array( 130 'Request', 131 'Request.Validator', 132 'Request.Job', 133 'Request.Job.Application', 134 'Request.Job.Platform', 135 'Request.Job.Result', 136 'Request.Job.Result.Validator', 137 ), 138 )); 139 140 // Get the path to this gallery 141 $path = $this->Gallery->getpath($gallery['Gallery']['id']); 142 array_pop($path); 143 144 // Check access 145 $access = $this->_checkAccess($slug); 146 147 $gallery['children'] =& $children; 148 $this->set(compact('gallery', 'path', 'access')); 108 149 } 109 150 -
trunk/server/www/app/controllers/requests_controller.php
r287 r292 45 45 { 46 46 parent::beforeFilter(); 47 $this->AuthCert->allow('add'); 48 49 if (Configure::read('Auth.allowAnonymous')) { 50 $this->AuthCert->allow('view', 'download'); 51 } 47 $this->AuthCert->allow('add', 'view', 'download'); 52 48 } 53 49 -
trunk/server/www/app/models/gallery.php
r256 r292 35 35 public $actsAs = array( 36 36 'Containable', 37 'Sluggable' => array('label' => 'name', 'overwrite' => true) 37 'Sluggable' => array('label' => 'name', 'overwrite' => true), 38 'Tree', 38 39 ); 39 40 -
trunk/server/www/app/views/galleries/index.ctp
r256 r292 21 21 </td> 22 22 <td> 23 <?php echo sizeof($gallery['Request']); ?>23 <?php echo $gallery['Gallery']['num_documents']; ?> 24 24 </td> 25 25 <td> -
trunk/server/www/app/views/galleries/view.ctp
r282 r292 1 1 <div class="galleries view"> 2 <h2><?php echo $gallery['Gallery']['name'];?></h2> 2 <h2> 3 <?php 4 foreach ($path as $parent) { 5 echo $html->link($parent['Gallery']['name'], array('action' => 'view', $parent['Gallery']['slug'])); 6 echo ' / '; 7 } 8 echo $gallery['Gallery']['name']; 9 ?> 10 </h2> 3 11 <?php echo $gallery['Gallery']['description_html'];?> 4 12 </div> … … 13 21 <th><?php __('Created'); ?></th> 14 22 <th><?php __('State'); ?></th> 15 < th class="actions"><?php __('Actions'); ?></th>23 <?php if ($access):?><th class="actions"><?php __('Actions'); ?></th><?php endif;?> 16 24 </tr> 17 <?php foreach ($gallery['Request'] as $request):?> 18 <tr class="request"> 19 <td class="request-name"><?php echo $html->link($request['filename'], array('controller'=> 'requests', 'action'=>'view', $request['id'])); ?></td> 20 <td><?php foreach ($request['Validator'] as $validator) { echo $validatorModel->getStateIcon($validator) . ' '; } ?></td> 21 <td><?php echo $request['created'];?></td> 22 <td><?php echo $requestModel->getState($request); ?></td> 23 <td class="actions"> 24 <?php echo $html->link(__('Remove', true), array('action' => 'remove_document', $gallery['Gallery']['slug'], $request['id'])); ?> 25 </td> 26 </tr> 27 <?php foreach ($request['Job'] as $job):?> 28 <tr<?php if (!$job['Result']) { echo ' class="expired"'; } ?>> 29 <td class="job-name"> 30 <?php 31 if ($job['Result']) { 32 echo $html->link($job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')', array('controller'=> 'results', 'action'=>'view', $job['Result']['id'])); 33 } else { 34 echo $job['Application']['name'] . ' ' . $job['version'] . ' (' . $job['Platform']['name'] . ')'; 35 } 36 ?> 37 </td> 38 <td> 39 <?php 40 if (isset($job['Result']['Validator'])) { 41 foreach ($job['Result']['Validator'] as $validator) { 42 echo $validatorModel->getStateIcon($validator) . ' '; 43 } 44 } 45 ?> 46 </td> 47 <td><?php echo isset($job['Result']['created']) ? $job['Result']['created'] : $job['created']; ?></td> 48 <td><?php echo $resultModel->getState($job['Result']); ?></td> 49 <td class="actions"> </td> 50 </tr> 51 <?php endforeach; ?> 52 <?php endforeach; ?> 25 <?php echo $this->element('gallery', array('gallery' => $gallery, 'indent' => 0)); ?> 53 26 </table> 54 27 <?php endif; ?> 55 28 </div> 56 29 57 <div class="actions"> 58 <ul> 59 <li><?php echo $html->link(__('Add a document', true), array('action'=>'add_document', $gallery['Gallery']['slug'])); ?> </li> 60 <li><?php echo $html->link(__('Edit this gallery', true), array('action'=>'edit', $gallery['Gallery']['slug'])); ?> </li> 61 <li><?php echo $html->link(__('Delete this gallery', true), array('action'=>'delete', $gallery['Gallery']['slug']), null, sprintf(__('Are you sure you want to delete "%s"?', true), $gallery['Gallery']['name'])); ?> </li> 62 </ul> 63 </div> 30 <?php if ($access):?> 31 <div class="actions"> 32 <ul> 33 <li><?php echo $html->link(__('Add a document', true), array('action'=>'add_document', $gallery['Gallery']['slug'])); ?> </li> 34 <li><?php echo $html->link(__('Edit this gallery', true), array('action'=>'edit', $gallery['Gallery']['slug'])); ?> </li> 35 <li><?php echo $html->link(__('Delete this gallery', true), array('action'=>'delete', $gallery['Gallery']['slug']), null, sprintf(__('Are you sure you want to delete "%s"?', true), $gallery['Gallery']['name'])); ?> </li> 36 </ul> 37 </div> 38 <?php endif;?> -
trunk/server/www/app/views/helpers/result_model.php
r282 r292 42 42 43 43 if (!isset($result['Result']['state'])) { 44 return '';44 return __('Failed', true); 45 45 } 46 46 -
trunk/server/www/app/webroot/css/cake.override.css
r286 r292 212 212 /* Galleries */ 213 213 214 #gallery-results .subgallery { background-color: #ddf; } 214 215 #gallery-results .request { background-color: #ddf; } 215 #gallery-results .request-name { text-align: left; } 216 #gallery-results .job-name { text-align: left; padding-left: 4em; } 216 217 #gallery-results .request-name, #gallery-results .job-name, #gallery-results .subgallery-name { text-align: left; } 218 #gallery-results .subgallery-name a { color: #003d4c; } 217 219 #gallery-results .job-name a { font-weight: normal; } 220 218 221 #gallery-results .expired { color: #999; } 222 223 .galleries.view h2 a { font-weight: normal; color: #006bbe; } 219 224 220 225 /* Mailinglist registration callout */
Note: See TracChangeset
for help on using the changeset viewer.