Changeset 771
- Timestamp:
- 09/20/08 15:32:48 (2 months ago)
- Location:
- trunk/app
- Files:
-
- 4 added
- 11 modified
-
config/sql/postgresql/entries.sql (modified) (1 diff)
-
config/sql/postgresql/resources.sql (modified) (1 diff)
-
controllers/wikis_controller.php (modified) (2 diffs)
-
tests/cases/controllers/entries_controller.test.php (modified) (3 diffs)
-
tests/cases/controllers/news_controller.test.php (added)
-
tests/cases/models/entry.test.php (modified) (2 diffs)
-
tests/cases/models/lesson.test.php (added)
-
tests/fixtures/entry_test_fixture.php (modified) (2 diffs)
-
tests/fixtures/lesson_test_fixture.php (added)
-
tests/fixtures/news_test_fixture.php (added)
-
views/elements/admin_menu.ctp (modified) (1 diff)
-
views/elements/wikibar.ctp (modified) (4 diffs)
-
views/entries/admin_start.ctp (modified) (1 diff)
-
views/wikis/admin_edit.ctp (modified) (3 diffs)
-
webroot/css/cpanel/cpanel.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/postgresql/entries.sql
r750 r771 1 1 -- entries in the users blogs 2 2 CREATE TABLE entries ( 3 id serial PRIMARY KEY,4 title varchar(50) NOT NULL,5 body text NOT NULL,6 subject_id int REFERENCES subjects(id) NOT NULL,7 created timestamp(0) with time zone DEFAULT now() NOT NULL,8 status int NOT NULL DEFAULT 0,9 user_id int REFERENCES users(id) ON DELETE CASCADE,10 discution int NOT NULL DEFAULT 0, -- discution, Activ/Desactiv 1/011 "karanet" smallint NOT NULL DEFAULT 03 id serial PRIMARY KEY, 4 title varchar(50) NOT NULL, 5 body text NOT NULL, 6 subject_id int REFERENCES subjects(id) NOT NULL, 7 created timestamp(0) with time zone DEFAULT now() NOT NULL, 8 status int NOT NULL DEFAULT 0, 9 user_id int REFERENCES users(id) ON DELETE CASCADE, 10 discution int NOT NULL DEFAULT 0, -- discution, Activ/Desactiv 1/0 11 "karanet" smallint NOT NULL DEFAULT 0 12 12 ); 13 13 -- search engine index -
trunk/app/config/sql/postgresql/resources.sql
r436 r771 1 -- table for school library 2 CREATE TABLE resources ( 3 id serial PRIMARY KEY, 4 clasification varchar(40) NOT NULL UNIQUE, 5 media smallint NOT NULL, -- Book, CD, LP, magazine 6 title varchar (100), 7 author varchar(90) NOT NULL, 8 edition smallint, 9 editor varchar(100), 10 cost money, 11 copies smallint NOT NULL DEFAULT 1 1 -- tables for school library 2 3 CREATE TABLE types ( 4 id serial PRIMARY KEY, 5 type varchar(80) NOT NULL 12 6 ); 13 7 8 INSERT INTO types (type) VALUES ('Book'); 9 INSERT INTO types (type) VALUES ('Magazine'); 10 INSERT INTO types (type) VALUES ('Newspaper'); 11 INSERT INTO types (type) VALUES ('DVD'); 12 INSERT INTO types (type) VALUES ('CD'); 13 14 15 CREATE TABLE resources ( 16 id serial PRIMARY KEY, 17 clasification varchar(40) NOT NULL UNIQUE, 18 type_id smallint NOT NULL references types(id) ON DELETE CASCADE, -- Book, CD, LP, periodicals 19 title varchar (100), 20 author varchar(150) NOT NULL, 21 edition smallint, 22 editor varchar(100), 23 isonumber varchar(20), --ISBN, ISSN, NS 24 cost money DEFAULT '0.0', 25 copies smallint NOT NULL DEFAULT 1, 26 created timestamp(0) without time zone DEFAULT now() NOT NULL 27 ); 28 29 -- Prestamos 30 CREATE TABLE lendings ( 31 id serial PRIMARY KEY, 32 resource_id int NOT NULL references resources(id), 33 lend timestamp(0) without time zone DEFAULT now() NOT NULL, 34 days smallint NOT NULL DEFAULT 7, 35 user_id int NOT NULL references users(id) 36 ); -
trunk/app/controllers/wikis_controller.php
r770 r771 81 81 if ($this->Wiki->save($this->data)): 82 82 $id = $this->Wiki->getLastInsertID(); 83 $this->msgFlash(__('WikiPage added', true), '/admin/wikis/edit/'.$id);83 $this->msgFlash(__('WikiPage saved', true), '/admin/wikis/edit/'.$id); 84 84 endif; 85 85 endif; … … 122 122 if ($this->Wiki->save($this->data['Wiki'])): 123 123 if ( $this->data['Wiki']['end'] == 1 ): // edition ends 124 $this->msgFlash('Wiki page saved', '/admin/wikis/listing');124 $this->msgFlash('WikiPage saved', '/admin/wikis/listing'); 125 125 else: 126 $this->msgFlash('Wiki page saved', '/admin/wikis/edit/'.$this->data['Wiki']['id']);126 $this->msgFlash('WikiPage saved', '/admin/wikis/edit/'.$this->data['Wiki']['id']); 127 127 endif; 128 else: 129 $this->flash('Error in DB, contact staff', '/admin/wikis/listing'); 128 130 129 endif; 131 132 133 130 endif; 134 131 } -
trunk/app/tests/cases/controllers/entries_controller.test.php
r533 r771 1 1 <?php 2 // Chipotle Software 2002-2008 GPLv3 3 // MM 2 4 class EntriesControllerTest extends CakeTestCase { 5 3 6 public function startCase() 4 7 { … … 21 24 } 22 25 23 public function test Index()26 public function testDisplay() 24 27 { 25 $result = $this->testAction('/entries/ index');28 $result = $this->testAction('/entries/display'); 26 29 debug($result); 27 30 } … … 54 57 public function testIndexPostFixturized() 55 58 { 56 $data = array(' Article' => array('user_id' => 1, 'published'59 $data = array('Entry' => array('user_id' => 1, 'published' 57 60 => 1, 'slug'=>'new-article', 'title' => 'New Article', 'body' => 'New Body')); 58 61 $result = $this->testAction('/entries/index', -
trunk/app/tests/cases/models/entry.test.php
r533 r771 1 1 <?php 2 App::import('Model','Entry'); 2 // Chipotle Software 2002-2008 GLv3 3 4 App::import('Model','Entry'); 3 5 4 6 class EntryTest extends Entry { 5 public $name = 'EntryTest';6 public $useDbConfig = 'test_suit e';7 public $name = 'EntryTest'; 8 public $useDbConfig = 'test_suit'; 7 9 } 8 10 9 11 class EntryTestCase extends CakeTestCase { 10 public $fixtures = array('entry_test' );11 12 12 public function testPublished() 13 public $fixtures = array('app.entry_test'); 14 /* 15 public function testGetComments() 13 16 { 14 17 $this->EntryTest =& new EntryTest(); 15 18 16 $result = $this->EntryTest->published(array('id', 'title')); 19 $result = $this->EntryTest->getComments(2); 20 17 21 $expected = array( 18 22 array('EntryTest' => array( 'id' => 1, 'title' => 'First Entry' )), … … 22 26 23 27 $this->assertEqual($result, $expected); 24 } 28 }*/ 25 29 } 26 30 ?> -
trunk/app/tests/fixtures/entry_test_fixture.php
r533 r771 1 1 <?php 2 // Entry Model Unit Test 2 3 class EntryTestFixture extends CakeTestFixture { 3 4 … … 5 6 public $import = array('model' => 'Entry', 'records' => true); 6 7 public $fields = array( 7 'id' => array('type' => 'integer', 'key' => 'primary'), 8 'title' => array('type' => 'string', 'length' => 255, 'null' => false), 9 'body' => 'text', 10 'published' => array('type' => 'integer', 'default' => '0', 'null' => false), 11 'created' => 'datetime', 12 'updated' => 'datetime' 13 ); 14 public $records = array( 15 array ('id' => 1, 'title' => 'First Entry', 'body' => 'First Entry Body', 'published' => '1', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), 16 array ('id' => 2, 'title' => 'Second Entry', 'body' => 'Second Entry Body', 'published' => '1', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'), 17 array ('id' => 3, 'title' => 'Third Entry', 'body' => 'Third Entry Body', 'published' => '1', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31') 8 'id' => array('type' => 'integer', 'key' => 'primary'), 9 'title' => array('type'=>'string', 'length'=>50, 'null'=>false), 10 'body' => array('type'=>'text', 'null'=>false), 11 'published' => array('type' => 'integer', 'default' => 0, 'null' => false), 12 'user_id' => array('type' => 'integer', 'default' => 1, 'null' => false), 13 'created' => 'timestamp', 14 'updated' => 'timestamp' 15 ); 16 public $records = array( 17 array('id'=>1, 'title' => 'First Entry', 'body' => 'First Entry Body', 'published'=>1, 'user_id'=>1, 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), 18 array('id'=>2, 'title' => 'Second Entry', 'body' => 'Second Entry Body', 'published' => 1, 'user_id'=>1, 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'), 19 array('id'=>3, 'title'=>'Third Entry', 'body' => 'Third Entry Body', 'published' => 1, 'user_id'=>1, 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31') 18 20 ); 19 21 } -
trunk/app/views/elements/admin_menu.ctp
r758 r771 13 13 $html->link(__('Forums', true), '/admin/catforums/listing'), 14 14 $html->link(__('Messages', true), '/admin/messages/listing') 15 //$html->link(__('WikiPages', true), '/admin/wikis/listing') 15 16 ), 16 17 $html->link('Webquests', '/admin/webquests/listing'), -
trunk/app/views/elements/wikibar.ctp
r767 r771 1 2 1 <script type= "text/javascript">/*<![CDATA[*/ 3 // wiki_add('*','*','bold') 4 function wiki_add(open_tag, close_tag, tag_text) { 2 // wiki_add('--','--','underline') 3 function wiki_add(open_tag, close_tag, tag_text) 4 { 5 5 var text_element = document.getElementById('WikiContent'); 6 6 … … 15 15 while (p1 > p0 && text_element.value.substring(p1-1, p1) == ' ') 16 16 { 17 p1--; 17 p1--; // position 18 18 } 19 20 if (p1 > p0) 19 if (p1 > p0) // si en verdad hay texto en el textarea 21 20 { 22 21 str = text_element.value.substring(p0, p1); … … 35 34 text_element.focus(); 36 35 range = document.selection.createRange() 37 if (str == '') 38 { 39 range.text = open_tag + tag_text + close_tag; 40 range.moveStart('character', -close_tag.length - tag_text.length ); 41 range.moveEnd('character', -close_tag.length ); 42 } 43 else 36 if (str == '') 37 { 38 range.text = open_tag + tag_text + close_tag; 39 range.moveStart('character', -close_tag.length - tag_text.length ); 40 range.moveEnd('character', -close_tag.length ); 41 } 42 else 43 { 44 if (str.charAt(str.length - 1) == " ") 44 45 { 45 if (str.charAt(str.length - 1) == " ")46 {47 46 close_tag = close_tag + " "; 48 47 str = str.substr(0, str.length - 1); 49 }50 range.text = open_tag + str + close_tag;51 }48 } 49 range.text = open_tag + str + close_tag; 50 } 52 51 range.select(); 53 52 } … … 61 60 </script> 62 61 63 <div id="toolbar" >64 <a href="# toolbar"><img onclick="wiki_add('*','*','bold');" src="/img/static/button_bold.png" alt="Bold" title="Bold" /></a>65 <a href="# toolbar"><img onclick="wiki_add('**','**','italics');" src="/img/static/button_italic.png" alt="Italics" /></a>66 <a href="# toolbar"><img onclick="wiki_add('--','--','underline');" src="/img/static/button_underline.png" alt="Underline" title="Underline" /></a>67 <a href="# toolbar"><img onclick="wiki_add('', '\\n#########','heading 1');" src="/img/static/button_headline.png" alt="Heading1" /></a>68 <a href="# toolbar"><img onclick="wiki_add('', '\\n=========','heading 2');" src="/img/static/button_hr.png" alt="Line" /></a>69 <a href="# toolbar"><img onclick="wiki_add('', '\\n---------','heading 3');" src="/img/static/button_heading3.png" alt="Heading 3" /></a>70 <a href="# toolbar"><img onclick="wiki_add('{', '}','image url');" src="/img/static/button_image.png" alt="Inline image" /></a>71 <a href="# toolbar"><img onclick="wiki_add('[link url]', '[/]','link text');" src="/img/static/button_link.png" alt="Inline link" /></a>62 <div id="toolbar" style="padding:0;margin:15px 0 0 0;"> 63 <a href="#legend"><img onclick="wiki_add('\'\'\'','\'\'\'','bold');" src="/img/static/button_bold.png" class="wikibutton" alt="Bold" title="Bold" /></a> 64 <a href="#legend"><img onclick="wiki_add('\'\'','\'\'','italics');" src="/img/static/button_italic.png" class="wikibutton" alt="Italics" /></a> 65 <a href="#legend"><img onclick="wiki_add('--','--','underline');" src="/img/static/button_underline.png" class="wikibutton" alt="Underline" title="Underline" /></a> 66 <a href="#legend"><img onclick="wiki_add('\n==', '==\n','heading 1');" src="/img/static/button_headline.png" class="wikibutton" alt="Heading 1" title="Headline 1" /></a> 67 <a href="#legend"><img onclick="wiki_add('', '\n----\n','');" src="/img/static/button_hr.png" class="wikibutton" alt="Line" title="Line" /></a> 68 <a href="#legend"><img onclick="wiki_add('[', ']','http://www.ejemplo.com|TÃtulo del enlace');" src="/img/static/button_extlink.png" class="wikibutton" alt="External Link" title="External link" /></a> 69 <a href="#legend"><img onclick="wiki_add('[[', ']]','Imagen:Ejemplo.jpg');" src="/img/static/button_image.png" class="wikibutton" alt="Inline image" title="Inline image" /></a> 70 <a href="#legend"><img onclick="wiki_add('[', ']','Link text');" src="/img/static/button_link.png" class="wikibutton" title="Inline link" alt="Inline link" /></a> 72 71 </div> -
trunk/app/views/entries/admin_start.ctp
r764 r771 30 30 echo $html->div('main-item', $tmp, array('title'=>'Messages', 'onclick'=>"document.location.href='/admin/messages/listing'")); 31 31 32 $tmp = $html->link($html->image('wikis.png', array('title'=>'Wikis', 'alt'=>'Wikis')), '/admin/wikis/listing', null, null, false);33 $tmp .= $html->link('Wikis', '/admin/wikis/listing', array('title'=>'Wikis', 'class'=>'main-item-caption'));34 echo $html->div('main-item', $tmp, array('title'=>'Blog', 'onclick'=>"document.location.href='/admin/wikis/listing'"));32 // $tmp = $html->link($html->image('wikis.png', array('title'=>'Wikis', 'alt'=>'Wikis')), '/admin/wikis/listing', null, null, false); 33 // $tmp .= $html->link('Wikis', '/admin/wikis/listing', array('title'=>'Wikis', 'class'=>'main-item-caption')); 34 // echo $html->div('main-item', $tmp, array('title'=>'Blog', 'onclick'=>"document.location.href='/admin/wikis/listing'")); 35 35 36 36 $tmp = $html->link($html->image('mmultimedia.png',array('title'=>__('Shared files', true), 'alt'=>__('Shared files', true))), '/admin/shares/listing', null, null, false); -
trunk/app/views/wikis/admin_edit.ctp
r770 r771 6 6 ?> 7 7 <fieldset> 8 <legend ><?php __('Edit Wiki'); ?></legend>8 <legend id="legend"><?php __('Edit Wiki'); ?></legend> 9 9 <?php 10 10 echo $form->input('Wiki.title', array('size' => 60, 'maxlength'=>80)); … … 16 16 echo $form->select('Wiki.vclassroom_id', $vclassrooms, null, null, false); 17 17 18 echo $html->link($html->image('admin/myimages.jpg', array('alt'=>__('My Images', true), 'title'=>__('My Images',true))), '#', array("onclick"=>"javascript:window.open('/admin/images/listing/set', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=500')"), null, false); 19 18 20 echo $this->element('wikibar'); 21 19 22 echo $form->textarea('Wiki.content', array('cols'=>100,'rows' =>20, 'class'=>'wikitext')); 20 echo $html->div('optional',$form->label('Wiki.status', 'Status:').$form->checkbox('Wiki.status', array('value'=>1))); 23 echo $form->label('Wiki.status', __('Status', true)); 24 echo $form->checkbox('Wiki.status', array('value'=>1)); 21 25 22 echo $html->div('optional',$form->label('Wiki.end', 'End:').$form->checkbox('Wiki.end', array('value'=>1))); 26 echo $form->label('Wiki.end', __('End', true)); 27 echo $form->checkbox('Wiki.end', array('value'=>1)); 23 28 24 echo $ html->div('submit', $form->end(__('Save', true)));29 echo $form->end(__('Save', true)); 25 30 ?> 26 31 <script type="text/javascript"> … … 34 39 </fieldset> 35 40 36 <?php echo $html->link( 'View revisions', '/admin/wikis/history/'.$this->data['Wiki']['id']); ?>41 <?php echo $html->link(__('View history', true), '/admin/wikis/history/'.$this->data['Wiki']['id']); ?> -
trunk/app/webroot/css/cpanel/cpanel.css
r697 r771 1033 1033 1034 1034 .petit{font-style:oblique;font-size:7pt;} 1035 1036 .wikibutton{padding:0;margin:0;}
