Changeset 247
- Timestamp:
- 03/18/09 11:44:57 (3 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 5 edited
-
config/core.php (modified) (1 diff)
-
controllers/bookmarks_controller.php (modified) (2 diffs)
-
views/bookmarks/add.ctp (deleted)
-
views/bookmarks/admin_listing.ctp (modified) (1 diff)
-
views/bookmarks/rss.ctp (deleted)
-
views/layouts/portal.ctp (modified) (2 diffs)
-
views/quicks/admin_listing.ctp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/core.php
r246 r247 15 15 */ 16 16 17 Configure::write('debug', 0);17 Configure::write('debug', 1); 18 18 /** 19 19 * To configure CakePHP *not* to use mod_rewrite and to -
trunk/controllers/bookmarks_controller.php
r123 r247 3 3 * Chipotle Software 4 4 * Manuel Montoya 2002-2009 5 * GPL manuel<a t>mononeurona.org5 * GPL manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 8 App::import('Model','User');9 8 App::import('Sanitize'); 10 9 11 10 class BookmarksController extends AppController { 12 11 13 public $helpers = array(' Html', 'Javascript', 'Ajax', 'Form', 'User', 'Fck', 'Gags');12 public $helpers = array('Javascript', 'User', 'Fck', 'Gags'); 14 13 15 public $components = array(' Security');14 public $components = array('RequestHandler'); 16 15 17 16 public function beforeFilter() … … 21 20 } 22 21 23 public function rss($username) 24 { 25 $this->layout = 'rss'; 26 27 $this->User = new User; 28 29 $user_id = $this->User->field('id', array("User.username"=>$username)); 30 31 $conditions = array("Bookmark.user_id"=>$user_id); 32 33 $fields = array("id", "name", "url", "created"); 34 35 $data = $this->Bookmark->findAll($conditions, $fields, "Bookmark.id DESC"); 36 37 $this->set('data', $data); 38 39 $this->set('username', $username); 22 23 /** 24 * Create an rss feed of the 15 last uploaded uses the RSS component 25 * 26 */ 27 public function feeder($username) 28 { 29 $conditions = array('User.username'=>trim($username)); 30 $user_id = $this->Bookmark->User->field('User.id', $conditions); 31 $channelData = array('title' => $username . "'s Bookmarks", 32 'link' => array('controller' => 'blog', 'action' => $username), 33 'description' => 'Hacktivismo', 34 'language' => 'es-mx' 35 ); 36 37 $conditions = array('Bookmark.user_id'=>$user_id); 38 $fields = array('Bookmark.id', 'Bookmark.name', 'Bookmark.url', 'Bookmark.created'); 39 $order = 'Bookmark.name ASC'; 40 $limit = 50; 41 42 $bookmarks = $this->Bookmark->findAll($conditions, $fields, $order, $limit); 43 #die(debug($bookmarks)); 44 $this->set(compact('channelData', 'bookmarks')); 40 45 } 41 46 42 /*** 43 ==== ADMIN SECTION ===== 44 ****/ 47 /*** ==== ADMIN SECTION =====****/ 45 48 46 49 public function admin_add() 47 50 { 48 if (!empty($this->data["Bookmark"])) 49 { 51 if (!empty($this->data['Bookmark'])): 52 $this->data['Bookmark'] = Sanitize::clean($this->data['Bookmark']); 53 $this->data['Bookmark']['user_id'] = (int) $this->Auth->user('id'); 50 54 51 52 Sanitize::clean($this->data); //Hopefully this is enough 53 54 $this->data['Bookmark']['user_id'] = $this->Auth->user('id'); 55 56 if ( $this->Bookmark->save($this->data['Bookmark'])) 57 { 58 $this->msgFlash('An new bookmark has been added!','/admin/bookmarks/listing'); 59 exit(); 60 } 61 } 62 } 55 if ( $this->Bookmark->save($this->data['Bookmark'])): 56 $this->msgFlash('Bookmark saved','/admin/bookmarks/listing'); 57 endif; 58 endif; 59 } 63 60 64 public function admin_listing()65 {66 $this->layout = 'admin';67 $this->pageTitle = 'Bookmarks';61 public function admin_listing() 62 { 63 $this->layout = 'admin'; 64 $this->pageTitle = 'Bookmarks'; 68 65 69 $conditions = array("Bookmark.user_id" => $this->Auth->user('id')); 70 $fields = array("Bookmark.id", "Bookmark.name", "Bookmark.url"); 71 $order = "Bookmark.name ASC"; 72 73 $this->set('data', $this->Bookmark->findAll($conditions, $fields, $order)); 74 } 75 76 public function admin_edit($id=null) 77 { 78 if (empty($this->data["Bookmark"])) 79 { 80 $this->layout = 'admin'; 81 66 $conditions = array('Bookmark.user_id' => $this->Auth->user('id')); 67 $fields = array('Bookmark.id', 'Bookmark.name', 'Bookmark.url'); 68 $order = 'Bookmark.name ASC'; 69 $this->set('data', $this->Bookmark->findAll($conditions, $fields, $order)); 70 } 71 72 public function admin_edit($bookmark_id=null) 73 { 74 if (empty($this->data['Bookmark'])): 75 $this->layout = 'admin'; 82 76 $this->Bookmark->id = $id; 83 77 84 $this->data = $this->Bookmark->read(); 85 } 86 else 87 { 88 89 90 Sanitize::clean($this->data); 91 92 if ($this->Bookmark->save($this->data)) 93 { 94 $this->msgFlash('The bookmark has been saved!','/admin/bookmarks/listing'); 95 exit(); 96 } 97 } 98 } 78 $this->data = $this->Bookmark->read(null, $bookmark_id); 79 else: 80 $this->data['Bookmark'] = Sanitize::clean($this->data['Bookmark']); 81 if ($this->Bookmark->save($this->data)): 82 $this->msgFlash('Bookmark saved','/admin/bookmarks/listing'); 83 endif; 84 endif; 85 } 99 86 100 public function admin_delete($ id)87 public function admin_delete($bookmark_id) 101 88 { 102 // deletes task from database 103 //die($this->data['Bookmark']['id']); 104 $this->Bookmark->del($id); 89 if ( $this->Bookmark->del($bookmark_id)): 105 90 $this->msgFlash('Bookmark has been deleted', '/admin/bookmarks/listing'); 106 exit(); 107 } 108 91 endif; 92 } 109 93 } 110 94 ?> -
trunk/views/bookmarks/admin_listing.ctp
r194 r247 3 3 echo $html->getCrumbs(' / '); 4 4 5 echo $html->div(null, $html->link($html->image('static/icon_rss.png', array('alt'=>'Subscribe bookmarks', 'title'=>'Subscribe bookmarks')), '/bookmarks/feeder/'.$session->read('Auth.User.username').'.rss', array(), false, false), array('style'=>'width:80px;float:right;')); 6 5 7 echo $html->div('title_section', $session->read('Auth.User.username'). "' Bookmarks"); 6 8 7 echo $html->para(null, $html->link($html->image('admin/new.gif', array('alt'=>'Add new bookmark', 'title'=>'Add new bookmark')), 8 '#', array('onclick'=>'hU()'), false, false)); 9 echo $html->div(null, $html->link($html->image('admin/new.gif', array('alt'=>'Add new bookmark', 'title'=>'Add new bookmark')), 10 '#', array('onclick'=>'hU()'), false, false), array('style'=>'width:80px;float:left;')); 11 9 12 ?> 10 13 <div id="trh" style="margin:0;padding:0;padding-left:40px;width:80%;display:none;"> -
trunk/views/layouts/portal.ctp
r246 r247 53 53 <tr> 54 54 <td id="tdleft"> 55 <div style="text-align:center;margin:5px 0 5px 0;padding:3px;">55 <div style="text-align:center;margin:5px 0 5px 0;padding:3px;"> 56 56 <?php 57 57 58 if ( $session->check('Auth.User') ): 58 59 echo $this->element('todos'); … … 88 89 'style'=>'border:1px solid black')), 89 90 'http://www.chipotle-software.com', null, null, false)); 90 91 91 echo $this->element('poll'); 92 92 echo $this->element('rankpages'); -
trunk/views/quicks/admin_listing.ctp
r240 r247 2 2 echo $html->div('title_section','Quick News'); 3 3 echo $html->para(null, $html->link($html->image('admin/new.gif', array('alt'=>'Add new', 'title'=>'Add new')), '#', 4 array("onclick "=>"hU()"), false, false)); 5 ?> 6 <table class="tbadmin" id="tbl"> 7 <tr> 8 <td style="text-align:left;display:none" id="trh" colspan="5"> 9 <?php echo $form->create('Quick'); ?> 4 array('onclick'=>'hU()'), false, false)); 5 echo $html->div(null, null, array('style'=>'text-align:left;display:none;width:100%', 'id'=>'trh')); 6 echo $form->create('Quick'); ?> 10 7 <fieldset> 11 8 <legend>Add Quick new</legend> … … 18 15 ?> 19 16 </fieldset> 20 </td> 21 </tr> 22 17 </div> 18 <table class="tbadmin" id="tbl"> 23 19 <?php 24 20 //die(print_r($data)); … … 48 44 49 45 if (tr.style.display == 'none') 50 tr.style.display = ' table-row';46 tr.style.display = 'block'; 51 47 else 52 48 tr.style.display = 'none';
Note: See TracChangeset
for help on using the changeset viewer.
