OSDN Git Service

キャラ編集画面にプレビュー追加
authorCake <cake_67@users.sourceforge.jp>
Fri, 18 Feb 2011 14:21:29 +0000 (23:21 +0900)
committerCake <cake_67@users.sourceforge.jp>
Fri, 18 Feb 2011 14:21:29 +0000 (23:21 +0900)
app/config/sql/install/upgrade/bto1_0/upgrade.sql
app/controllers/app_controller.php
app/controllers/characters_controller.php
app/models/character.php
app/views/characters/edit.ctp
app/views/elements/character_view.ctp
app/views/users/edit.ctp

index 3f749cc..51fd552 100644 (file)
@@ -14,10 +14,11 @@ ALTER TABLE `profiles` MODIFY `profile_type` TINYINT(2) NOT NULL DEFAULT '1';
 ALTER TABLE `characters` MODIFY `status` TINYINT(2) NOT NULL DEFAULT '1';
 
 /* Add Table */
-DROP TABLE IF EXISTS `default_profiles`;
 
-DROP TABLE IF EXISTS `tagged`;
 DROP TABLE IF EXISTS `tags`;
+DROP TABLE IF EXISTS `tagged`;
+
+DROP TABLE IF EXISTS `default_profiles`;
 
 CREATE TABLE `default_profiles` (
   `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -71,3 +72,38 @@ CREATE TABLE `tags` (
   UNIQUE KEY `UNIQUE_TAG` (`identifier`, `keyname`)
 ) TYPE=InnoDB DEFAULT CHARSET=utf8;
 
+CREATE TABLE `access` (
+  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+  `model` varchar(255) NOT NULL,
+  `foreign_key` int(10) NOT NULL,
+  `host` varchar(64) NOT NULL,
+  `created` DATETIME NULL,
+  PRIMARY KEY(`id`),
+  INDEX `access_model`(`model`, `foreign_key`),
+  INDEX `access_model_created`(`model`, `foreign_key`, `created`)
+) TYPE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `access_counts` (
+  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+  `counts` int(10) NOT NULL,
+  `model` varchar(255) NOT NULL,
+  `foreign_key` int(10) NOT NULL,
+  `created` DATETIME NULL,
+  PRIMARY KEY(`id`),
+  INDEX `access_counts`(`counts`)
+  INDEX `access_model`(`model`, `foreign_key`)
+) TYPE=InnoDB DEFAULT CHARSET=utf8;
+
+
+CREATE TABLE `cron_results` (
+  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+  `cron_name` varchar(255) NOT NULL,
+  `model` varchar(255) NULL,
+  `foreign_key` int(10) NULL,
+  `start_date` DATETIME NULL,
+  `end_date` DATETIME NULL,
+  `created` DATETIME NULL,
+  PRIMARY KEY(`id`),
+  INDEX `cron_model`(`model`, `foreign_key`),
+  INDEX `cron_range`(`cron_name`, `start_date`, `end_date`)
+) TYPE=InnoDB DEFAULT CHARSET=utf8;
index ab25dd6..3d81943 100644 (file)
@@ -42,7 +42,8 @@ class AppController extends Controller
        var $helpers = array(
                'Html',
                'Form',
-               'Javascript',
+               'Js' => array(
+               ),
                'Text',
                'Time',
                'Settings',
@@ -253,7 +254,7 @@ class AppController extends Controller
                                Configure::read('Group.admin'),
                                Configure::read('Group.subadmin'),
                                Configure::read('Group.watcher'),
-                               Configure::read('Group.member'),
+                               Configure::read('Group'),
                                Configure::read('Group.locked'),
                                Configure::read('Group.pre'),
                        );
index 5128925..069addd 100644 (file)
@@ -113,6 +113,8 @@ class CharactersController extends AppController {
                        unset($character['System']['Profile']);
                }
 
+//             $this->Character->saveCount($id);
+
                $this->set('maxPictures', $this->check_character_picture_max(count($character['CharacterPicture'])));
 
                $isOwner = false;
index 3b2808b..3cb75af 100644 (file)
@@ -15,6 +15,11 @@ class Character extends AppModel {
 
        var $name = 'Character';
 
+       var $actsAs = array(
+               'tags.taggable',
+               'Count.CountUp',
+       );
+
        var $status = array(
                'active' => 1,
                'inactive' => 2,
@@ -249,6 +254,8 @@ class Character extends AppModel {
                                        ),
                                ),
                                'CharacterProfileArchive',
+                               'Tag',
+                               'Count',
                        ), $contain
                );
                $character = $this->find('first', array(
@@ -309,6 +316,12 @@ class Character extends AppModel {
                if (isset($orig_character['CharacterPicture'])) {
                        $character['CharacterPicture'] = $orig_character['CharacterPicture'];
                }
+               if (isset($orig_character['Tag'])) {
+                       $character['Tag'] = $orig_character['Tag'];
+               }
+               if (isset($orig_character['Count'])) {
+                       $character['Count'] = $orig_character['Count'];
+               }
                if (isset($orig_character['CharacterProfileArchive']) && $isArchive !== true) {
                        $character['CharacterProfileArchive'] = $orig_character['CharacterProfileArchive'];
                }
index 102aae1..5aaa0b0 100644 (file)
@@ -2,6 +2,9 @@
 <h3><?php echo sprintf(__('Edit %s', true), $this->data['Character']['name']); ?></h3>
 
 <?php echo $form->create('Character');?>
+<?php 
+echo $this->Form->input('tags');
+?>
 <table class="CharacterSheet">
 <tbody>
 <!-- Header -->
index 44abd98..9d94b3c 100644 (file)
@@ -25,6 +25,13 @@ echo $this->element('character_picture_full', array(
        ); 
 ?>
 <?php endif; ?>
+<ul>
+<?php if (!empty($character['Tag'])): ?>
+<?php foreach ($character['Tag'] as $tag): ?>
+<li><?php echo $tag['name']; ?></li>
+<?php endforeach; ?>
+<?php endif; ?>
+</ul>
 </h3></div>
 <div class="boxBody <?php if (!empty($site_configs['Character.fullLengthView']['value'])): ?>
 fullLength<?php endif; ?>">
index 62baad6..6491052 100644 (file)
@@ -39,7 +39,7 @@ echo $form->end(array('label' => __('Cancel', true)));
 <?php 
        echo $this->element('home_left', array(
                'target_user' => $user,
-               'isOwner' => false,
+               'isOwner' => true,
        ));
 
        if (!isset($public_characters)) {
@@ -52,7 +52,7 @@ echo $form->end(array('label' => __('Cancel', true)));
 
        echo $this->element('home_right', array(
                'user' => $user,
-               'owner' => false,
+               'owner' => true,
                'public_characters' => $public_characters,
        ));
 ?>