From 31d87849d3005d32f84ad4d4f988e5d48b307648 Mon Sep 17 00:00:00 2001 From: Cake Date: Sun, 21 Mar 2010 22:49:45 +0900 Subject: [PATCH] =?utf8?q?=E3=83=9B=E3=83=BC=E3=83=A0=E3=83=AC=E3=82=A4?= =?utf8?q?=E3=82=A2=E3=82=A6=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/controllers/app_controller.php | 3 +- app/controllers/users_controller.php | 91 ++++++++++++++++++++++++----------- app/views/elements/character_view.ctp | 4 +- app/views/elements/home.ctp | 4 +- app/views/elements/home_left.ctp | 73 ++++++++++++++++++++++++++++ app/views/elements/home_right.ctp | 42 ++++++++++++++++ app/views/layouts/default.ctp | 1 + app/views/users/index.ctp | 52 +++++--------------- app/views/users/view.ctp | 9 +++- app/webroot/css/base.css | 6 ++- app/webroot/css/character-sheet.css | 4 +- app/webroot/css/layout.css | 36 ++++++++++++++ 12 files changed, 247 insertions(+), 78 deletions(-) create mode 100644 app/views/elements/home_left.ctp create mode 100644 app/views/elements/home_right.ctp create mode 100644 app/webroot/css/layout.css diff --git a/app/controllers/app_controller.php b/app/controllers/app_controller.php index 5750ef5..c36607a 100644 --- a/app/controllers/app_controller.php +++ b/app/controllers/app_controller.php @@ -19,7 +19,6 @@ class AppController extends Controller var $user = array('User' => array( 'id' => 0, 'group_id' => 0, - 'name' => 'ゲスト' )); var $user_id = 0; var $isAdministrator = false; @@ -66,6 +65,8 @@ class AppController extends Controller { parent::beforeFilter(); + $this->user['User']['name'] = __('Guest', true); + // ブラウザキャッシュ破棄 $this->disableCache(); diff --git a/app/controllers/users_controller.php b/app/controllers/users_controller.php index ff3200d..031b7d7 100644 --- a/app/controllers/users_controller.php +++ b/app/controllers/users_controller.php @@ -3,6 +3,7 @@ class UsersController extends ModuleController { var $name = 'Users'; var $helpers = array( + 'Time', ); /* ACL */ @@ -21,6 +22,7 @@ class UsersController extends ModuleController { // 認証なしアクセス可 $this->AuthPlus->allow('index'); + $this->AuthPlus->allow('view'); $this->AuthPlus->allow('add'); //todo:メール認証etc $this->AuthPlus->allow('logout'); $this->AuthPlus->allow('to_login'); @@ -50,33 +52,36 @@ class UsersController extends ModuleController { } function index() { - // 全体の情報 - // characters - $this->Character = CorePlus::set_model('Character'); - $public_characters = $this->Character->find('all', array( - 'conditions' => array( - 'Character.public_flag' => 'public', - 'Character.deleted' => 0, - ), - 'recursive' => 1, - 'contain' => array( - 'System', - 'User', - ), - 'fields' => '', - 'order' => array('Character.modified' => 'DESC'), - 'limit' => 5, - )); - $this->set('public_characters', $public_characters); - // ユーザ情報表示 if ($this->AuthPlus->user()) { $this->set('isOwner', true); + $this->pageTitle = $this->AuthPlus->user('name'). __("'s Home", true); + self::_index(); + } else { + $this->pageTitle = __('Guest', true). __("'s Home", true); } + + self::_view($this->user_id); } function view($id = null) { + if ($id && $id == $this->AuthPlus->user("id")) { + $this->redirect(array('action'=>'index')); + } + + $user = $this->getUser($id); + if (!$user) { + $this->redirect(array('action'=>'listview')); + } + $this->set('target_user', $user); + + if (!empty($this->user_id) && $this->user_id == $id) { + $this->set('isOwner', true); + } else { + $this->set('isOwner', false); + } + self::_view($id); } @@ -172,11 +177,23 @@ class UsersController extends ModuleController { } function mobile_index() { + // ユーザ情報表示 + if ($this->AuthPlus->user()) { $this->set('isOwner', true); + $this->pageTitle = $this->AuthPlus->user('name'). __("'s Home", true); - self::_index(); + self::_index(); + } else { + $this->pageTitle = __('Guest', true). __("'s Home", true); + } } function mobile_view($id = null) { + $user = $this->getUser($id); + if (!$user) { + $this->redirect(array('action'=>'listview')); + } + $this->set('target_user', $user); + self::_view($id); } @@ -252,6 +269,13 @@ class UsersController extends ModuleController { $this->Session->setFlash(__('Invalid User.', true)); $this->redirect(array('controller' => 'users', 'action'=>'index')); } + + $user = $this->getUser($id); + if (!$user) { + $this->redirect(array('action'=>'listview')); + } + $this->set('target_user', $user); + $this->set('target_user', $this->User->read(null, $id)); } @@ -327,15 +351,24 @@ class UsersController extends ModuleController { } function _view($id) { - if ($id && $id == $this->AuthPlus->user("id")) { - $this->redirect(array('action'=>'index')); - } - - $user = $this->getUser($id); - if (!$user) { - $this->redirect(array('action'=>'listview')); - } - $this->set('target_user', $user); + // 全体の情報 + // characters + $this->Character = CorePlus::set_model('Character'); + $public_characters = $this->Character->find('all', array( + 'conditions' => array( + 'Character.public_flag' => 'public', + 'Character.deleted' => 0, + ), + 'recursive' => 1, + 'contain' => array( + 'System', + 'User', + ), + 'fields' => '', + 'order' => array('Character.modified' => 'DESC'), + 'limit' => 5, + )); + $this->set('public_characters', $public_characters); } function _listview() { diff --git a/app/views/elements/character_view.ctp b/app/views/elements/character_view.ctp index f78a4f8..eaf576b 100644 --- a/app/views/elements/character_view.ctp +++ b/app/views/elements/character_view.ctp @@ -72,8 +72,8 @@ echo $this->renderElement('character_picture_full', array( - -
+ +
'character_pictures', 'action' => 'index', $character['Character']['id']); diff --git a/app/views/elements/home.ctp b/app/views/elements/home.ctp index 1ff8bc5..0b34a3c 100644 --- a/app/views/elements/home.ctp +++ b/app/views/elements/home.ctp @@ -1,4 +1,4 @@ -
+

