diff --git a/Controller/LinkListsAppController.php b/Controller/LinkListsAppController.php deleted file mode 100644 index 1a01fb3..0000000 --- a/Controller/LinkListsAppController.php +++ /dev/null @@ -1,7 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ -class LinkListsController extends LinkListsAppController { - -/** - * Components - * - * @var array - */ - public $components = array('Paginator'); - -/** - * index method - * - * @return void - */ - public function index() { - $this->LinkList->recursive = 0; - $this->set('linkLists', $this->Paginator->paginate()); - } - -/** - * view method - * - * @throws NotFoundException - * @param string $id - * @return void - */ - public function view($id = null) { - if (!$this->LinkList->exists($id)) { - throw new NotFoundException(__('Invalid link list')); - } - $options = array('conditions' => array('LinkList.' . $this->LinkList->primaryKey => $id)); - $this->set('linkList', $this->LinkList->find('first', $options)); - } - -/** - * add method - * - * @return void - */ - public function add() { - if ($this->request->is('post')) { - $this->LinkList->create(); - if ($this->LinkList->save($this->request->data)) { - $this->Session->setFlash(__('The link list has been saved.')); - return $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The link list could not be saved. Please, try again.')); - } - } - $linklistsBlocks = $this->LinkList->LinklistsBlock->find('list'); - $languages = $this->LinkList->Language->find('list'); - $linklistsCategories = $this->LinkList->LinklistsCategory->find('list'); - $blocks = $this->LinkList->Block->find('list'); - $this->set(compact('linklistsBlocks', 'languages', 'linklistsCategories', 'blocks')); - } - -/** - * edit method - * - * @throws NotFoundException - * @param string $id - * @return void - */ - public function edit($id = null) { - if (!$this->LinkList->exists($id)) { - throw new NotFoundException(__('Invalid link list')); - } - if ($this->request->is(array('post', 'put'))) { - if ($this->LinkList->save($this->request->data)) { - $this->Session->setFlash(__('The link list has been saved.')); - return $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The link list could not be saved. Please, try again.')); - } - } else { - $options = array('conditions' => array('LinkList.' . $this->LinkList->primaryKey => $id)); - $this->request->data = $this->LinkList->find('first', $options); - } - $linklistsBlocks = $this->LinkList->LinklistsBlock->find('list'); - $languages = $this->LinkList->Language->find('list'); - $linklistsCategories = $this->LinkList->LinklistsCategory->find('list'); - $blocks = $this->LinkList->Block->find('list'); - $this->set(compact('linklistsBlocks', 'languages', 'linklistsCategories', 'blocks')); - } - -/** - * delete method - * - * @throws NotFoundException - * @param string $id - * @return void - */ - public function delete($id = null) { - $this->LinkList->id = $id; - if (!$this->LinkList->exists()) { - throw new NotFoundException(__('Invalid link list')); - } - $this->request->onlyAllow('post', 'delete'); - if ($this->LinkList->delete()) { - $this->Session->setFlash(__('The link list has been deleted.')); - } else { - $this->Session->setFlash(__('The link list could not be deleted. Please, try again.')); - } - return $this->redirect(array('action' => 'index')); - }} diff --git a/Controller/LinksAppController.php b/Controller/LinksAppController.php new file mode 100644 index 0000000..c61903a --- /dev/null +++ b/Controller/LinksAppController.php @@ -0,0 +1,22 @@ +_initializeFrame($frameId, $lang)) { + $this->response->statusCode(400); + return $this->render(false); + } + } +} diff --git a/Controller/LinkListsCategoriesController.php b/Controller/LinksCategoriesController.php similarity index 52% rename from Controller/LinkListsCategoriesController.php rename to Controller/LinksCategoriesController.php index 530e17a..7b26d36 100644 --- a/Controller/LinkListsCategoriesController.php +++ b/Controller/LinksCategoriesController.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Ryuji AMANO + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -class LinkListsCategoriesController extends LinkListsAppController { +class LinksCategoriesController extends LinksAppController { /** * Components @@ -25,23 +25,23 @@ class LinkListsCategoriesController extends LinkListsAppController { * @return void */ public function index() { - $this->LinkListsCategory->recursive = 0; + $this->LinksCategory->recursive = 0; $this->set('linkListsCategories', $this->Paginator->paginate()); } /** * view method * + * @param string $id 仮 * @throws NotFoundException - * @param string $id * @return void */ public function view($id = null) { - if (!$this->LinkListsCategory->exists($id)) { + if (!$this->LinksCategory->exists($id)) { throw new NotFoundException(__('Invalid link lists category')); } - $options = array('conditions' => array('LinkListsCategory.' . $this->LinkListsCategory->primaryKey => $id)); - $this->set('linkListsCategory', $this->LinkListsCategory->find('first', $options)); + $options = array('conditions' => array('LinksCategory.' . $this->LinksCategory->primaryKey => $id)); + $this->set('linkListsCategory', $this->LinksCategory->find('first', $options)); } /** @@ -51,63 +51,64 @@ public function view($id = null) { */ public function add() { if ($this->request->is('post')) { - $this->LinkListsCategory->create(); - if ($this->LinkListsCategory->save($this->request->data)) { + $this->LinksCategory->create(); + if ($this->LinksCategory->save($this->request->data)) { $this->Session->setFlash(__('The link lists category has been saved.')); return $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The link lists category could not be saved. Please, try again.')); } } - $linklistsBlocks = $this->LinkListsCategory->LinklistsBlock->find('list'); - $languages = $this->LinkListsCategory->Language->find('list'); - $this->set(compact('linklistsBlocks', 'languages')); + $linksBlocks = $this->LinksCategory->LinksBlock->find('list'); + $languages = $this->LinksCategory->Language->find('list'); + $this->set(compact('linksBlocks', 'languages')); } /** * edit method * + * @param string $id 仮 * @throws NotFoundException - * @param string $id * @return void */ public function edit($id = null) { - if (!$this->LinkListsCategory->exists($id)) { + if (!$this->LinksCategory->exists($id)) { throw new NotFoundException(__('Invalid link lists category')); } if ($this->request->is(array('post', 'put'))) { - if ($this->LinkListsCategory->save($this->request->data)) { + if ($this->LinksCategory->save($this->request->data)) { $this->Session->setFlash(__('The link lists category has been saved.')); return $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The link lists category could not be saved. Please, try again.')); } } else { - $options = array('conditions' => array('LinkListsCategory.' . $this->LinkListsCategory->primaryKey => $id)); - $this->request->data = $this->LinkListsCategory->find('first', $options); + $options = array('conditions' => array('LinksCategory.' . $this->LinksCategory->primaryKey => $id)); + $this->request->data = $this->LinksCategory->find('first', $options); } - $linklistsBlocks = $this->LinkListsCategory->LinklistsBlock->find('list'); - $languages = $this->LinkListsCategory->Language->find('list'); - $this->set(compact('linklistsBlocks', 'languages')); + $linksBlocks = $this->LinksCategory->LinksBlock->find('list'); + $languages = $this->LinksCategory->Language->find('list'); + $this->set(compact('linksBlocks', 'languages')); } /** * delete method * + * @param string $id 仮 * @throws NotFoundException - * @param string $id * @return void */ public function delete($id = null) { - $this->LinkListsCategory->id = $id; - if (!$this->LinkListsCategory->exists()) { + $this->LinksCategory->id = $id; + if (!$this->LinksCategory->exists()) { throw new NotFoundException(__('Invalid link lists category')); } $this->request->onlyAllow('post', 'delete'); - if ($this->LinkListsCategory->delete()) { + if ($this->LinksCategory->delete()) { $this->Session->setFlash(__('The link lists category has been deleted.')); } else { $this->Session->setFlash(__('The link lists category could not be deleted. Please, try again.')); } return $this->redirect(array('action' => 'index')); - }} + } +} diff --git a/Controller/LinksController.php b/Controller/LinksController.php new file mode 100644 index 0000000..195bbba --- /dev/null +++ b/Controller/LinksController.php @@ -0,0 +1,139 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ +class LinksController extends LinksAppController { + + public $helpers = array('Links.LinksForm', 'BoostCake.BoostCakeForm'); + + public $uses = array( + 'Links.Link', + ); + +/** + * Components + * + * @var array + */ + public $components = array('Paginator'); + +/** + * index + * + * @param int $frameId frame.id + * @param string $lang languge_id + * @return void + */ + public function index($frameId = 0, $lang = '') { + $this->_init($frameId, $lang); + + $this->Link->recursive = 0; + $this->set('links', $this->Paginator->paginate()); + + if (Configure::read('Pages.isSetting')) { + $this->render('Links/setting_mode/index'); + // 編集権限があり、セッティングモードON⇒index/edit.ctpでrenderする + } else { + // 編集権限があり、セッティングモードOFF⇒index/latest.ctpでrenderする + $this->render('Links/view/index'); + } + } + +/** + * view method + * + * @param string $id 仮 + * @throws NotFoundException + * @return void + */ + public function view($id = null) { + if (!$this->Link->exists($id)) { + throw new NotFoundException(__('Invalid link list')); + } + $options = array('conditions' => array('Link.' . $this->Link->primaryKey => $id)); + $this->set('linkList', $this->Link->find('first', $options)); + } + +/** + * add method + * + * @return void + */ + public function add() { + Debugger::log($this->request->data); + + if ($this->request->is('post')) { + $this->Link->create(); + if ($this->Link->save($this->request->data)) { + $this->Session->setFlash(__('The link list has been saved.')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The link list could not be saved. Please, try again.')); + } + } + $linksBlocks = $this->Link->LinksBlock->find('list'); + $languages = $this->Link->Language->find('list'); + $linksCategories = $this->Link->LinksCategory->find('list'); + $blocks = $this->Link->Block->find('list'); + $this->set(compact('linksBlocks', 'languages', 'linksCategories', 'blocks')); + } + +/** + * edit method + * + * @param string $id 仮 + * @throws NotFoundException + * @return void + */ + public function edit($id = null) { + if (!$this->Link->exists($id)) { + throw new NotFoundException(__('Invalid link list')); + } + if ($this->request->is(array('post', 'put'))) { + if ($this->Link->save($this->request->data)) { + $this->Session->setFlash(__('The link list has been saved.')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The link list could not be saved. Please, try again.')); + } + } else { + $options = array('conditions' => array('Link.' . $this->Link->primaryKey => $id)); + $this->request->data = $this->Link->find('first', $options); + } + $linksBlocks = $this->Link->LinksBlock->find('list'); + $languages = $this->Link->Language->find('list'); + $linksCategories = $this->Link->LinksCategory->find('list'); + $blocks = $this->Link->Block->find('list'); + $this->set(compact('linksBlocks', 'languages', 'linksCategories', 'blocks')); + } + +/** + * delete method + * + * @param string $id kari + * @throws NotFoundException + * @return void + */ + public function delete($id = null) { + $this->Link->id = $id; + if (!$this->Link->exists()) { + throw new NotFoundException(__('Invalid link list')); + } + $this->request->onlyAllow('post', 'delete'); + if ($this->Link->delete()) { + $this->Session->setFlash(__('The link list has been deleted.')); + } else { + $this->Session->setFlash(__('The link list could not be deleted. Please, try again.')); + } + return $this->redirect(array('action' => 'index')); + } +} diff --git a/Model/Linklist.php b/Model/Link.php similarity index 73% rename from Model/Linklist.php rename to Model/Link.php index 37e50b9..6ca9b66 100644 --- a/Model/Linklist.php +++ b/Model/Link.php @@ -1,23 +1,51 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsAppModel', 'LinkLists.Model'); +App::uses('LinksAppModel', 'Links.Model'); /** - * Summary for Linklist Model + * Summary for Link Model */ -class Linklist extends LinkListsAppModel { +class Link extends LinksAppModel { + +/** + * Link status publish + * + * @var int + */ + const STATUS_PUBLISHED = '1'; + +/** + * Link status approval + * + * @var int + */ + const STATUS_APPROVED = '2'; + +/** + * Link status draft + * + * @var int + */ + const STATUS_DRAFTED = '3'; + +/** + * Link status disapproval + * + * @var int + */ + const STATUS_DISAPPROVED = '4'; /** * Use database config @@ -32,7 +60,7 @@ class Linklist extends LinkListsAppModel { * @var array */ public $validate = array( - 'linklists_block_id' => array( + 'links_block_id' => array( 'numeric' => array( 'rule' => array('numeric'), //'message' => 'Your custom message here', @@ -92,9 +120,9 @@ class Linklist extends LinkListsAppModel { * @var array */ public $belongsTo = array( - 'LinklistsBlock' => array( - 'className' => 'LinklistsBlock', - 'foreignKey' => 'linklists_block_id', + 'LinksBlock' => array( + 'className' => 'LinksBlock', + 'foreignKey' => 'links_block_id', 'conditions' => '', 'fields' => '', 'order' => '' @@ -106,9 +134,9 @@ class Linklist extends LinkListsAppModel { 'fields' => '', 'order' => '' ), - 'LinklistsCategory' => array( - 'className' => 'LinklistsCategory', - 'foreignKey' => 'linklists_category_id', + 'LinksCategory' => array( + 'className' => 'LinksCategory', + 'foreignKey' => 'links_category_id', 'conditions' => '', 'fields' => '', 'order' => '' @@ -123,8 +151,8 @@ class Linklist extends LinkListsAppModel { public $hasAndBelongsToMany = array( 'Block' => array( 'className' => 'Block', - 'joinTable' => 'linklists_blocks', - 'foreignKey' => 'linklist_id', + 'joinTable' => 'links_blocks', + 'foreignKey' => 'link_id', 'associationForeignKey' => 'block_id', 'unique' => 'keepExisting', 'conditions' => '', diff --git a/Model/LinklistPartSetting.php b/Model/LinkPartSetting.php similarity index 83% rename from Model/LinklistPartSetting.php rename to Model/LinkPartSetting.php index 870aacc..7fe5b56 100644 --- a/Model/LinklistPartSetting.php +++ b/Model/LinkPartSetting.php @@ -1,21 +1,21 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsAppModel', 'LinkLists.Model'); +App::uses('LinksAppModel', 'Links.Model'); /** - * Summary for LinklistPartSetting Model + * Summary for LinkPartSetting Model */ -class LinklistPartSetting extends LinkListsAppModel { +class LinkPartSetting extends LinksAppModel { /** * Use database config @@ -30,7 +30,7 @@ class LinklistPartSetting extends LinkListsAppModel { * @var array */ public $validate = array( - 'linklist_block_id' => array( + 'link_block_id' => array( 'numeric' => array( 'rule' => array('numeric'), //'message' => 'Your custom message here', @@ -100,9 +100,9 @@ class LinklistPartSetting extends LinkListsAppModel { * @var array */ public $belongsTo = array( - 'LinklistBlock' => array( - 'className' => 'LinklistBlock', - 'foreignKey' => 'linklist_block_id', + 'LinkBlock' => array( + 'className' => 'LinkBlock', + 'foreignKey' => 'link_block_id', 'conditions' => '', 'fields' => '', 'order' => '' diff --git a/Model/LinklistSetting.php b/Model/LinkSetting.php similarity index 59% rename from Model/LinklistSetting.php rename to Model/LinkSetting.php index e44285c..a1e9cfd 100644 --- a/Model/LinklistSetting.php +++ b/Model/LinkSetting.php @@ -1,20 +1,20 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsAppModel', 'LinkLists.Model'); +App::uses('LinksAppModel', 'Links.Model'); /** - * Summary for LinklistSetting Model + * Summary for LinkSetting Model */ -class LinklistSetting extends LinkListsAppModel { +class LinkSetting extends LinksAppModel { /** * Use database config @@ -29,7 +29,7 @@ class LinklistSetting extends LinkListsAppModel { * @var array */ public $validate = array( - 'linklist_block_id' => array( + 'link_block_id' => array( 'numeric' => array( 'rule' => array('numeric'), //'message' => 'Your custom message here', @@ -49,9 +49,9 @@ class LinklistSetting extends LinkListsAppModel { * @var array */ public $belongsTo = array( - 'LinklistBlock' => array( - 'className' => 'LinklistBlock', - 'foreignKey' => 'linklist_block_id', + 'LinkBlock' => array( + 'className' => 'LinkBlock', + 'foreignKey' => 'link_block_id', 'conditions' => '', 'fields' => '', 'order' => '' diff --git a/Model/LinkListsAppModel.php b/Model/LinksAppModel.php similarity index 50% rename from Model/LinkListsAppModel.php rename to Model/LinksAppModel.php index d3679d3..40c3512 100644 --- a/Model/LinkListsAppModel.php +++ b/Model/LinksAppModel.php @@ -2,6 +2,6 @@ App::uses('AppModel', 'Model'); -class LinkListsAppModel extends AppModel { +class LinksAppModel extends AppModel { } diff --git a/Model/LinklistsBlock.php b/Model/LinksBlock.php similarity index 68% rename from Model/LinklistsBlock.php rename to Model/LinksBlock.php index f047f9b..f708006 100644 --- a/Model/LinklistsBlock.php +++ b/Model/LinksBlock.php @@ -1,22 +1,22 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsAppModel', 'LinkLists.Model'); +App::uses('LinksAppModel', 'Links.Model'); /** - * Summary for LinklistsBlock Model + * Summary for LinksBlock Model */ -class LinklistsBlock extends LinkListsAppModel { +class LinksBlock extends LinksAppModel { /** * Use database config @@ -66,9 +66,9 @@ class LinklistsBlock extends LinkListsAppModel { * @var array */ public $hasMany = array( - 'Linklist' => array( - 'className' => 'Linklist', - 'foreignKey' => 'linklists_block_id', + 'Link' => array( + 'className' => 'Link', + 'foreignKey' => 'links_block_id', 'dependent' => false, 'conditions' => '', 'fields' => '', @@ -79,9 +79,9 @@ class LinklistsBlock extends LinkListsAppModel { 'finderQuery' => '', 'counterQuery' => '' ), - 'LinklistsCategory' => array( - 'className' => 'LinklistsCategory', - 'foreignKey' => 'linklists_block_id', + 'LinksCategory' => array( + 'className' => 'LinksCategory', + 'foreignKey' => 'links_block_id', 'dependent' => false, 'conditions' => '', 'fields' => '', diff --git a/Model/LinklistsCategory.php b/Model/LinksCategory.php similarity index 77% rename from Model/LinklistsCategory.php rename to Model/LinksCategory.php index 9405527..a3512cb 100644 --- a/Model/LinklistsCategory.php +++ b/Model/LinksCategory.php @@ -1,22 +1,22 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsAppModel', 'LinkLists.Model'); +App::uses('LinksAppModel', 'Links.Model'); /** - * Summary for LinklistsCategory Model + * Summary for LinksCategory Model */ -class LinklistsCategory extends LinkListsAppModel { +class LinksCategory extends LinksAppModel { /** * Use database config @@ -31,7 +31,7 @@ class LinklistsCategory extends LinkListsAppModel { * @var array */ public $validate = array( - 'linklists_block_id' => array( + 'links_block_id' => array( 'numeric' => array( 'rule' => array('numeric'), //'message' => 'Your custom message here', @@ -81,9 +81,9 @@ class LinklistsCategory extends LinkListsAppModel { * @var array */ public $belongsTo = array( - 'LinklistsBlock' => array( - 'className' => 'LinklistsBlock', - 'foreignKey' => 'linklists_block_id', + 'LinksBlock' => array( + 'className' => 'LinksBlock', + 'foreignKey' => 'links_block_id', 'conditions' => '', 'fields' => '', 'order' => '' @@ -103,9 +103,9 @@ class LinklistsCategory extends LinkListsAppModel { * @var array */ public $hasMany = array( - 'Linklist' => array( - 'className' => 'Linklist', - 'foreignKey' => 'linklists_category_id', + 'Link' => array( + 'className' => 'Link', + 'foreignKey' => 'links_category_id', 'dependent' => false, 'conditions' => '', 'fields' => '', diff --git a/Test/Case/Controller/LinkListsControllerTest.php b/Test/Case/Controller/LinkListsControllerTest.php deleted file mode 100644 index 5c62fb0..0000000 --- a/Test/Case/Controller/LinkListsControllerTest.php +++ /dev/null @@ -1,73 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('LinkListsController', 'LinkLists.Controller'); - -/** - * Summary for LinkListsController Test Case - */ -class LinkListsControllerTest extends ControllerTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklist', - 'plugin.link_lists.linklists_block', - 'plugin.link_lists.language', - 'plugin.link_lists.linklists_category', - 'plugin.link_lists.block', - 'plugin.link_lists.blocks_language', - 'plugin.link_lists.site_setting', - 'plugin.link_lists.site_setting_value' - ); - -/** - * testIndex method - * - * @return void - */ - public function testIndex() { - } - -/** - * testView method - * - * @return void - */ - public function testView() { - } - -/** - * testAdd method - * - * @return void - */ - public function testAdd() { - } - -/** - * testEdit method - * - * @return void - */ - public function testEdit() { - } - -/** - * testDelete method - * - * @return void - */ - public function testDelete() { - } - -} diff --git a/Test/Case/Controller/LinksAppControllerTest.php b/Test/Case/Controller/LinksAppControllerTest.php new file mode 100644 index 0000000..1c769ab --- /dev/null +++ b/Test/Case/Controller/LinksAppControllerTest.php @@ -0,0 +1,7 @@ + -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ -App::uses('LinkListsCategoriesController', 'LinkLists.Controller'); +App::uses('LinksCategoriesController', 'Links.Controller'); /** - * Summary for LinkListsCategoriesController Test Case + * Summary for LinksCategoriesController Test Case */ -class LinkListsCategoriesControllerTest extends ControllerTestCase { +class LinksCategoriesControllerTest extends ControllerTestCase { /** * Fixtures @@ -20,10 +20,10 @@ class LinkListsCategoriesControllerTest extends ControllerTestCase { * @var array */ public $fixtures = array( - 'plugin.link_lists.linklists_category', - 'plugin.link_lists.linklists_block', + 'plugin.link_lists.links_category', + 'plugin.link_lists.links_block', 'plugin.link_lists.language', - 'plugin.link_lists.linklist', + 'plugin.link_lists.link', 'plugin.link_lists.site_setting', 'plugin.link_lists.site_setting_value' ); diff --git a/Test/Case/Controller/LinksControllerTest.php b/Test/Case/Controller/LinksControllerTest.php new file mode 100644 index 0000000..905a18a --- /dev/null +++ b/Test/Case/Controller/LinksControllerTest.php @@ -0,0 +1,73 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('LinksController', 'Links.Controller'); + +/** + * Summary for LinksController Test Case + */ +class LinksControllerTest extends ControllerTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.links.link', + 'plugin.links.links_block', + 'plugin.links.language', + 'plugin.links.links_category', + 'plugin.links.block', + 'plugin.links.blocks_language', + 'plugin.links.site_setting', + 'plugin.links.site_setting_value' + ); + +/** + * testIndex method + * + * @return void + */ + public function testIndex() { + } + +/** + * testView method + * + * @return void + */ + public function testView() { + } + +/** + * testAdd method + * + * @return void + */ + public function testAdd() { + } + +/** + * testEdit method + * + * @return void + */ + public function testEdit() { + } + +/** + * testDelete method + * + * @return void + */ + public function testDelete() { + } + +} diff --git a/Test/Case/Model/LinkPartSettingTest.php b/Test/Case/Model/LinkPartSettingTest.php new file mode 100644 index 0000000..7cfcfa4 --- /dev/null +++ b/Test/Case/Model/LinkPartSettingTest.php @@ -0,0 +1,51 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('LinkPartSetting', 'Links.Model'); + +/** + * Summary for LinkPartSetting Test Case + */ +class LinkPartSettingTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.link_lists.link_part_setting', + 'plugin.link_lists.link_block', + 'plugin.link_lists.part', + 'plugin.link_lists.language', + 'plugin.link_lists.languages_part' + ); + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $this->LinkPartSetting = ClassRegistry::init('Links.LinkPartSetting'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->LinkPartSetting); + + parent::tearDown(); + } + +} diff --git a/Test/Case/Model/LinkSettingTest.php b/Test/Case/Model/LinkSettingTest.php new file mode 100644 index 0000000..535e372 --- /dev/null +++ b/Test/Case/Model/LinkSettingTest.php @@ -0,0 +1,48 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('LinkSetting', 'Links.Model'); + +/** + * Summary for LinkSetting Test Case + */ +class LinkSettingTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.link_lists.link_setting', + 'plugin.link_lists.link_block' + ); + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $this->LinkSetting = ClassRegistry::init('Links.LinkSetting'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->LinkSetting); + + parent::tearDown(); + } + +} diff --git a/Test/Case/Model/LinkTest.php b/Test/Case/Model/LinkTest.php new file mode 100644 index 0000000..5ba4d09 --- /dev/null +++ b/Test/Case/Model/LinkTest.php @@ -0,0 +1,52 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('Link', 'Links.Model'); + +/** + * Summary for Link Test Case + */ +class LinkTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.link_lists.link', + 'plugin.link_lists.links_block', + 'plugin.link_lists.language', + 'plugin.link_lists.links_category', + 'plugin.link_lists.block', + 'plugin.link_lists.blocks_language' + ); + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $this->Link = ClassRegistry::init('Links.Link'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->Link); + + parent::tearDown(); + } + +} diff --git a/Test/Case/Model/LinklistPartSettingTest.php b/Test/Case/Model/LinklistPartSettingTest.php deleted file mode 100644 index ebc516f..0000000 --- a/Test/Case/Model/LinklistPartSettingTest.php +++ /dev/null @@ -1,51 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('LinklistPartSetting', 'LinkLists.Model'); - -/** - * Summary for LinklistPartSetting Test Case - */ -class LinklistPartSettingTest extends CakeTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklist_part_setting', - 'plugin.link_lists.linklist_block', - 'plugin.link_lists.part', - 'plugin.link_lists.language', - 'plugin.link_lists.languages_part' - ); - -/** - * setUp method - * - * @return void - */ - public function setUp() { - parent::setUp(); - $this->LinklistPartSetting = ClassRegistry::init('LinkLists.LinklistPartSetting'); - } - -/** - * tearDown method - * - * @return void - */ - public function tearDown() { - unset($this->LinklistPartSetting); - - parent::tearDown(); - } - -} diff --git a/Test/Case/Model/LinklistSettingTest.php b/Test/Case/Model/LinklistSettingTest.php deleted file mode 100644 index b85ee01..0000000 --- a/Test/Case/Model/LinklistSettingTest.php +++ /dev/null @@ -1,48 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('LinklistSetting', 'LinkLists.Model'); - -/** - * Summary for LinklistSetting Test Case - */ -class LinklistSettingTest extends CakeTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklist_setting', - 'plugin.link_lists.linklist_block' - ); - -/** - * setUp method - * - * @return void - */ - public function setUp() { - parent::setUp(); - $this->LinklistSetting = ClassRegistry::init('LinkLists.LinklistSetting'); - } - -/** - * tearDown method - * - * @return void - */ - public function tearDown() { - unset($this->LinklistSetting); - - parent::tearDown(); - } - -} diff --git a/Test/Case/Model/LinklistTest.php b/Test/Case/Model/LinklistTest.php deleted file mode 100644 index e5eb9a3..0000000 --- a/Test/Case/Model/LinklistTest.php +++ /dev/null @@ -1,52 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('Linklist', 'LinkLists.Model'); - -/** - * Summary for Linklist Test Case - */ -class LinklistTest extends CakeTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklist', - 'plugin.link_lists.linklists_block', - 'plugin.link_lists.language', - 'plugin.link_lists.linklists_category', - 'plugin.link_lists.block', - 'plugin.link_lists.blocks_language' - ); - -/** - * setUp method - * - * @return void - */ - public function setUp() { - parent::setUp(); - $this->Linklist = ClassRegistry::init('LinkLists.Linklist'); - } - -/** - * tearDown method - * - * @return void - */ - public function tearDown() { - unset($this->Linklist); - - parent::tearDown(); - } - -} diff --git a/Test/Case/Model/LinklistsBlockTest.php b/Test/Case/Model/LinklistsBlockTest.php deleted file mode 100644 index fdbbc8e..0000000 --- a/Test/Case/Model/LinklistsBlockTest.php +++ /dev/null @@ -1,52 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('LinklistsBlock', 'LinkLists.Model'); - -/** - * Summary for LinklistsBlock Test Case - */ -class LinklistsBlockTest extends CakeTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklists_block', - 'plugin.link_lists.block', - 'plugin.link_lists.language', - 'plugin.link_lists.blocks_language', - 'plugin.link_lists.linklist', - 'plugin.link_lists.linklists_category' - ); - -/** - * setUp method - * - * @return void - */ - public function setUp() { - parent::setUp(); - $this->LinklistsBlock = ClassRegistry::init('LinkLists.LinklistsBlock'); - } - -/** - * tearDown method - * - * @return void - */ - public function tearDown() { - unset($this->LinklistsBlock); - - parent::tearDown(); - } - -} diff --git a/Test/Case/Model/LinklistsCategoryTest.php b/Test/Case/Model/LinklistsCategoryTest.php deleted file mode 100644 index fbfc49e..0000000 --- a/Test/Case/Model/LinklistsCategoryTest.php +++ /dev/null @@ -1,50 +0,0 @@ - -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License - */ - -App::uses('LinklistsCategory', 'LinkLists.Model'); - -/** - * Summary for LinklistsCategory Test Case - */ -class LinklistsCategoryTest extends CakeTestCase { - -/** - * Fixtures - * - * @var array - */ - public $fixtures = array( - 'plugin.link_lists.linklists_category', - 'plugin.link_lists.linklists_block', - 'plugin.link_lists.language', - 'plugin.link_lists.linklist' - ); - -/** - * setUp method - * - * @return void - */ - public function setUp() { - parent::setUp(); - $this->LinklistsCategory = ClassRegistry::init('LinkLists.LinklistsCategory'); - } - -/** - * tearDown method - * - * @return void - */ - public function tearDown() { - unset($this->LinklistsCategory); - - parent::tearDown(); - } - -} diff --git a/Test/Case/Model/LinksBlockTest.php b/Test/Case/Model/LinksBlockTest.php new file mode 100644 index 0000000..8972507 --- /dev/null +++ b/Test/Case/Model/LinksBlockTest.php @@ -0,0 +1,52 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('LinksBlock', 'Links.Model'); + +/** + * Summary for LinksBlock Test Case + */ +class LinksBlockTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.link_lists.links_block', + 'plugin.link_lists.block', + 'plugin.link_lists.language', + 'plugin.link_lists.blocks_language', + 'plugin.link_lists.link', + 'plugin.link_lists.links_category' + ); + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $this->LinksBlock = ClassRegistry::init('Links.LinksBlock'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->LinksBlock); + + parent::tearDown(); + } + +} diff --git a/Test/Case/Model/LinksCategoryTest.php b/Test/Case/Model/LinksCategoryTest.php new file mode 100644 index 0000000..e4815d4 --- /dev/null +++ b/Test/Case/Model/LinksCategoryTest.php @@ -0,0 +1,50 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('LinksCategory', 'Links.Model'); + +/** + * Summary for LinksCategory Test Case + */ +class LinksCategoryTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + */ + public $fixtures = array( + 'plugin.link_lists.links_category', + 'plugin.link_lists.links_block', + 'plugin.link_lists.language', + 'plugin.link_lists.link' + ); + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $this->LinksCategory = ClassRegistry::init('Links.LinksCategory'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->LinksCategory); + + parent::tearDown(); + } + +} diff --git a/Test/Case/View/Helper/LinksFormHelperTest.php b/Test/Case/View/Helper/LinksFormHelperTest.php new file mode 100644 index 0000000..c4612ac --- /dev/null +++ b/Test/Case/View/Helper/LinksFormHelperTest.php @@ -0,0 +1,50 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + */ + +App::uses('View', 'View'); +App::uses('Helper', 'View'); +App::uses('LinksFormHelper', 'Links.View/Helper'); + +/** + * Summary for LinksFormHelper Test Case + */ +class LinksFormHelperTest extends CakeTestCase { + +/** + * setUp method + * + * @return void + */ + public function setUp() { + parent::setUp(); + $View = new View(); + $this->LinksForm = new LinksFormHelper($View); + } + +/** + * Fake + * + * @return void + */ + public function testFake() { + //fake + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->LinksForm); + + parent::tearDown(); + } + +} diff --git a/Test/Case/View/Helper/empty b/Test/Case/View/Helper/empty deleted file mode 100644 index e69de29..0000000 diff --git a/Test/Fixture/LinklistFixture.php b/Test/Fixture/LinkFixture.php similarity index 81% rename from Test/Fixture/LinklistFixture.php rename to Test/Fixture/LinkFixture.php index d400499..938ad2f 100644 --- a/Test/Fixture/LinklistFixture.php +++ b/Test/Fixture/LinkFixture.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ /** - * Summary for LinklistFixture + * Summary for LinkFixture */ -class LinklistFixture extends CakeTestFixture { +class LinkFixture extends CakeTestFixture { /** * Fields @@ -19,12 +19,12 @@ class LinklistFixture extends CakeTestFixture { */ public $fields = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'linklists_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'links_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), 'status' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 3), 'language_id' => array('type' => 'integer', 'null' => false, 'default' => '2'), 'is_auto_translated' => array('type' => 'boolean', 'null' => false, 'default' => '0'), 'translation_engine' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'linklists_category_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'links_category_id' => array('type' => 'integer', 'null' => true, 'default' => null), 'title' => array('type' => 'string', 'null' => true, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'url' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -46,12 +46,12 @@ class LinklistFixture extends CakeTestFixture { public $records = array( array( 'id' => 1, - 'linklists_block_id' => 1, + 'links_block_id' => 1, 'status' => 1, 'language_id' => 1, 'is_auto_translated' => 1, 'translation_engine' => 'Lorem ipsum dolor sit amet', - 'linklists_category_id' => 1, + 'links_category_id' => 1, 'title' => 'Lorem ipsum dolor sit amet', 'url' => 'Lorem ipsum dolor sit amet', 'description' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', diff --git a/Test/Fixture/LinklistPartSettingFixture.php b/Test/Fixture/LinkPartSettingFixture.php similarity index 77% rename from Test/Fixture/LinklistPartSettingFixture.php rename to Test/Fixture/LinkPartSettingFixture.php index 4623518..24604ce 100644 --- a/Test/Fixture/LinklistPartSettingFixture.php +++ b/Test/Fixture/LinkPartSettingFixture.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ /** - * Summary for LinklistPartSettingFixture + * Summary for LinkPartSettingFixture */ -class LinklistPartSettingFixture extends CakeTestFixture { +class LinkPartSettingFixture extends CakeTestFixture { /** * Fields @@ -19,7 +19,7 @@ class LinklistPartSettingFixture extends CakeTestFixture { */ public $fields = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'linklist_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'link_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), 'part_id' => array('type' => 'integer', 'null' => false, 'default' => '0'), 'readable_content' => array('type' => 'boolean', 'null' => false, 'default' => '0'), 'editable_content' => array('type' => 'boolean', 'null' => false, 'default' => '0'), @@ -43,7 +43,7 @@ class LinklistPartSettingFixture extends CakeTestFixture { public $records = array( array( 'id' => 1, - 'linklist_block_id' => 1, + 'link_block_id' => 1, 'part_id' => 1, 'readable_content' => 1, 'editable_content' => 1, diff --git a/Test/Fixture/LinklistSettingFixture.php b/Test/Fixture/LinkSettingFixture.php similarity index 69% rename from Test/Fixture/LinklistSettingFixture.php rename to Test/Fixture/LinkSettingFixture.php index 8bf60c0..d92ffed 100644 --- a/Test/Fixture/LinklistSettingFixture.php +++ b/Test/Fixture/LinkSettingFixture.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ /** - * Summary for LinklistSettingFixture + * Summary for LinkSettingFixture */ -class LinklistSettingFixture extends CakeTestFixture { +class LinkSettingFixture extends CakeTestFixture { /** * Fields @@ -19,7 +19,7 @@ class LinklistSettingFixture extends CakeTestFixture { */ public $fields = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'linklist_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'link_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), 'created_user' => array('type' => 'integer', 'null' => true, 'default' => null), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'modified_user' => array('type' => 'integer', 'null' => true, 'default' => null), @@ -38,7 +38,7 @@ class LinklistSettingFixture extends CakeTestFixture { public $records = array( array( 'id' => 1, - 'linklist_block_id' => 1, + 'link_block_id' => 1, 'created_user' => 1, 'created' => '2014-08-30 00:55:24', 'modified_user' => 1, diff --git a/Test/Fixture/LinklistsBlockFixture.php b/Test/Fixture/LinksBlockFixture.php similarity index 77% rename from Test/Fixture/LinklistsBlockFixture.php rename to Test/Fixture/LinksBlockFixture.php index 0b741b6..c0cd05c 100644 --- a/Test/Fixture/LinklistsBlockFixture.php +++ b/Test/Fixture/LinksBlockFixture.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ /** - * Summary for LinklistsBlockFixture + * Summary for LinksBlockFixture */ -class LinklistsBlockFixture extends CakeTestFixture { +class LinksBlockFixture extends CakeTestFixture { /** * Fields diff --git a/Test/Fixture/LinklistsCategoryFixture.php b/Test/Fixture/LinksCategoryFixture.php similarity index 79% rename from Test/Fixture/LinklistsCategoryFixture.php rename to Test/Fixture/LinksCategoryFixture.php index 27d5a14..88aa2c3 100644 --- a/Test/Fixture/LinklistsCategoryFixture.php +++ b/Test/Fixture/LinksCategoryFixture.php @@ -1,16 +1,16 @@ -* @link http://www.netcommons.org NetCommons Project -* @license http://www.netcommons.org/license.txt NetCommons License + * @author Jun Nishikawa + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License */ /** - * Summary for LinklistsCategoryFixture + * Summary for LinksCategoryFixture */ -class LinklistsCategoryFixture extends CakeTestFixture { +class LinksCategoryFixture extends CakeTestFixture { /** * Fields @@ -19,7 +19,7 @@ class LinklistsCategoryFixture extends CakeTestFixture { */ public $fields = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'linklists_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'links_block_id' => array('type' => 'integer', 'null' => false, 'default' => null), 'status' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 3), 'language_id' => array('type' => 'integer', 'null' => false, 'default' => '2'), 'is_auto_translated' => array('type' => 'boolean', 'null' => false, 'default' => '0'), @@ -43,7 +43,7 @@ class LinklistsCategoryFixture extends CakeTestFixture { public $records = array( array( 'id' => 1, - 'linklists_block_id' => 1, + 'links_block_id' => 1, 'status' => 1, 'language_id' => 1, 'is_auto_translated' => 1, diff --git a/View/Elements/form_buttons.ctp b/View/Elements/form_buttons.ctp new file mode 100644 index 0000000..c18515e --- /dev/null +++ b/View/Elements/form_buttons.ctp @@ -0,0 +1,62 @@ + + * @author SkeletonAuthorName + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + * @package app.Plugin.AccessCounters.View.Elements.setting + */ +?> + +
+ + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/View/Elements/header_buttons.ctp b/View/Elements/header_buttons.ctp new file mode 100644 index 0000000..59795d5 --- /dev/null +++ b/View/Elements/header_buttons.ctp @@ -0,0 +1,41 @@ + + * @author SkeletonAuthorName + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + * @package app.Plugin.Notepads.View.Elements.index + */ +?> +
+ + + + + + + + + + + +
+ diff --git a/View/Elements/link_form.ctp b/View/Elements/link_form.ctp new file mode 100644 index 0000000..1bbbc56 --- /dev/null +++ b/View/Elements/link_form.ctp @@ -0,0 +1,44 @@ + + * @author SkeletonAuthorName + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + * @package app.Plugin.AccessCounters.View.Elements.index + */ +?> + + + +element('form_buttons'); +?> diff --git a/View/Elements/link_list.ctp b/View/Elements/link_list.ctp new file mode 100644 index 0000000..4b40886 --- /dev/null +++ b/View/Elements/link_list.ctp @@ -0,0 +1,68 @@ +
+ + + +
\ No newline at end of file diff --git a/View/Helper/LinksFormHelper.php b/View/Helper/LinksFormHelper.php new file mode 100644 index 0000000..8d452b8 --- /dev/null +++ b/View/Helper/LinksFormHelper.php @@ -0,0 +1,42 @@ + +Form->create('Link'); ?> +
+ + Form->input('links_block_id'); + echo $this->Form->input('status'); + echo $this->Form->input('language_id'); + echo $this->Form->input('is_auto_translated'); + echo $this->Form->input('translation_engine'); + echo $this->Form->input('links_category_id'); + echo $this->Form->input('title'); + echo $this->Form->input('url'); + echo $this->Form->input('description'); + echo $this->Form->input('created_user'); + echo $this->Form->input('modified_user'); + echo $this->Form->input('Block'); + ?> +
+Form->end(__('Submit')); ?> + +
+

+
    + +
  • Html->link(__('List Links'), array('action' => 'index')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links Categories'), array('controller' => 'links_categories', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Category'), array('controller' => 'links_categories', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Blocks'), array('controller' => 'blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Block'), array('controller' => 'blocks', 'action' => 'add')); ?>
  • +
+
diff --git a/View/Links/edit.ctp b/View/Links/edit.ctp new file mode 100644 index 0000000..83f6e98 --- /dev/null +++ b/View/Links/edit.ctp @@ -0,0 +1,38 @@ + +
+

+
    + +
  • Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Link.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Link.id'))); ?>
  • +
  • Html->link(__('List Links'), array('action' => 'index')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links Categories'), array('controller' => 'links_categories', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Category'), array('controller' => 'links_categories', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Blocks'), array('controller' => 'blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Block'), array('controller' => 'blocks', 'action' => 'add')); ?>
  • +
+
diff --git a/View/Links/index.ctp b/View/Links/index.ctp new file mode 100644 index 0000000..d78b224 --- /dev/null +++ b/View/Links/index.ctp @@ -0,0 +1,78 @@ + +
+

+
    +
  • Html->link(__('New Link'), array('action' => 'add')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links Categories'), array('controller' => 'links_categories', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Category'), array('controller' => 'links_categories', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Blocks'), array('controller' => 'blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Block'), array('controller' => 'blocks', 'action' => 'add')); ?>
  • +
+
diff --git a/View/Links/setting_mode/index.ctp b/View/Links/setting_mode/index.ctp new file mode 100644 index 0000000..a0dc1e8 --- /dev/null +++ b/View/Links/setting_mode/index.ctp @@ -0,0 +1,32 @@ + +Html->script('/links/js/links.js'); ?> +
+ + + +element('header_buttons'); +echo $this->element('link_list'); + +?> + element('index/preview'); + + //状態ラベルの表示 +// echo $this->element('index/status_label'); + + //入力フォームの表示 + echo $this->element('link_form'); + + ?> + + + +
diff --git a/View/Links/view.ctp b/View/Links/view.ctp new file mode 100644 index 0000000..f5ab0b2 --- /dev/null +++ b/View/Links/view.ctp @@ -0,0 +1,129 @@ + +
+

+
    +
  • Html->link(__('Edit Link'), array('action' => 'edit', $link['Link']['id'])); ?>
  • +
  • Form->postLink(__('Delete Link'), array('action' => 'delete', $link['Link']['id']), null, __('Are you sure you want to delete # %s?', $link['Link']['id'])); ?>
  • +
  • Html->link(__('List Links'), array('action' => 'index')); ?>
  • +
  • Html->link(__('New Link'), array('action' => 'add')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links Categories'), array('controller' => 'links_categories', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Category'), array('controller' => 'links_categories', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Blocks'), array('controller' => 'blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Block'), array('controller' => 'blocks', 'action' => 'add')); ?>
  • +
+
+ diff --git a/View/Links/view/index.ctp b/View/Links/view/index.ctp new file mode 100644 index 0000000..f38627f --- /dev/null +++ b/View/Links/view/index.ctp @@ -0,0 +1,2 @@ +element('link_list'); \ No newline at end of file diff --git a/View/LinksCategories/add.ctp b/View/LinksCategories/add.ctp new file mode 100644 index 0000000..e59ba07 --- /dev/null +++ b/View/LinksCategories/add.ctp @@ -0,0 +1,30 @@ +
+Form->create('LinksCategory'); ?> +
+ + Form->input('links_block_id'); + echo $this->Form->input('status'); + echo $this->Form->input('language_id'); + echo $this->Form->input('is_auto_translated'); + echo $this->Form->input('translation_engine'); + echo $this->Form->input('title'); + echo $this->Form->input('created_user'); + echo $this->Form->input('modified_user'); + ?> +
+Form->end(__('Submit')); ?> +
+
+

+
    + +
  • Html->link(__('List Links Categories'), array('action' => 'index')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links'), array('controller' => 'links', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add')); ?>
  • +
+
diff --git a/View/LinksCategories/edit.ctp b/View/LinksCategories/edit.ctp new file mode 100644 index 0000000..912915d --- /dev/null +++ b/View/LinksCategories/edit.ctp @@ -0,0 +1,32 @@ +
+Form->create('LinksCategory'); ?> +
+ + Form->input('id'); + echo $this->Form->input('links_block_id'); + echo $this->Form->input('status'); + echo $this->Form->input('language_id'); + echo $this->Form->input('is_auto_translated'); + echo $this->Form->input('translation_engine'); + echo $this->Form->input('title'); + echo $this->Form->input('created_user'); + echo $this->Form->input('modified_user'); + ?> +
+Form->end(__('Submit')); ?> +
+
+

+
    + +
  • Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('LinksCategory.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('LinksCategory.id'))); ?>
  • +
  • Html->link(__('List Links Categories'), array('action' => 'index')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links'), array('controller' => 'links', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add')); ?>
  • +
+
diff --git a/View/LinksCategories/index.ctp b/View/LinksCategories/index.ctp new file mode 100644 index 0000000..62af884 --- /dev/null +++ b/View/LinksCategories/index.ctp @@ -0,0 +1,68 @@ +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Paginator->sort('id'); ?>Paginator->sort('links_block_id'); ?>Paginator->sort('status'); ?>Paginator->sort('language_id'); ?>Paginator->sort('is_auto_translated'); ?>Paginator->sort('translation_engine'); ?>Paginator->sort('title'); ?>Paginator->sort('created_user'); ?>Paginator->sort('created'); ?>Paginator->sort('modified_user'); ?>Paginator->sort('modified'); ?>
  + Html->link($linksCategory['LinksBlock']['id'], array('controller' => 'links_blocks', 'action' => 'view', $linksCategory['LinksBlock']['id'])); ?> +   + Html->link($linksCategory['Language']['id'], array('controller' => 'languages', 'action' => 'view', $linksCategory['Language']['id'])); ?> +         + Html->link(__('View'), array('action' => 'view', $linksCategory['LinksCategory']['id'])); ?> + Html->link(__('Edit'), array('action' => 'edit', $linksCategory['LinksCategory']['id'])); ?> + Form->postLink(__('Delete'), array('action' => 'delete', $linksCategory['LinksCategory']['id']), null, __('Are you sure you want to delete # %s?', $linksCategory['LinksCategory']['id'])); ?> +
+

+ Paginator->counter(array( + 'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') + )); + ?>

+
+ Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled')); + echo $this->Paginator->numbers(array('separator' => '')); + echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled')); + ?> +
+
+
+

+
    +
  • Html->link(__('New Links Category'), array('action' => 'add')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links'), array('controller' => 'links', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add')); ?>
  • +
+
diff --git a/View/LinksCategories/view.ctp b/View/LinksCategories/view.ctp new file mode 100644 index 0000000..9426317 --- /dev/null +++ b/View/LinksCategories/view.ctp @@ -0,0 +1,128 @@ +
+

+
+
+
+ +   +
+
+
+ Html->link($linksCategory['LinksBlock']['id'], array('controller' => 'links_blocks', 'action' => 'view', $linksCategory['LinksBlock']['id'])); ?> +   +
+
+
+ +   +
+
+
+ Html->link($linksCategory['Language']['id'], array('controller' => 'languages', 'action' => 'view', $linksCategory['Language']['id'])); ?> +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+
+

+
    +
  • Html->link(__('Edit Links Category'), array('action' => 'edit', $linksCategory['LinksCategory']['id'])); ?>
  • +
  • Form->postLink(__('Delete Links Category'), array('action' => 'delete', $linksCategory['LinksCategory']['id']), null, __('Are you sure you want to delete # %s?', $linksCategory['LinksCategory']['id'])); ?>
  • +
  • Html->link(__('List Links Categories'), array('action' => 'index')); ?>
  • +
  • Html->link(__('New Links Category'), array('action' => 'add')); ?>
  • +
  • Html->link(__('List Links Blocks'), array('controller' => 'links_blocks', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Links Block'), array('controller' => 'links_blocks', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Languages'), array('controller' => 'languages', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Language'), array('controller' => 'languages', 'action' => 'add')); ?>
  • +
  • Html->link(__('List Links'), array('controller' => 'links', 'action' => 'index')); ?>
  • +
  • Html->link(__('New Link'), array('controller' => 'links', 'action' => 'add')); ?>
  • +
+
+ diff --git a/webroot/js/links.js b/webroot/js/links.js new file mode 100644 index 0000000..ec8928c --- /dev/null +++ b/webroot/js/links.js @@ -0,0 +1,233 @@ +NetCommonsApp.controller('Links', + function($scope , $http, $sce, $timeout) { + /** + * ヘッダーボタン + * + * @type {boolean} + */ + $scope.sendLock = false; + + + /** + * display header button + * + * @type {boolean} + */ + $scope.displayHeaderBtn = true; + + + /** + * input form object + * + * @type {{display: boolean, + * title: string, + * content: content, + * button: boolean}} + */ + $scope.Form = { + 'display': false, + 'title': '', + 'url' : '', + 'description' : '', + 'button': false + }; + + /** + * content object + * + * @type {{display: boolean}} + */ + $scope.Content = { + 'display': true + }; + + /** + * Notepad plugin URL + * + * @const + */ + $scope.PLUGIN_URL = '/links/links/'; + + /** + * post url + * + * @const + */ + $scope.POST_FORM_URL = $scope.PLUGIN_URL + 'add/'; + + /** + * result message id attribute + * + * @type {sring} + */ + $scope.contentAttrId = ''; + + /** + * input form id attribute + * + * @type {sring} + */ + $scope.inputFormAttrId = ''; + + /** + * input form id attribute + * + * @const + */ + $scope.INPUT_FORM_ATTR_ID = '#nc-links-input-form-'; + + /** + * Initialize + * + * @return {void} + */ + $scope.initialize = function(notepad, frameId) { +// $scope.notepad = notepad; + $scope.frameId = frameId; + + //入力フォームid属性のセット + $scope.inputFormAttrId = $scope.INPUT_FORM_ATTR_ID + $scope.frameId; + +// //POSTフォームid属性のセット +// $scope.postFormAttrId = $scope.POST_FORM_ATTR_ID + $scope.frameId; +// //POSTフォームエリアid属性のセット +// $scope.postFormAreaAttrId = $scope.POST_FORM_ATTR_ID + +// 'area-' + $scope.frameId; + +// //登録処理結果メッセージのid属性のセット +// $scope.resultMessageAttrId = +// $scope.RESULT_MESSAGE_ATTR_ID + $scope.frameId; +// +// //コンテンツのid属性のセット +// $scope.ContentAttrId = $scope.CONTENT_ATTR_ID + $scope.frameId; + + $scope.Content.display = true; + + }; + + /** + * show setting form + * + * @return {void} + */ + $scope.showAddForm = function() { + /** + * 1.フォームを表示する $scope.GET_FORM_URL = $scope.PLUGIN_URL + 'form/'; + * 2.編集・ブロックセッティングのボタンを隠す + * 3.コンテンツを隠す + */ + $scope.Form.display = true; + $scope.displayHeaderBtn = false; + $scope.Form.button = true; + $scope.Content.display = false; + +// //メッセージの初期化 +// $($scope.resultMessageAttrId) +// .removeClass('alert-danger') +// .removeClass('alert-success'); +// $($scope.resultMessageAttrId + ' .message').html(' '); +// +// //POSTフォームエリアの内容をクリア +// $($scope.postFormAreaAttrId).html(' '); + }; + + + /** + * post + * 1: Publish + * 2: Approve + * 3: Draft + * 4: Disapprove + * + * @param {string} status + * @return {void} + */ +// $scope.post = function(postStatus) { +// //$scope.sendLock = true; +// +// $http.get($scope.GET_FORM_URL + +// $scope.frameId + '/' + +// $scope.notepad.Notepad.language_id + '/' + Math.random()) +// .success(function(data, status, headers, config) { +// //POST用のフォームセット +// $($scope.postFormAreaAttrId).html(data); +// //ステータスのセット +// $($scope.postFormAttrId + +// ' select[name="data[Notepad][status]"]').val(postStatus); +// +// var postParams = {}; +// //POSTフォームのシリアライズ +// var postSerialize = +// $($scope.postFormAttrId).serializeArray(); +// var length = postSerialize.length; +// for (var i = 0; i < length; i++) { +// postParams[postSerialize[i]['name']] = +// postSerialize[i]['value']; +// } +// +// //入力フォームのシリアライズ +// var inputSerialize = +// $($scope.inputFormAttrId).serializeArray(); +// var length = inputSerialize.length; +// for (var i = 0; i < length; i++) { +// postParams[inputSerialize[i]['name']] = +// inputSerialize[i]['value']; +// } +// +// //登録情報をPOST +// $scope.sendPost(postParams); +// }) +// .error(function(data, status, headers, config) { +// //keyの取得に失敗 +// if (! data) { data = 'error'; } +// $scope.showResult('error', data); +// }); +// }; + + + $scope.post = function(postStatus) { + var postParams = {}; + + //入力フォームのシリアライズ + var inputSerialize = + $($scope.inputFormAttrId).serializeArray(); + var length = inputSerialize.length; + for (var i = 0; i < length; i++) { + postParams[inputSerialize[i]['name']] = + inputSerialize[i]['value']; + } + $scope.sendPost(postParams); + } + /** + * save + * + * @param {Object.} postParams + * @return {void} + */ + $scope.sendPost = function(postParams) { + $.ajax({ + method: 'POST' , + url: $scope.POST_FORM_URL + $scope.frameId + '/' + Math.random(), + data: postParams, + success: function(json, status, headers, config) { +// $scope.notepad = json.data; +// $($scope.contentAttrId + ' .nc-notepads-title') +// .html(json.data.Notepad.title); +// $($scope.contentAttrId + ' .nc-notepads-content') +// .html(json.data.Notepad.content); +// $scope.showResult('success', json.message); + }, + error: function(json, status, headers, config) { + if (! json.message) { + $scope.showResult('error', headers); + } else { + $scope.showResult('error', json.message); + } + } + }); + }; + + } + + +) \ No newline at end of file