Changeset 247


Ignore:
Timestamp:
03/18/09 11:44:57 (3 years ago)
Author:
aarkerio
Message:

Update RSS

Location:
trunk
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/core.php

    r246 r247  
    1515 */ 
    1616 
    17         Configure::write('debug', 0); 
     17        Configure::write('debug', 1); 
    1818/** 
    1919 * To configure CakePHP *not* to use mod_rewrite and to 
  • trunk/controllers/bookmarks_controller.php

    r123 r247  
    33*  Chipotle Software 
    44*  Manuel Montoya 2002-2009 
    5 *  GPL manuel<at>mononeurona.org 
     5*  GPL manuel<arroba>mononeurona<punto>org 
    66*/  
    77 
    8 App::import('Model','User'); 
    98App::import('Sanitize'); 
    109 
    1110class BookmarksController extends AppController { 
    1211     
    13  public $helpers       = array('Html', 'Javascript', 'Ajax', 'Form', 'User', 'Fck', 'Gags'); 
     12 public $helpers       = array('Javascript', 'User', 'Fck', 'Gags'); 
    1413     
    15  public $components    = array('Security'); 
     14 public $components    = array('RequestHandler'); 
    1615 
    1716 public function beforeFilter()  
     
    2120 } 
    2221 
    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'));   
    4045  } 
    4146 
    42 /***  
    43 ====  ADMIN SECTION    ===== 
    44 ****/ 
     47/*** ====  ADMIN SECTION    =====****/ 
    4548 
    4649public function admin_add()  
    4750{ 
    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'); 
    5054          
    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 } 
    6360  
    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'; 
    6865       
    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';        
    8276        $this->Bookmark->id  = $id; 
    8377         
    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 } 
    9986 
    100  public function admin_delete($id) 
     87 public function admin_delete($bookmark_id) 
    10188 { 
    102                 // deletes task from database 
    103                 //die($this->data['Bookmark']['id']); 
    104                 $this->Bookmark->del($id); 
     89   if ( $this->Bookmark->del($bookmark_id)): 
    10590                $this->msgFlash('Bookmark has been deleted', '/admin/bookmarks/listing'); 
    106                 exit(); 
    107   } 
    108    
     91   endif; 
     92 } 
    10993} 
    11094?> 
  • trunk/views/bookmarks/admin_listing.ctp

    r194 r247  
    33 echo $html->getCrumbs(' / ');  
    44 
     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 
    57 echo $html->div('title_section', $session->read('Auth.User.username'). "' Bookmarks"); 
    68 
    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 
    912?> 
    1013<div id="trh" style="margin:0;padding:0;padding-left:40px;width:80%;display:none;"> 
  • trunk/views/layouts/portal.ctp

    r246 r247  
    5353<tr> 
    5454 <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;"> 
    5656 <?php 
     57   
    5758  if (  $session->check('Auth.User') ): 
    5859      echo  $this->element('todos'); 
     
    8889                                           'style'=>'border:1px solid black')),  
    8990                                                               'http://www.chipotle-software.com', null, null, false));  
    90    
    9191  echo  $this->element('poll'); 
    9292  echo  $this->element('rankpages'); 
  • trunk/views/quicks/admin_listing.ctp

    r240 r247  
    22  echo $html->div('title_section','Quick News'); 
    33  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'); ?> 
    107  <fieldset> 
    118     <legend>Add Quick new</legend> 
     
    1815 ?> 
    1916</fieldset> 
    20 </td> 
    21 </tr> 
    22  
     17</div> 
     18<table class="tbadmin" id="tbl"> 
    2319<?php 
    2420//die(print_r($data)); 
     
    4844 
    4945  if (tr.style.display == 'none') 
    50             tr.style.display = 'table-row'; 
     46            tr.style.display = 'block'; 
    5147  else  
    5248            tr.style.display = 'none'; 
Note: See TracChangeset for help on using the changeset viewer.