@@ -49,4 +49,6 @@
+
+ diff --git a/app/views/elements/home_left.ctp b/app/views/elements/home_left.ctp new file mode 100644 index 0000000..15cb092 --- /dev/null +++ b/app/views/elements/home_left.ctp @@ -0,0 +1,73 @@ +
+ +
+
+ +
+ + +
+ 'users', + 'action' => 'edit_image', + ); + } + + $file = $upfile->file( + 'filter/m', + CorePlus::get_value($target_user, 'Attachment.0'), + array( + 'model_name' => 'User', + 'mime_type' => 'original', + 'nodata' => 'image', + ) + ); + + echo $medium->embed( + $file, + array( + 'url' => $url, + 'alt' => CorePlus::get_value($target_user, 'User.name'), + 'class' => 'shadow', + 'id' => 'HomeUserImage', + 'restrict' => array('image') + ) + ); +?> +
+div('EditLink', $html->link(__('Edit Image', true), $url)); + } + + if (!$isOwner) { + echo $html->div('LastAccess', + __('Last Access', true) + ); + echo $html->div('LastAccess', + $time->timeAgoInWords( + $target_user['User']['modified'], + array( + 'format' => 'Y/m/d', + 'end' => '+1 days' + ), + true + ) + ); + } +?> + + +
+ +
diff --git a/app/views/elements/home_right.ctp b/app/views/elements/home_right.ctp new file mode 100644 index 0000000..4ee25d5 --- /dev/null +++ b/app/views/elements/home_right.ctp @@ -0,0 +1,42 @@ + diff --git a/app/views/layouts/default.ctp b/app/views/layouts/default.ctp index 55bc2c1..0512dbf 100644 --- a/app/views/layouts/default.ctp +++ b/app/views/layouts/default.ctp @@ -21,6 +21,7 @@ //echo $html->meta('icon'); // スキン設定etcで管理画面変更対応予定 echo $html->css('cake.generic'); echo $html->css('base'); + echo $html->css('layout'); echo $html->css('character-sheet'); echo $html->css('jquery-css/ui.all.css'); diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index e3f263b..d44e676 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,47 +1,17 @@ +
renderElement('home', array( - 'user' => $user, - 'owner' => true, - )); +// $user = ; } -?> +echo $this->renderElement('home_left', array( + 'user' => $user, + 'owner' => true, +)); + +echo $this->renderElement('home_right', array( + 'public_characters' => $public_characters, +)); -

