Changeset 653
- Timestamp:
- 07/15/08 14:38:50 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 10 modified
-
config/sql/postgresql/news.sql (modified) (1 diff)
-
controllers/discussions_controller.php (modified) (5 diffs)
-
controllers/messages_controller.php (modified) (1 diff)
-
controllers/news_controller.php (modified) (1 diff)
-
locale/spa/LC_MESSAGES/default.po (modified) (1 diff)
-
views/discussions/admin_listing.ctp (modified) (2 diffs)
-
views/messages/message.ctp (modified) (2 diffs)
-
views/messages/sent.ctp (modified) (1 diff)
-
views/news/admin_listing.ctp (modified) (4 diffs)
-
views/news/display.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/postgresql/news.sql
r436 r653 5 5 body text NOT NULL, 6 6 created timestamp(0) with time zone DEFAULT now() NOT NULL, 7 reference varchar(350) NOT NULL,7 reference varchar(350), 8 8 theme_id int NOT NULL REFERENCES themes(id) ON DELETE CASCADE, 9 9 status smallint NOT NULL, -- 0 = draft, 1 = published -
trunk/app/controllers/discussions_controller.php
r636 r653 14 14 class DiscussionsController extends AppController 15 15 { 16 public $name = 'Discussions';17 18 16 public $helpers = array('Ajax', 'Gags'); 19 17 … … 46 44 $this->data['Discussion']['comment'] = nl2br($this->data['Discussion']['comment']); 47 45 48 if ( $this->Auth->user() ) 49 { 46 if ( $this->Auth->user() ): 50 47 $this->data['Discussion']['user_id'] = $this->Auth->user('id'); 51 48 $this->data['Discussion']['username'] = $this->Auth->user('username'); 52 } 53 else 54 { 49 else: 55 50 /*if ($this->data['Discussion']['captcha'] != $this->Session->read('captcha') || strlen($this->data['Discussion']['captcha']) < 3) 56 51 { … … 59 54 60 55 $this->data['Discussion']['user_id'] = 0; 61 }56 endif; 62 57 63 58 if ( $this->Discussion->save($this->data) ): //save the comment … … 67 62 $this->__sendMail($user_id, $this->data['Discussion']['new_id']); 68 63 69 $this-> redirect('/news/view/'.$this->data['Discussion']['new_id'].'#cnews');64 $this->msgFlash(__('Message waiting for approval', true), '/news/view/'.$this->data['Discussion']['new_id'].'#cnews'); 70 65 endif; 71 66 } … … 115 110 $this->layout = 'admin'; 116 111 117 $this->pageTitle = 'Comments on News';112 $this->pageTitle = __('Comments on News', true); 118 113 119 114 $this->Discussion->bindModel(array('belongsTo'=> array('News' =>array('className'=> 'News', 'foreignKey'=> 'new_id' )))); 115 116 $this->paginate['fields'] = array('Discussion.id','News.id','News.title','Discussion.id','Discussion.comment', 'Discussion.created', 'Discussion.user_id', 'Discussion.status', 'User.username'); 117 $this->paginate['conditions'] = null; 118 $this->paginate['order'] = "Discussion.id DESC"; 119 $this->paginate['limit'] = 30; 120 $data = $this->paginate('Discussion'); 120 121 121 $conditions = null; 122 123 $fields = array('Discussion.id','News.id','News.title','Discussion.id','Discussion.comment', 'Discussion.created', 'Discussion.user_id', 'Discussion.status', 'User.username'); 124 125 $order = "Discussion.id DESC"; 126 127 $limit = 50; 122 $this->set(compact('data')); 128 123 129 $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit));130 124 } 131 125 -
trunk/app/controllers/messages_controller.php
r652 r653 65 65 $this->set('nick', $nick); 66 66 } 67 67 /* 68 * deliver method, used to deliver message in /messages/message and /message/compose views 69 * 70 */ 68 71 public function deliver() 69 { 70 72 { 71 73 if (!empty($this->data['Message'])): 72 74 73 $this->Sanitize = new Sanitize; 74 75 $this->Sanitize->html($this->data['Message']['title']); 76 77 $this->Sanitize->html($this->data['Message']['body']); 78 79 $this->data['Message']['sender'] = $this->Auth->user('id'); 80 $this->data['Message']['username'] = $this->Auth->user('username'); 81 82 if ( $this->Message->save($this->data) ): 83 $this->__sendMail($this->data['Message']['user_id']); 75 $this->Sanitize = new Sanitize; 76 77 $this->Sanitize->html($this->data['Message']['title']); 78 79 $this->Sanitize->html($this->data['Message']['body']); 80 81 $this->data['Message']['sender'] = $this->Auth->user('id'); 82 83 if ( !isset( $this->data['Message']['user_id'] ) ): 84 $this->data['Message']['user_id'] = $this->Message->User->field('User.id',array('User.username'=>trim($this->data['Message']['sender']))); 85 endif; 86 87 if ( $this->Message->save($this->data) ): 88 $this->__sendMail($this->data['Message']['user_id']); 89 if ( isset($this->data['Message']['ajax']) ): 90 $this->render('sent', 'ajax'); 91 else: 84 92 $this->msgFlash(__('Message sent', true), '/messages/listing'); 85 endif; 93 endif; 94 endif; 86 95 endif; 87 96 } -
trunk/app/controllers/news_controller.php
r648 r653 119 119 120 120 $this->layout = 'admin'; 121 122 $conditions = array("News.user_id" => $this->Auth->user('id') ); // only the user's news 123 $fields = array("id", "title", "body", "created", "reference", "status", "theme_id", "user_id"); 124 $order = "News.id DESC"; 125 $limit = 20; 126 127 $this->set('data', $this->News->findAll($conditions, $fields, $order, $limit)); 121 $this->News->unbindModel(array('hasMany'=>array('Discussion'))); 122 $this->paginate['conditions'] = null; 123 $this->paginate['fields'] = array('News.id', 'News.title', 'News.created', 'News.status', 'News.user_id', 'User.username'); 124 $this->paginate['order'] = 'News.id DESC'; 125 $this->paginate['limit'] = 20; 126 $data = $this->paginate('News'); 127 128 $this->set(compact('data')); 128 129 } 129 130 -
trunk/app/locale/spa/LC_MESSAGES/default.po
r652 r653 4 4 msgid "View all Lessons" 5 5 msgstr "Todas las lecciones" 6 7 msgid "Message waiting for approval" 8 msgstr "Mensaje en espera de aprobación" 6 9 7 10 msgid "Your current groups" -
trunk/app/views/discussions/admin_listing.ctp
r636 r653 1 1 <?php 2 2 //die(debug($data)); 3 echo $html->addCrumb('Control Tools', '/admin/news/start');4 echo $html->addCrumb( 'Comments', '/admin/comments/listing');3 echo $html->addCrumb('Control Panel', '/admin/news/start'); 4 echo $html->addCrumb(__('News', true), '/admin/news/listing'); 5 5 echo $html->getCrumbs(' / '); 6 6 7 echo $html->div('title_section', 'Comments on News');7 echo $html->div('title_section', __('Comments on News', true)); 8 8 9 9 foreach ($data as $val): … … 16 16 echo $html->div('grayblock', $tmp); 17 17 endforeach; 18 19 20 $t = $html->div(null,$paginator->prev('« '. __('Previous', true).' ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 21 $t .= $html->div(null, $paginator->next(' '.__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 22 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 23 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 18 24 ?> -
trunk/app/views/messages/message.ctp
r652 r653 15 15 echo $ajax->form(); 16 16 echo $form->hidden('Message.user_id', array('value'=>$blog['User']['id'])); 17 echo $form->hidden('Message.ajax', array('value'=>1)); 17 18 ?> 18 19 <fieldset> 19 20 <legend>Message to teacher from <?php echo $session->read('Auth.User.username'); ?>:</legend> 20 21 <?php 21 echo $form->input('Message.title', array( "size" => 30, "maxlength" => 50));22 echo $form->input('Message.title', array('size' => 30, 'maxlength' => 50, 'label'=>__('Title', true), 'between'=>': ')); 22 23 echo $form->error('Message.title', 'Title is required.'); 23 24 … … 31 32 "complete" => "Element.hide('charging');Effect.Appear('updater')" 32 33 )); 33 ?>34 ?> 34 35 </fieldset> 35 36 </form> -
trunk/app/views/messages/sent.ctp
r257 r653 1 <p>Message sent</p> 1 <?php 2 e($html->para(null, __('Thx', true).'! '.__('Message sent', true))); 3 ?> -
trunk/app/views/news/admin_listing.ctp
r620 r653 1 1 <?php 2 //die(debug($data)); 2 3 echo $html->div('title_section', __('News', true)); 3 echo $html->link($html->image('actions/new.png', array("alt"=>"Add new", "title"=>"Add new")), '/admin/news/add', null, false, false); 4 echo $html->link($html->image('actions/new.png', array('alt'=>__('Add new', true), 'title'=>__('Add new', true))), '/admin/news/add', null, false, false); 5 echo ' '; 4 6 echo $html->link($html->image('static/forum.gif', array("alt"=>"See comments", "title"=>"See comments")), '/admin/discussions/listing', null, false, false); 5 7 ?> … … 7 9 <?php 8 10 9 $th = array ('Edit', 'Title', 'Status', 'Delete');11 $th = array(__('Edit', true), __('Title', true), __('Author', true), __('Status', true), __('Delete', true)); 10 12 echo $html->tableHeaders($th); 11 13 foreach ($data as $key=>$val): … … 14 16 $gags->sendEdit($val['News']['id'], 'news'), 15 17 $val['News']['title'], 18 $val['User']['username'], 16 19 $html->link($st, '/admin/news/change/'.$val['News']['status'].'/'.$val['News']['id']), 17 20 $gags->confirmDel($val['News']['id'], 'news') … … 26 29 27 30 <?php 28 // echo $pagination; 31 $t = $html->div(null,$paginator->prev('« '.__('Previous', true). ' ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 32 $t .= $html->div(null, $paginator->next(' '.__('Next', true). ' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 33 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 34 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 29 35 ?> -
trunk/app/views/news/display.ctp
r636 r653 52 52 endforeach; 53 53 54 $t = $html->div(null,$paginator->prev('« Previous',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left'));55 $t .= $html->div(null, $paginator->next(' Next»', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right'));54 $t = $html->div(null,$paginator->prev('«'. __('Previous', true).' ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 55 $t .= $html->div(null, $paginator->next(' '.__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 56 56 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 57 57 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;'));
