OSDN Git Service

「その他」システム設定 chara-shee
authorCake <cake_67@users.sourceforge.jp>
Tue, 21 Dec 2010 09:30:59 +0000 (18:30 +0900)
committerCake <cake_67@users.sourceforge.jp>
Tue, 21 Dec 2010 09:30:59 +0000 (18:30 +0900)
12 files changed:
app/controllers/app_controller.php
app/controllers/characters_controller.php
app/controllers/profile_selects_controller.php
app/controllers/profile_table_statics_controller.php
app/controllers/profile_tables_controller.php
app/controllers/profiles_controller.php
app/locale/jpn/LC_MESSAGES/default.po
app/models/site_config.php
app/views/characters/change_system.ctp
app/views/characters/edit.ctp
app/views/site_configs/admin_edit.ctp
app/views/systems/admin_view.ctp

index e7f5fed..2b8e434 100644 (file)
@@ -769,6 +769,26 @@ class AppController extends Controller
                return false;
        }
 
+       function checkEditOtherSystem($system_id = null)
+       {
+               if ($this->isOtherSystem($system_id)) {
+                       $this->Session->setFlash(__('Other System cannot have ANY PROFILE SETTINGS.', true));
+                       $this->redirect(array('controller' => 'systems', 'action'=>'view', $system_id));
+               }
+       }
+       function isOtherSystem($system_id = null)
+       {
+               if (empty($system_id)) {
+                       return false;
+               }
+
+               if (empty($this->site_configs['System.otherSetting']['value']) || $this->site_configs['System.otherSetting']['value'] != $system_id) {
+                       return false;
+               }
+
+               return true;
+       }
+
 }
 
 /*
index e030145..120414d 100644 (file)
@@ -456,8 +456,11 @@ class CharactersController extends AppController {
                // Systemチェック
                // Systemあり
                if (isset($character['System']) && !empty($character['System'])) {
+                       // 「その他」設定
+                       if ($this->isOtherSystem($character['System']['id'])) {
+                               $this->set('isChange', true);
                        // 公開状態は変更不可
-                       if ($this->check_public_flag($character['System'])) {
+                       } elseif ($this->check_public_flag($character['System'])) {
                                $this->redirect(array('action'=>'edit', $id));
                        // System非公開
                        } else {
index a2969f6..fe87db3 100644 (file)
@@ -31,6 +31,9 @@ class ProfileSelectsController extends AppController {
                        $this->redirect(array('controller' => 'systems', 'action'=>'admin_index'));
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($profile['Profile']['system_id']);
+
                if (isset($this->data['ProfileSelect']) || !empty($this->data['ProfileSelect'])) {
 
                        $error = false;
index e9a0d34..009d33e 100644 (file)
@@ -45,6 +45,9 @@ class ProfileTableStaticsController extends AppController {
                        $this->redirect(array('controller'=>'systems', 'action'=>'admin_index'));
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($profileTable['Profile']['system_id']);
+
                foreach ($profileTable['ProfileTableStatic'] as $k => $v) {
                        if (isset($v['sort_order'])  && !empty($v['sort_order'])) {
                                $sort_order[$k] = $v['sort_order'];
index 3162355..972af76 100644 (file)
@@ -31,6 +31,9 @@ class ProfileTablesController extends AppController {
                        $this->redirect(array('controller' => 'systems', 'action'=>'admin_index'));
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($profile['Profile']['system_id']);
+
                $newdata = array(
                        'title' => null,
                        'tablekey_name' => null,
index 48080bd..a93f870 100644 (file)
@@ -38,6 +38,9 @@ class ProfilesController extends AppController {
                        }
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($system_id);
+
                $data['system_id'] = $system_id;
                if (!$this->Profile->validSystemId($data, false)) {
                        $this->Session->setFlash(__('Invalid System.', true));
@@ -81,6 +84,9 @@ class ProfilesController extends AppController {
                }
                $old_profile_type = $profile['Profile']['profile_type'];
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($profile['Profile']['system_id']);
+
                if (!empty($this->data)) {
                        $new_profile_type = $this->data['Profile']['profile_type'];
 
@@ -139,6 +145,9 @@ class ProfilesController extends AppController {
 
                unset($this->data['CharactersHasProfile']);
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($system_id);
+
                $error = false;
                foreach ($this->data['Profile'] as $id => $v) {
                        if ($id == '__Token') {
@@ -218,6 +227,9 @@ class ProfilesController extends AppController {
                        $this->redirect(array('controller' => 'systems', 'action'=>'admin_index'));
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($system_id);
+
                unset($this->Profile->System->hasMany['Profile']['fields']);
                $system = $this->Profile->System->find('first', array(
                        'conditions' => array(
@@ -318,6 +330,9 @@ class ProfilesController extends AppController {
                        $this->redirect(array('controller' => 'systems', 'action'=>'admin_index'));
                }
 
+               // 「その他」システム設定
+               $this->checkEditOtherSystem($system_id);
+
                $system = $this->Profile->System->find('first', array(
                        'conditions' => array(
                                'System.id' => $system_id,
@@ -449,4 +464,4 @@ class ProfilesController extends AppController {
        }
 
 }
-?>
\ No newline at end of file
+
index 8862aa8..e6700f8 100644 (file)
@@ -422,6 +422,9 @@ msgstr "システムを削除しました。"
 msgid "No System."
 msgstr "システムが存在しません。"
 
+msgid "Other System cannot have ANY PROFILE SETTINGS."
+msgstr "「その他」システムにはプロフィール設定を作成できません。"
+
 #: /controllers/users_controller.php:79;83;206;210
 #: /views/elements/admin_character_sidenav.ctp:36
 #: /views/elements/admin_system_sidenav.ctp:31
@@ -1198,6 +1201,15 @@ msgstr "システムを変更すると、以前のシステムに基づくデー
 msgid "%s Change System"
 msgstr "%sのシステムを変更"
 
+msgid "Change System"
+msgstr "システム変更"
+
+msgid "You can select New System."
+msgstr "システムを「その他」から変更できます。"
+
+msgid "Notice! Once you have changed from OTHER SYSTEM, you CANNOT changed again."
+msgstr "ただし、一度「その他」の設定から他に変更すると、再度別のシステムに変更する事は、基本的にできません。"
+
 #: /views/characters/edit.ctp:2
 msgid "Edit %s"
 msgstr "%s 編集"
@@ -2059,6 +2071,9 @@ msgstr "サイト紹介"
 msgid "Allow User Character-sheet"
 msgstr "一般ユーザによるキャラクターシート表示スキン追加"
 
+msgid "Id of OTHER Setting System"
+msgstr "「その他」設定のシステムID"
+
 #: /views/site_configs/admin_edit.ctp:
 msgid "Single System"
 msgstr "単一システム"
index ffd9e60..8a78571 100644 (file)
@@ -94,15 +94,18 @@ class SiteConfig extends AppModel {
                        'value' => '1000'
                ),
 
-               'System.singleSystem' => array(
+               'System.allowUserSheet' => array(
                        'id' => null,
                        'value' => 0
                ),
-
-               'System.allowUserSheet' => array(
+               'System.otherSetting' => array(
                        'id' => null,
                        'value' => 0
                ),
+               'System.singleSystem' => array(
+                       'id' => null,
+                       'value' => ''
+               ),
 
                'Design.customCss' => array(
                        'id' => null,
index f5278aa..2647088 100644 (file)
@@ -9,6 +9,7 @@
 
 ?>
 
+<?php if (empty($site_configs['System.otherSetting']['value']) || $site_configs['System.otherSetting']['value'] != $character['System']['id']) : ?>
 <?php 
        echo $html->div('notice',
        __('Previous System is unpubic or deleted. You can select New system.', true)
        );
  ?>
 <?php endif; ?>
+<?php else: ?>
+<?php 
+       echo $html->div('notice',
+       __('You can select New System.', true)
+       );
+ ?>
+
+<?php 
+       echo $html->div('notice',
+       __('Notice! Once you have changed from OTHER SYSTEM, you CANNOT changed again.', true)
+       );
+ ?>
+<?php endif; ?>
 
 <fieldset>
 <legend>
@@ -32,7 +46,7 @@
                        'action' => 'view',
                        $character['Character']['id']
                ), array('escape' => false), false
-       );
+       ));
 ?>
 </legend>
 <?php
index ba77261..575f202 100644 (file)
                'SystemName',
                $this->data['System']['name']
        );
+
+       if (!empty($site_configs['System.otherSetting']['value']) && $site_configs['System.otherSetting']['value'] == $this->data['Character']['system_id']) {
+               echo $html->div(
+                       'link',
+                       $html->link(__('Change System', true), array(
+                               'action' => 'change_system',
+                               $this->data['Character']['id'],
+                       ))
+               );
+       }
+
  ?>
 </td>
 <td>
index 37a65a8..2f3ed39 100644 (file)
@@ -315,6 +315,14 @@ echo $html->div('submit',
 </tr>
 
 <tr>
+<th><?php echo __('Id of OTHER Setting System') ?></th>
+<td id="System_otherSetting">
+<input name="data[SiteConfig][System.otherSetting][value]" type="text" value="<?php echo $this->data['SiteConfig']['System.otherSetting']['value'];?>" style="ime-mode:inactive;">
+<input name="data[SiteConfig][System.otherSetting][id]" type="hidden" value="<?php echo $this->data['SiteConfig']['System.otherSetting']['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 a92eb34..d76e918 100644 (file)
@@ -170,6 +170,7 @@ $characterSheet['id'],
  ?>
 </div>
 
+<?php if (empty($site_configs['System.otherSetting']['value']) || $site_configs['System.otherSetting']['value'] != $system['System']['id']) : ?>
 <div class="profiles">
 <div class="box">
 <div class="boxHeader"><h3>
@@ -387,5 +388,7 @@ foreach ($system['Profile'] as $profile):
 <?php // echo $html->div('', ' * '. __('Import is available only No Profiles.', true)); ?>
 </div>
 </div>
+</div>
+<?php endif; ?>
 
 </div>
\ No newline at end of file