OSDN Git Service

一般ユーザによるキャラクターシートスキンアップロード機能追加
authorCake <cake_67@users.sourceforge.jp>
Thu, 16 Dec 2010 07:07:05 +0000 (16:07 +0900)
committerCake <cake_67@users.sourceforge.jp>
Thu, 16 Dec 2010 07:15:03 +0000 (16:15 +0900)
28 files changed:
app/config/sql/install/create_table.sql
app/controllers/app_controller.php
app/controllers/character_sheets_controller.php
app/controllers/characters_controller.php
app/controllers/systems_controller.php
app/locale/jpn/LC_MESSAGES/default.po
app/models/character_sheet.php
app/models/site_config.php
app/models/user.php
app/views/character_sheets/add.ctp [new file with mode: 0644]
app/views/character_sheets/admin_add.ctp
app/views/character_sheets/admin_index.ctp
app/views/character_sheets/admin_view.ctp
app/views/character_sheets/index.ctp [new file with mode: 0644]
app/views/character_sheets/view.ctp [new file with mode: 0644]
app/views/elements/character_sheet_add.ctp [new file with mode: 0644]
app/views/elements/character_sheet_index.ctp [new file with mode: 0644]
app/views/elements/character_sheet_view.ctp [new file with mode: 0644]
app/views/elements/character_skinchanger.ctp
app/views/elements/home_left.ctp
app/views/elements/sidenav_admin_character.ctp
app/views/elements/sidenav_character.ctp
app/views/elements/sidenav_characterskin.ctp
app/views/elements/sidenav_system.ctp
app/views/layouts/default.ctp
app/views/site_configs/admin_edit.ctp
app/views/systems/view.ctp
app/views/users/admin_view.ctp

