ff4c779cf9bf0bab6849f7c8c8ef620f73434370
Author: Jeff Loiselle
Date: 2008-12-14 19:27:33 -0500
diff --git a/TODO b/TODO
index 109e94b..8231c15 100644
--- a/TODO
+++ b/TODO
@@ -14,5 +14,16 @@
* 301 redirects
* serve as an OpenID auth server
* talk to OpenID auth servers
+* add RSS feed to header
-* download vcard
\ No newline at end of file
+* download vcard
+
+* compatible with WordPress templates
+* import from WordPress
+
+
+* Why a new CMS
+
+- Built on a framework you can live with CakePHP
+- It's both a module and a complete solution
+- Every part of the system has a development API
diff --git a/controllers/categories_controller.php b/controllers/categories_controller.php
index eb8fea1..d9dcd4f 100644
--- a/controllers/categories_controller.php
+++ b/controllers/categories_controller.php
@@ -1,8 +1,67 @@
<?php
class CategoriesController extends AppController {
+
+ var $helpers = array('Paginator');
+
+ /**
+ * shows all categories
+ */
+ function admin_index() {
+ $this->set('categories', $this->paginate());
+ }
- var $scaffold;
+ /**
+ * creates a category
+ */
+ function admin_add() {
+ if (!empty($this->data)) {
+ if ($this->Category->save($this->data)) {
+ $this->Session->setFlash(__('Successfully saved categories', true));
+ $this->redirect('/admin/categories');
+ } else {
+ $this->Session->setFlash(__('Failed to save categories', true), null, null, 'error');
+ }
+ }
+ $this->set('parents', $parents = $this->Category->find('list'));
+ }
+
+ /**
+ * deletes a category
+ */
+ function admin_delete($id) {
+ if (!$id) {
+ $this->Session->setFlash(__('That category does not exist', true), null, null, 'error');
+ $this->redirect($this->referer());
+ }
+ if ($this->Category->del($id)) {
+ $this->Session->setFlash(__('Successfully deleted category', true));
+ $this->redirect($this->referer());
+ } else {
+ $this->Session->setFlash(__('Failed to delete category', true), null, null, 'error');
+ }
+ }
+
+ /**
+ * edits a category
+ */
+ function admin_edit($id = null) {
+ if (!$id && empty($this->data['Category']['id'])) {
+ $this->Session->setFlash(__('That category does not exist', true), null, null, 'error');
+ $this->redirect($this->referer());
+ }
+ if (!empty($this->data)) {
+ if ($this->Category->save($this->data)) {
+ $this->Session->setFlash(__('Successfully saved category', true));
+ $this->redirect('/admin/categories');
+ } else {
+ $this->Session->setFlash(__('Failed to save category', true), null, null, 'error');
+ }
+ } else {
+ $this->data = $this->Category->read(null, $id);
+ }
+ $this->set('parents', $parents = $this->Category->find('list'));
+ }
}
diff --git a/controllers/comments_controller.php b/controllers/comments_controller.php
index c4694b1..5974393 100644
--- a/controllers/comments_controller.php
+++ b/controllers/comments_controller.php
@@ -2,8 +2,7 @@
class CommentsController extends AppController {
- var $components = array('LiveValidation.JqueryForm');
- var $helpers = array('LiveValidation.JqueryForm', 'Paginator');
+ var $helpers = array('Paginator');
function add() {
if (!empty($this->data)) {
diff --git a/models/category.php b/models/category.php
index 6f7eac3..f41d49a 100644
--- a/models/category.php
+++ b/models/category.php
@@ -4,6 +4,13 @@ class Category extends AppModel {
var $actsAs = array('Tree');
+ var $validate = array(
+ 'name' => array(
+ 'rule' => array('custom', '/^[A-Za-z\- ]+$/'),
+ 'message' => 'Only letters, spaces, and hyphens allowed'
+ )
+ );
+
}
?>
\ No newline at end of file
diff --git a/views/content/admin_index.ctp b/views/content/admin_index.ctp
index d1e515e..b70b595 100644
--- a/views/content/admin_index.ctp
+++ b/views/content/admin_index.ctp
@@ -1,11 +1,6 @@
<div class="contents index">
<h2><?php __('Contents');?></h2>
-<p>
-<?php
-echo $paginator->counter(array(
-'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
-));
-?></p>
+
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('id');?></th>
diff --git a/views/elements/comment.ctp b/views/elements/comment.ctp
index 4b0db06..161ab1b 100644
--- a/views/elements/comment.ctp
+++ b/views/elements/comment.ctp
@@ -1,7 +1,6 @@
<fieldset>
<legend><?php __('Add Comment') ?></legend>
<?php print $form->create('Comment')?>
- <?php #print $jqueryForm->validate('CommentAddForm') ?>
<?php print $form->hidden('content_id', array('value' => $c['Content']['id'])) ?>
<?php print $form->input('name') ?>
<?php print $form->input('email') ?>
diff --git a/views/layouts/admin.ctp b/views/layouts/admin.ctp
index 24a873f..d9f49ea 100644
--- a/views/layouts/admin.ctp
+++ b/views/layouts/admin.ctp
@@ -96,7 +96,17 @@
</ul>
</div>
</div>
- </li>
+ </li>
+ <li class="yuimenuitem"><a class="yuimenuitemlabel" href="#">Categories</a>
+ <div id="" class="yuimenu">
+ <div class="bd">
+ <ul class="first-of-type">
+ <li class="yuimenuitem"><a class="yuimenuitemlabel" href="<?php print Router::url('/admin/categories/add') ?>">Create Category</a></li>
+ <li class="yuimenuitem"><a class="yuimenuitemlabel" href="<?php print Router::url('/admin/categories/') ?>">Manage Categories</a></li>
+ </ul>
+ </div>
+ </div>
+ </li>
</ul>
</div>
</div>
