Changeset 370

Show
Ignore:
Timestamp:
04/06/08 13:50:06 (9 months ago)
Author:
aarkerio
Message:

Wiki starting

Location:
trunk/app
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/config/core.php

    r363 r370  
    1414 * In development mode, you need to click the flash message to continue. 
    1515 */ 
    16     Configure::write('debug', 1); 
     16    Configure::write('debug', 2); 
    1717/** 
    1818 * Application wide charset encoding 
  • trunk/app/config/sql/karamelo_postgres.sql

    r369 r370  
    8787INSERT INTO subjects (code, title) VALUES ('0006', 'Music'); 
    8888INSERT INTO subjects (code, title) VALUES ('0007', 'Psichology'); 
    89 INSERT INTO subjects (code, title) VALUES ('0008', 'Chemistry'); 
    90 INSERT INTO subjects (code, title) VALUES ('0009', 'Physiscs'); 
    91 INSERT INTO subjects (code, title) VALUES ('0010', 'Science'); 
    92 INSERT INTO subjects (code, title) VALUES ('0011', 'Public health'); 
    93 INSERT INTO subjects (code, title) VALUES ('0012', 'Biology'); 
    94 INSERT INTO subjects (code, title) VALUES ('0013', 'Sociology'); 
    95 INSERT INTO subjects (code, title) VALUES ('0014', 'Archeology'); 
    96 INSERT INTO subjects (code, title) VALUES ('0015', 'Spanish'); 
    97 INSERT INTO subjects (code, title) VALUES ('0016', 'Geography'); 
    98 INSERT INTO subjects (code, title) VALUES ('0017', 'Computing'); 
    99 INSERT INTO subjects (code, title) VALUES ('0018', 'Business Studies'); 
    100 INSERT INTO subjects (code, title) VALUES ('0019', 'Genre Studies'); 
    101 INSERT INTO subjects (code, title) VALUES ('0020', 'French'); 
    102 INSERT INTO subjects (code, title) VALUES ('0021', 'German'); 
    103 INSERT INTO subjects (code, title) VALUES ('0022', 'Health Care'); 
    104 INSERT INTO subjects (code, title) VALUES ('0023', 'Commerce'); 
    105 INSERT INTO subjects (code, title) VALUES ('0024', 'Graphic Design'); 
    106 INSERT INTO subjects (code, title) VALUES ('0025', 'Administration'); 
    107 INSERT INTO subjects (code, title) VALUES ('0026', 'Accounting'); 
    108 INSERT INTO subjects (code, title) VALUES ('0027', 'Classic Latin'); 
    109 INSERT INTO subjects (code, title) VALUES ('0028', 'Literature'); 
    110 INSERT INTO subjects (code, title) VALUES ('0029', 'Japanese'); 
    111 INSERT INTO subjects (code, title) VALUES ('0030', 'Chinese'); 
    112 INSERT INTO subjects (code, title) VALUES ('0031', 'Engineering'); 
    113 INSERT INTO subjects (code, title) VALUES ('0032', 'Sports'); 
     89 
    11490 
    11591-- Confirms user registration table, just a support table until new user confirm his/her email 
     
    590566--HABTM 
    591567CREATE TABLE "tests_vclassrooms" ( 
     568 "id" serial PRIMARY KEY, 
    592569 "test_id" int NOT NULL REFERENCES tests(id), 
    593570 "vclassroom_id" int NOT NULL REFERENCES vclassrooms(id), 
    594   PRIMARY KEY  ("test_id", "vclassroom_id") 
     571  UNIQUE  ("test_id", "vclassroom_id") 
    595572); 
    596573 
     
    674651 status int NOT NULL DEFAULT 0 
    675652); 
     653 
     654-- Wiki tables beggin 
     655CREATE TABLE wikis ( 
     656  id serial PRIMARY KEY, 
     657  title varchar(255) NOT NULL, 
     658  content text NOT NULL, 
     659  access smallint NOT NULL DEFAULT 0, 
     660  modified timestamp NOT NULL default now(), 
     661  user_id serial NOT NULL, 
     662  ip varchar(15) NOT NULL, 
     663  revision int(5) NOT NULL, 
     664  accessed datetime NOT NULL 
     665); 
     666 
     667CREATE TABLE wiki_revisions ( 
     668  id serial PRIMARY KEY, 
     669  title varchar(255) NOT NULL, 
     670  content text NOT NULL, 
     671  access smallint NOT NULL default 0, 
     672  modified timestamp NOT NULL default now(), 
     673  user_id serial NOT NULL, 
     674  ip varchar(15) NOT NULL, 
     675  revision int(5) NOT NULL, 
     676  accessed date NOT NULL default now() 
     677); 
     678 
     679CREATE TABLE settings ( 
     680  id serial PRIMARY KEY, 
     681  name varchar(50) NOT NULL UNIQUE, 
     682  value varchar(255) NOT NULL, 
     683  default varchar(255) NOT NULL, 
     684  description varchar(255) NOT NULL 
     685); 
     686 
     687CREATE TABLE upload_revisions ( 
     688  id serial PRIMARY KEY, 
     689  filename varchar(250) NOT NULL, 
     690  location varchar(250) NOT NULL, 
     691  access smallint NOT NULL, 
     692  modified timestamp NOT NULL default now(), 
     693  user_id int NOT NULL REFERENCES users(id), 
     694  ip varchar(15) NOT NULL, 
     695  revision int NOT NULL 
     696); 
     697 
     698CREATE TABLE uploads ( 
     699  id serial PRIMARY KEY, 
     700  filename varchar(255) NOT NULL UNIQUE, 
     701  location varchar(255) NOT NULL, 
     702  access smallint NOT NULL, 
     703  modified timestamp NOT NULL default now(), 
     704  user_id int NOT NULL REFERENCES users(id), 
     705  ip varchar(15) NOT NULL, 
     706  revision int NOT NULL 
     707); 
     708 
     709-- wiki tables ends 
  • trunk/app/controllers/vclassrooms_controller.php

    r369 r370  
    1919      parent::beforeFilter(); 
    2020 } 
     21 
    2122 public function isAuthorized() 
    2223 { 
     
    122123      $this->set('test', $this->Vclassroom->Test->findAll(array("Test.user_id"=>$this->Auth->user('id'), "Test.status"=>1))); 
    123124 } 
     125 
     126 public function admin_linktest() 
     127 { 
     128   if (!empty($this->data["TestsVclassroom"])) 
     129   { 
     130        $this->Sanitize = new Sanitize; 
     131         
     132        $this->Sanitize->clean($this->data["TestsVclassroom"]);  
     133         
     134        $this->Vclassroom->TestsVclassroom->create(); 
     135         
     136        unset($this->Vclassroom->TestsVclassroom->id); 
     137 
     138        if ( $this->Vclassroom->TestsVclassroom->save($this->data["TestsVclassroom"])) 
     139    { 
     140           
     141               $this->msgFlash('Test linked', '/admin/vclassrooms/tests/'.$this->data["TestsVclassroom"]["vclassroom_id"]); 
     142    } 
     143    }  
     144 } 
    124145 // link webquest to classroom 
    125146 public function admin_webquest($vclassroom_id) 
     
    200221        else 
    201222        { 
    202         echo 'Problem'; 
    203         } 
    204   } 
    205 } 
    206  
    207  /** 
    208   *   
    209   *  args id  
    210   *   
    211  **/  
    212   public function admin_edit($id = null) 
    213   { 
     223        echo 'Problem please report bug'; 
     224        } 
     225   } 
     226 } 
     227 
     228 public function admin_edit($vclassroom_id = null) 
     229 { 
    214230    if (empty($this->data["Vclassroom"])) 
    215231    { 
    216232        $this->layout = 'admin'; 
    217233         
    218         $this->Vclassroom->id = $id; 
    219                  
    220         $this->data = $this->Vclassroom->read(); 
     234        $this->data = $this->Vclassroom->read(null, $vclassroom_id); 
    221235    } 
    222236    else 
  • trunk/app/models/vclassroom.php

    r369 r370  
    1616                   array('className'    => 'User', 
    1717                     'joinTable'    => 'users_vclassrooms', 
    18                      'foreignKey'   => 'user_id', 
    19                      'associationForeignKey'=> 'vclassroom_id', 
     18                     'foreignKey'   => 'vclassroom_id', 
     19                     'associationForeignKey'=> 'user_id', 
    2020                     'conditions'   => '', 
     21                                         'fields'       => 'username, id, email, name', 
    2122                     'order'        => '', 
    2223                     'limit'        => '', 
     
    2425                     'finderQuery'  => '', 
    2526                     'deleteQuery'  => '', 
    26                      ) 
    27                    ); 
    28  
    29     /* 
    30     public $hasAndBelongsToMany = array( 
     27                     ), 
    3128                                        'Test' => 
    3229                       array('className'             => 'Test', 
     
    4037                         'finderQuery'           => '', 
    4138                         'deleteQuery'           => '' 
    42                          ), 
     39                         ) 
     40                       ); 
     41  /* 
    4342                                        'Webquest' => 
    4443                       array('className'             => 'Webquest', 
  • trunk/app/views/vclassrooms/admin_members.ctp

    r369 r370  
    11<?php 
    2 //die( debug($users)); 
     2//die( debug($data)); 
    33echo '<div style="padding:4px;margin:10px auto 10px;width:700px;text-align:center;">'; 
    44 
    55//popup window for tests 
    6 $t="javascript:window.open('/admin/vclassrooms/display/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";  
     6$t="javascript:window.open('/admin/vclassrooms/tests/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";  
    77 
    88//popup window for webquest 
     
    3636echo $html->div('title_section', 'Students belonging to ' . $data['Vclassroom']['name']); 
    3737 
    38 if ( count($users) < 1 ) 
     38if ( count($data['User']) < 1 ) 
    3939{ 
    4040  echo $html->div('divblock', 'There are no students in this classrroom yet'); 
    4141} 
    4242 
    43 foreach ($users as $val) 
     43foreach ($data['User'] as $val) 
    4444{ 
     45  // die(debug($val)); 
    4546 echo '<div style="padding:6px 3px 28px 4px;margin:10px 0 5px 0;border:1px dotted gray;">'; 
    46        echo 'Name: '    . $val['User']['name']                    . '<br />'; 
    47        echo 'Username:' . $val['User']['username']                . '<br />'; 
    48        echo 'Email: '   . $html->linkEmail($val['User']['email']) . '<br />'; 
    49        echo $html->div('butonright', $gags->confirmDel($val['User']['id'], 'vclassmembers')); 
     47       echo '<b>Name</b>: '    . $val['name'] . '  ' . '<b> Username</b>:' . $val['username']                . '<br />'; 
     48       echo 'Email: '   . $html->link($val['email'], 'mailto:'.$val['email']) . '<br />'; 
     49       echo $html->div('butonright', $gags->confirmDel($val['id'], 'vclassmembers')); 
    5050 echo '</div>'; 
    5151} 
  • trunk/app/views/vclassrooms/admin_tests.ctp

    r369 r370  
    2828     { 
    2929       $tmp  =  'Test:' . $val['Test']['title']; 
    30        $tmp .=  $form->create('Vclassroom', array('action'=>'admin_addtest')); 
    31        $tmp .=  $form->hidden('Test.id', array('value'=>$val['Test']['id']));  
    32        $tmp .=  $form->hidden('Vclassroom.id', array('value'=>$data['Vclassroom']['id'])); 
    33        $tmp .=  $form->end('Assign this test'); 
     30       $tmp .=  $form->create('Vclassroom', array('action'=>'linktest')); 
     31       $tmp .=  $form->hidden('TestsVclassroom.test_id', array('value'=>$val['Test']['id']));  
     32       $tmp .=  $form->hidden('TestsVclassroom.vclassroom_id', array('value'=>$data['Vclassroom']['id'])); 
     33       $tmp .=  $form->end('Assign this test to this class'); 
    3434                       
    3535       echo $html->div('divblock', $tmp);