Changeset 456


Ignore:
Timestamp:
06/02/10 16:14:29 (20 months ago)
Author:
aarkerio
Message:

Todos improved

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/controllers/todos_controller.php

    r424 r456  
    3838 } 
    3939 
     40/** 
     41 * Cron reminder 
     42 * @return void 
     43 * @accesss public 
     44 */ 
    4045 public function reminders()  # crontab every six hours:  1 6,12 * * * lynx -dum htt://server/todos/reminders > /dev/null 
    4146 { 
     
    4550  $data  = $this->Todo->find('all', $params); 
    4651  
    47   //exit(print_r($data)); 
     52  #exit(print_r($data)); 
    4853  $k = 0; 
    4954  foreach ($data as $val): 
    50      // echo print_r($val); 
    51      $this->sendMail($val); 
     55      # echo print_r($val); 
     56      $this->sendMail($val); 
    5257  endforeach; 
    5358 } 
     
    5661 * Feeder 
    5762 * @access public 
     63 * @return void 
    5864 */ 
    5965 public function rss($username)  
    6066 {    
    61    $this->layout    = 'rss'; 
     67   $this->layout = 'rss'; 
    6268     
    6369   $user_id = (int) $this->Todo->User->field('id', array('User.username'=>$username)); 
     
    100106  $this->layout    = 'ajax';    
    101107  if (!empty($this->data['Todo'])): 
    102       $this->data['Todo']['user_id'] = (int) $this->Auth->user('id');     
     108      $this->data['Todo']['user_id'] = (int) $this->Auth->user('id'); 
    103109      if ( $this->Todo->save($this->data)):  
    104110           $params = array( 
     
    116122 public function admin_listing($order_field = 'id') 
    117123 {      
    118   $this->layout    = 'admin';      
    119   $this->pageTitle = $this->Auth->user('username') . 'TODOs'; 
     124  $this->layout    = 'admin'; 
    120125  $params = array( 
    121126        'conditions' => array('Todo.user_id' => $this->Auth->user('id')),      
     
    158163  if ($this->Todo->save($this->data)): 
    159164      $this->msgFlash('ToDo has been changed','/admin/todos/listing'); 
    160       exit(); 
     165      return True; 
    161166  endif; 
    162167 } 
    163168 
     169/** 
     170 * Remove todo 
     171 * @return void 
     172 * @access public 
     173 */ 
    164174 public function admin_delete($id) 
    165175 { 
    166   if (isset($this->data['Todo']['get'])) // get indicate shows edit form action  
    167   { 
    168         $this->Todo->delete($id); 
    169   } 
    170   else 
    171   { 
    172            $this->Todo->delete($id); 
    173        $this->msgFlash('Todo has been deleted!', '/admin/todos/listing'); 
    174        exit(); 
    175    } 
     176  if ( $this->Todo->delete($id) ): 
     177      $msg = 'Todo has been deleted!'; 
     178  else: 
     179          $msg = 'Todo has NOT been deleted!'; 
     180  endif; 
     181 $this->msgFlash($msg, '/admin/todos/listing'); 
    176182 } 
    177183} 
    178 # ? > 
     184# ? > EOF 
  • trunk/controllers/topics_controller.php

    r386 r456  
    199199    } 
    200200 } 
    201     /****===  
    202           ADMIN SECTION  
    203    ==== ****/ 
     201    /****===    ADMIN SECTION    ==== ****/ 
    204202    
    205203   public function admin_listing($order = null) 
     
    233231    } 
    234232 } 
    235    
     233 
     234 /** 
     235  * 
     236  */   
    236237 public function admin_delete($topic_id) 
    237238 {   
     
    248249} 
    249250 
    250 # ? > 
     251# ? > EOF 
  • trunk/controllers/users_controller.php

    r448 r456  
    222222  $this->set(compact('data')); 
    223223 } 
    224     
     224 
     225/** 
     226 * Remove user 
     227 * @access public 
     228 * @return void 
     229 */    
    225230 public function admin_delete($user_id) 
    226231 { 
    227232   if ($this->User->delete($user_id) ): 
    228       $this->msgFlash('User deleted', '/admin/users/listing'); 
     233       $msg = 'User deleted'; 
     234   else: 
     235       $msg = 'User NOT deleted'; 
    229236   endif; 
     237   $this->msgFlash($msg, '/admin/users/listing'); 
    230238 } 
    231239  
     
    245253  $this->User->id = (int) $user_id; 
    246254  if ($this->User->saveField('active', $new_status)): 
    247            $this->msgFlash('User status changed', '/admin/users/listing/'); 
    248   endif; 
    249  } 
    250  
    251  /****   AVATAR   ***/ 
     255      $this->msgFlash('User status changed', '/admin/users/listing/'); 
     256  endif; 
     257 } 
     258 
     259/** 
     260  *  AVATAR    
     261***/ 
    252262 public function admin_avatar()  
    253263 { 
    254   //die(print_r($this->data)); 
     264  #die(print_r($this->data)); 
    255265  $this->layout    = 'admin';   
    256266  if (!empty($this->data) && is_uploaded_file($this->data['User']['file']['tmp_name'])): 
    257267      $this->flash('Error uploading image, please contact the support team', '/admin/users/edit'); 
    258268  endif; 
    259   #Sanitize::clean($this->data); //Hopefully this is enough 
    260269     
    261270    /** SUBMITTED INFORMATION - use what you need 
     
    285294     
    286295    if ( $imgfile_size > $maxfilesize): 
    287              $msg  = "ERROR The image is too big. Bigger than 2.0 MB Current size: " . $imgfile_size;         
    288          /** delete uploaded file */ 
    289          unlink($imgfile); 
    290          die( $this->flash($msg,'/users/edit/'.$this->Auth->user('id')) ); 
     296            $msg  = "ERROR The image is too big. Bigger than 2.0 MB Current size: " . $imgfile_size;          
     297        /** delete uploaded file */ 
     298        unlink($imgfile); 
     299        die( $this->flash($msg,'/users/edit/'.$this->Auth->user('id')) ); 
    291300    endif; 
    292301     
     
    319328  } 
    320329} 
    321 # ? > 
     330# ? > EOF 
  • trunk/controllers/waydings_controller.php

    r386 r456  
    135135 public function admin_delete($wayd_id) 
    136136 { 
    137    // deletes task from database 
     137   # deletes task from database 
    138138   if ($this->Wayding->delete($wayd_id)): 
    139        $this->msgFlash('Data removed', '/admin/waydings/listing'); 
     139       $msg = 'Data removed'; 
     140   else: 
     141       $msg = 'Data NOT removed'; 
    140142   endif; 
    141   } 
     143   $this->msgFlash($msg, '/admin/waydings/listing'); 
     144 } 
    142145} 
    143 # ? > 
     146 
     147# ? > EOF 
  • trunk/index.php

    r379 r456  
    1717 */ 
    1818require 'webroot' . DIRECTORY_SEPARATOR . 'index.php'; 
    19 ?> 
  • trunk/views/elements/admin_menu.ctp

    r450 r456  
    66                                                                  $this->Html->link(__('Podcasts', True), '/admin/podcasts/listing'), 
    77                                                                  $this->Html->link(__('Bookmarks', True), '/admin/bookmarks/listing'), 
     8                                                                  $this->Html->link('Mis pendientes', '/admin/todos/listing'), 
    89                                                                  $this->Html->link(__('Google Maps', True), '/admin/markers/index') 
    910                                                                         ), 
  • trunk/views/elements/themes_top.ctp

    r399 r456  
    11<?php 
    22# Chipotle Software GPLv3 2002-2010 
    3 if ($session->read('Auth.User.username')): # User is logged in 
     3if ($this->Session->read('Auth.User.username')): # User is logged in 
    44    $list = array($this->Html->link('MyMONO', '/admin/entries/start') => array( 
    55                                                               $this->Html->link(__('New blog Entry', true), '/admin/entries/edit'), 
    66                                               $this->Html->link(__('Submit Quick', true), '/admin/quicks/listing'), 
    77                                   $this->Html->link(__('Submit New', true), '/admin/news/edit'), 
    8                                    $this->Html->link(__('Quotes', true), '/admin/quotes/listing'), 
     8                                   $this->Html->link(__('Cosas pendientes', true), '/admin/todos/listing'), 
    99                                   $this->Html->link(__('Images', true), '/admin/images/listing'), 
    1010                                   $this->Html->link(__('Shares', true), '/admin/shares/listing'), 
     
    2525array_push($list, $more); 
    2626echo $this->Html->nestedList($list, array('id'=>'navmenu')); 
    27 # ? > 
     27 
     28# ? > EOF 
  • trunk/views/elements/todos.ctp

    r422 r456  
    1212<?php 
    1313$todos = $this->requestAction('todos/chkTodos'); 
    14 echo $this->Html->div('element', Null, array('style'=>'background:#fff;')); 
    15 echo$this->Js->link($this->Html->image('static/todos.jpg', array('alt'=>__('Publish Quick New', True), 'title'=>__('Publish Quick New', True))),  
    16            '/admin/todos/new', 
    17                        array('update'      => '#ts', 
    18                              'evalScripts' => True, 
    19                              'escape'      => False, 
    20                              'before'      => $gags->ajaxBefore('ts', 'lquick'), 
    21                              'complete'    => $gags->ajaxComplete('ts', 'lquick') 
    22                              )); 
    23 echo $gags->ajaxDiv('ts', array('style'=>'padding:3px')).$gags->divEnd('ts'); 
    24 echo $gags->imgLoad('lquick'); 
     14 
     15echo $this->Html->div('element', Null, array('style'=>'background:#fff;padding:5px;margin:6px')); 
     16echo $this->Html->image('static/todos.jpg', array('alt'=>'My TODOs', 'title'=>'My TODOs')); 
    2517#die(debug($todos)); 
    2618foreach ($todos as $v): 
    27     echo $gags->ajaxDiv('td'.$v['Todo']['id'], array('class'=>'editable_textarea')).$v['Todo']['name'].$gags->divEnd('td'.$v['Todo']['id']); 
     19    echo $this->Html->div('todo_'.$v['Todo']['priority'], $v['Todo']['name'], array('id'=>'td'.$v['Todo']['id'])); 
    2820endforeach; 
     21 
     22echo $this->Html->link('Agregar pendiente', '/admin/todos/listing', array('style'=>'font-size:7pt;padding:6px;')); 
    2923echo '</div>'; 
    3024 
    31 echo $this->Js->writeBuffer(); 
    32 # ? > 
     25# ? > EOF 
  • trunk/views/layouts/portal.ctp

    r451 r456  
    3939 <div style="text-align:center;margin:3px 0 3px 0;padding:2px;"> 
    4040 <?php 
    41   echo $this->Html->div('sidepanel', $this->element('lastentries')); 
    42   echo  $this->element('adsense'); 
    4341  if ( $session->check('Auth.User') ): 
    4442      echo  $this->element('todos'); 
     
    4644      echo $this->element('login', array('cache' => True)); 
    4745  endif; 
     46  echo $this->Html->div('sidepanel', $this->element('lastentries')); 
     47  echo  $this->element('adsense'); 
    4848  echo $this->Html->div('sidepanel', $this->element('lastdownloads'));/*, array('cache' => True));*/ 
    4949 
  • trunk/views/todos/admin_edit.ctp

    r393 r456  
    1 <?php  
    2 //exit(print_r($data)); 
    3   echo $this->Form->create('/admin/todos/edit/','post'); 
    4   echo $this->Form->hidden('Todo/id');  
     1<?php 
     2#exit(print_r($data)); 
     3echo $this->Form->create('Todo'); 
     4echo $this->Form->hidden('Todo.id');  
    55?> 
    6  
    76<fieldset style="width:370px;background-color:transparent"> 
    87<legend>Edit TODO</legend> 
    98<table> 
     9<?php 
     10  echo $this->Form->input('Todo.name', array('size' => 25, 'maxlength' => 80)); 
     11  echo $this->Form->input('Todo.deadline',  array('type'=>'date','label'=>__('Dead line', True), 'dateFormat'=>'DMY')); 
     12  echo $this->Form->input('Todo.priority', array('options'=>range(0,5))); 
     13  echo $this->Form->input('Todo.task', array('cols'=>33, 'rows'=>7)); 
     14  echo $this->Form->input('Todo.completed', array('value'=>'1', 'type'=>'checkbox')); 
     15  echo $this->Form->end('Save'); 
     16  echo '</fieldset>'; 
    1017 
    11 <?php  
    12   echo $this->Form->label('Todo/name', 'Name:' );  
    13   echo $this->Form->input('Todo/name', array('size' => 25, 'maxlength' => 80)); 
    14   echo $this->Form->error('Todo/name', 'Title is required.'); 
    15    
    16   echo $this->Form->label('Todo/priority', 'Priority:' ); 
    17    
    18   $priorities = array("1"=>"1", "2"=>"2", "3"=>"3", "4"=>"4", "5"=>"5"); 
    19    
    20   echo $this->Html->selectTag('Todo/priority', $priorities, null, null, null, false); 
    21    
    22   echo $this->Form->label('Todo/task', 'Task:'); 
    23   echo $this->Form->textarea('Todo/task', array("cols"=>33, "rows"=>7));  
    24   echo $this->Form->error('Todo/task', 'Task is required.');  
    25    
    26   echo $this->Form->label('Todo/completed', 'Completed:' ) . $this->Form->checkbox('Todo/completed', array('value'=>'1'));  
    27    
    28   echo $this->Form->end('Save'); 
    29 ?> 
    30 </fieldset> 
    31 </form> 
    32 <p style="text-align:center">  
    33 <?php echo $this->Html->link('Cancel', '#', array("onclick"=>"javascript:getElementById('editTodoDiv').style.display = \"none\";"));?> 
    34 </p> 
     18  echo $this->Html->link('Cancel', '#', array('onclick'=>"javascript:getElementById('editTodoDiv').style.display = \"none\";")); 
    3519 
     20# ? > EOF 
     21 
     22 
  • trunk/views/todos/admin_listing.ctp

    r424 r456  
    11<?php 
     2$this->set('title_for_layout',  'My TODOs'); 
    23echo $this->Html->div('title_section', 'My TO-DOs'); 
    34 
     
    67                        '/todos/rss/'.$session->read('Auth.User.username'), array('escape'=>False)); 
    78 
    8 echo $gags->imgLoad(); 
     9echo $gags->imgLoad('loading'); 
    910 
    1011echo '</div>'; 
     
    2930endif; 
    3031 
    31 echo $this->Form->create();  
     32echo $this->Form->create(); 
    3233?> 
    3334 <fieldset> 
    3435 <legend>Quick add</legend> 
    35    <?php  
     36<?php  
    3637    echo $this->Form->input('Todo.name', array('size' => 35, 'maxlength'=>80)); 
    37     echo $this->Js->submit('Save', array('url'         => '/admin/todos/edit/',  
     38    echo $this->Js->submit('Save', array('url'         => '/admin/todos/add/', 
    3839                                         'update'      => '#todolist', 
    3940                                         'evalScripts' => True, 
     
    4849<table class="tbadmin" style="width:100%"> 
    4950<?php 
    50 $th = array ('Edit', 'Name', 'Priority', 'Deadline', 'Completed', 'Created', 'Delete'); 
     51$th = array('Edit', 'Name', 'Priority', 'Deadline', 'Completed', 'Created', 'Delete'); 
    5152echo $this->Html->tableHeaders($th);     
    5253foreach ($data as $val): 
     
    8283<?php  
    8384  echo $gags->ajaxDiv('editTodoDiv', array('class'=>'box', 'style'=>'display:none;')).$gags->divEnd('editTodoDiv');  
    84 ?> 
     85# ? > EOF 
  • trunk/views/todos/updated.ctp

    r416 r456  
    44echo $this->Html->tableHeaders($th);     
    55foreach ($data as $val): 
    6        $completed = ($val['Todo']['completed'] == 1) ? 'Completed' : 'Pending'; 
    7        $tr = array ( 
    8            $this->Form->create(null,'post') . $this->Form->hidden('Todo/id', array('value'=>$val['Todo']['id'])) . $this->Form->hidden('Todo/get', array("value" => 1)) . 
     6    $completed = ($val['Todo']['completed'] == 1) ? 'Completed' : 'Pending'; 
     7    $tr = array( 
     8           $this->Form->create('Todo').$this->Form->hidden('Todo.id',array('value'=>$val['Todo']['id'])).$this->Form->hidden('Todo.get',array('value'=>1)). 
    99            $this->Js->submit('Edit', array('url'         => '/admin/todos/edit/',  
    1010                                            'update'      => '#editTodoDiv', 
    1111                                            'evalScripts' => True, 
    12                                             'before'      => $gags->ajaxBefore('editTodoDiv', 'charging'), 
    13                                             'complete'    => $gags->ajaxComplete()));    
     12                                            'before'      => $gags->ajaxBefore('todolist'), 
     13                                            'complete'    => $gags->ajaxComplete('todolist'))), 
     14 
     15    $val['Todo']['name'], 
     16    $val['Todo']['priority'], 
     17    $val['Todo']['deadline'], 
     18    $html->link($completed,'/admin/todos/change/'.$val['Todo']['id'].'/'.$val['Todo']['completed']), 
     19    $val['Todo']['created'], 
     20    $gags->confirmDel($val['Todo']['id'], 'todos') ); 
     21 
     22    echo $html->tableCells($tr,$gags->aRow, $gags->eRow); 
    1423endforeach; 
    15 ?> 
    16 </table> 
     24echo '</table>'; 
    1725 
     26echo $this->Js->writeBuffer(); 
     27# ? > EOF 
  • trunk/webroot/css.php

    r383 r456  
    11<?php 
    22/** 
    3  * Short description for file. 
     3 * CSS helping functions 
    44 * 
    55 * PHP versions 4 and 5 
     
    2424 
    2525/** 
    26  * Enter description here... 
     26 * Ensure required classes are available. 
    2727 */ 
    2828if (!class_exists('File')) { 
    29         require LIBS . 'file.php'; 
     29        uses('file'); 
    3030} 
    3131 
    3232/** 
    33  * Enter description here... 
     33 * Make clean CSS 
    3434 * 
    3535 * @param unknown_type $path 
     
    4646                return $output; 
    4747        } 
    48  
    4948/** 
    50  * Enter description here... 
     49 * Write CSS cache 
    5150 * 
    5251 * @param unknown_type $path 
     
    6362 
    6463        if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) { 
    65                 exit('Wrong file name.'); 
     64                die('Wrong file name.'); 
    6665        } 
    6766 
     
    7170 
    7271        if (!file_exists($filepath)) { 
    73                 exit('Wrong file name.'); 
     72                die('Wrong file name.'); 
    7473        } 
    7574 
     
    9291        header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT'); 
    9392        header("Content-Type: text/css"); 
    94         header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT"); 
     93        header("Expires: " . gmdate("D, d M Y H:i:s", time() + DAY) . " GMT"); 
    9594        header("Cache-Control: max-age=86400, must-revalidate"); // HTTP/1.1 
    9695        header("Pragma: cache");        // HTTP/1.0 
    9796        print $output; 
    98 ?> 
  • trunk/webroot/index.php

    r433 r456  
    8383                $Dispatcher->dispatch(); 
    8484        } 
    85         if (Configure::read() > 0) { 
    86                 echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->"; 
    87         } 
    88 ?> 
  • trunk/webroot/test.php

    r383 r456  
    55 * PHP versions 4 and 5 
    66 * 
    7  * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> 
    8  * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) 
     7 * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing> 
     8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) 
    99 * 
    1010 *  Licensed under The Open Group Test Suite License 
    1111 *  Redistributions of files must retain the above copyright notice. 
    1212 * 
    13  * @copyright     Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) 
    14  * @link          https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests 
     13 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) 
     14 * @link          http://book.cakephp.org/view/1196/Testing 
    1515 * @package       cake 
    16  * @subpackage    cake.cake.tests.libs 
     16 * @subpackage    cake.app.webroot 
    1717 * @since         CakePHP(tm) v 1.2.0.4433 
    1818 * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License 
     
    5151 */ 
    5252        if (!defined('CAKE_CORE_INCLUDE_PATH')) { 
    53                 define('CAKE_CORE_INCLUDE_PATH',  DS . 'myDocs' . DS . 'devels'); 
     53                define('CAKE_CORE_INCLUDE_PATH', ROOT); 
    5454        } 
    5555 
     
    9393$Dispatcher = new CakeTestSuiteDispatcher(); 
    9494$Dispatcher->dispatch(); 
    95  
    96 ?> 
Note: See TracChangeset for help on using the changeset viewer.