OSDN Git Service

CharacterSheetView変更
authorCake <cake_67@users.sourceforge.jp>
Tue, 3 Aug 2010 05:01:42 +0000 (14:01 +0900)
committerCake <cake_67@users.sourceforge.jp>
Tue, 3 Aug 2010 05:01:42 +0000 (14:01 +0900)
app/controllers/character_sheets_controller.php
app/views/character_sheets/admin_edit.ctp [deleted file]
app/views/character_sheets/admin_view.ctp

index 255565c..cdb85ed 100644 (file)
@@ -159,19 +159,12 @@ class CharacterSheetsController extends AppController {
                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));
-                               $this->redirect(array('action'=>'view', $id));
                        } else {
                                $this->Session->setFlash(__('The data could not be saved. Please, try again.', true));
                        }
                }
-               if (empty($this->data)) {
-                       $this->data = $this->CharacterSheet->read(null, $id);
-               }
 
-               $systems = $this->_get_systems(null);
-               $this->set(compact('systems'));
-
-               $this->pageTitle .= " - ". __('Edit CharacterSheet', true);
+               $this->redirect(array('action'=>'view', $id));
        }
 
        function admin_delete($id = null) {
diff --git a/app/views/character_sheets/admin_edit.ctp b/app/views/character_sheets/admin_edit.ctp
deleted file mode 100644 (file)
index 4e02cba..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<div class="characterSheets form">
-<?php echo $form->create('CharacterSheet');?>
-<fieldset>
-<legend><?php __('Edit CharacterSheet');?></legend>
-
-<?php
-               echo $form->input('name', array(
-                       'type' => 'text',
-                       'label' => __('Name', true).
-                               $html->tag(
-                                       'span',
-                                       __(' * required', true),
-                               array('class' => 'required')
-                               ),
-                       'after' => $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)
-       ));
-
-       echo $form->input('sort_order', array(
-               'label' => __('Order', true)
-       ));
-
-       echo $token->create();
-?>
-</fieldset>
-<?php echo $form->end('Submit');?>
-</div>
-
index cf68ee3..6907317 100644 (file)
@@ -10,7 +10,6 @@
                'type' => 'file',
                'url' => $url
        ));
-
 ?>
 
 <?php
                )
        );
 
-       $header = $character_sheet_name. $system_name. $public.
-               $html->tag('span',
-                       $html->link(__('Edit CharacterSheet', true), array(
-                               'action' => 'edit', 
-                               $characterSheets['CharacterSheet']['id'])
+       $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',
                        )
-               ).
-               $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',
-                       )
                );
+       }
 
        // メイン表示
        // Upfile
        $body = "<fieldset>\n".
-//             "<legend>".__('Upload CharacterSheet', true)."</legend>\n".
                $html->div('upsheet', 
                $form->input('file', array(
                        'label' => __('Upload CharacterSheet', true),
                )))
        ).
        $token->create().
-       $form->end('Submit').
-       "</fieldset>\n";
-
+       $form->end('Submit');
 
-       if (!empty($view_link)) {
-               $body .= $html->div('leftLink', 
-                       $html->link(
-                               __('Check View', true), 
-                               $view_link , 
-                               array(
-                                       'target' => 'sampleView',
-                               )
-                       )
-               );
-       }
+       $body .= "</fieldset>\n";
 
        $footer = null;
 
 ?>
 
 </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),
+                       'default' => $characterSheets['CharacterSheet']['sort_order'],
+               )).
+               $token->create().
+               $form->end('Submit');
+
+       $body .= "</fieldset>\n";
+
+       $footer = null;
+
+       echo $this->renderElement('box', array(
+               'header' => $header,
+               'body' => $body,
+               'footer' => $footer,
+       ));
+
+
+?>
+</div>
\ No newline at end of file