}
if (empty($this->data)) {
$this->data = $this->System->read(null, $id);
+
+ $this->data['System'] = $this->_restore_html_system($this->data['System']);
}
}
}
$systems = $this->paginate();
+ if (!empty($systems)) {
+ $systems = $this->HtmlEscape->nl_unescape($systems);
+ }
+
$this->set('systems', $systems);
}
$this->redirect(array('action'=>'index'));
}
- $this->set('system', $system);
+ $this->set('system', $this->HtmlEscape->nl2br_escaped($system));
+ }
+
+
+ /* 共通関数 */
+ function _restore_html_system($data, $nl2br = false) {
+ $data['name'] = $this->System->restore_html($data['name'], false, false, false);
+ $data['detail'] = $this->System->restore_html($data['detail'], false, false, false);
+ if ($nl2br) {
+ $data['detail'] = nl2br($data['detail']);
+ }
+
+ return $data;
}
+
}
-?>
\ No newline at end of file
+
// i18n Error Messages
// Working on the CakePlus
$error_messages = array(
- 'notEmpty' => __('Please be sure to input.', true),
+ 'alphaNumeric' => __('Please input only alphanumeric characters.', true),
'between' => __('Between %2$d and %3$d characters.', true),
- 'minLength' => __('More than %2$d characters.', true),
- 'maxLength' => __('Less than %2$d characters.', true),
- 'alphaNumeric' => __('Please input only alphameric characters.', true),
- 'compare2fields' => __('Please input same as above.', true),
'betweenWrapper' => __('Too short or Too long.', true),
+ 'betweenWrapper' => __('Too short or Too long.', true),
+ 'boolean' => __('Incorrect value.', true),
'isUnique' => __('It was already registed.', true),
+ 'minLength' => __('More than %2$d characters.', true),
+ 'maxLength' => __('Less than %2$d characters.', true),
+ 'notEmpty' => __('Please be sure to input.', true),
+ 'numeric' => __('Please input only number.', true),
+ 'publicFlag' => __('Incorrect value.', true),
+ 'url' => __('Please input URL.', true),
);
$this->setErrorMessageI18n($error_messages, false);
return Validation::between($check, $min, $max);
}
+ /* check PublicFlag Setting */
+ function publicFlag($data)
+ {
+ $public_flag_settings = array(
+ 'public',
+ 'private',
+ );
+ if (isset($data["public_flag"]) && in_array($data["public_flag"], $public_flag_settings)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
}
'auto' => false,
'add' => true,
'edit' => true,
- ),
- 'default' => array(
- 'auto' => false,
- 'add' => true,
- 'edit' => true,
+ 'escape' => array(
+ 'html' => true,
+ 'all' => true,
+ ),
),
'sort_order' => array(
'auto' => false,
'add' => true,
'edit' => true,
),
- 'logo_filename' => array(
+ 'set_npc' => array(
'auto' => false,
- 'add' => false,
- 'edit' => false,
+ 'add' => true,
+ 'edit' => true,
+ ),
+ 'public_flag' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ ),
+ 'detail' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ 'escape' => array(
+ 'html' => true,
+ 'images' => true,
+ 'sctipts' => true,
+ ),
),
);
var $validate = array(
- 'name' => array('notempty'),
- 'sort_order' => array('numeric'),
+ 'name' => array(
+ 'notEmpty' => array(
+ 'rule' => array('notEmpty'),
+ ),
+ ),
+ 'sort_order' => array(
+ 'numeric' => array(
+ 'rule' => array('numeric'),
+ ),
+ ),
+ 'image_filename' => array(
+ 'url' => array(
+ 'rule' => array('url', true),
+ ),
+ ),
+ 'url' => array(
+ 'url' => array(
+ 'rule' => array('url', true),
+ ),
+ ),
+ 'set_npc' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ ),
+ ),
+ 'public_flag' => array(
+ 'publicFlag' => array(
+ 'rule' => array('publicFlag'),
+ ),
+ ),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
)
);
+ /* コールバックメソッド */
+ function beforeSave($options = array())
+ {
+ return parent::beforeSave($options);
+ }
+
}
-?>
\ No newline at end of file
+
'label' => __('URL', true),
)
);
- echo $form->input('public_flag');
+ echo $form->input('set_npc', array(
+ 'label' => __('Use NPC', true),
+ 'selected' => true
+ )
+ );
+ echo $form->input('public_flag', array(
+ 'type' => 'select',
+ 'label' => __('Public', true),
+ 'options' => array(
+ 'public' => __('Public', true),
+ 'private' => __('Private', true),
+ ),
+ 'selected' => 'public',
+ )
+ );
echo $form->input('detail', array(
'label' => __('Detail', true),
)
</div>
<div class="actions">
<ul>
- <li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('System.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('System.id'))); ?></li>
+ <li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('System.id')), null, sprintf(__('Are you sure you want to delete %s?', true), $form->value('System.name'))); ?></li>
<li><?php echo $html->link(__('List Systems', true), array('action' => 'index'));?></li>
</ul>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit System', true), array('action' => 'edit', $system['System']['id'])); ?> </li>
- <li><?php echo $html->link(__('Delete System', true), array('action' => 'delete', $system['System']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $system['System']['id'])); ?> </li>
+ <li><?php echo $html->link(__('Delete System', true), array('action' => 'delete', $system['System']['id']), null, sprintf(__('Are you sure you want to delete %s?', true), $system['System']['name'])); ?> </li>
<li><?php echo $html->link(__('List Systems', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New System', true), array('action' => 'add')); ?> </li>
</ul>