-

-

-

-

- -> -div('characterName', $html->link($character['Character']['name'], array('controller' => 'characters', 'action' => 'view', $character['Character']['id']))); - echo $html->div('systemName', $html->link($character['System']['name'], array('controller' => 'systems', 'action' => 'view', $character['System']['id']))); ?> - -
- 'characters', 'action' => 'view', $character['Character']['id']); - echo $this->renderElement('character_picture_image', array( - 'basename' => $character['Character']['main_picture'], - 'options' => array( - 'previewVersion' => 'm', - 'class' => 'mainImage', - 'url' => $url, - 'alt' => $character['Character']['name'], - ) - )); - ?> -
- -
-
-

+
\ No newline at end of file diff --git a/app/views/users/view.ctp b/app/views/users/view.ctp index 3de75a5..b10352f 100644 --- a/app/views/users/view.ctp +++ b/app/views/users/view.ctp @@ -1,5 +1,12 @@ +
renderElement('home', array( + echo $this->renderElement('home_left', array( 'user' => $user, 'owner' => false, )); + + echo $this->renderElement('home_right', array( + 'public_characters' => $public_characters, + )); +?> +
\ No newline at end of file diff --git a/app/webroot/css/base.css b/app/webroot/css/base.css index e104ebe..a6e9ae5 100644 --- a/app/webroot/css/base.css +++ b/app/webroot/css/base.css @@ -15,6 +15,7 @@ body { color: #333333; font-size: 12px; padding: 0; + position : relative } a { background: transparent; @@ -75,6 +76,7 @@ html, body { width: 100%; height:100%; min-height:100%; + position : relative } #container ul { margin: 0; @@ -303,9 +305,9 @@ ul#navAdmin li { width: 100%; height:100%; min-height:100%; - padding: 10px 10px 10px 10px; + padding: 5px 10px; overflow: hidden; - + position : relative } #footer { diff --git a/app/webroot/css/character-sheet.css b/app/webroot/css/character-sheet.css index f714771..2a6b496 100644 --- a/app/webroot/css/character-sheet.css +++ b/app/webroot/css/character-sheet.css @@ -72,13 +72,15 @@ table.CharacterSheet td.CharacterBasicData { } /* キャラ画像 */ +div#left div.image160, tr#CharacterStatusRow td.image { width: 160px; padding: 0; margin: 0; - border-right: 1px solid #ccc; + text-align: center; } +div#left div.image150, div#CharacterMainPicture { display : inline; width: 150px; diff --git a/app/webroot/css/layout.css b/app/webroot/css/layout.css new file mode 100644 index 0000000..77e9ba7 --- /dev/null +++ b/app/webroot/css/layout.css @@ -0,0 +1,36 @@ +@charset "UTF-8"; + + +* { +} + +.layout2colums { + width: 100%; + position : relative +} +.layout2colums div { +} + +#home { +} + +.layout2colums div#left { + float: left; + width: 160px; + height:100%; + padding-right: 5px; +} +.layout2colums div#right { + margin-left: 160px; + height:100%; +} + +/* ホーム表示 */ +.userName { + text-align: center; + font-size: 125%; + font-weight: bold; + padding-bottom: 3px; +} -- 2.11.0