}
function admin_edit($id = null) {
- $this->_edit($id, false);
+ $this->_edit($id, true);
}
function admin_delete($id = null) {
$fieldList = $this->Link->fields['admin_add'];
} else {
$fieldList = $this->Link->fields['add'];
+
+
+ if (isset($this->data['Link']['type'])) {
+ unset($this->data['Link']['type']);
+ }
}
$this->data['Link']['user_id'] = $this->user_id;
$this->Session->setFlash(__('No Permission', true));
$this->redirect(array('action' => 'listview'));
}
+
+ if (isset($this->data['Link']['type'])) {
+ unset($this->data['Link']['type']);
+ }
}
if (!empty($this->data)) {
$this->data = $this->_restore_html_link($link, false, true);
}
- $this->set('title_for_layout', " - ". __('Edit Link', true));
+ $this->set('title_for_layout', " - ". __('Edit Link', true). " - ". $link['Link']['title']. "(". $link['Link']['url']. ")");
}
function _delete($id = null, $isAdmin = false) {
$confirm_message = __('Are you sure you want to delete it?', true);
$this->Session->setFlash($confirm_message);
- $this->set('title_for_layout', " - ". $confirm_message);
+ $this->set('title_for_layout', " - ". $confirm_message. " - ". $link['Link']['title']. "(". $link['Link']['url']. ")");
}
/* get link By Id */
function set_type_i18n() {
$this->type_settings = array(
'member' => array(
- 'title' => '',
+ 'title' => __('Normal', true),
'description' => '',
),
'creators' => array(
}
}
+ if (isset($data['Link']['ring']) && !empty($data['Link']['ring'])) {
+ $data['Link']['ring'] = $this->{$this->modelClass}->restore_html($data['Link']['ring'], false, false, false);
+ }
+
return $data;
}
return parent::beforeSave($options);
}
+
+ /* validate */
+ function validType($data) {
+ if (!isset($data["type"])) {
+ return true;
+ }
+
+ $params = Router::getParams();
+ if ($params->admin) {
+ if (!in_array($data["type"], array_keys($this->type))) {
+ return false;
+ }
+ }
+ unset($data["type"]);
+
+ return true;
+ }
+
+
/* URLのマルチバイトを変換 */
function mb_urlEncode($data) {
if (!isset($data['Link']['url'])) {
'url' => $url,
'type' => 'file',
));
-
?>
<fieldset>
-<legend><?php if ($action = 'add'): ?><?php __('Add Link'); ?><?php else: ?><?php __('Edit Link'); ?><?php endif ?></legend>
+<legend><?php if (!$isEdit): ?><?php __('Add Link'); ?><?php else: ?><?php __('Edit Link'); ?><?php endif ?></legend>
<?php
echo $this->Form->input('url', array(
'type' => 'text',
'label' => __('Description', true)
));
+if ($isAdmin) {
+ echo $select->create_boolean_select('pickup', array(
+ 'label' => __('PickUp', true),
+ 'default' => 0,
+ ));
+
+ echo $linkSelect->create_type_select($type);
+
+ echo $form->input('ring', array(
+ 'label' => __('Ring text', true),
+ 'after' => $html->tag('div',
+ __('HTML tags OK. It is for RING Tags setting.', true),
+ array('class' => 'attention')
+ )
+ ));
+}
+
echo $token->create();
?>
</fieldset>
$header = __('Links', true);
$header .= $this->Html->tag('span',
- '['.$this->Html->link(__('New Link', true), array(
+ '['.$this->Html->link(__('Add Link', true), array(
'action' => 'add'
), array(
'class' => 'edit'
<div class="boxHeader">
<?php
+$url = array(
+ 'controller' => 'links',
+ 'action' => 'visit',
+ 'plugin' => 'links',
+ 'admin' => false,
+ $link['Link']['id']
+);
+
if (!empty($link['Link']['title'])) {
$title = $link['Link']['title'];
echo $this->Upfile->embed(
$file,
array(
- 'linkTo' => $link['Link']['url'],
+ 'linkTo' => $url,
'alt' => $title,
'restrict' => array('image'),
'htmlAttributes' => array(
?>
<h3>
<?php
-if (!$isAdmin) {
- $url = array(
- 'controller' => 'links',
- 'action' => 'visit',
- 'plugin' => 'links',
- $link['Link']['id']
- );
-} else {
- $url =$link['Link']['url'];
-}
-
echo $this->Html->link(
$title,
$url,
</h3></div>
<div class="boxBody">
<div class="infoBody">
-<?php if (!$isAdmin): ?>
<script language="JavaScript">
<!--
- var thumbnailweb_jump = 'visit/<?php echo $link['Link']['id']; ?>';
+ var thumbnailweb_jump = '<?php echo $this->Html->url($url) ?>';
//-->
</script>
-<?php endif ?>
<?php
$ThumnailNotice = null;
if ($this->Time->wasWithinLast('2 hours', $link['Link']['modified'])) {
return null;
}
- $type_list = $this->set_type($type_list);
-
- if (isset($type_list[$type])) {
- return $type_list[$type];
+ if (isset($type_list[$type]['title'])) {
+ return $type_list[$type]['title'];
} else {
return null;
}
if (!isset($options['options'])) {
$options['options'] = array();
}
- $options['options'] = $this->set_type($type_list, $options['options']);
+ $options['options'] = $this->set_type_select($type_list, $options['options']);
return $this->Form->input($fieldName, $options);
}
- /* typeの設定を、key->value(多言語化対応)に変換 */
- function set_type($type_list = array(), $options = array())
+ /* typeの設定を、key->value(プルダウン用)に変換 */
+ function set_type_select($type_list = array(), $options = array())
{
static $i18n_type;
return $i18n_type;
}
- if (!empty($options)) {
- $i18n_type = $options;
+ if (empty($type_list)) {
+ return array();
}
- if (empty($type_list)) {
- $type_list = $this->default_type;
+ if (!empty($options)) {
+ $i18n_type = $options;
}
foreach ($type_list as $k => $v) {
- if ($v == 'member') {
- $i18n_type[$v] = __('Member\'s Links', true);
- } elseif($v == 'official') {
- $i18n_type[$v] = __('Official Site', true);
- } elseif($v == 'ring') {
- $i18n_type[$v] = __('Web Ring', true);
- } elseif($v == 'material') {
- $i18n_type[$v] = __('Material Site', true);
- } elseif($v == 'thanks') {
- $i18n_type[$v] = __('Thanks Links', true);
- } elseif($v == 'mutual') {
- $i18n_type[$v] = __('Mutual Links', true);
- } elseif($v == 'admin') {
- $i18n_type[$v] = __('Administrator\'s Links', true);
- } else {
- $i18n_type[$v] = $v;
+ if (isset($v['title'])) {
+ $i18n_type[$k] = $v['title'];
}
}
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://trpgtools-onweb.sourceforge.jp/
*/
-?>
-<div class="links form">
-<?php
- $url = array(
+
+echo $this->element('link_edit', array(
+ 'url' => array(
'plugin' => 'links',
'controller' => 'links',
'action' => 'add',
- );
- echo $form->create('Link', array('url' => $url));
-
-?>
-<fieldset>
-<legend><?php __('Add Link'); ?></legend>
-<?php
- echo $this->Form->input('url', array(
- 'type' => 'text',
- 'label' => __('URL', true),
- 'style' => 'ime-mode:inactive;',
- 'class' => 'longInput',
- 'after' => $html->div(
- 'required',
- __(' required', true)
- )
- ));
- echo $this->Html->div(
- 'attention',
- __('URL must be less than 512 letters. The Multi-byte letters will counted after UTF-8 encoded.', true)
- );
-
- echo $this->Form->input('title', array(
- 'type' => 'text',
- 'label' => __('Title', true),
- 'class' => 'longInput',
- 'after' => $html->div(
- '',
- __('If empty, the site title will be automatically inputted.', true)
- )
- ));
-
- echo $linkSelect->create_type_select($type, 'type', array(
- 'label' => __('Link Type', true),
- 'selected' => '99',
- ));
-
- echo $this->Form->input('pickup', array(
- 'type' => 'checkbox',
- 'label' => __('PickUp', true),
- ));
-
- echo $token->create();
-?>
-</fieldset>
-<?php echo $this->Form->end(__('Submit', true));?>
-</div>
-
-<div class="backButton">
-<?php
- echo $form->create('', array('url' => array(
- 'action' => 'index'),
- 'type' => 'GET',
- 'id' => 'CancelButton'
- ));
- echo $form->end(array('label' => __('Cancel', true)));
-?>
-</div>
+ ),
+ 'isEdit' => false,
+ 'isAdmin' => true,
+));
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://trpgtools-onweb.sourceforge.jp/
*/
+echo $this->Html->css('/links/css/link.css');
+?>
+<script language="JavaScript">
+<!--
+ var thumbnailweb_jump = "";
+ var thumbnailweb_target = "_blank";
+ var thumbnailweb_lpos = "right";
+ var thumbnailweb_lposv = "10";
+
+//-->
+</script>
+<?php
echo $this->element('link_view', array(
+ 'link' => $link,
'isDelete' => true,
'isAdmin' => true,
));
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://trpgtools-onweb.sourceforge.jp/
*/
-?>
-<div class="links form">
-<?php echo $this->Form->create('Link');?>
- <fieldset>
- <legend><?php __('Admin Edit Link'); ?></legend>
- <?php
- echo $this->Form->input('id');
- echo $this->Form->input('title');
- echo $this->Form->input('user_id');
- echo $this->Form->input('url');
- echo $this->Form->input('type');
- echo $this->Form->input('pickup');
- echo $this->Form->input('not_found');
- ?>
- </fieldset>
-<?php echo $this->Form->end(__('Submit', true));?>
-</div>
-<div class="actions">
- <h3><?php __('Actions'); ?></h3>
- <ul>
- <li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Link.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Link.id'))); ?></li>
- <li><?php echo $this->Html->link(__('List Links', true), array('action' => 'index'));?></li>
- <li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
- <li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
- </ul>
-</div>
\ No newline at end of file
+echo $this->element('link_edit', array(
+ 'url' => array(
+ 'plugin' => 'links',
+ 'controller' => 'links',
+ 'action' => 'edit',
+ $this->data['Link']['id'],
+ ),
+ 'isEdit' => true,
+ 'isAdmin' => true,
+));
--- /dev/null
+<?php
+/*
+ * Link Plugin for TRPG Databank
+ *
+ * PHP version 5
+ *
+ * @copyright Copyright 2010, Cake. (http://trpgtools-onweb.sourceforge.jp/)
+ * @category View
+ * @package plugin for TRPG Data Bank
+ * @version beta
+ * @author Cake <cake_67@users.sourceforge.jp>
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ * @link http://trpgtools-onweb.sourceforge.jp/
+ */
+
+echo $this->element('link_index', array(
+ 'links' => $links,
+ 'isAdmin' => true,
+));