index 6cd425a..516c9ec 100644 (file)
@@ -118,15 +118,21 @@ CREATE TABLE `systems` (
 CREATE TABLE `character_sheets` (
   `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
   `system_id` INTEGER UNSIGNED NULL,
+  `user_id` INTEGER UNSIGNED NOT NULL,
   `key_name` VARCHAR(40) NOT NULL,
   `name` VARCHAR(64) NOT NULL,
   `public_flag` ENUM('public', 'private') NOT NULL DEFAULT 'public',
   `sort_order` INTEGER UNSIGNED NOT NULL,
+  `created` DATETIME NULL,
+  `modified` DATETIME NULL,
   PRIMARY KEY(`id`),
-  INDEX `character_sheets_system`(`system_id`, `public_flag`, `sort_order`),
+  INDEX `character_sheets_system`(`system_id`, `public_flag`),
+  INDEX `character_sheets_user`(`user_id`, `public_flag`),
   UNIQUE INDEX `character_sheets_key_name`(`key_name`),
   CONSTRAINT `fk_systems-character_sheets`
-    FOREIGN KEY (`system_id`) REFERENCES `systems` (`id`) ON DELETE CASCADE
+    FOREIGN KEY (`system_id`) REFERENCES `systems` (`id`) ON DELETE CASCADE,
+  CONSTRAINT `fk_users-character_sheets`
+    FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
 ) TYPE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE `profiles` (
@@ -198,8 +204,8 @@ CREATE TABLE `characters_has_profiles` (
   `public_flag` ENUM('public', 'private') NOT NULL DEFAULT 'public',
   `link_value` TEXT NOT NULL,
   PRIMARY KEY(`id`),
-  INDEX `characters_has_profiles_character`(`character_id`),
-  INDEX `characters_has_profiles_character_public`(`character_id`, `public_flag`),
+  INDEX `characters_has_profiles_character` (`character_id`),
+  INDEX `characters_has_profiles_character_public` (`character_id`, `public_flag`),
   CONSTRAINT `fk_profiles-characters_has_profiles`
     FOREIGN KEY (`profile_id`) REFERENCES `profiles` (`id`) ON DELETE CASCADE,
   CONSTRAINT `fk_profile_selects-characters_has_profiles`
index 7b50d38..e5d6b42 100644 (file)
@@ -288,7 +288,17 @@ class AppController extends Controller
 
                $contain = array(
                         'Attachment',
+                        'CharacterSheet' => array(
+                               'System',
+                        ),
                );
+
+               if ($id == $this->user_id || $isAdmin === true) {
+                       unset($this->User->hasMany['CharacterSheet']['conditions']['CharacterSheet.public_flag']);
+               } else {
+                       $this->User->hasMany['CharacterSheet']['conditions']['CharacterSheet.public_flag'] = 'public';
+               }
+
                if ($isAdmin === true || $isDelete === true) {
                        $contain = array_merge($contain, array(
                                'Character',
@@ -301,7 +311,7 @@ class AppController extends Controller
                if (empty($contain)) {
                        $recursive = -1;
                } else {
-                       $recursive = Set::countDim($contain);
+                       $recursive = Set::countDim($contain, true);
                }
 
                $user = $this->User->find('first', array(
@@ -314,6 +324,39 @@ class AppController extends Controller
                return $user;
        }
 
+       /* 指定Systemを取得 */
+       function _getThisSystem($id, $isAdmin = false)
+       {
+               static $this_system;
+               static $prev_id;
+               static $prev_isAdmin;
+
+               if (!empty($this_system) 
+                       && (!empty($prev_id) && $id == $prev_id)
+                       && ($isAdmin == $prev_isAdmin)) {
+                       return $this_system;
+               }
+
+               $prev_id = $id;
+               $prev_isAdmin = $isAdmin;
+               $system_conditions['System.id'] = $id;
+               if ($isAdmin === false) {
+                       $system_conditions['System.public_flag'] = 'public';
+               }
+
+               $this_system = $this->{$this->modelClass}->System->find('first', array(
+                       'conditions' => $system_conditions,
+                       'recursive' => -1,
+               ));
+
+               if (!isset($this_system['System'])) {
+                       $this->Session->setFlash(__('Invalid System.', true));
+                       $this->redirect(array('action' => 'index'));
+               }
+
+               return $this_system;
+       }
+
        /* デモモードチェック */
        function _check_demo()
        {
@@ -704,6 +747,19 @@ class AppController extends Controller
                return $data;
        }
 
+       function _checkCharaSheeOwner($characterSheet)
+       {
+               if (!isset($characterSheet['CharacterSheet']) || empty($characterSheet['CharacterSheet']) || !isset($characterSheet['CharacterSheet']['user_id']) || empty($characterSheet['CharacterSheet']['user_id'])) {
+                       return false;
+               }
+
+               if ($characterSheet['CharacterSheet']['user_id'] == $this->user_id) {
+                       return true;
+               }
+
+               return false;
+       }
+
 }
 
 /*
index 450ba5c..ce2d0b7 100644 (file)
@@ -25,6 +25,7 @@ class CharacterSheetsController extends AppController {
                'recursive' => 1,
                'contain' => array(
                        'System',
+                       'User',
                ),
                'limit' => 20,
                'order' => array(
@@ -42,6 +43,10 @@ class CharacterSheetsController extends AppController {
 
                parent::beforeFilter();
 
+               // Cache
+               $this->cacheAction = array(
+               );
+
                // 認証なしアクセス可
        }
 
@@ -54,21 +59,29 @@ class CharacterSheetsController extends AppController {
 
        /* アクションメソッド */
 
+       function index($system_id = null) {
+               // Check
+               $this->_checkCharaSheeAuth($system_id);
+
+               $this->_index($system_id, false);
+       }
+
        function admin_index($system_id = null) {
+
+               $this->_index($system_id, true);
+       }
+
+       function _index($system_id = null, $isAdmin = false) {
+               // user_id指定
+               if (!$isAdmin) {
+                       // character_sheets絞込み
+                       $this->paginate['conditions']['CharacterSheet.user_id'] = $this->user_id;
+               }
+
                // $system_id指定
                if (!empty($system_id)) {
                        // System情報取得
-                       $this_system = $this->CharacterSheet->System->find('first', array(
-                               'conditions' => array(
-                                       'System.id' => $system_id,
-                               ),
-                               'recursive' => -1,
-                       ));
-
-                       if (!isset($this_system['System'])) {
-                               $this->Session->setFlash(__('Invalid System.', true));
-                               $this->redirect(array('controller' => 'character_sheets', 'action' => 'index'));
-                       }
+                       $this_system = $this->__getThisSystem($system_id, $isAdmin);
                        $this->set('this_system', $this_system);
 
                        // character_sheets絞込み
@@ -82,26 +95,50 @@ class CharacterSheetsController extends AppController {
                $this->set('title_for_layout', " - ". __('List of All CharacterSheets', true));
        }
 
+       function view($id = null) {
+               // Check
+               $this->_checkCharaSheeAuth();
+
+               $this->_view($id , false);
+       }
+
        function admin_view($id = null) {
+
+               $this->_view($id , true);
+       }
+
+       function _view($id = null, $isAdmin = true) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid CharacterSheet.', true));
                        $this->redirect(array('action'=>'index'));
                }
 
+               $contain = array(
+                       'System' => array(
+                               'Character',
+                       ),
+               );
+               if ($isAdmin) {
+                       $contain[] = 'User';
+               }
+
                $characterSheet = $this->CharacterSheet->find('first', array(
                        'conditions' => array('CharacterSheet.id' => $id),
                        'fields' => '',
                        'recursive' => 2,
-                       'contain' => array(
-                               'System' => array(
-                                       'Character',
-                               ),
-                       )
+                       'contain' => $contain,
                ));
+               $characterSheet = $this->__restore_html_system($characterSheet);
+               
                if (empty($characterSheet)) {
                        $this->Session->setFlash(__('Invalid CharacterSheet.', true));
                        $this->redirect(array('action'=>'index'));
                }
+               // 一般ユーザの場合、自身のキャラシのみ
+               if (empty($isAdmin)) {
+                       $this->__checkCharaSheeOwner($characterSheet);
+               }
+
                $this->set('characterSheets', $characterSheet);
 
                // キャラシビュー表示
@@ -122,20 +159,36 @@ class CharacterSheetsController extends AppController {
                $this->set('title_for_layout', " - ". __('CharacterSheets', true));
        }
 
+       function add($system_id = null) {
+               // Check
+               $this->_checkCharaSheeAuth($system_id);
+
+               $this->_add($system_id, false);
+       }
+
+
        function admin_add($system_id = null) {
+
+               $this->_add($system_id, true);
+       }
+
+       function _add($system_id = null, $isAdmin = false) {
                $systems = $this->_get_systems(null);
                $this->set(compact('systems'));
 
+               // System情報取得
                $this_system = array();
                if (!empty($system_id)) {
                        if (!empty($this->data)) {
                                $this->data['CharacterSheet']['system_id'] = $system_id;
                        }
-                       $this_system = $this->CharacterSheet->System->read(null, $system_id);
+                       $this_system = $this->__getThisSystem($system_id, $isAdmin);
                }
                $this->set('this_system', $this_system);
 
                if (!empty($this->data)) {
+                       $this->data['CharacterSheet']['user_id'] = $this->user_id;
+
                        // Dir作れなかった場合のロールバック用
                        $dataSource = $this->CharacterSheet->getDataSource();
                        $dataSource->begin($this);
@@ -161,11 +214,37 @@ class CharacterSheetsController extends AppController {
                $this->set('title_for_layout', " - ". __('Add CharacterSheet', true));
        }
 
+       function edit($id = null) {
+               // Check
+               $this->_checkCharaSheeAuth();
+
+               $this->_edit($id, false);
+       }
+
        function admin_edit($id = null) {
-               if (!$id && empty($this->data)) {
+
+               $this->_edit($id, true);
+       }
+
+       function _edit($id = null, $isAdmin = false) {
+               if (!$id) {
                        $this->Session->setFlash(__('Invalid CharacterSheet', true));
                        $this->redirect(array('action'=>'index'));
                }
+
+               $characterSheet = $this->CharacterSheet->find('first', array(
+                       'conditions' => array('CharacterSheet.id' => $id),
+                       'recursive' => -1,
+               ));
+               if (empty($characterSheet)) {
+                       $this->Session->setFlash(__('Invalid CharacterSheet.', true));
+                       $this->redirect(array('action'=>'index'));
+               }
+               // 一般ユーザの場合、自身のキャラシのみ
+               if (empty($isAdmin)) {
+                       $this->__checkCharaSheeOwner($characterSheet);
+               }
+
                if (!empty($this->data)) {
                        if ($this->CharacterSheet->save($this->data, array('fieldList' => $this->CharacterSheet->fields['edit']))) {
                                $this->Session->setFlash(__('The CharacterSheet has been saved', true));
@@ -177,17 +256,36 @@ class CharacterSheetsController extends AppController {
                $this->redirect(array('action'=>'view', $id));
        }
 
+       function delete($id = null) {
+               // Check
+               $this->_checkCharaSheeAuth();
+
+               $this->_delete($id, true);
+       }
+
        function admin_delete($id = null) {
+
+               $this->_delete($id, true);
+       }
+
+       function _delete($id = null, $isAdmin = false) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid id for CharacterSheet', true));
                        $this->redirect(array('action'=>'index'));
                }
 
-               $characterSheet = $this->CharacterSheet->read(null, $id);
+               $characterSheet = $this->CharacterSheet->find('first', array(
+                       'conditions' => array('CharacterSheet.id' => $id),
+                       'recursive' => -1,
+               ));
                if (empty($characterSheet)) {
                        $this->Session->setFlash(__('Invalid CharacterSheet.', true));
                        $this->redirect(array('action'=>'index'));
                }
+               // 一般ユーザの場合、自身のキャラシのみ
+               if (empty($isAdmin)) {
+                       $this->__checkCharaSheeOwner($characterSheet);
+               }
 
                if ($this->CharacterSheet->delete($id)) {
                        $dir = $this->getSkinDir($characterSheet['CharacterSheet']['key_name']);
@@ -204,17 +302,36 @@ class CharacterSheetsController extends AppController {
                $this->set('title_for_layout', " - ". __('Delete CharacterSheet', true));
        }
 
+       function upload($id = null) {
+               // Check
+               $this->_checkCharaSheeAuth();
+
+               $this->_upload($id, false);
+       }
+
        function admin_upload($id = null) {
+
+               $this->_upload($id, true);
+       }
+
+       function _upload($id = null, $isAdmin = false) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid id for CharacterSheet', true));
                        $this->redirect(array('action'=>'index'));
                }
 
-               $characterSheet = $this->CharacterSheet->read(null, $id);
+               $characterSheet = $this->CharacterSheet->find('first', array(
+                       'conditions' => array('CharacterSheet.id' => $id),
+                       'recursive' => -1,
+               ));
                if (empty($characterSheet)) {
                        $this->Session->setFlash(__('Invalid CharacterSheet.', true));
                        $this->redirect(array('action'=>'index'));
                }
+               // 一般ユーザの場合、自身のキャラシのみ
+               if (empty($isAdmin)) {
+                       $this->__checkCharaSheeOwner($characterSheet);
+               }
 
                $skin_dir = $this->getSkinDir($characterSheet['CharacterSheet']['key_name']);
                $tmpfile = $skin_dir. 'view.tmp';
@@ -469,5 +586,41 @@ class CharacterSheetsController extends AppController {
 
                return $replacement;
        }
+
+       function _checkCharaSheeAuth($system_id = null)
+       {
+               if (empty($this->site_configs['System.allowUserSheet']['value'])) {
+                       $this->Session->setFlash(__('Unavailable Now.', true));
+                       $this->redirect(array('action'=>'index', $system_id));
+               }
+
+               // デモモードチェック
+               $this->_check_demo();
+       }
+
+       function __checkCharaSheeOwner($characterSheet)
+       {
+               if (!$this->_checkCharaSheeOwner($characterSheet)) {
+                       $this->Session->setFlash(__('No Permission', true));
+                       $this->redirect(array('action'=>'index'));
+               }
+       }
+
+       function __getThisSystem($id, $isAdmin = false)
+       {
+               $this_system = $this->_getThisSystem($id, $isAdmin);
+
+               return $this->__restore_html_system($this_system);
+       }
+
+       function __restore_html_system($data)
+       {
+               if (!isset($data['System']) || empty($data['System'])) {
+                       return $data;
+               }
+
+               return $this->_restore_html_system($data);
+       }
+
 }
 
index 45d0179..ab57e3a 100644 (file)
@@ -1032,14 +1032,6 @@ class CharactersController extends AppController {
        function _view($id, $conditions = array(), $isAdmin = false) {
                $this->helpers[] = 'CharacterSheet';
 
-               // キャラクターシート設定
-               $mode = null;
-               if (isset($this->params['named']['mode']) && !empty($this->params['named']['mode'])) {
-                       $this->view = 'Theme';
-                       $this->theme = $this->params['named']['mode'];
-
-               }
-
                // キャラデータ取得
                $orig_character = $this->_get_character($id, $conditions, $isAdmin);
                $character = $this->Character->set_profiles2view($orig_character);
@@ -1064,6 +1056,47 @@ class CharactersController extends AppController {
 
                $this->set('title_for_layout', " - ". $character['Character']['name']);
 
+               // キャラクターシート設定
+               if (isset($this->params['named']['mode']) && !empty($this->params['named']['mode'])) {
+                       $mode = $this->params['named']['mode'];
+
+                       // スキン公開チェック
+                       $public_flg = false;
+                       $skin = array();
+                       if (!$isAdmin) {
+                               // 公開済み
+                               foreach ($character['System']['CharacterSheet'] as $v) {
+                                       if ($v['key_name'] == $mode) {
+                                               $public_flg = true;
+                                               $skin = $v;
+                                               break;
+                                       }
+                               }
+
+                               // 自身のキャラシのみ
+                               if (!$public_flg) {
+                                       $this->CharacterSheet = CorePlus::set_model('CharacterSheet');
+                                       $characterSheet = $this->CharacterSheet->find('first', array(
+                                               'conditions' => array('CharacterSheet.key_name' => $mode),
+                                               'recursive' => -1,
+                                       ));
+
+                                       if ($this->_checkCharaSheeOwner($characterSheet)) {
+                                               $skin = $characterSheet['CharacterSheet'];
+                                               $public_flg = true;
+                                       }
+                               }
+                       } else {
+                               $public_flg = true;
+                       }
+                       if ($public_flg) {
+                               $this->view = 'Theme';
+                               $this->theme = $mode;
+
+                               $this->set('skin', $skin);
+                       }
+               }
+
                return $character;
        } 
 
@@ -1483,30 +1516,4 @@ class CharactersController extends AppController {
                return $result;
        }
 
-       function _getThisSystem($id, $isAdmin = false)
-       {
-               static $this_system;
-
-               if (!empty($this_system)) {
-                       return $this_system;
-               }
-
-               $system_conditions['System.id'] = $id;
-               if ($isAdmin === false) {
-                       $system_conditions['System.public_flag'] = 'public';
-               }
-
-               $this_system = $this->Character->System->find('first', array(
-                       'conditions' => $system_conditions,
-                       'recursive' => -1,
-               ));
-
-               if (!isset($this_system['System'])) {
-                       $this->Session->setFlash(__('Invalid System.', true));
-                       $this->redirect(array('controller' => 'systems', 'action' => 'index'));
-               }
-
-               return $this_system;
-       }
-
 }
index 05a009c..f07ef96 100644 (file)
@@ -252,6 +252,7 @@ class SystemsController extends AppController {
                } else {
                        $contain = array(
                                'Character',
+                               'CharacterSheet',
                                'Attachment',
                        );
                        $recursive = 1;
index db36bb7..6e9f1d3 100644 (file)
@@ -904,6 +904,9 @@ msgstr "更新日"
 msgid "Add CharacterSheet"
 msgstr "キャラクターシート追加"
 
+msgid "Your CharacterSheet"
+msgstr "あなたのキャラクターシート"
+
 #: /views/character_sheets/admin_add.ctp:19;24
 #: /views/character_sheets/admin_index.ctp:24
 #: /views/characters/add.ctp:26;35
@@ -1995,6 +1998,9 @@ msgstr "お知らせ設定"
 msgid "Site Description"
 msgstr "サイト紹介"
 
+msgid "Allow User Character-sheet"
+msgstr "一般ユーザによるキャラクターシート表示スキン追加"
+
 #: /views/site_configs/admin_edit.ctp:
 msgid "Single System"
 msgstr "単一システム"
@@ -2195,6 +2201,9 @@ msgstr "○"
 msgid "OFF"
 msgstr "×"
 
+msgid "true"
+msgstr "◎"
+
 #: /views/systems/admin_view.ctp:260
 msgid "Edit Items"
 msgstr "項目編集"
index 8ade042..d315585 100644 (file)
@@ -14,7 +14,7 @@ class CharacterSheet extends AppModel {
        var $name = 'CharacterSheet';
 
        var $fields = array(
-               'add' => array('system_id', 'key_name', 'name', 'public_flag', 'sort_order'),
+               'add' => array('system_id', 'user_id', 'key_name', 'name', 'public_flag', 'sort_order'),
                'edit' => array('name', 'public_flag', 'sort_order'),
                'escape' => array(
                ),
@@ -77,6 +77,16 @@ class CharacterSheet extends AppModel {
                                'System.public_flag'
                        ),
                        'order' => ''
+               ),
+               'User' => array(
+                       'className' => 'User',
+                       'foreignKey' => 'user_id',
+                       'conditions' => '',
+                       'fields' => array(
+                               'User.id', 
+                               'User.group_id',
+                               'User.name'
+                       ),
                )
        );
 
@@ -114,6 +124,9 @@ class CharacterSheet extends AppModel {
                        $this->System = CorePlus::set_model('System');
                }
                $this->System->cacheDelete();
+
+               // 自セッション関連
+               $this->deleteCacheMyData();
        }
 
 }
index cda5463..c0a68ec 100644 (file)
@@ -99,6 +99,11 @@ class SiteConfig extends AppModel {
                        'value' => 0
                ),
 
+               'System.allowUserSheet' => array(
+                       'id' => null,
+                       'value' => 0
+               ),
+
                'Design.customCss' => array(
                        'id' => null,
                        'value' => null
index 151f21d..3f38317 100644 (file)
@@ -60,6 +60,27 @@ class User extends AppModel {
                        ),
                        'limit' => '5',
                        'offset' => '',
+               ),
+               'CharacterSheet' => array(
+                       'className' => 'CharacterSheet',
+                       'foreignKey' => 'user_id',
+                       'dependent' => false,
+                       'conditions' => array(
+                               'CharacterSheet.public_flag' => 'public',
+                       ),
+                       'fields' => array(
+                               'CharacterSheet.id',
+                               'CharacterSheet.system_id',
+                               'CharacterSheet.key_name',
+                               'CharacterSheet.name',
+                               'CharacterSheet.public_flag',
+                               'CharacterSheet.modified',
+                       ),
+                       'order' => array(
+                               'CharacterSheet.modified' => 'DESC',
+                       ),
+                       'limit' => '5',
+                       'offset' => '',
                )
        );
 
diff --git a/app/views/character_sheets/add.ctp b/app/views/character_sheets/add.ctp
new file mode 100644 (file)
index 0000000..aaf755b
--- /dev/null
@@ -0,0 +1,9 @@
+<?php 
+echo $this->element(
+       'character_sheet_add',
+       array(
+               'this_system' => $this_system,
+               'isAdmin' => false,
+       )
+);
+
index 37152f1..b8b1958 100644 (file)
@@ -1,102 +1,9 @@
-<div class="characterSheets form">
 <?php 
-       $url = array(
-               'controller' => 'character_sheets',
-               'action' => 'add',
-       );
-       if (isset($this_system['System']['id'])) {
-               $url[] = $this_system['System']['id'];
-       } 
-       echo $form->create('CharacterSheet', array('url' => $url));
-
-?>
-<fieldset>
-<legend><?php __('Add CharacterSheet');?></legend>
-
-<?php
-       if (isset($this_system['System']['id'])) {
-               echo '<div class="input select">';
-               echo '<label for="CharacterSheetSystemId">'. __('System').'</label>';
-               echo $systems[$this_system['System']['id']];
-               echo '</div>';
-       } else {
-               echo $form->input('system_id', array(
-                       'label' => __('System', true),
-                       'after' => $html->tag(
-                               'div',
-                               __('No Editable', true),
-                               array('class' => 'required')
-                       )
-               ));
-       }
-
-       echo $form->input('name', array(
-               'type' => 'text',
-               'label' => __('Name', true).
-                       $html->tag(
-                               'span',
-                               __(' required', true),
-                               array('class' => 'required')
-                       ),
-               'after' => $html->tag(
-                       'div',
-                       sprintf(__('Less than %d characters', true), 64),
-                       array('class' => 'attention')
-               )
-       ));
-
-
-       echo $form->input('key_name', array(
-               'type' => 'text',
-               'label' => __('Key Name', true).
-                       $html->tag(
-                               'span',
-                               __(' required', true),
-                               array('class' => 'required')
-                       ),
-               'style' => 'ime-mode:inactive;',
-               'after' => 
-               $html->tag(
-                       'div',
-                       __('No Editable', true),
-                       array('class' => 'required')
-               ).
-               $html->tag(
-                       'div',
-                       __('Only Number, Small letter and Underline.', true),
-                       array('class' => 'attention')
-               ).
-               $html->tag(
-                       'div',
-                       sprintf(__('Less than %d characters', true), 40),
-                       array('class' => 'attention')
-               )
-       ));
-       echo $select->create_publicflag_select($public_flags, 'public_flag', array(
-               'label' => __('Public Flag', true),
-               'default' => 'private',
-       ));
-
-       echo $form->input('sort_order', array(
-               'label' => __('Order', true),
-               'style' => 'ime-mode:inactive;',
-       ));
-
-       echo $token->create();
-?>
-</fieldset>
-<?php echo $form->end(array('label' => __('Submit', true)));?>
-</div>
-
-<div class="backButton">
-<?php
-$url['action'] = 'index';
-echo $form->create('', array(
-       'url' => $url,
-       'type' => 'GET',
-));
-echo $form->end(array('label' => __('Cancel', true)));
-?>
-</div>
-
+echo $this->element(
+       'character_sheet_add',
+       array(
+               'this_system' => $this_system,
+               'isAdmin' => true,
+       )
+);
 
index 71e46bd..5c06a71 100644 (file)
@@ -1,103 +1,9 @@
-<div class="characterSheets index">
-<h2>
-<?php if (isset($this_system['System'])): ?>
-       <?php echo $html->link($this_system['System']['name'], array('controller' => 'systems', 'action' => 'view', $this_system['System']['id']), array('escape' => false), false) ?>
-<?php endif; ?>
- <?php __('CharacterSheets');?>
-</h2>
-
-<p>
-<?php
-$paginator->options(array('url' => $this->passedArgs));
-
-echo $paginator->counter(array(
-'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
-));
-?></p>
-<table cellpadding="0" cellspacing="0">
-<tr>
-       <th><?php echo $paginatorEx->sortAllow('id');?></th>
-       <th><?php echo $paginatorEx->sortAllow(__('Name', true), 'name');?></th>
-       <th><?php echo $paginatorEx->sortAllow(__('Key Name', true), 'key_name');?></th>
-       <th><?php echo $paginatorEx->sortAllow(__('Public', true), 'public_flag');?></th>
-<?php if (!isset($this_system)): ?>
-       <th><?php echo $paginatorEx->sortAllow(__('System', true), 'system_id');?></th>
-<?php endif; ?>
-       <th><?php echo $paginatorEx->sortAllow(__('Order', true), 'sort_order');?></th>
-</tr>
-
-<?php
-$i = 0;
-foreach ($characterSheets as $characterSheet):
-       $class = null;
-       if ($i++ % 2 == 0) {
-               $class = ' class="altrow"';
-       }
-?>
-<tr<?php echo $class;?>>
-<td>
-       <?php echo $characterSheet['CharacterSheet']['id']; ?>
-</td>
-<td>
 <?php 
-       echo $html->link(
-               $characterSheet['CharacterSheet']['name'], 
-               array(
-                       'controller' => 'character_sheets', 
-                       'action' => 'view', 
-                       $characterSheet['CharacterSheet']['id']
-               ), array('escape' => false), false
-       ); 
-?>
-</td>
-<td>
-       <?php echo $characterSheet['CharacterSheet']['key_name']; ?>
-</td>
-<td>
-<?php 
-       echo $select->get_i18n_public_flag($characterSheet['CharacterSheet']['public_flag'], $public_flags); 
-?>
-</td>
-<?php if (!isset($this_system)): ?>
-<td>
-<?php 
-       echo $html->link(
-               $characterSheet['System']['name'], 
-               array(
-                       'controller' => 'character_sheets', 
-                       'action' => 'index', 
-                       $characterSheet['System']['id']
-               ), array('escape' => false), false
-       ); 
-?>
-</td>
-<?php endif; ?>
-<td>
-       <?php echo $characterSheet['CharacterSheet']['sort_order']; ?>
-</td>
-</tr>
-<?php endforeach; ?>
-</table>
-</div>
-<div class="paging">
-<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
- | <?php echo $paginator->numbers();?> | 
-<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
-</div>
+echo $this->element(
+       'character_sheet_index',
+       array(
+               'characterSheets' => $characterSheets,
+               'isAdmin' => true,
+       )
+);
 
-<div class="action">
-<?php 
-       if (isset($this_system['System']['id'])) {
-               $system_id = $this_system['System']['id'];
-       } else {
-               $system_id = null;
-       }
-       $url = array(
-               'controller' => 'character_sheets',
-               'action' => 'add',
-               $system_id
-       );
-       echo $form->create('CharacterSheet', array('url' => $url, 'type' => 'get'));
-?>
-<?php echo $form->end(__('New CharacterSheet', true));?>
-</div>
index 6f8796b..360f3f1 100644 (file)
@@ -1,142 +1,9 @@
-<div class="characterSheets view">
 <?php 
-       $url = array(
-               'controller' => 'character_sheets',
-               'action' => 'upload',
-               $characterSheets['CharacterSheet']['id'],
-               ''
-       );
-       echo $form->create('CharacterSheet', array(
-               'type' => 'file',
-               'url' => $url
-       ));
-?>
+echo $this->element(
+       'character_sheet_view',
+       array(
+               'characterSheets' => $characterSheets,
+               'isAdmin' => true,
+       )
+);
 
-<?php
-       $character_sheet_name = $characterSheets['CharacterSheet']['name'];
-
-       $system_name = $html->tag('span', 
-               $html->link($characterSheets['System']['name'], array('controller' => 'systems', 'action' => 'view', $characterSheets['System']['id']), array('escape' => false), false),
-               array(
-                       'class' => 'text',
-               )
-       );
-
-       $public = $html->tag('span', 
-               $select->get_i18n_public_flag($characterSheets['CharacterSheet']['public_flag'], $public_flags),
-               array(
-                       'class' => 'text publicFlag',
-               )
-       );
-
-       $header = $character_sheet_name. $system_name. $public;
-
-       if (!empty($view_link)) {
-               $header .= $html->tag('span', 
-                       $html->link(
-                               __('Check View', true), 
-                               $view_link,
-                               array(
-                                       'target' => 'sampleView',
-                               )
-                       ),
-                       array(
-                               'class' => 'text',
-                       )
-               );
-       }
-
-       // メイン表示
-       // Upfile
-       $body = "<fieldset>\n".
-               $html->div('upsheet', 
-               $form->input('file', array(
-                       'label' => __('Upload CharacterSheet', true),
-                       'type'  => 'file',
-                       'error' => array(
-               )))
-       ).
-       $token->create().
-       $form->end(array('label' => __('Submit', true)));
-
-       $body .= "</fieldset>\n";
-
-       $footer = null;
-
-       echo $this->element('box', array(
-               'header' => $header,
-               'body' => $body,
-               'footer' => $footer,
-       ));
-
-?>
-
-</div>
-
-<div class="characterSheets form">
-<?php 
-       $url = array(
-               'controller' => 'character_sheets',
-               'action' => 'edit',
-               $characterSheets['CharacterSheet']['id'],
-               ''
-       );
-       echo $form->create('CharacterSheet', array(
-               'url' => $url
-       ));
-?>
-
-<?php
-
-       $header = __('Edit CharacterSheet', true);
-       $header .= $html->tag('span',
-               $html->link(__('Delete CharacterSheet', true), array(
-                       'action' => 'delete', $characterSheets['CharacterSheet']['id']), null, 
-                       sprintf(__('Are you sure you want to delete # %s?', true), $characterSheets['CharacterSheet']['name'])
-               ),
-               array(
-                       'class' => 'text',
-               )
-       );
-
-       $body = "<fieldset>\n".
-               $form->input('name', array(
-                       'type' => 'text',
-                       'label' => __('Name', true).
-                               $html->tag(
-                                       'span',
-                                       __(' required', true),
-                               array('class' => 'required')
-                               ),
-                       'default' => $characterSheets['CharacterSheet']['name'],
-                       'after' => $html->tag(
-                               'div',
-                               sprintf(__('Less than %d characters', true), 64),
-                               array('class' => 'attention')
-                       )
-               )).
-               $select->create_publicflag_select($public_flags, 'public_flag', array(
-                       'label' => __('Public Flag', true),
-                       'default' => $characterSheets['CharacterSheet']['public_flag'],
-               )).
-               $form->input('sort_order', array(
-                       'label' => __('Order', true),
-                       'style' => 'ime-mode:inactive;',
-                       'default' => $characterSheets['CharacterSheet']['sort_order'],
-               )).
-               $token->create().
-               $form->end(array('label' => __('Submit', true)));
-
-       $body .= "</fieldset>\n";
-
-       $footer = null;
-
-       echo $this->element('box', array(
-               'header' => $header,
-               'body' => $body,
-               'footer' => $footer,
-       ));
-
-
-?>
-</div>
\ No newline at end of file
diff --git a/app/views/character_sheets/index.ctp b/app/views/character_sheets/index.ctp
new file mode 100644 (file)
index 0000000..20b22a9
--- /dev/null
@@ -0,0 +1,9 @@
+<?php 
+echo $this->element(
+       'character_sheet_index',
+       array(
+               'characterSheets' => $characterSheets,
+               'isAdmin' => false,
+       )
+);
+
diff --git a/app/views/character_sheets/view.ctp b/app/views/character_sheets/view.ctp
new file mode 100644 (file)
index 0000000..979f512
--- /dev/null
@@ -0,0 +1,9 @@
+<?php 
+echo $this->element(
+       'character_sheet_view',
+       array(
+               'characterSheets' => $characterSheets,
+               'isAdmin' => false,
+       )
+);
+
diff --git a/app/views/elements/character_sheet_add.ctp b/app/views/elements/character_sheet_add.ctp
new file mode 100644 (file)
index 0000000..37152f1
--- /dev/null
@@ -0,0 +1,102 @@
+<div class="characterSheets form">
+<?php 
+       $url = array(
+               'controller' => 'character_sheets',
+               'action' => 'add',
+       );
+       if (isset($this_system['System']['id'])) {
+               $url[] = $this_system['System']['id'];
+       } 
+       echo $form->create('CharacterSheet', array('url' => $url));
+
+?>
+<fieldset>
+<legend><?php __('Add CharacterSheet');?></legend>
+
+<?php
+       if (isset($this_system['System']['id'])) {
+               echo '<div class="input select">';
+               echo '<label for="CharacterSheetSystemId">'. __('System').'</label>';
+               echo $systems[$this_system['System']['id']];
+               echo '</div>';
+       } else {
+               echo $form->input('system_id', array(
+                       'label' => __('System', true),
+                       'after' => $html->tag(
+                               'div',
+                               __('No Editable', true),
+                               array('class' => 'required')
+                       )
+               ));
+       }
+
+       echo $form->input('name', array(
+               'type' => 'text',
+               'label' => __('Name', true).
+                       $html->tag(
+                               'span',
+                               __(' required', true),
+                               array('class' => 'required')
+                       ),
+               'after' => $html->tag(
+                       'div',
+                       sprintf(__('Less than %d characters', true), 64),
+                       array('class' => 'attention')
+               )
+       ));
+
+
+       echo $form->input('key_name', array(
+               'type' => 'text',
+               'label' => __('Key Name', true).
+                       $html->tag(
+                               'span',
+                               __(' required', true),
+                               array('class' => 'required')
+                       ),
+               'style' => 'ime-mode:inactive;',
+               'after' => 
+               $html->tag(
+                       'div',
+                       __('No Editable', true),
+                       array('class' => 'required')
+               ).
+               $html->tag(
+                       'div',
+                       __('Only Number, Small letter and Underline.', true),
+                       array('class' => 'attention')
+               ).
+               $html->tag(
+                       'div',
+                       sprintf(__('Less than %d characters', true), 40),
+                       array('class' => 'attention')
+               )
+       ));
+       echo $select->create_publicflag_select($public_flags, 'public_flag', array(
+               'label' => __('Public Flag', true),
+               'default' => 'private',
+       ));
+
+       echo $form->input('sort_order', array(
+               'label' => __('Order', true),
+               'style' => 'ime-mode:inactive;',
+       ));
+
+       echo $token->create();
+?>
+</fieldset>
+<?php echo $form->end(array('label' => __('Submit', true)));?>
+</div>
+
+<div class="backButton">
+<?php
+$url['action'] = 'index';
+echo $form->create('', array(
+       'url' => $url,
+       'type' => 'GET',
+));
+echo $form->end(array('label' => __('Cancel', true)));
+?>
+</div>
+
+
diff --git a/app/views/elements/character_sheet_index.ctp b/app/views/elements/character_sheet_index.ctp
new file mode 100644 (file)
index 0000000..d8ea0cb
--- /dev/null
@@ -0,0 +1,160 @@
+<div class="characterSheets index">
+
+<div class="characters listview">
+<div class="box full">
+<div class="boxHeader"><h2><span>
+<?php if (isset($this_system['System'])): ?>
+       <?php echo $html->link($this_system['System']['name'], array('controller' => 'systems', 'action' => 'view', $this_system['System']['id']), array('escape' => false), false) ?>
+<?php endif; ?>
+<?php if (empty($isAdmin)): ?>
+<?php
+       printf(__("%s's", true), 
+               $user['User']['name']
+       );
+?>
+<?php endif; ?>
+<?php __('CharacterSheets');?>
+</h2>
+</h2></div>
+<div class="boxBody">
+<p>
+<?php
+$paginator->options(array('url' => $this->passedArgs));
+$pagenator_options = array();
+
+$paginator->options(array('url' => $this->passedArgs));
+
+echo $paginator->counter(array(
+'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
+));
+?></p>
+
+<div class="paging">
+<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | <?php echo $paginator->numbers();?> | 
+<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
+</div>
+
+<table cellpadding="0" cellspacing="0">
+<tr>
+       <th><?php echo $paginatorEx->sortAllow('id');?></th>
+       <th><?php echo $paginatorEx->sortAllow(__('Name', true), 'name');?></th>
+       <th><?php echo $paginatorEx->sortAllow(__('Key Name', true), 'key_name');?></th>
+       <th><?php echo $paginatorEx->sortAllow(__('Public', true), 'public_flag');?></th>
+<?php if (!isset($this_system)): ?>
+       <th><?php echo $paginatorEx->sortAllow(__('System', true), 'system_id');?></th>
+<?php endif; ?>
+<?php if (!empty($isAdmin)): ?>
+       <th><?php echo $paginatorEx->sortAllow(__('User Name', true), 'user_id');?></th>
+       <th><?php __('User');?></th>
+<?php endif; ?>
+       <th><?php __('Order');?></th>
+       <th><?php echo $paginatorEx->sortAllow(__('Modified', true), 'modified');?></th>
+</tr>
+
+<?php
+$i = 0;
+foreach ($characterSheets as $characterSheet):
+       $class = null;
+       if ($i++ % 2 == 0) {
+               $class = ' class="altrow"';
+       }
+?>
+<tr<?php echo $class;?>>
+<td>
+       <?php echo $characterSheet['CharacterSheet']['id']; ?>
+</td>
+<td>
+<?php 
+       echo $html->link(
+               $characterSheet['CharacterSheet']['name'], 
+               array(
+                       'controller' => 'character_sheets', 
+                       'action' => 'view', 
+                       $characterSheet['CharacterSheet']['id']
+               ), array('escape' => false), false
+       ); 
+?>
+</td>
+<td>
+       <?php echo $characterSheet['CharacterSheet']['key_name']; ?>
+</td>
+<td>
+<?php 
+       echo $select->get_i18n_public_flag($characterSheet['CharacterSheet']['public_flag'], $public_flags); 
+?>
+</td>
+<?php if (!isset($this_system)): ?>
+<td>
+<?php 
+       echo $html->link(
+               $characterSheet['System']['name'], 
+               array(
+                       'controller' => 'character_sheets', 
+                       'action' => 'index', 
+                       $characterSheet['System']['id']
+               ), array('escape' => false), false
+       ); 
+?>
+</td>
+<?php endif; ?>
+<?php if (!empty($isAdmin)): ?>
+<td>
+<?php 
+       echo $html->link(
+               $characterSheet['User']['name'], 
+               array(
+                       'controller' => 'users', 
+                       'action' => 'view', 
+                       $characterSheet['User']['id']
+               ), array('escape' => false), false
+       ); 
+?>
+</td>
+<td>
+<?php 
+if (!in_array($characterSheet['User']['group_id'], array(1,2,3))) {
+       __('true');
+}
+?>
+</td>
+<?php endif; ?>
+<td>
+       <?php echo $characterSheet['CharacterSheet']['sort_order']; ?>
+</td>
+<td>
+       <?php echo $time->niceShort($characterSheet['CharacterSheet']['modified'], array('format' => 'Y/m/d H:i')); ?>
+</td>
+</tr>
+<?php endforeach; ?>
+</table>
+
+<div class="paging">
+<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
+ | <?php echo $paginator->numbers();?> | 
+<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
+</div>
+
+<div class="action">
+<?php 
+       if (isset($this_system['System']['id'])) {
+               $system_id = $this_system['System']['id'];
+       } else {
+               $system_id = null;
+       }
+       $url = array(
+               'controller' => 'character_sheets',
+               'action' => 'add',
+               $system_id
+       );
+       echo $form->create('CharacterSheet', array('url' => $url, 'type' => 'get'));
+?>
+<?php echo $form->end(__('New CharacterSheet', true));?>
+</div>
+
+
+</div>
+</div>
+
+</div>
\ No newline at end of file
diff --git a/app/views/elements/character_sheet_view.ctp b/app/views/elements/character_sheet_view.ctp
new file mode 100644 (file)
index 0000000..a4712c0
--- /dev/null
@@ -0,0 +1,151 @@
+<div class="characterSheets view">
+<?php 
+       $url = array(
+               'controller' => 'character_sheets',
+               'action' => 'upload',
+               $characterSheets['CharacterSheet']['id'],
+               ''
+       );
+       echo $form->create('CharacterSheet', array(
+               'type' => 'file',
+               'url' => $url
+       ));
+?>
+
+<?php
+       $character_sheet_name = $characterSheets['CharacterSheet']['name'];
+
+       if (!empty($isAdmin)) {
+               $character_sheet_name .= $html->tag('span', 
+                       ' By '. $html->link($characterSheets['User']['name'], array('controller' => 'users', 'action' => 'view', $characterSheets['User']['id']), array('escape' => false), false),
+                       array(
+                               'class' => 'text',
+                       )
+               );
+       }
+
+       $system_name = $html->tag('span', 
+               $html->link($characterSheets['System']['name'], array('controller' => 'systems', 'action' => 'view', $characterSheets['System']['id']), array('escape' => false), false),
+               array(
+                       'class' => 'text',
+               )
+       );
+
+       $public = $html->tag('span', 
+               $select->get_i18n_public_flag($characterSheets['CharacterSheet']['public_flag'], $public_flags),
+               array(
+                       'class' => 'text publicFlag',
+               )
+       );
+
+       $header = $character_sheet_name. $system_name. $public;
+
+       if (!empty($view_link)) {
+               $header .= $html->tag('span', 
+                       $html->link(
+                               __('Check View', true), 
+                               $view_link,
+                               array(
+                                       'target' => 'sampleView',
+                               )
+                       ),
+                       array(
+                               'class' => 'text',
+                       )
+               );
+       }
+
+       // メイン表示
+       // Upfile
+       $body = "<fieldset>\n".
+               $html->div('upsheet', 
+               $form->input('file', array(
+                       'label' => __('Upload CharacterSheet', true),
+                       'type'  => 'file',
+                       'error' => array(
+               )))
+       ).
+       $token->create().
+       $form->end(array('label' => __('Submit', true)));
+
+       $body .= "</fieldset>\n";
+
+       $footer = null;
+
+       echo $this->element('box', array(
+               'header' => $header,
+               'body' => $body,
+               'footer' => $footer,
+       ));
+
+?>
+
+</div>
+
+<div class="characterSheets form">
+<?php 
+       $url = array(
+               'controller' => 'character_sheets',
+               'action' => 'edit',
+               $characterSheets['CharacterSheet']['id'],
+               ''
+       );
+       echo $form->create('CharacterSheet', array(
+               'url' => $url
+       ));
+?>
+
+<?php
+
+       $header = __('Edit CharacterSheet', true);
+       $header .= $html->tag('span',
+               $html->link(__('Delete CharacterSheet', true), array(
+                       'action' => 'delete', $characterSheets['CharacterSheet']['id']), null, 
+                       sprintf(__('Are you sure you want to delete # %s?', true), $characterSheets['CharacterSheet']['name'])
+               ),
+               array(
+                       'class' => 'text',
+               )
+       );
+
+       $body = "<fieldset>\n".
+               $form->input('name', array(
+                       'type' => 'text',
+                       'label' => __('Name', true).
+                               $html->tag(
+                                       'span',
+                                       __(' required', true),
+                               array('class' => 'required')
+                               ),
+                       'default' => $characterSheets['CharacterSheet']['name'],
+                       'after' => $html->tag(
+                               'div',
+                               sprintf(__('Less than %d characters', true), 64),
+                               array('class' => 'attention')
+                       )
+               )).
+               $select->create_publicflag_select($public_flags, 'public_flag', array(
+                       'label' => __('Public Flag', true),
+                       'default' => $characterSheets['CharacterSheet']['public_flag'],
+               )).
+               $form->input('sort_order', array(
+                       'label' => __('Order', true),
+                       'style' => 'ime-mode:inactive;',
+                       'default' => $characterSheets['CharacterSheet']['sort_order'],
+               )).
+               $token->create().
+               $form->end(array('label' => __('Submit', true)));
+
+       $body .= "</fieldset>\n";
+
+       $footer = null;
+
+       echo $this->element('box', array(
+               'header' => $header,
+               'body' => $body,
+               'footer' => $footer,
+       ));
+
+
+?>
+</div>
\ No newline at end of file
index 1e6fca9..f3dc9f0 100644 (file)
 </li>
 <?php endforeach; ?>
 
+<?php if ($site_configs['System.allowUserSheet']['value']): ?>
+<li class="SkinAddLink">
+<?php
+echo $html->link("[".__('Add', true)."]", array(
+       'controller' => 'character_sheets',
+       'action' => 'add',
+       $character['Character']['system_id'],
+       ), array('escape' => false), false
+);
+ ?>
+</li>
+<?php endif; ?>
+
 </ul>
 <?php endif; ?>
\ No newline at end of file
index 0e26926..f87faa0 100644 (file)
@@ -43,6 +43,7 @@ if (isset($target_user)) {
        );
 ?>
 </div>
+</div>
 
 <?php
 if (!empty($target_user['User']['url'])) {
@@ -55,16 +56,39 @@ echo $html->div('homeUrl',
        )
 );
 }
-?>
 
+echo $html->div('userNotice',
+       $target_user['User']['notes']
+);
+
+if (isset($target_user['CharacterSheet']) && !empty($target_user['CharacterSheet'])) {
+       $header = __('CharacterSheets', true);
+
+       $body = '<ul class="boxList">';
+       foreach($target_user['CharacterSheet'] as $v) {
+               $body .= $html->tag('li', 
+                       $v['name']. '('. $v['System']['name']. ')',
+                       array(
+                       )
+               );
+       }
+       $body .= '</ul>';
+
+       $footer = null;
+       if (isset($isOwner) && $isOwner === true) {
+               $footer = $html->link(__(' ...More', true), array('controller' => 'character_sheets', 'action' => 'index'));
+       }
+
+       echo $this->element('box', array(
+               'id' => 'userCharaShee',
+               'header' => $header,
+               'body' => $body,
+               'footer' => $footer,
+       ));
+}
 
-<?php
-       echo $html->div('userNotice',
-               $target_user['User']['notes']
-       );
 ?>
 
 </div>
 
-</div>
 <?php endif; ?>
index 8f60d95..d3ce737 100644 (file)
@@ -26,6 +26,19 @@ if (isset($character['Character']['name'])) {
 } else {
        $character_name = null;
 }
+
+if (isset($character['System']['id'])) {
+       $system_id = $character['System']['id'];
+} else {
+       $system_id = null;
+}
+
+if (isset($this->params['named']['mode'])) {
+       $mode = $this->params['named']['mode'];
+} else {
+       $mode = null;
+}
+
 ?>
 
 <ul>
@@ -52,6 +65,10 @@ if (isset($character['Character']['name'])) {
                'character_skinchanger',
                array(
                        'character' => $character,
+/*                     'cache' => array(
+                               'time' => time() + Configure::read('Cache.expire'),
+                               'key' => $character_id. '_'. $mode,
+                       ),*/
                )
        );
 ?>
index 72b90ab..768dc56 100644 (file)
@@ -28,6 +28,12 @@ if (isset($character['System']['id'])) {
        $system_id = $this->params["system_id"];
 }
 
+if (isset($this->params['named']['mode'])) {
+       $mode = $this->params['named']['mode'];
+} else {
+       $mode = null;
+}
+
 if (isset($character['Character']['name'])) {
        $character_name = $text->truncate($character['Character']['name'], 16);
 } elseif (isset($this->data['Character']['name'])) {
@@ -87,6 +93,10 @@ if (isset($character['Character']['name'])) {
                'character_skinchanger',
                array(
                        'character' => $character,
+/*                     'cache' => array(
+                               'time' => time() + Configure::read('Cache.expire'),
+                               'key' => $character_id. '_'. $mode,
+                       ),*/
                )
 );
 ?>
index bf4ca3d..88ec05c 100644 (file)
@@ -1,3 +1,17 @@
+<?php 
+if (isset($character['Character']['id'])) {
+       $character = $character['Character']['id'];
+} else {
+       $character = null;
+}
+
+if (isset($this->params['named']['mode'])) {
+       $mode = $this->params['named']['mode'];
+} else {
+       $mode = null;
+}
+ ?>
+
 <?php if (!isset($chracter['Character']) || (isset($character['System']['CharacterSheet']) && !empty($character['System']['CharacterSheet']))) ?>
 <ul>
 
@@ -9,6 +23,10 @@
                array(
                        'character' => $character,
                        'params' => $this->params,
+/*                     'cache' => array(
+                               'time' => time() + Configure::read('Cache.expire'),
+                               'key' => $character_id. '_'. $mode,
+                       ),*/
                )
 );
 ?>
index 8cd535c..5cf4053 100644 (file)
@@ -1,19 +1,44 @@
+<?php 
+if (isset($system['System']['name'])) {
+       $system_name = $system['System']['name'];
+       $system_id = $system['System']['id'];
+} elseif(isset($this->data['System']['name'])) {
+       $system_name = $this->data['System']['name'];
+       $system_id = $this->data['System']['id'];
+} elseif(isset($this_system['System']['name'])) {
+       $system_name = $this_system['System']['name'];
+       $system_id = $this_system['System']['id'];
+} elseif(isset($characterSheets['System']['name'])) {
+       $system_name = $characterSheets['System']['name'];
+       $system_id = $characterSheets['System']['id'];
+} else {
+       $system_name = null;
+       $system_id = null;
+}
+
+ ?>
 <ul>
 <?php if (isset($system['System']['name'])): ?>
 <li>
 <?php 
        echo $html->link(
-               sprintf(__("%s's Home", true), $system['System']['name']), 
-               array('controller' => 'systems', 'action' => 'view', $system['System']['id']), array('escape' => false), false
+               sprintf(__("%s's Home", true), $system_name), 
+               array('controller' => 'systems', 'action' => 'view', $system_id), array('escape' => false), false
        ); 
 ?>
 </li>
 <?php endif; ?>
 
+<?php if ($user['User']['id'] && isset($system_id)): ?>
+<li><?php echo $html->link(__('New Character', true), array('controller' => 'characters', 'action' => 'add', 'system_id:'.$system_id)); ?></li>
+<?php endif; ?>
+
 <li><?php echo $html->link(__('List of All Systems', true), array('controller' => 'systems', 'action' => 'index')); ?></li>
 
-<?php if ($user['User']['id'] && isset($system['System']['id'])): ?>
-<li><?php echo $html->link(__('New Character', true), array('controller' => 'characters', 'action' => 'add', 'system_id:'.$system['System']['id'])); ?></li>
+<?php if ($site_configs['System.allowUserSheet']['value']): ?>
+<li><?php echo $html->link(__('New CharacterSheet', true), array('controller' => 'character_sheets', 'action' => 'add', $system_id)); ?></li>
+
+<li><?php echo $html->link(__('List of All CharacterSheets', true), array('controller' => 'character_sheets', 'action' => 'index', $system_id));?></li>
 <?php endif; ?>
 
 </ul>
index 45ad14c..c847062 100644 (file)
@@ -129,6 +129,7 @@ switch ($this->params["controller"]) {
                        }
                break;
        case 'systems':
+       case 'character_sheets':
                if (!$site_configs['System.singleSystem']['value']) {
                        echo $this->element('sidenav_system', array());
                }
index ee54e6f..37a65a8 100644 (file)
@@ -304,6 +304,17 @@ echo $html->div('submit',
 
 <table>
 <tr>
+<th><?php echo __('Allow User Character-sheet') ?></th>
+<td id="System_allowUserSheet">
+<div class="input radio inline">
+<input name="data[SiteConfig][System.allowUserSheet][value]" type="radio" value="1"<?php if (!empty($this->data['SiteConfig']['System.allowUserSheet']['value'])): ?> checked="checked"<?php endif; ?>><?php __('Allow') ?>
+<input name="data[SiteConfig][System.allowUserSheet][value]" type="radio" value="0"<?php if (empty($this->data['SiteConfig']['System.allowUserSheet']['value'])): ?> checked="checked"<?php endif; ?>><?php __('No Allow') ?>
+</div>
+<input name="data[SiteConfig][System.allowUserSheet][id]" type="hidden" value="<?php echo $this->data['SiteConfig']['System.allowUserSheet']['id'];?>">
+</td>
+</tr>
+
+<tr>
 <th><?php echo __('Single System') ?></th>
 <td id="System_singleSystem">
 <?php echo $html->div('caption', __('Use the only one System. Make the system before setting.', true)); ?>
index 1701cf5..627dc65 100644 (file)
 ?>
 </div>
 
+<div class="character_sheets">
+<?php 
+       $header =  __('CharacterSheets', true).
+               $html->tag(
+                       'span',
+                       $html->link(
+                               __('Your CharacterSheet', true),
+                               array(
+                                       'controller' => 'character_sheets',
+                                       'action' => 'index',
+                                       $system['System']['id'],
+                               )
+                       ),
+                       array(
+                               'class' => 'link',
+                       )
+               ).
+               $html->tag(
+                       'span',
+                       $html->link(
+                               __('New CharacterSheet', true),
+                               array(
+                                       'controller' => 'character_sheets',
+                                       'action' => 'add',
+                                       $system['System']['id'],
+                               )
+                       ),
+                       array(
+                               'class' => 'link',
+                       )
+               );
+
+
+       $body = '';
+       if (isset($system['CharacterSheet'])) {
+               foreach($system['CharacterSheet'] as $characterSheet) {
+                       $sheet = $html->link(
+                               $characterSheet['name'],
+                               array(
+                                       'controller' => 'character_sheets',
+'action' => 'view',
+$characterSheet['id'],
+                               ), array('escape' => false), false
+                       );
+                       $body .= $html->tag(
+                               'span',
+                               $sheet,
+                               array(
+                                       'class' => 'characterSheet',
+                               )
+                       );
+               }
+       }
+
+       $footer = null;
+
+       echo $this->element('box', array(
+               'header' =>$header,
+               'body' => $body,
+               'footer' => $footer,
+       ));
+ ?>
+</div>
+
+
 </div>
index 613853c..af138ad 100644 (file)
 ?>
 </div>
 
+
+<div class="character_sheets">
+<?php
+       $body = '<ul class="boxList">';
+       foreach($target_user['CharacterSheet'] as $v) {
+               $content = $html->link($v['name'], array(
+                       'controller' => 'character_sheets',
+                       'action' => 'view',
+                       $v['id']
+               ), array('escape' => false), false);
+               $content .= '('. 
+                       $html->link($v['System']['name'], array(
+                               'controller' => 'character_sheets',
+                               'action' => 'index',
+                               $v['System']['id']
+                       ), array('escape' => false), false)
+                       . ')';
+               $body .= $html->tag('li', $content,
+                       array(
+                       )
+               );
+       }
+       $body .= '</ul>';
+
+       echo $this->element('box', array(
+               'id' => 'userCharaShee',
+               'header' => __('CharacterSheets', true),
+               'body' => $body,
+               'footer' => null,
+       ));
+?>
+</div>
+
 </div>
\ No newline at end of file