Changeset 401
- Timestamp:
- 04/16/08 03:07:25 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 13 modified
- 2 moved
-
config/sql/karamelo_postgres.sql (modified) (3 diffs)
-
controllers/commentnews_controller.php (modified) (4 diffs)
-
controllers/components/captcha.php (modified) (2 diffs)
-
controllers/news_controller.php (modified) (2 diffs)
-
models/discussion.php (moved) (moved from trunk/app/models/commentnews.php) (2 diffs)
-
models/news.php (modified) (1 diff)
-
models/wiki.php (modified) (1 diff)
-
vendors/kcaptcha/kcaptcha.php (modified) (3 diffs)
-
views/discutions (moved) (moved from trunk/app/views/commentnews)
-
views/news/admin_add.ctp (modified) (5 diffs)
-
views/news/admin_edit.ctp (modified) (6 diffs)
-
views/news/display.ctp (modified) (2 diffs)
-
views/news/view.ctp (modified) (5 diffs)
-
webroot/css/portal/portal.css (modified) (1 diff)
-
webroot/img/imgusers/aarkerio_10.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/karamelo_postgres.sql
r395 r401 139 139 3, 1, 1); 140 140 141 -- Discu tions onnews142 CREATE TABLE commentnews (143 idserial PRIMARY KEY,144 new_idint NOT NULL REFERENCES news(id) ON DELETE CASCADE,145 namevarchar(100),146 commenttext NOT NULL,141 -- Discussions on portal news 142 CREATE TABLE discussions ( 143 "id" serial PRIMARY KEY, 144 "new_id" int NOT NULL REFERENCES news(id) ON DELETE CASCADE, 145 "name" varchar(100), 146 "comment" text NOT NULL, 147 147 "created" timestamp(0) with time zone DEFAULT now() NOT NULL, 148 levelint NOT NULL,149 comentnew_idint NOT NULL,150 user_idint REFERENCES news(id) NOT NULL,151 statusint NOT NULL DEFAULT 0148 "level" int NOT NULL, 149 "discussion_id" int NOT NULL, 150 "user_id" int REFERENCES news(id) NOT NULL, 151 "status" int NOT NULL DEFAULT 0 152 152 ); 153 153 … … 163 163 INSERT INTO licenses (title) VALUES ('CopyRigth License'); 164 164 165 --Edis (Educative elements)166 CREATE TABLE edis (167 id serial PRIMARY KEY,168 title varchar(150) NOT NULL,169 tags varchar(150) NOT NULL,170 description text,171 status smallint NOT NULL DEFAULT 0,172 created timestamp(0) with time zone DEFAULT now() NOT NULL,173 modified timestamp(0) with time zone DEFAULT now() NOT NULL,174 license_id integer NOT NULL REFERENCES licenses(id) ON DELETE CASCADE,175 user_id integer NOT NULL REFERENCES users(id) ON DELETE CASCADE176 );177 178 165 -- ** Forums tables beggins ** 179 CREATE TABLE catforums ( -- phorums categories166 CREATE TABLE catforums ( -- forums categories 180 167 id serial PRIMARY KEY, 181 168 title varchar(150) NOT NULL, … … 183 170 created timestamp(0) with time zone DEFAULT now() NOT NULL, 184 171 user_id integer NOT NULL REFERENCES users(id) ON DELETE CASCADE, 185 status int NOT NULL DEFAULT 0 -- Activated = 1, Deactivated=0172 status int NOT NULL DEFAULT 0 -- Enabled = 1, Disabled = 0 186 173 ); 187 174 -
trunk/app/controllers/commentnews_controller.php
r400 r401 8 8 * @package Karamelo 9 9 */ 10 //File: /app/controllers/ commentnews_controller.php10 //File: /app/controllers/discusions_controller.php 11 11 12 12 uses('sanitize'); … … 14 14 App::import('Model','User'); 15 15 16 class CommentnewsController extends AppController16 class DiscusionsController extends AppController 17 17 { 18 public $name = 'Commentnews';19 20 18 public $helpers = array('Ajax', 'Time', 'Gags'); 21 19 … … 24 22 public function beforeFilter() 25 23 { 26 $this->Auth->allow(array('captcha', ' insert', 'rss'));24 $this->Auth->allow(array('captcha', 'add', 'rss')); 27 25 parent::beforeFilter(); 28 26 } … … 40 38 } 41 39 42 public function insert()43 { 44 45 //die(var_dump($this->data));40 public function add() 41 { 42 echo 'entre !!!<br />'; 43 die(debug($this->data['Commentnews'])); 46 44 47 45 if ( !empty($this->data['Commentnews']) ) -
trunk/app/controllers/components/captcha.php
r23 r401 1 1 <?php 2 /** 3 * Karamelo e-Learning Platform 4 * Chipotle Software TM 2002-2008 5 * GPLv3 6 * @author Manuel Montoya manuel<arroba>mononeurona<punto>org 7 * @version 0.2 8 * @package Karamelo 9 */ 10 //File: /app/controllers/components/captcha.php 2 11 3 12 class CaptchaComponent extends Object 4 13 { 14 public function initialize() 15 { 16 17 } 18 5 19 public function startup(&$controller) 6 20 { … … 10 24 public function render() 11 25 { 12 vendor('kcaptcha/kcaptcha'); 26 if ( !vendor('kcaptcha/kcaptcha')) 27 { 28 die('Problem in captcha component'); 29 } 13 30 14 31 $kcaptcha = new KCAPTCHA(); -
trunk/app/controllers/news_controller.php
r400 r401 13 13 14 14 class NewsController extends AppController { 15 16 public $name = 'News'; 15 17 16 18 public $helpers = array('Ajax', 'Fck', 'News', 'Time', 'Gags'); … … 44 46 $conditions = array("News.status"=>1); 45 47 46 $fields = array("News.id", "News.title", "News.comments", "News.body", "News.created", "News.reference", "News.theme_id", "News.user_id", "Theme.img", "Theme.theme", "User.username", "Subject.title", "Subject.id");48 $fields = null; 47 49 48 50 $order = "News.id DESC"; 49 51 50 $limit = 1 5;51 52 $this->set('data', $this->News->findAll($conditions ));52 $limit = 10; 53 54 $this->set('data', $this->News->findAll($conditions, $fields, $order)); 53 55 54 56 $this->Portal->statics(); // Charge Portal components aka Sidebars -
trunk/app/models/discussion.php
r282 r401 5 5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 **/ 7 //file: app/models/discussion.php 7 8 8 class Commentnewsextends AppModel9 class Discussion extends AppModel 9 10 { 10 public $name = ' Commentnews';11 public $name = 'Discussion'; 11 12 12 13 public $belongsTo = array('News' => … … 24 25 public $validate = array( 25 26 'username' => array( 26 'rule' => array('minLength', 6),27 'rule' => array('minLength', 2), 27 28 'message' => 'Usernames must be at least 6 characters long.' 28 29 ) -
trunk/app/models/news.php
r399 r401 25 25 26 26 public $hasMany = array( 27 ' Commentnews' => array(28 'className' => ' Commentnews',27 'Discussion' => array( 28 'className' => 'Discussion', 29 29 'foreignKey' => 'new_id' 30 30 ) -
trunk/app/models/wiki.php
r371 r401 1 1 <?php 2 /** 3 * Karamelo eLearning Platform 4 * Chipotle Software 2002-2008 5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 **/ 7 //file: app/models/wiki.php 8 2 9 class Wiki extends AppModel { 3 10 -
trunk/app/vendors/kcaptcha/kcaptcha.php
r1 r401 1 1 <?php 2 3 2 # KCAPTCHA PROJECT VERSION 1.2.4 4 3 … … 17 16 # See kcaptcha_config.php for customizing 18 17 19 class KCAPTCHA {18 class KCAPTCHA { 20 19 21 20 // generates keystring and image 22 function KCAPTCHA(){21 public function KCAPTCHA(){ 23 22 24 23 require(dirname(__FILE__).'/kcaptcha_config.php'); … … 202 201 } 203 202 204 if(function_exists("imagejpeg")){ 203 if (function_exists("imagejpeg")) 204 { 205 205 header("Content-Type: image/jpeg"); 206 206 imagejpeg($img2, null, $jpeg_quality); -
trunk/app/views/news/admin_add.ctp
r301 r401 6 6 echo $html->addCrumb('News', '/admin/news/listing'); 7 7 echo $html->getCrumbs(' / '); 8 echo $form->create('News', array('action'=>'admin_add', 'onsubmit'=>'return validateNew()')); 8 echo $form->create('News', array('onsubmit'=>'return validateNew()')); 9 10 echo $html->div('title_section', 'Add new'); 9 11 ?> 10 12 <table> … … 24 26 <td> 25 27 <?php 26 echo $form->input('News.reference', array( "size" => 30, "maxlength" => 250, "value"=>"http://"));28 echo $form->input('News.reference', array('size'=> 30, 'maxlength'=> 250, 'value'=>'http://')); 27 29 ?> 28 30 </td> … … 34 36 <?php 35 37 echo $form->label('News.Body', 'Body:' ); 36 echo $form->textarea('News.body', array( "cols"=>80, "rows"=>45));38 echo $form->textarea('News.body', array('cols'=>80, 'rows'=>35)); 37 39 echo $fck->load('NewsBody', 'Karamelo'); 38 echo $form->error('News.body', 'Body is required.'); 39 ?> 40 ?> 40 41 </td></tr> 41 42 <tr><td colspan="2"> 42 43 <?php 43 44 echo $form->label('News.status', 'Published:' ); 44 echo $form->checkbox('News.status', null, array("value"=>1));45 echo $form->checkbox('News.status', array('value'=>1)); 45 46 ?> 46 47 </td> … … 48 49 <?php 49 50 echo $form->label('News.comments', 'Comments actived:' ); 50 echo $form->checkbox('News.comments', null, array("value"=>1));51 echo $form->checkbox('News.comments', array('value'=>1)); 51 52 ?> 52 53 </td> … … 54 55 <?php 55 56 echo $form->label('News.end', 'Finish editing:'); 56 echo $form->checkbox('News.end', null, array("value"=>1));57 echo $form->checkbox('News.end', array('value'=>1)); 57 58 ?> 58 59 </td> -
trunk/app/views/news/admin_edit.ctp
r311 r401 4 4 echo $html->addCrumb('News', '/admin/news/listing'); 5 5 echo $html->getCrumbs(' / '); 6 7 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new", "title"=>"Add new")), '/admin/news/add', null, false, false)); 6 8 7 9 echo $form->create('News', array('onsubmit'=>'return validateNew()')); … … 12 14 <td> 13 15 <?php 14 echo $form->input('News.title', array( "size" => 40, "maxlength"=> 120));16 echo $form->input('News.title', array('size' => 40, 'maxlength' => 120)); 15 17 echo $form->error('News.title', 'Title is required.'); 16 18 ?> … … 23 25 </td> 24 26 <td> 25 <?php echo $form->input('News.reference', array("size" => 30, "maxlength" => 250, "value"=>"http://")); ?>27 <?php echo $form->input('News.reference', array("size" => 30, "maxlength" => 250, 'value'=>'http://')); ?> 26 28 </td> 27 29 <td> … … 32 34 <?php 33 35 echo $form->label('News.Body', 'Body:') . '<br />'; 34 echo $form->textarea('News.body', array( "cols"=>80, "rows"=>45));36 echo $form->textarea('News.body', array('cols'=>80, 'rows'=>35)); 35 37 echo $fck->load('NewsBody', 'Karamelo'); 36 echo $form->error('News.body', 'News is required.');37 38 ?> 38 39 </td></tr> … … 40 41 <td> 41 42 <?php 42 echo $form->label('News.status', 'Published:' );43 echo $form->label('News.status', 'Published:'); 43 44 echo $form->checkbox('News.status', array("value"=>1)); 44 45 ?> … … 52 53 <td colspan="2"> 53 54 <?php 54 echo $form->label('News.end', 'Finish editing:' );55 echo $form->label('News.end', 'Finish editing:'); 55 56 echo $form->checkbox('News.end', array("value"=>1)); 56 57 ?> -
trunk/app/views/news/display.ctp
r400 r401 2 2 // die(debug($data)); 3 3 4 echo $html->div('title_ section', 'News');4 echo $html->div('title_portal', 'News in campus'); 5 5 6 6 foreach ($data as $val) … … 29 29 $tmp .= $html->div(null, $html->link('Reference', $val['News']['reference'])); 30 30 } 31 31 32 if ($val['News']['comments'] == 1 ) // the reference 33 { 34 $tmp .= $html->div(null, $html->link('Put your comment', '/news/view/'.$val['News']['id'])); 35 } 32 36 echo $html->div('wrapnew', $tmp); 33 37 } -
trunk/app/views/news/view.ctp
r400 r401 1 <div class="titnew"><?php echo $data['News']['title']; ?></div> 1 <?php 2 echo $html->div('titnew', $data['News']['title']); 2 3 3 <div class="redaccion">From <i><?php echo $data['Theme']['theme']; ?> dept</i>, 4 posted by 5 <?php 6 echo $html->link($data['User']['username'], '/users/blogger/'.$data['User']['username']).' on '. $data['News']['created']; 4 echo $html->div('redaccion', 'From <i>'.$data['Theme']['theme'].' dept</i>, posted by '.$html->link($data['User']['username'], '/users/blogger/'.$data['User']['username']).' on '. $data['News']['created']); 7 5 ?> 8 </div> 6 9 7 <div class="bodynew"> 10 11 8 <?php 12 9 … … 23 20 <span style="font-size:7pt;">Permalink:</span> <br /> 24 21 <?php echo $html->link( 25 'http://'.$_SERVER['SERVER_NAME'].'/news/ display/'.$data['News']['id'],26 'http://'.$_SERVER['SERVER_NAME'].'/news/ display/'.$data['News']['id']22 'http://'.$_SERVER['SERVER_NAME'].'/news/view/'.$data['News']['id'], 23 'http://'.$_SERVER['SERVER_NAME'].'/news/view/'.$data['News']['id'] 27 24 ); 28 25 ?> … … 37 34 null, 38 35 false); 39 40 36 41 37 echo $news->socialNets($data['News']['id'], $data['News']['title']); // Social nets buttons 42 38 … … 45 41 $i = 1; 46 42 echo '<div id="cnews">'; 47 foreach($data[ "Commentnews"] as $v)43 foreach($data['Discussion'] as $v) 48 44 { 49 45 $bg = ($i%2==0) ? "#e2e2e2" : "#fff"; … … 56 52 } 57 53 echo "</div>"; 58 ?> 59 <p> 60 <?php 61 echo $form->create('Commentnews', array('action'=>'add',"onsubmit"=>"return validateNew()")); 62 echo $form->hidden('Commentnews.new_id', array('value'=>$data['News']['id'])); 63 echo $form->hidden('Commentnews.level', array('value'=>1)); 64 echo $form->hidden('Commentnews.comentnew_id', array('value'=>1)); 54 55 echo $form->create('Discussion', array('action'=>'add')); 56 echo $form->hidden('Discussion.new_id', array('value'=>$data['News']['id'])); 57 echo $form->hidden('Discussion.level', array('value'=>1)); 58 echo $form->hidden('Discussion.comentnew_id', array('value'=>1)); 65 59 ?> 66 60 <fieldset> 67 61 <legend>Add comment:</legend> 68 <?php 69 if ( isset( $cU['User']['id'] ) ) 70 { 71 echo $form->hidden('Commentnews.user_id', array('value'=> $cU['User']['id'])); 72 echo $form->hidden('Commentnews.name', array('value'=>$cU['User']['username'])); 62 <?php 63 if ( isset( $cU['User']['id'] ) ): 64 echo $form->hidden('Discussion.user_id', array('value'=> $cU['User']['id'])); 65 echo $form->hidden('Discussion.name', array('value'=>$cU['User']['username'])); 73 66 echo '<b>'. $cU['User']['username'] . '</b> write: <br />'; 74 } 75 else 76 { 77 echo $form->hidden(' Commentnews.user_id', array('value'=> 0));78 echo $form->input(' Commentnews.name', array('size'=> 25, 'maxlength' => 40));67 68 else: 69 70 echo $form->hidden('Discussion.user_id', array('value'=> 0)); 71 echo $form->input('Discussion.name', array('size'=> 25, 'maxlength' => 40)); 79 72 80 echo '<br /><br /> <img src="'. $html->url('/ comentnews/captcha') .'" alt="Captcha" title="Captcha" /> <br />';81 echo $form->input(' Commentnews.captcha', array("size" => 6, "maxlength" => 6));82 echo $form->label(' Commentnews.captcha', 'Introduce el código, todas la letras son minúsculas' );83 }73 echo '<br /><br /> <img src="'. $html->url('/discussions/captcha') .'" alt="Captcha" title="Captcha" /> <br />'; 74 echo $form->input('Discussion.captcha', array("size" => 6, "maxlength" => 6)); 75 echo $form->label('Discussion.captcha', 'Introduce el código, todas la letras son minúsculas' ); 76 endif; 84 77 85 echo $form->textarea('Commentnews.comment', array('cols'=>60, 'rows'=>10)); 86 87 ?> 88 </fieldset> 89 <?php echo $form->end('Send comment'); ?> 78 echo $form->textarea('Discussion.comment', array('cols'=>60, 'rows'=>10)) . $form->end('Send comment'); ?> 90 79 91 80 92 81 <?php } ?> 93 </div> 82 </div><!-- bodynew --> -
trunk/app/webroot/css/portal/portal.css
r360 r401 394 394 395 395 .divblock{ padding:4px;margin:2px; border:1px solid gray; } 396 397 .title_portal{ font-size:18pt; color:#30a6f0;font-weight:bold;font-family:Arial;margin:0;}
