Changeset 363

Show
Ignore:
Timestamp:
04/02/08 15:41:18 (9 months ago)
Author:
aarkerio
Message:

Locale and test improvements

Location:
trunk/app
Files:
1 added
10 modified

Legend:

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

    r341 r363  
    7575 * 
    7676 */ 
    77     Configure::write('Session.save', 'database'); 
     77    Configure::write('Session.save', 'cake'); 
    7878/** 
    7979 * The name of the table used to store CakePHP database sessions. 
  • trunk/app/controllers/acquaintances_controller.php

    r339 r363  
    4444 } 
    4545  
    46  /** ADMIN METHODS***/ 
     46 /** === ADMIN METHODS === ***/ 
    4747 public function admin_listing() 
    4848 {     
     
    8989        $this->layout = 'admin'; 
    9090         
    91         $this->Acquaintance->id = $id; 
    92          
    93         $this->data = $this->Acquaintance->read(); 
     91        $this->data = $this->Acquaintance->read(null, $id); 
    9492    } 
    9593    else 
  • trunk/app/controllers/answers_controller.php

    r361 r363  
    2525 } 
    2626 
    27   /*** 
    28    === ADMIN METHODS=== 
    29   ***/ 
     27  /***   === ADMIN METHODS===  ***/ 
    3028   
    3129  public function admin_add()  
     
    6664    if (empty($this->data["Answer"])) 
    6765    {    
    68         $this->Answer->id = $catfaq_id; 
    69          
    70         $this->data = $this->Answer->read(); 
     66        $this->data = $this->Answer->read(null, $answer_id ); 
    7167    } 
    7268    else 
     
    7773         
    7874        if ($this->Answer->save($this->data['Answer'])) 
    79     { 
    80             $this->msgFlash('Answers has been updated.','/admin/questions/listing/'.$this->data["Answers"]["question_id"]); 
    81     } 
     75        { 
     76            $this->msgFlash('Answer updated.','/admin/questions/answers/'.$this->data["Answer"]["question_id"]); 
     77        } 
    8278    } 
    8379  }   
  • trunk/app/controllers/questions_controller.php

    r362 r363  
    4444   { 
    4545     $conditions = array("Question.test_id" => $this->data['Question']['test_id']); 
    46      $fields     = array("Question.id", "Question.question", "Question.hint", "Question.worth", "Question.explanation", "Answer.id"); 
     46     $fields     = array("Question.id", "Question.question", "Question.hint", "Question.worth", "Question.explanation"); 
    4747     $order      = "Question.id"; 
    4848                     
     
    5353    else 
    5454    { 
    55             echo "Ajax error, check with the company's computer guy..."; 
     55            echo "Ajax error, please report this bug"; 
    5656    } 
    5757  } 
  • trunk/app/models/answer.php

    r284 r363  
    88class Answer extends AppModel { 
    99    
    10    public $belongsTo = 'User'; 
    11     
     10  public $belongsTo = array('Question' => 
     11                                    array('className'  => 'Question', 
     12                                          'conditions' => '', 
     13                                          'order'      => '', 
     14                                          'foreignKey' => 'question_id' 
     15                                          ) 
     16                          ); 
     17  
    1218  public $validate = array( 
    1319                'comment'  => VALID_NOT_EMPTY,         //'/[a-z0-9\_\-]{3,}$/i', 
  • trunk/app/models/question.php

    r282 r363  
    88class Question extends AppModel { 
    99    
    10   public $belongsTo = array('User' => 
    11              array('className'  => 'User', 
    12                'conditions' => '', 
    13                'order'      => '', 
    14                            'foreignKey' => 'user_id' 
    15                            ) 
    16                      ); 
     10  public $belongsTo = array('Test' => 
     11                                    array('className'  => 'Test', 
     12                                          'conditions' => '', 
     13                                          'order'      => '', 
     14                                          'foreignKey' => 'test_id' 
     15                                          ) 
     16                          ); 
    1717    
    1818  public $hasMany = array('Answer' => 
    19              array('className'=>'Answer', 
    20                         'conditions'    => null,                 
    21                         'foreignKey'    => 'question_id', 
    22                         'dependent'     => true, 
    23                         'exclusive'     => false, 
    24                                 'finderQuery'   => '', 
    25                                             'order'         => 'Answer.id ASC' 
    26                         ) 
    27                       ); 
     19                                    array('className'=>'Answer', 
     20                                           'conditions'    => null,              
     21                                           'foreignKey'    => 'question_id', 
     22                                           'dependent'     => true, 
     23                                           'exclusive'     => false, 
     24                                           'finderQuery'   => null, 
     25                                           'order'         => 'Answer.id ASC' 
     26                                          ) 
     27                          ); 
    2828 
    29     public $validate = array('question'   => VALID_NOT_EMPTY,         //'/[a-z0-9\_\-]{3,}$/i', 
    30                  'user_id' => VALID_NOT_EMPTY, 
    31                  'explanation'  => VALID_NOT_EMPTY); 
     29    public $validate = array('question'   => VALID_NOT_EMPTY,          
     30                             'user_id' => VALID_NOT_EMPTY, 
     31                             'explanation'  => VALID_NOT_EMPTY 
     32                 ); 
    3233} 
    3334?> 
  • trunk/app/views/questions/admin_answers.ctp

    r361 r363  
    77?> 
    88 
    9 <div id="loading" style="display: none;"> 
    10            <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?> 
    11 </div> 
     9<div id="loading" style="display: none;"> <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?></div> 
    1210 
    13 <p> 
    14  <?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new answer", "title"=>"Add new answer")), '#', array("onclick"=>"hU()"), false, false); ?> 
    15 </p> 
     11<?php echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new answer", "title"=>"Add new answer")), '#', array("onclick"=>"hU()"), false, false)); ?> 
     12 
    1613 
    1714<div id="addquestion" style="display:none"> 
     
    3835foreach ($data['Answer'] as $val)  
    3936{ 
    40   $st = ($val["correct"]==1) ? 'Yes' : 'No';       
     37  $st = ($val['correct']==1) ? 'Yes' : 'No';       
    4138  $tmp  = $html->div(null, $html->link('Delete', '/admin/answers/delete/'.$val['id'].'/'.$val['question_id'])); 
    4239  $tmp .= $html->div(null, $html->link('Edit',   '/admin/answers/edit/'  .$val['id'])); 
    43   $tmp .= "Answer:  "     . $val["answer"]          . "<br />"; 
    44   $tmp .= "Correct: "     . $html->link($st, '/admin/answers/changed/'.$val['id'].'/'.$val['question_id']) . "<br />"; 
     40  $tmp .= "Answer:  "     .    $val["answer"]       . "<br />"; 
     41  $tmp .= "Correct: "     . $html->link($st, '/admin/answers/change/'.$val['id'].'/'.$val['correct'] .'/'.$val['question_id']) . "<br />"; 
    4542 
    4643  echo $html->div('adminblock', $tmp); 
  • trunk/app/views/questions/questions.ctp

    r362 r363  
    99    $i++; 
    1010    echo '<div style="padding:5px;border:1px dotted gray;margin:auto;width:60%"><b>' . $i . '.-</b> '; 
    11     echo $html->div('butonright', $gags->sendEdit($val['id'],   'Question')); 
    12     echo $html->div('butonright', $gags->confirmDel($val['id'], 'Question')); 
    13        echo "Question: "    . $val["question"]       . "<br />"; 
    14        echo "Hint: "        . $val["hint"]           . "<br />"; 
    15        echo "Explanation: " . $val["explanation"]    . "<br />"; 
    16        echo "Worth: "       . $val["worth"]          . "<br /><br />"; 
    17        echo $html->link('View answers ('.$answers.')', '/admin/questions/answers/'.$val["id"]); 
     11    echo $html->div('butonright', $gags->sendEdit($val['Question']['id'],   'Question')); 
     12    echo $html->div('butonright', $gags->confirmDel($val['Question']['id'], 'Question')); 
     13       echo "Question: "    . $val['Question']['question']       . "<br />"; 
     14       echo "Hint: "        . $val['Question']['hint']           . "<br />"; 
     15       echo "Explanation: " . $val['Question']['explanation']    . "<br />"; 
     16       echo "Worth: "       . $val['Question']['worth']          . "<br /><br />"; 
     17       echo $html->link('View answers ('.$answers.')', '/admin/questions/answers/'.$val['Question']['id']); 
    1818    echo '</div>'; 
    1919} 
  • trunk/app/views/tests/admin_questions.ctp

    r362 r363  
    1616 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false));  
    1717?> 
     18 
    1819<!-- Ajax form beggin --> 
    1920<div id="addquestion" style="display:none"> 
    2021<?php  
    21    echo $ajax->form(null,'post');  
     22   echo $ajax->form();  
    2223   echo $form->hidden('Question.test_id', array('value'=>$data['Test']['id']));  
    2324?> 
     
    2930 echo $html->div('required', $form->label('Question.explanation', 'Explanation:') . $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5)));  
    3031 
    31  $tmp = $form->label('Question.worth', 'Worth:'); 
     32 $tmp  = $form->label('Question.worth', 'Worth:'); 
    3233 $tmp .=  $form->select('Question.worth',  array(1, 2, 3, 4, 5, 6,7, 8, 9, 10), null, null, false, false);  
    3334 echo $html->div('required', $tmp); 
  • trunk/app/views/users/login.ctp

    r340 r363  
    22<?php 
    33echo $form->create('User', array('action' => 'login')); 
    4 echo $form->input('email', array('size' => 40, 'maxlength'=> 50)); 
    5 echo $form->label('pwd', 'Password:'); 
    6 echo $form->password('pwd') . '<br />'; 
     4echo $form->input('email', array('size' => 40, 'maxlength'=> 50, 'between'=>':<br />')); 
     5echo $form->input('pwd', array('between'=>'<br />', 'type' => 'password', 'label'=>'Password:', 'size' => 9, 'maxlength'=> 9)); 
    76echo $form->label('remember_me', 'Remember me:'); 
    8 echo $form->checkbox('remember_me'); 
     7echo $form->checkbox('remember_me', array('value'=>1)); 
    98echo $form->end('Login'); 
    10 //sujaclal 
    119?>