Changeset 67
- Timestamp:
- 06/14/07 16:48:54 (1 year ago)
- Files:
-
- branch/controllers/galleries_controller.php (modified) (1 diff)
- branch/controllers/menus_controller.php (modified) (5 diffs)
- branch/controllers/posts_controller.php (modified) (1 diff)
- branch/views/elements/js_include.ctp (modified) (1 diff)
- branch/views/elements/mainnav.ctp (modified) (1 diff)
- branch/views/galleries/admin_add.ctp (modified) (1 diff)
- branch/views/galleries/admin_edit.ctp (modified) (1 diff)
- branch/views/menus/admin_add.ctp (modified) (1 diff)
- branch/views/menus/admin_edit.ctp (modified) (1 diff)
- branch/views/menus/admin_index.ctp (modified) (1 diff)
- branch/views/posts/admin_add.ctp (modified) (1 diff)
- branch/webroot/js/jquery.cookie.js (added)
- branch/webroot/js/jquery.form.js (added)
- branch/webroot/js/webrocket.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branch/controllers/galleries_controller.php
r63 r67 114 114 $this->data = $this->Gallery->read(null, $id); 115 115 } 116 $images = $this->Gallery->Image->generateList( );116 $images = $this->Gallery->Image->generateList(null,null,null, '{n}.Image.id', '{n}.Image.alt'); 117 117 $subjects = $this->Gallery->Subject->generateList(); 118 118 $this->set(compact('images','subjects')); branch/controllers/menus_controller.php
r60 r67 1 1 <?php 2 class MenusController extends AppController {2 class menusController extends AppController { 3 3 4 var $name = 'Menus'; 4 var $name = 'menus'; 5 var $helpers = array('Html', 'Form' ); 6 5 7 var $uses = array('Menu','Group'); 6 8 … … 18 20 } 19 21 20 function view($id = null) { 22 function admin_index() { 23 $this->Menu->recursive = 0; 24 $this->set('menus', $this->paginate()); 25 } 26 27 function admin_view($id = null) { 21 28 if(!$id) { 22 29 $this->Session->setFlash('Invalid Menu.'); … … 26 33 } 27 34 28 function add() { 35 function admin_add() { 36 37 $sections = $this->Menu->Section->generateList(); 38 $this->set(compact('sections')); 39 40 $access_levels = $this->Group->generateList(null,null,null,'{n}.Group.level', '{n}.Group.name'); 41 $this->set(compact('access_levels')); 42 43 $data = $this->Menu->findAllThreaded(array(null, null, 'Menu.position')); 44 $this->set(compact('data')); 45 29 46 if(!empty($this->data)) { 30 47 $this->cleanUpFields(); … … 37 54 } 38 55 } 39 $parents = $this->Menu->Parent->generateList();40 $sections = $this->Menu->Section->generateList();41 $this->set(compact('parents', 'sections'));42 56 } 43 57 44 function edit($id = null) { 58 function admin_edit($id = null) { 59 60 $sections = $this->Menu->Section->generateList(); 61 $this->set(compact('sections')); 62 63 $access_levels = $this->Group->generateList(null,null,null,'{n}.Group.level', '{n}.Group.name'); 64 $this->set(compact('access_levels')); 65 66 $data = $this->Menu->findAllThreaded(array(null, null, 'Menu.position')); 67 $this->set(compact('data')); 68 45 69 if(!$id && empty($this->data)) { 46 70 $this->Session->setFlash('Invalid Menu'); … … 59 83 $this->data = $this->Menu->read(null, $id); 60 84 } 61 $parents = $this->Menu->Parent->generateList();62 $sections = $this->Menu->Section->generateList();63 $this->set(compact('parents','sections'));64 }65 66 function delete($id = null) {67 if(!$id) {68 $this->Session->setFlash('Invalid id for Menu');69 $this->redirect(array('action'=>'index'), null, true);70 }71 if($this->Menu->del($id)) {72 $this->Session->setFlash('Menu #'.$id.' deleted');73 $this->redirect(array('action'=>'index'), null, true);74 }75 }76 77 78 function admin_index() {79 $this->Menu->recursive = 0;80 $this->set('menus', $this->paginate());81 }82 83 function admin_view($id = null) {84 if(!$id) {85 $this->Session->setFlash('Invalid Menu.');86 $this->redirect(array('action'=>'index'), null, true);87 }88 $this->set('menu', $this->Menu->read(null, $id));89 }90 91 function admin_add() {92 if(!empty($this->data)) {93 $this->cleanUpFields();94 $this->Menu->create();95 if($this->Menu->save($this->data)) {96 $this->Session->setFlash('The Menu has been saved');97 $this->redirect(array('action'=>'index'), null, true);98 } else {99 $this->Session->setFlash('The Menu could not be saved. Please, try again.');100 }101 }102 $parents = $this->Menu->Parent->generateList();103 $sections = $this->Menu->Section->generateList();104 $this->set(compact('parents', 'sections'));105 }106 107 function admin_edit($id = null) {108 if(!$id && empty($this->data)) {109 $this->Session->setFlash('Invalid Menu');110 $this->redirect(array('action'=>'index'), null, true);111 }112 if(!empty($this->data)) {113 $this->cleanUpFields();114 if($this->Menu->save($this->data)) {115 $this->Session->setFlash('The Menu saved');116 $this->redirect(array('action'=>'index'), null, true);117 } else {118 $this->Session->setFlash('The Menu could not be saved. Please, try again.');119 }120 }121 if(empty($this->data)) {122 $this->data = $this->Menu->read(null, $id);123 }124 $parents = $this->Menu->Parent->generateList();125 $sections = $this->Menu->Section->generateList();126 $this->set(compact('parents','sections'));127 85 } 128 86 branch/controllers/posts_controller.php
r60 r67 111 111 $this->Post->create(); 112 112 if($this->Post->save($this->data)) { 113 $this->Session->setFlash('The Post has been saved');114 $this->redirect(array('action'=>'index'), null, true);113 //$this->Session->setFlash('The Post has been saved'); 114 //$this->redirect(array('action'=>'index'), null, true); 115 115 } else { 116 116 $this->Session->setFlash('The Post could not be saved. Please, try again.'); branch/views/elements/js_include.ctp
r63 r67 1 1 <?php e($javascript->link('jquery'));?> 2 <?php e($javascript->link('jamal'));?> 2 <?php e($javascript->link('jquery.cookie'));?> 3 <?php e($javascript->link('jquery.form'));?> 4 <?php e($javascript->link('treeview/jquery.treeview.pack'));?> 3 5 <?php e($javascript->link('wymeditor/jquery.wymeditor'));?> 4 6 <?php e($javascript->link('wymeditor/plugins/tidy/jquery.wymeditor.tidy'));?> branch/views/elements/mainnav.ctp
r57 r67 1 <?php e($javascript->link('treeview/jquery.treeview'));?>2 1 <?php $menus = $this->requestAction('/menus/index/1');?> 3 2 <div id="mainnav" class="primarynav"> branch/views/galleries/admin_add.ctp
r63 r67 2 2 <h2>New Gallery</h2> 3 3 <?php echo $form->create('Gallery');?> 4 <?php echo $form->input('title', array('class' => 'required'));?> 5 <?php echo $form->input('primary_image', array('options' => $images, 'class' => 'required'));?> 6 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 7 <?php echo $form->input('published', array('class' => 'required'));?> 8 <?php echo $form->input('tags', array('type'=>'text', 'class' => 'required'));?> 9 <?php echo $form->input('Image/Image', array('options' => $images, 'multiple' => 'multiple'));?> 4 <fieldset id="main-content"> 5 <legend>Main Content</legend> 6 <?php echo $form->input('title', array('class' => 'required'));?> 7 <?php echo $form->input('primary_image', array('options' => $images, 'class' => 'required'));?> 8 <?php echo $form->input('Image/Image', array('options' => $images, 'multiple' => 'multiple'));?> 9 </fieldset> 10 11 <fieldset id="meta-content"> 12 <legend>Meta Data</legend> 13 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 14 <?php echo $form->input('tags', array('type'=>'text', 'class' => 'required'));?> 15 </fieldset> 16 17 <fieldset id="publishing-options"> 18 <legend>Publishing Options</legend> 19 <?php echo $form->input('published', array('class' => 'required'));?> 20 </fieldset> 21 10 22 <?php echo $form->submit('Add');?> 11 23 </form> 12 24 </div> 13 <div class="actions">14 <ul>15 <li><?php echo $html->link('List Galleries', array('action'=>'index')); ?></li>16 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view'));?></li>17 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li>18 </ul>19 </div>branch/views/galleries/admin_edit.ctp
r55 r67 2 2 <h2>Edit Gallery</h2> 3 3 <?php echo $form->create('Gallery');?> 4 <?php echo $form->input('id');?> 5 <?php echo $form->input('title', array('class' => 'required'));?> 6 <?php echo $form->input('url', array('class' => 'required'));?> 7 <?php echo $form->input('primary_image', array('class' => 'required'));?> 8 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 9 <?php echo $form->input('published', array('class' => 'required'));?> 10 <?php echo $form->input('Image/Image', array('options' => $images, 'multiple' => 'multiple'));?> 4 <fieldset id="main-content"> 5 <legend>Main Content</legend> 6 <?php echo $form->input('id');?> 7 <?php echo $form->input('title', array('class' => 'required'));?> 8 <?php echo $form->input('primary_image', array('options' => $images, 'class' => 'required'));?> 9 <?php echo $form->input('Image/Image', array('options' => $images, 'multiple' => 'multiple'));?> 10 </fieldset> 11 12 <fieldset id="meta-content"> 13 <legend>Meta Data</legend> 14 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 15 <?php echo $form->input('tags', array('type'=>'text', 'class' => 'required'));?> 16 </fieldset> 17 18 <fieldset id="publishing-options"> 19 <legend>Publishing Options</legend> 20 <?php echo $form->input('published', array('class' => 'required'));?> 21 </fieldset> 22 11 23 <?php echo $form->submit('Update');?> 24 <?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Gallery/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Gallery/id')); ?> 12 25 </form> 13 26 </div> 14 <div class="actions">15 <ul>16 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Gallery/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Gallery/id')); ?>17 <li><?php echo $html->link('List Galleries', array('action'=>'index')); ?></li>18 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view')); ?></li>19 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li>20 </ul>21 </div>branch/views/menus/admin_add.ctp
r55 r67 1 <div class="menu"> 2 <h2>New Menu</h2> 3 <?php echo $form->create('Menu');?> 4 <?php echo $form->input('name', array('class' => 'required'));?> 5 <?php echo $form->input('url', array('class' => 'required'));?> 6 <?php echo $form->input('position', array('class' => 'required'));?> 7 <?php echo $form->input('icon');?> 8 <?php echo $form->input('parent_id', array('class' => 'required', 'options' => $parents));?> 9 <?php echo $form->input('section_id', array('class' => 'required', 'options' => $sections));?> 10 <?php echo $form->input('access_level', array('class' => 'required'));?> 11 <?php echo $form->input('published', array('class' => 'required'));?> 12 <?php echo $form->submit('Add');?> 13 </form> 1 <div id="post"> 2 <h2>Add New Menu</h2> 3 <?php e($form->create('Menu'));?> 4 <fieldset id="post-main"> 5 <legend>Menu Details:</legend> 6 <?php echo $form->input('name');?> 7 <?php echo $form->input('url');?> 8 <?php echo $form->input('position');?> 9 <?php echo $form->input('icon');?> 10 <?php echo $treeMenu->select($data);?> 11 <?php echo $form->input('section_id', array('options' => $sections));?> 12 <?php echo $form->input('access_level', array('options'=>$access_levels));?> 13 <?php echo $form->input('published', array('type'=>'checkbox'));?> 14 </fieldset> 15 <?php e($form->submit('Save Menu'));?> <?php e($html->link('Cancel', '/admin/menus', array('class'=>'cancel')));?> 16 <?php e($form->end());?> 14 17 </div> 15 <div class="actions">16 <ul>17 <li><?php echo $html->link('List Menuses', array('action'=>'index')); ?></li>18 <li><?php echo $html->link('View Sections', array('controller'=> 'sections', 'action'=>'view'));?></li>19 <li><?php echo $html->link('Add Sections', array('controller'=> 'sections', 'action'=>'add')); ?></li>20 </ul>21 </div>branch/views/menus/admin_edit.ctp
r55 r67 1 <div class="menu"> 2 <h2>Edit Menu</h2> 3 <?php echo $form->create('Menu');?> 4 <?php echo $form->input('id');?> 5 <?php echo $form->input('name', array('class' => 'required'));?> 6 <?php echo $form->input('url', array('class' => 'required'));?> 7 <?php echo $form->input('position', array('class' => 'required'));?> 8 <?php echo $form->input('icon');?> 9 <?php echo $form->input('parent_id', array('class' => 'required', 'options' => $parents));?> 10 <?php echo $form->input('section_id', array('class' => 'required', 'options' => $sections));?> 11 <?php echo $form->input('access_level', array('class' => 'required'));?> 12 <?php echo $form->input('published', array('class' => 'required'));?> 13 <?php echo $form->submit('Update');?> 14 </form> 1 <div id="post"> 2 <h2>Edit Menu</h2> 3 <?php e($form->create('Menu'));?> 4 <fieldset id="post-main"> 5 <legend>Menu Details:</legend> 6 <?php echo $form->input('id');?> 7 <?php echo $form->input('name');?> 8 <?php echo $form->input('url');?> 9 <?php echo $form->input('position');?> 10 <?php echo $form->input('icon');?> 11 <?php echo $treeMenu->select($data);?> 12 <?php echo $form->input('section_id', array('options' => $sections));?> 13 <?php echo $form->input('access_level', array('options'=>$access_levels));?> 14 <?php echo $form->input('published', array('type'=>'checkbox'));?> 15 </fieldset> 16 <?php e($form->submit('Save Menu'));?> <?php e($html->link('Cancel', '/admin/menus', array('class'=>'cancel')));?> 17 <?php e($form->end());?> 15 18 </div> 16 <div class="actions">17 <ul>18 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Menu/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Menu/id')); ?>19 <li><?php echo $html->link('List Menuses', array('action'=>'index')); ?></li>20 <li><?php echo $html->link('View Sections', array('controller'=> 'sections', 'action'=>'view')); ?></li>21 <li><?php echo $html->link('Add Sections', array('controller'=> 'sections', 'action'=>'add')); ?></li>22 </ul>23 </div>branch/views/menus/admin_index.ctp
r55 r67 22 22 <td><?php echo $menu['Menu']['position']; ?></td> 23 23 <td><?php echo $menu['Menu']['icon']; ?></td> 24 <td><?php echo $html->link($menu[' Parent']['name'], array('controller'=> 'menus', 'action'=>'view', $menu['Parent']['id'])); ?></td>24 <td><?php echo $html->link($menu['Menu']['parent_id'], array('controller'=> 'menus', 'action'=>'view', $menu['Menu']['parent_id'])); ?></td> 25 25 <td><?php echo $html->link($menu['Section']['name'], array('controller'=> 'sections', 'action'=>'view', $menu['Section']['id'])); ?></td> 26 26 <td><?php echo $menu['Menu']['access_level']; ?></td> branch/views/posts/admin_add.ctp
r60 r67 1 <?php //e($javascript->codeBlock('$j.ready(function() {$("#PostAddForm").ajaxSubmit(function() { var options = { target: ".post" }; });});'));?> 2 3 <div class="success" style="display:none;"> 4 <h2>Post has successfuly saved.</h2> 5 </div> 6 1 7 <div class="post"> 2 8 <h2>New Post</h2> branch/webroot/js/webrocket.js
r63 r67 1 1 var $j = jQuery.noConflict(); 2 var $z = jamal.noConflict();2 //var $z = jamal.noConflict(); 3 3 4 4 $j(function() { … … 42 42 $j(".wymsubmit").click(function () {alert($j(this).siblings(".wymeditor").val());}); 43 43 44 $j("ul.mytreemenu").Treeview({speed: "slow", collapsed: true}); 44 $j("ul.mytreemenu").Treeview({speed: "slow", collapsed: true, store: true}); 45 46 /*var options = { 47 target: '#content', // target element(s) to be updated with server response 48 //beforeSubmit: showRequest, // pre-submit callback 49 success: showResponse // post-submit callback 50 }; */ 51 52 /*$j("#PostAddForm").submit(function(){ 53 $(this).ajaxSubmit(options); 54 $(".post").fadeOut("fast"); 55 return false; 56 });*/ 57 58 /*function showResponse() { 59 $(".success").fadeIn("slow"); 60 };*/ 45 61 });