OSDN Git Service

システム詳細画面にキャラクターサムネイル表示
authorCake <cake_67@users.sourceforge.jp>
Thu, 25 Mar 2010 15:46:45 +0000 (00:46 +0900)
committerCake <cake_67@users.sourceforge.jp>
Thu, 25 Mar 2010 15:46:45 +0000 (00:46 +0900)
app/controllers/systems_controller.php
app/models/system.php
app/views/elements/box.ctp
app/views/elements/character_picture_index.ctp
app/views/systems/admin_view.ctp
app/views/systems/view.ctp
app/webroot/css/box.css
app/webroot/css/ie.css

index b3fbbd0..5c96f0a 100644 (file)
@@ -61,6 +61,7 @@ class SystemsController extends AppController {
        }
 
        function view($id = null) {
+               $this->System->hasMany['Character']['limit'] = 60;
                $this->_view($id);
        }
 
@@ -70,6 +71,8 @@ class SystemsController extends AppController {
        }
 
        function admin_view($id = null) {
+               $this->System->hasMany['Character']['limit'] = 30;
+               unset($this->System->hasMany['Character']['conditions']['Character.public_flag']);
                $this->_view($id);
        }
 
@@ -179,11 +182,7 @@ class SystemsController extends AppController {
                $conditions['System.id'] = $id;
                if ($this->isAdmin) {
                        $this->System->hasMany['Profile']['fields'] = '';
-               }
-
-               $system = $this->System->find('first', array(
-                       'conditions' => $conditions,
-                       'contain' => array(
+                       $contain = array(
                                'Character',
                                'Profile' => array(
                                        'ProfileSelect',
@@ -192,8 +191,20 @@ class SystemsController extends AppController {
                                        ),
                                ),
                                'Attachment',
-                       ),
-                       'recursive' => 3,
+                       );
+                       $recursive = 3;
+               } else {
+                       $contain = array(
+                               'Character',
+                               'Attachment',
+                       );
+                       $recursive = 1;
+               }
+
+               $system = $this->System->find('first', array(
+                       'conditions' => $conditions,
+                       'contain' => $contain,
+                       'recursive' => $recursive,
                ));
 
                if (!isset($system['System']) || empty($system['System'])) {
@@ -201,6 +212,17 @@ class SystemsController extends AppController {
                        $this->redirect(array('action'=>'index'));
                }
 
+               // 全キャラクター数取得
+               if (empty($system['Character'])) {
+                       $system['System']['character_num'] = 0;
+               }
+
+               $system['System']['character_num'] = $this->System->Character->find('count', array(
+                       'conditions' => array_merge($this->System->hasMany['Character']['conditions'],
+                               array('Character.system_id' => $system['System']['id'])),
+                       'recursive' => -1,
+               ));
+
                $this->set('system', $this->HtmlEscape->nl2br_escaped($system));
 
                $this->set('profile_types', $this->System->Profile->profile_type);
index d18a2f5..47cf4f5 100644 (file)
@@ -93,7 +93,12 @@ class System extends AppModel {
                        'foreignKey' => 'foreign_key',
                        'dependent' => true,
                        'conditions' => array('Attachment.model' => 'System'),
-                       'fields' => '',
+                       'fields' => array(
+                               'Attachment.id',
+                               'Attachment.foreign_key',
+                               'Attachment.dirname',
+                               'Attachment.basename',
+                       ),
                        'order' => '',
                        'limit' => '',
                        'offset' => '',
index 85a2d1e..646a207 100644 (file)
@@ -4,12 +4,6 @@
 <?php
 if (isset($body)) {
        echo $body;
-} else {
-       if (isset($noBody)) {
-               echo $noBody;
-       } else {
-               echo __('No Data')
-       }
 }
 ?>
 </div>
index ca6d0a9..d071e96 100644 (file)
@@ -200,11 +200,6 @@ foreach ($characterPictures as $characterPicture):
 </tr>
 </table>
 <?php else: ?>
-<?php if (isset($nodata)): ?>
-<?php echo $nodata; ?>
-<?php else: ?>
-<?php echo $html->div('noData', __('No data', true)); ?>
-<?php endif; ?>
 <?php endif; ?>
 </div>
 
index 6c1184f..6a4a047 100644 (file)
@@ -1,22 +1,15 @@
 <div class="systems view">
-<h2><?php echo $system['System']['name']; ?></h2>
 
-<p>
-<table>
-<tbody>
-<tr>
-<th>
-       <?php __('Image'); ?>
-</th>
-<td colspan="3" class="photo">
+<div class="system_data">
 <?php
+       $system_name = $system['System']['name'];
+
        $url = null;
        if ($system['System']['url']) {
                $url = $system['System']['url'];
        }
-
        $file = $upfile->file(
-               'filter/s', 
+               'filter/xs', 
                CorePlus::get_value($system, 'Attachment.0'),
                array(
                        'model_name' => 'System', 
@@ -24,7 +17,7 @@
                        'nodata' => 'image',
                )
        );
-       echo $upfile->embed(
+       $system_img = $upfile->embed(
                $file,
                array(
                        'linkTo' => $url,
                        ),
                )
        );
+
+       $system_link = null;
+       if (isset($system['System']['url'])) {
+               $system_link = $html->tag('span', 
+                       "[".$html->link(__('System Home', true), $system['System']['url'], array('target'=>'_blank'), false, false)."]",
+                       array(
+                               'class' => 'link',
+                       )
+               );
+       }
+       $public = $html->tag('span', 
+               $select->get_i18n_public_flag($system['System']['public_flag'], $public_flags),
+               array(
+                       'class' => 'text publicFlag',
+               )
+       );
+       if ($system['System']['set_npc']) {
+               $npc_status = __('NPC Setting: Use', true);
+       } else {
+               $npc_status = __('NPC Setting: No Use', true);
+       }
+       $npc_use = $html->tag('span', 
+               $npc_status,
+               array(
+                       'class' => 'text',
+               )
+       );
+
+       $footer = '<ul>'.
+               '<li>'.$html->link(__('Edit System', true), array('action' => 'edit', $system['System']['id'])).'</li>'.
+               '<li>'.$html->link(__('Delete System', true), array('action' => 'delete', $system['System']['id']), null, sprintf(__('Are you sure you want to delete %s?', true), $system['System']['name'])).'</li>'.
+               '</ul>';
+
+       echo $this->renderElement('box', array(
+               'header' => $system_img. $system_name. $public. $system_link. $npc_use,
+               'body' => $system['System']['detail']."&nbsp;",
+               'footer' => $footer,
+       ));
 ?>
-</td>
-</tr>
-<tr>
-<th>
-       <?php __('URL'); ?>
-</th>
-<td colspan="3">
-<?php if ($system['System']['url']): ?>
-       <?php echo $html->link($system['System']['url'], $system['System']['url'], array('target'=>'_blank'), false, false); ?>
-<?php else: ?>
-       &nbsp;
-<?php endif; ?>
-</td>
-</tr>
-<tr>
-<th>
-       <?php __('Public'); ?>
-</th>
-<td>
-       <?php echo $select->get_i18n_public_flag($system['System']['public_flag'], $public_flags) ?>
-</td>
-<th>
-       <?php __('Use NPC Setting'); ?>
-</th>
-<td>
-<?php if ($system['System']['set_npc']): ?>
-       <?php echo __('Use', true) ?>
-<?php else: ?>
-       <?php echo __('No Use', true) ?>
-<?php endif; ?>
-</td>
-</tr>
-<tr>
-<th>
-       <?php __('Detail'); ?>
-</th>
-<td colspan="3">
-       <?php echo $system['System']['detail']; ?>
-       &nbsp;
-</td>
-</tr>
-</tbody>
-</table>
 </div>
-</p>
 
-<div class="actions">
-<ul>
-<li><?php echo $html->link(__('Edit System', true), array('action' => 'edit', $system['System']['id'])); ?> </li>
-<li><?php echo $html->link(__('Delete System', true), array('action' => 'delete', $system['System']['id']), null, sprintf(__('Are you sure you want to delete %s?', true), $system['System']['name'])); ?> </li>
-</ul>
+<div class="characters">
+<?php
+       $total =  $html->tag('span', sprintf(__('Total Characters %d', true), $system['System']['character_num']), array('class' => 'total_chara_num'));
+
+       echo $this->renderElement('character_picture_table', array(
+               'header' => __('Characters', true). $total,
+               'characters' => $system['Character'],
+               'previewVersion' => 'xs',
+               'colNum' => 15,
+               'id' => null,
+               'isUser' => false,
+               'isCharacter' => false,
+               'isSystem' => false,
+               'isModified' => false,
+               'more_url' => array(
+                       'controller' => 'characters', 
+                       'action' => 'index',
+                       'system:'.$system['System']['id'],
+               ),
+       ));
+?>
 </div>
 
-<hr>
+<div class="profiles">
+<div class="box">
+<div class="boxHeader"><h3>
+<?php
+       __('Profiles');
 
-<div class="profiles view">
-<h2><?php __('Profiles');?></h2>
-<p>
-<div class="actions">
-<ul>
-<li><?php echo $html->link(__('New Profile', true), array('controller' => 'profiles', 'action' => 'add', $system['System']['id'])); ?></li>
-</ul>
-</div>
-</p>
-<p>
+       echo $html->tag('span',
+               "[".$html->link(__('New Profile', true), 
+                       array('controller' => 'profiles', 'action' => 'add', $system['System']['id']),
+                       array(
+                               'class' => 'link',
+                       )
+               )."]"
+       );
+?>
+</h3></div>
+<div>
 <table>
 <tr>
 <th>
@@ -219,3 +227,14 @@ foreach ($system['Profile'] as $profile):
 <?php endforeach; ?>
 </table>
 </div>
+
+<div class="boxFooter">
+<div class="actions">
+<ul>
+<li><?php echo $html->link(__('New Profile', true), array('controller' => 'profiles', 'action' => 'add', $system['System']['id'])); ?></li>
+</ul>
+</div>
+</div>
+</div>
+
+</div>
\ No newline at end of file
index 9acd0bb..fd3ca14 100644 (file)
@@ -1,21 +1,15 @@
 <div class="systems view">
-<h2><?php echo $system['System']['name']; ?></h2>
-<p>
-<table>
-<tbody>
-<tr>
-<th>
-       <?php __('Image'); ?>
-</th>
-<td colspan="3" class="photo">
+
+<div class="system_data">
 <?php
+       $system_name = $system['System']['name'];
+
        $url = null;
        if ($system['System']['url']) {
                $url = $system['System']['url'];
        }
-
        $file = $upfile->file(
-               'filter/s', 
+               'filter/xs', 
                CorePlus::get_value($system, 'Attachment.0'),
                array(
                        'model_name' => 'System', 
@@ -23,7 +17,7 @@
                        'nodata' => 'image',
                )
        );
-       echo $upfile->embed(
+       $system_img = $upfile->embed(
                $file,
                array(
                        'linkTo' => $url,
                        ),
                )
        );
+
+       $system_link = null;
+       if (isset($system['System']['url'])) {
+               $system_link = $html->tag('span', 
+                       "[".$html->link(__('System Home', true), $system['System']['url'], array('target'=>'_blank'), false, false)."]",
+                       array(
+                               'class' => 'link',
+                       )
+               );
+       }
+
+       $footer = null;
+
+       echo $this->renderElement('box', array(
+               'header' => $system_img. $system_name. $system_link,
+               'body' => $system['System']['detail']."&nbsp;",
+               'footer' => $footer,
+       ));
 ?>
-</td>
-</tr>
-<tr>
-<th>
-       <?php __('URL'); ?>
-</th>
-<td colspan="3">
-<?php if ($system['System']['url']): ?>
-       <?php echo $html->link($system['System']['url'], $system['System']['url'], array('target'=>'_blank'), false, false); ?>
-<?php else: ?>
-       &nbsp;
-<?php endif; ?>
-</td>
-</tr>
-<tr>
-<th>
-       <?php __('Detail'); ?>
-</th>
-<td colspan="3">
-       <?php echo $system['System']['detail']; ?>
-       &nbsp;
-</td>
-</tr>
-</tbody>
-</table>
 </div>
-<div class="actions">
-<ul>
-</ul>
-</div>
-</p>
-
-<hr>
 
-<div class="profiles view">
-<h2><?php __('Profiles');?></h2>
-<p>
-<table>
-<tr>
-<th>
-       <?php echo __('Name');?>
-</th>
-<th>
-       <?php echo __('Sample');?>
-</th>
-</tr>
+<div class="characters">
 <?php
-       $i = 0;
-       foreach ($system['Profile'] as $profile):
-               $class = null;
-               $profiledisp->set_profile_type4view($profile);
-?>
-<tr>
-<td>
-       <?php echo $profile['name']; ?>
-</td>
-<td class="edit<?php if ($profiledisp->profile_type['is_table']): ?> table<?php endif; ?>">
-<?php 
-       $profiledisp->disp_forms4profile_type($profile, 2, 0);
+       $total =  $html->tag('span', sprintf(__('Total Characters %d', true), $system['System']['character_num']), array('class' => 'total_chara_num'));
+
+       echo $this->renderElement('character_picture_table', array(
+               'header' => __('Characters', true). $total,
+               'characters' => $system['Character'],
+               'previewVersion' => 'xs',
+               'colNum' => 15,
+               'id' => null,
+               'isUser' => false,
+               'isCharacter' => false,
+               'isSystem' => false,
+               'isModified' => false,
+               'more_url' => array(
+                       'controller' => 'characters', 
+                       'action' => 'index',
+                       'system:'.$system['System']['id'],
+               ),
+       ));
 ?>
-</td>
-</tr>
-<?php endforeach; ?>
-</table>
+</div>
+
 </div>
index 791f8a5..1cdf3f1 100644 (file)
        background: transparent url('skin/default/boxHeader.gif') repeat-x 0 100%;
        text-align: left;
 }
+.boxHeader a,
+.boxHeader a:visited,
+.boxHeader a:hover {
+       color: #003399;
+}
 .boxHeader h3 {
        display: inline;
        overflow: hidden;
        overflow: hidden;
        display: inline;
        padding-left: 10px;
-       eidth: 350px;
+       width: 350px;
+}
+.boxHeader span {
+       overflow: hidden;
+       padding-left: 10px;
+       font-size: 80%;
+}
+.boxHeader img {
+       margin-right: 7px;
 }
 
 .boxBody {
 }
 .boxFooter {
 }
+.boxFooter a,
+.boxFooter a:visited,
+.boxFooter a:hover {
+       color: #003399;
+}
+.boxFooter ul li a {
+       background: transparent;
+       padding-right: 10px;
+       font-size: 120%;
+}
 .boxFooter .editLink {
        font-size: 120%;
        border: 0 none;
        color: #000;
 }
 
+/* ページごとの設定 */
+div.systems .system_data .box {
+       width: 720px;
+       margin-bottom: 20px;
+}
+div.systems .system_data .boxHeader {
+       padding-bottom: 0;
+}
+div.systems .system_data .boxHeader h3 {
+       width: 720px;
+       overflow: hidden;
+       font-size: 250%;
+}
+div.systems .system_data .boxHeader span {
+       font-size: 50%;
+}
+div.systems .system_data .boxBody {
+       width: 720px;
+       padding: 10px;
+}
+div.systems .system_data .boxFooter {
+       width: 720px;
+       overflow: hidden;
+       padding-left: 10px;
+}
+div.systems .characters .box {
+       margin-bottom: 20px;
+}
+div.systems .profiles .box table {
+       margin-top: 5px;
+}
+
 /* 各サイズごとの設定 */
+.CharacterTable_xs_15
+{
+       width: 720px;
+       overflow: hidden;
+}
+.CharacterTable_xs_15 td
+{
+       width: 32px;
+       overflow: hidden;
+}
+.CharacterTable_xs_15 div.picture
+{
+       width: 32px;
+       height: 32px;
+       overflow: hidden;
+       padding: 3px;
+}
+.CharacterTable_xs_15 div.picture a.characterThmbnail
+{
+       width: 32px;
+       height: 32px;
+       overflow: hidden;
+}
+.CharacterTable_xs_15 div.picture a.characterThmbnail span.image_caption
+{
+       display: none;
+}
+.CharacterTable_xs_15 .boxFooter .editLink
+{
+       padding: 0 32px;
+}
+
+
 .CharacterTable_s_5
 {
        width: 400px;
index fec8a28..127102c 100644 (file)
@@ -33,18 +33,21 @@ div.picture a.shadow {
 .boxBody div.picture .image_caption {
        left: 4px;
 }
-.CharacterTable_m_5 div.picture a.characterThmbnail span.image_caption
+
+/* サイズごとの設定 */
+.CharacterTable_xs_15 a.shadow {
+       border-width: 2px;
+}
+.CharacterTable_xs_15 td
 {
-       width: 117px;
-       top: 106px;
-       left: 5px;
+       width: 37px;
 }
-.CharacterTable_ll_4 div.picture a.characterThmbnail span.image_caption,
-.CharacterTable_ll_5 div.picture a.characterThmbnail span.image_caption
+.CharacterTable_xs_15 div.picture
 {
-       top: 166px;
-       width: 177px;
-       left: 4px;
+       width: 37px;
+       height: 37px;
+       margin: 0;
+       padding: 0;
 }
 
 .CharacterTable_s_5