Changeset 529
- Timestamp:
- 05/20/08 12:57:16 (5 months ago)
- Location:
- trunk/app
- Files:
-
- 5 modified
-
controllers/discussions_controller.php (modified) (7 diffs)
-
views/discussions/admin_listing.ctp (modified) (1 diff)
-
views/elements/login_hide.ctp (modified) (2 diffs)
-
views/layouts/portal.ctp (modified) (1 diff)
-
webroot/js/myfunctions.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/discussions_controller.php
r526 r529 12 12 uses('sanitize'); 13 13 14 App::import('Model','User');15 16 14 class DiscussionsController extends AppController 17 15 { … … 25 23 { 26 24 parent::beforeFilter(); 27 $this->Auth->allow(array('captcha', 'add')); 25 26 if ( $this->Auth->user() ): 27 $this->Auth->allow(array('captcha', 'add')); 28 endif; 28 29 } 29 30 … … 70 71 $this->Discussion->create(); 71 72 72 if ( $this->Discussion->save($this->data['Discussion']) ) //save the comment73 { 73 if ( $this->Discussion->save($this->data['Discussion']) ): //save the comment 74 74 75 $user_id = $this->Discussion->News->field('user_id', array('News.id'=>$this->data['Discussion']['new_id'])); 75 76 … … 77 78 78 79 $this->redirect('/news/view/'.$this->data['Discussion']['new_id'].'#cnews'); 79 }80 endif; 80 81 } 81 82 } … … 86 87 $this->User = new User; 87 88 88 $this->User->unbind Model(array("hasMany"=>array('Entry', 'Lesson', 'Faq', 'Vclassroom', 'Acquaintance')));89 $this->User->unbindAll(); 89 90 90 91 $val = $this->User->find(array('User.id'=>$user_id), array("User.name", "User.email")); … … 119 120 120 121 /*****#### ADMIN METHODS #####*****/ 121 public function admin_listing($limit=20) 122 123 public function admin_listing($paginate=0, $limit=20) 122 124 { 123 125 $this->layout = 'admin'; … … 127 129 $conditions = null; 128 130 129 $fields = array("Discussion.id", "News.title", "Discussion.id", "Discussion.comment", "Discussion.created", "Discussion. name", "Discussion.user_id");131 $fields = array("Discussion.id", "News.title", "Discussion.id", "Discussion.comment", "Discussion.created", "Discussion.username", "Discussion.user_id"); 130 132 $order = "Discussion.id DESC"; 131 133 132 $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit , null, 2));134 $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit)); 133 135 } 134 136 -
trunk/app/views/discussions/admin_listing.ctp
r409 r529 1 1 <?php 2 echo 'later'; 2 die(debug($data)); 3 echo $html->addCrumb('Control Tools', '/admin/news/start'); 4 echo $html->addCrumb('Comments', '/admin/comments/listing'); 5 echo $html->getCrumbs(' / '); 6 7 echo $html->div('title_section', 'Comments on News'); 8 9 foreach ($data as $val): 10 $tmp = $html->link($val['Discussion']['title'], '/users/entry/'. $cU['User']['username'] . '/'.$val['Discussion']['id']) . '<br />'; 11 $tmp .= $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 12 $tmp .= $html->para(null, $val['Comment']['comment']); 13 $tmp .= $gags->confirmDel($val['Comment']['id'], 'Comment'); 14 echo $html->div(null, $tmp); 15 endforeach; 3 16 ?> 4 17 -
trunk/app/views/elements/login_hide.ctp
r366 r529 1 1 <!-- hide by default --> 2 <div id="cover" style="display:none;" onclick=" hide('cover', 'loginpopup')">2 <div id="cover" style="display:none;" onclick="ocultar()"> 3 3 4 4 </div> 5 5 <div id="loginpopup" style="display:none"> 6 <div style="border-right: 2px solid #D3D3D3; vertical-align: top; padding-right:10px"> 7 <?php echo $html->link($html->image('close.gif', array('alt'=>'Close window', 'title'=>'Close window')), 6 <div style="border:3px solid orange; vertical-align: top; padding:3px 10px 4px 4px"> 7 <?php 8 echo $html->div(null,$html->link($html->image('close.gif', array('alt'=>'Close window', 'title'=>'Close window')), 8 9 '#', 9 array("onclick"=>" javascript:hide('loginpopup', 'cover');"),10 false,10 array("onclick"=>"ocultar()"), 11 null, 11 12 false 12 ); 13 ), array('style'=>'width:150px;float:right;')); 14 15 echo $html->div(null, 'Login', array('style'=>'width:250px;float:left;')); 16 echo $html->div(null, '', array('style'=>'clear:both;')); 17 echo $form->create('User',array("action"=>"login","onsubmit"=>"return validateLogin()")); 13 18 ?> 14 <h1>login</h1>15 <p>Already have an account and just want to login?</p>16 17 <?php echo $form->create('User',array("action"=>"login","onsubmit"=>"return validateLogin()")); ?>18 19 <fieldset> 19 20 <legend>Login</legend> … … 25 26 echo $form->label('remember_me', 'Remember me:'); 26 27 echo $form->checkbox("User.cokie", array("value" => 1)); 27 ?> 28 <br /> 29 </fieldset> 30 <?php 31 echo $form->end('Login'); 32 echo $html->para(null, $html->link('Join us!', '/users/register')); 33 echo $html->para(null, $html->link('forgot your password?', '/recovers/recover')); 28 29 echo $form->end('Login'); 30 echo '</fieldset>'; 31 32 echo $html->div(null, $html->link('Join us!', '/users/register')); 33 echo $html->div(null, $html->link('forgot your password?', '/recovers/recover')); 34 34 ?> 35 35 </div> -
trunk/app/views/layouts/portal.ctp
r494 r529 14 14 echo $html->charset('UTF-8'); 15 15 echo $javascript->link('prototype'); 16 echo $javascript->link('scriptaculous.js?load=effects'); 16 17 echo $javascript->link('myfunctions'); 17 echo $javascript->link('scriptaculous.js?load=effects');18 18 endif; 19 19 echo $html->css("portal/portal"); -
trunk/app/webroot/js/myfunctions.js
r326 r529 3 3 var logged = false; 4 4 5 function init() { 5 function init() 6 { 6 7 //Check log 7 8 if (!logged) 8 9 { 9 createCookie("karamelo_first", "first", 999999) 10 createCookie("karamelo_first", "first", 999999); 10 11 return; 11 12 } … … 27 28 } 28 29 29 function validateVote(vote) { 30 function validateVote(vote) 31 { 30 32 31 33 valid = false; 32 34 33 35 // Opera 5.05 Linux does not support for/in on this object 34 for ( var i = 0; i < vote.length; i++ ) { 35 if ( vote[i].checked ) { 36 for ( var i = 0; i < vote.length; i++ ) 37 { 38 if ( vote[i].checked ) 39 { 36 40 valid = true; 37 41 break; 38 42 } 39 43 } 40 if ( ! valid ) { 44 45 if ( ! valid ) 46 { 41 47 alert("You must choose one"); 42 48 } … … 116 122 var name = document.getElementById('UserName'); 117 123 var passwd = document.getElementById('UserPasswd'); 118 var email = document.getElementById('UserEmail');124 var email = document.getElementById('UserEmail'); 119 125 120 126 if (username.value.length < 6) … … 206 212 } 207 213 208 function hide () {for (i = 0; i < arguments.length; i++) {var e = $(arguments[i]); if (e) e.style.display = "none";}} 214 function ocultar() 215 { 216 var Cover = document.getElementById('cover'); 217 var Login = document.getElementById('loginpopup'); 218 219 Cover.style.display = "none"; 220 Login.style.display = "none"; 221 } 222 209 223 function show () {for (i = 0; i < arguments.length; i++) {var e = $(arguments[i]); if (e) e.style.display = "";}} 210 224
