aeff86cc6c7cb4774dda7e3b25957d712f09d62e

Author: José Lorenzo Rodríguez

Date: 2009-04-22 18:35:14 -0430

More changes for richtext editors in question types

diff --git a/plugins/quiz/controllers/quizzes_controller.php b/plugins/quiz/controllers/quizzes_controller.php index 5ebec7f..255f5fc 100755 --- a/plugins/quiz/controllers/quizzes_controller.php +++ b/plugins/quiz/controllers/quizzes_controller.php @@ -150,10 +150,10 @@ class QuizzesController extends QuizAppController { if (!empty($this->data['Search']) && !$this->RequestHandler->isAjax()) { $this->redirect($this->params['pass'] + $this->data['Search']); } elseif (!empty($this->data['Search']) && $this->RequestHandler->isAjax()) { - $this->params['named'] = $this->data['Search']; + $this->params['named'] += $this->data['Search']; } $question_type = 'all'; - if (isset($this->params['named']['question_type'])) { + if (!empty($this->params['named']['question_type'])) { $question_type = $this->params['named']['question_type']; } $this->set('question_type', $question_type); @@ -182,6 +182,7 @@ class QuizzesController extends QuizAppController { $questions= $this->paginate($this->Quiz->Question); } else { array_unshift($this->paginate['Question'],Inflector::camelize($question_type)); + $this->paginate['Question']['conditions'] = array('Question.type' => Inflector::camelize($question_type)); $questions = $this->paginate($this->Quiz->Question); } $this->set('isAjax',$this->RequestHandler->isAjax()); diff --git a/plugins/quiz/vendors/css/quiz.css b/plugins/quiz/vendors/css/quiz.css index 4728c06..4f943c2 100755 --- a/plugins/quiz/vendors/css/quiz.css +++ b/plugins/quiz/vendors/css/quiz.css @@ -183,7 +183,6 @@ #questions .list ul li.question-list-element label { display:inline; padding-top:1px; - vertical-align:center; width:auto; } #questions .list ul li.question-list-element .input { @@ -246,7 +245,8 @@ } .choices fieldset.question-choices { - width:60%; + width:63%; + margin-right:0; float:right; } @@ -269,13 +269,22 @@ fieldset.question-choices .choice .text { } .information textarea, +.information table, fieldset.question-choices .choice .text textarea, -fieldset.question-choices .choice .position input { +fieldset.question-choices .choice .text table, +fieldset.question-choices .choice .position input[type=text] { width:90%; + clear:both; +} + +.information table, +fieldset.question-choices .choice .text table { + width:70%; } fieldset.question-choices .choice .position { - width:40%; + width:15%; float:left; + margin-left:10%; } fieldset.question-choices .choice .position label { display:inline; @@ -284,7 +293,6 @@ fieldset.question-choices .choice .position label { } fieldset.question-choices .choice label { float:left; - width:100%; display:block; } @@ -295,22 +303,21 @@ fieldset.question-choices .choice.set { } fieldset.question-choices .choice.question.set { width:55%; - float:left; } -fieldset.question-choices .choice.question.set textarea{ - float:right; - width:75%; +fieldset.question-choices .choice.question.set textarea, +fieldset.question-choices .choice.question.set table{ + width:65%; margin-right: 25%; } fieldset.question-choices .choice.answer.set { - float:right; + /*float:right;*/ } -fieldset.question-choices .set textarea { +fieldset.question-choices .set textarea, fieldset.question-choices .set table { width:100%; } -.set ol { +fieldset .set ol { padding:0; } @@ -318,26 +325,31 @@ fieldset.question-choices .choice.set ol label { display:inline; float:none; } + .set ol li { - list-style-position:inside; padding-bottom:0px; margin-bottom:20px; clear:both; float:left; - position:relative; +} +fieldset .set ol li { + list-style-position:inside; } +fieldset .set ol li div.sourceChoice { + position:relative; +} .set ol li span { - margin:; + margin:0; } .set ol li span.correct { - display:block; position:absolute; - right:0; - top:13px; + font-size:0.8em; + display:block; + top:5%; + right:3%; width:15%; text-align:center; - margin:-5px 3px 0 0; } .matching .submit { clear:both; @@ -393,7 +405,7 @@ fieldset.question-choices .choice.set ol label { .matchingQuestion.view div.answer { float:left; - padding-left:50px; + padding-left:70px; } .set ol li div.error-message { @@ -407,7 +419,7 @@ ol li div ol { margin-top:10px; } -div.textQuestion input[type=text] { +div.textQuestion div.input.text input, div.textQuestion div.input.textarea textarea { width:75%; } diff --git a/plugins/quiz/views/choice_questions/add.ctp b/plugins/quiz/views/choice_questions/add.ctp index b71db17..6c9224e 100755 --- a/plugins/quiz/views/choice_questions/add.ctp +++ b/plugins/quiz/views/choice_questions/add.ctp @@ -55,4 +55,10 @@ </fieldset> </fieldset> <?php echo $form->end(__('Create Question',true));?> -</div> \ No newline at end of file +</div> +<?php echo $this->element('ui/editor',array( + 'options' => array( + 'theme_advanced_toolbar_location' => 'external', + ) + ) +); ?> \ No newline at end of file diff --git a/plugins/quiz/views/matching_questions/add.ctp b/plugins/quiz/views/matching_questions/add.ctp index c9e816c..c24087d 100755 --- a/plugins/quiz/views/matching_questions/add.ctp +++ b/plugins/quiz/views/matching_questions/add.ctp @@ -35,6 +35,7 @@ for ($i=0;$i<$totalQuestions;$i++) : ?> <li> + <div class="sourceChoice"> <?php echo $form->input('SourceChoice.'.$i.'.text', array('rows' => 2, 'div' => false, 'label' => false)); ?> <span class="correct"> <?php @@ -45,6 +46,7 @@ ?> </span> + </div> </li> <?php endfor; @@ -73,4 +75,10 @@ </fieldset> </fieldset> <?php echo $form->end(__('Submit', true));?> +<?php echo $this->element('ui/editor',array( + 'options' => array( + 'theme_advanced_toolbar_location' => 'external' + ) + ) +); ?> </div> diff --git a/plugins/quiz/views/ordering_questions/add.ctp b/plugins/quiz/views/ordering_questions/add.ctp index b105ba4..2ab0460 100755 --- a/plugins/quiz/views/ordering_questions/add.ctp +++ b/plugins/quiz/views/ordering_questions/add.ctp @@ -62,4 +62,10 @@ ?> </fieldset> <?php echo $form->end(__('Submit', true));?> +<?php echo $this->element('ui/editor',array( + 'options' => array( + 'theme_advanced_toolbar_location' => 'external' + ) + ) +); ?> </div> \ No newline at end of file diff --git a/plugins/quiz/views/text_questions/add.ctp b/plugins/quiz/views/text_questions/add.ctp index 8265e8d..2fc7292 100755 --- a/plugins/quiz/views/text_questions/add.ctp +++ b/plugins/quiz/views/text_questions/add.ctp @@ -18,4 +18,4 @@ echo $form->end(__('Create Question',true)); ?> </div> -<?php echo $this->element('ui/editor',array('theme' => 'simple')); ?> \ No newline at end of file +<?php echo $this->element('ui/editor'); ?> \ No newline at end of file diff --git a/views/elements/ui/editor.ctp b/views/elements/ui/editor.ctp index 31c172d..f571426 100755 --- a/views/elements/ui/editor.ctp +++ b/views/elements/ui/editor.ctp @@ -1,29 +1,11 @@ -<?php echo $javascript->link('tiny_mce/tiny_mce',null,null,false); ?> <?php -$width = '"90%"'; -$height = 300; -if (isset($settings['width'])) - $width = $settings['width']; - -if (isset($settings['height'])) - $height = $settings['height']; +if (!isset($options)) { + $options = array(); +} +echo $javascript->link('tiny_mce/tiny_mce',null,null,false); +$this->_loadHelpers($this->helpers,array('TinyMce')); +$this->TinyMce = $this->helpers['TinyMce']; ?> <script language="javascript" type="text/javascript"> - tinyMCE.init({ - mode : "textareas", - theme : "advanced", - skin : "osmosis", - plugins : "safari,table,save,inlinepopups,preview,media,contextmenu,paste,fullscreen,noneditable,visualchars,xhtmlxtras,noneditable,latex", - theme_advanced_buttons1: "save,preview,|,cut,copy,paste,pasteword,|,undo,redo,|,link,unlink,|,image,media,|,removeformat,code,fullscreen", - theme_advanced_buttons2 : "bold,italic,underline,|,justifyleft,justifyfull,|,bullist,numlist,|,blockquote,formatselect,|,charmap,latex", - theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "bottom", - theme_advanced_toolbar_align : "left", - theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : true, - media_types : 'flash', - convert_urls: false, - width: <?php echo $width?>, - height: <?php echo $height?> - }); +<?php echo $this->TinyMce->widget($options); ?> </script> diff --git a/webroot/js/tiny_mce/themes/simple/skins/osmosis/ui.css b/webroot/js/tiny_mce/themes/simple/skins/osmosis/ui.css index c12d3a5..7b9feb4 100755 --- a/webroot/js/tiny_mce/themes/simple/skins/osmosis/ui.css +++ b/webroot/js/tiny_mce/themes/simple/skins/osmosis/ui.css @@ -11,7 +11,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we .wp_themeSkin .mceToolbar {padding: 2px;} /* External */ -.wp_themeSkin .mceExternalToolbar {position:absolute; border-bottom:0; display:none} +.wp_themeSkin .mceExternalToolbar {position:fixed; border-bottom:0; display:none} .wp_themeSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;} .wp_themeSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}