Use $form->addButtonAdvancedSetting(), remove advanced_parameter js code

See #7602
1.10.x
Julio Montoya 11 years ago
parent 02a2799b5a
commit 1399e0c822
  1. 81
      main/admin/session_add.php
  2. 67
      main/admin/session_edit.php
  3. 9
      main/attendance/attendance_add.php
  4. 11
      main/attendance/attendance_edit.php
  5. 10
      main/attendance/index.php
  6. 23
      main/create_course/add_course.php
  7. 9
      main/css/base.css
  8. 27
      main/document/upload.php
  9. 21
      main/exercice/exercise.class.php
  10. 22
      main/exercice/exercise_admin.php
  11. 7
      main/exercice/hotpotatoes.php
  12. 24
      main/exercice/question.class.php
  13. 2
      main/exercice/upload_exercise.php
  14. 13
      main/forum/editpost.php
  15. 14
      main/forum/forumfunction.inc.php
  16. 9
      main/forum/index.php
  17. 13
      main/forum/newthread.php
  18. 13
      main/forum/reply.php
  19. 22
      main/forum/viewforumcategory.php
  20. 13
      main/inc/lib/formvalidator/FormValidator.class.php
  21. 9
      main/inc/lib/grade_model.lib.php
  22. 54
      main/inc/lib/pear/HTML/QuickForm/advanced_settings.php
  23. 9
      main/messages/new_message.php
  24. 20
      main/newscorm/learnpath.class.php
  25. 25
      main/newscorm/lp_add.php
  26. 22
      main/newscorm/lp_add_item.php
  27. 34
      main/survey/create_new_survey.php
  28. 13
      main/template/default/layout/footer.tpl
  29. 9
      main/wiki/index.php
  30. 19
      main/wiki/wiki.inc.php
  31. 28
      main/work/work.lib.php

@ -53,17 +53,17 @@ function search_coachs($needle) {
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%")
AND status=1'.
$order_clause.
' LIMIT 10';
if ($access_url_id != -1) {
$sql = 'SELECT username, lastname, firstname
FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE
access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%")
AND status=1'.
$order_clause.
' LIMIT 10';
}
}
@ -86,21 +86,6 @@ function fill_coach_field (username) {
document.getElementById('ajax_list_coachs').innerHTML = '';
}
$(document).on('ready', function () {
var value = 1;
$('#advanced_parameters').on('click', function() {
$('#options').toggle(function() {
if (value == 1) {
$('#advanced_parameters').addClass('btn-hide');
value = 0;
} else {
$('#advanced_parameters').removeClass('btn-hide');
value = 1;
}
});
});
});
function setDisable(select){
document.forms['edit_session'].elements['session_visibility'].disabled = (select.checked) ? true : false;
document.forms['edit_session'].elements['session_visibility'].selectedIndex = 0;
@ -256,7 +241,6 @@ if (intval($countUsers) < 50) {
'class' => 'chzn-select',
'style' => 'width:370px;'
));
$form->addElement('advanced_settings', Display::return_icon('synthese_view.gif') . ' ' . get_lang('ActivityCoach'));
} else {
$form->addElement('text', 'coach_username', get_lang('CoachName'), array(
'maxlength' => 50,
@ -268,28 +252,37 @@ if (intval($countUsers) < 50) {
$form->addRule('coach_username', get_lang('ThisFieldIsRequired'), 'required');
$form->addHtml('<div id="ajax_list_coachs"></div>');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html','<div id="advanced_params_options" style="display:none">');
$form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
'id' => 'session_category',
'class' => 'chzn-select',
'style' => 'width:370px;'
));
$form->addElement('advanced_settings','<a class="btn-show" id="advanced_parameters" href="javascript://">'.get_lang('DefineSessionOptions').'</a>');
$form->addHtmlEditor(
'description',
get_lang('Description'),
false,
false,
array(
'ToolbarSet' => 'Minimal'
)
);
$form->addElement('html','<div id="options" style="display:none">');
$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
$form->addElement('text', 'nb_days_acess_before', array('', '', get_lang('DaysBefore')), array(
'style' => 'width: 30px;',
'input-size' => '2',
'value' => $nb_days_acess_before
));
$form->addElement('text', 'nb_days_acess_after', array('', '', get_lang('DaysAfter')), array(
'style' => 'width: 30px;',
'input-size' => '2',
'value' => $nb_days_acess_after
));
$form->addElement('html','</div>');
$form->addElement('checkbox', 'start_limit', '', get_lang('DateStartSession'), array(
'onchange' => 'disable_starttime(this)',
'id' => 'start_limit'
@ -306,34 +299,20 @@ $form->addElement('checkbox', 'end_limit', '', get_lang('DateEndSession'), array
'id' => 'end_limit'
));
$form->addElement('html','<div id="end_date" style="display:none">');
$form->addElement('html', '<div id="end_date" style="display:none">');
$form->addElement('date_picker', 'date_end');
$visibilityGroup = array();
$visibilityGroup[] = $form->createElement('advanced_settings', get_lang('SessionVisibility'));
$visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))
));
$form->addGroup($visibilityGroup, 'visibility_group', null, null, false);
$form->addGroup($visibilityGroup, 'visibility_group', get_lang('SessionVisibility'), null, false);
$form->addElement('html','</div>');
$form->addHtmlEditor(
'description',
get_lang('Description'),
false,
false,
array(
'ToolbarSet' => 'Minimal'
)
);
$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
$form->addElement(
'text',
'duration',
@ -346,10 +325,12 @@ $form->addElement(
)
);
//Extra fields
// Extra fields
$extra_field = new ExtraField('session');
$extra = $extra_field->addElements($form, null);
$form->addElement('html','</div>');
$htmlHeadXtra[] ='
<script>

@ -46,8 +46,10 @@ if (api_is_multiple_url_enabled()) {
$table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql="SELECT DISTINCT u.user_id,lastname,firstname,username FROM $tbl_user u INNER JOIN $table_access_url_rel_user url_rel_user ON (url_rel_user.user_id = u.user_id)
WHERE status='1' AND access_url_id = '$access_url_id' $order_clause";
$sql = "SELECT DISTINCT u.user_id,lastname,firstname,username
FROM $tbl_user u
INNER JOIN $table_access_url_rel_user url_rel_user ON (url_rel_user.user_id = u.user_id)
WHERE status='1' AND access_url_id = '$access_url_id' $order_clause";
}
}
@ -124,30 +126,43 @@ $form->addElement('select', 'id_coach', get_lang('CoachName'), $coachesOption, a
));
$form->addRule('id_coach', get_lang('ThisFieldIsRequired'), 'required');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html','<div id="advanced_params_options" style="display:none">');
$form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOption, array(
'id' => 'session_category',
'class' => 'chzn-select',
'style' => 'width:370px;'
));
$form->addElement('advanced_settings','<a class="btn-show" id="show-options" href="#">'.get_lang('DefineSessionOptions').'</a>');
$form->addHtmlEditor(
'description',
get_lang('Description'),
false,
false,
array(
'ToolbarSet' => 'Minimal'
)
);
if ($infos['nb_days_access_before_beginning'] != 0 || $infos['nb_days_access_after_end'] != 0) {
$form->addElement('html','<div id="options" style="display:block;">');
} else {
$form->addElement('html','<div id="options" style="display:none;">');
$chkDescriptionAttributes = array();
if (!empty($infos['show_description'])) {
$chkDescriptionAttributes['checked'] = '';
}
$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'), $chkDescriptionAttributes);
$form->addElement('text', 'nb_days_access_before', array('', '', get_lang('DaysBefore')), array(
'style' => 'width: 30px;'
'input-size' => '2',
));
$form->addElement('text', 'nb_days_access_after', array('', '', get_lang('DaysAfter')), array(
'style' => 'width: 30px;'
'input-size' => '2',
));
$form->addElement('html','</div>');
if ($year_start!="0000") {
$form->addElement('checkbox', 'start_limit', '', get_lang('DateStartSession'), array(
'onchange' => 'disable_starttime(this)',
@ -189,7 +204,6 @@ if ($year_end != "0000") {
$form->addElement('date_picker', 'date_end');
$visibilityGroup = array();
$visibilityGroup[] = $form->createElement('advanced_settings', get_lang('SessionVisibility'));
$visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
@ -198,28 +212,10 @@ $visibilityGroup[] = $form->createElement('select', 'session_visibility', null,
'style' => 'width:250px;'
));
$form->addGroup($visibilityGroup, 'visibility_group', null, null, false);
$form->addGroup($visibilityGroup, 'visibility_group', get_lang('SessionVisibility'), null, false);
$form->addElement('html','</div>');
$form->addHtmlEditor(
'description',
get_lang('Description'),
false,
false,
array(
'ToolbarSet' => 'Minimal'
)
);
$chkDescriptionAttributes = array();
if (!empty($infos['show_description'])) {
$chkDescriptionAttributes['checked'] = '';
}
$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'), $chkDescriptionAttributes);
$duration = empty($infos['duration']) ? null : $infos['duration'];
$form->addElement(
@ -238,6 +234,8 @@ $form->addElement(
$extra_field = new ExtraField('session');
$extra = $extra_field->addElements($form, $id);
$form->addElement('html','</div>');
$htmlHeadXtra[] ='
<script>
@ -339,11 +337,6 @@ $form->display();
?>
<script type="text/javascript">
<?php
//if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n";
?>
function setDisable(select) {
document.forms['edit_session'].elements['session_visibility'].disabled = (select.checked) ? true : false;
document.forms['edit_session'].elements['session_visibility'].selectedIndex = 0;
@ -387,9 +380,7 @@ function emptyDuration() {
$(document).on('ready', function (){
$('#show-options').on('click', function (e) {
e.preventDefault();
var display = $('#options').css('display');
display === 'block' ? $('#options').slideUp() : $('#options').slideDown() ;
});
});

@ -11,7 +11,7 @@
api_protect_course_script(true);
// error messages
if ($error) {
if (isset($error)) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
}
@ -20,7 +20,7 @@ if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
}
if (!$error) {
if (!isset($error)) {
$token = Security::get_token();
}
// display form
@ -39,11 +39,10 @@ $form->addHtmlEditor(
);
// Adavanced Parameters
$advanced = '<a href="javascript://" class = "advanced_parameters" ><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>';
if ((api_get_session_id() != 0 && Gradebook::is_active()) || api_get_session_id() == 0) {
$form -> addElement('advanced_settings',$advanced);
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify" style="display:none">');
$form->addElement('html','<div id="id_qualify_options" style="display:none">');
// Qualify Attendance for gradebook option
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');

@ -39,16 +39,13 @@ $form->addHtmlEditor('description', get_lang('Description'), false, false, array
if (Gradebook::is_active()) {
if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
$advanced = '<a href="javascript://" class="advanced_parameters"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>';
$form->addElement('advanced_settings',$advanced);
$form->addElement('html','<div id="id_qualify" style="display:block">');
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:block">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
$form->addElement('html','<div id="options_field" style="display:block">');
} else {
$advanced = '<a href="javascript://" class="advanced_parameters"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>';
$form->addElement('advanced_settings',$advanced);
$form->addElement('html','<div id="id_qualify" style="display:none">');
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:none">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('html','<div id="options_field" style="display:none">');
}

@ -164,16 +164,6 @@ $(function() {
$(".row_odd").css({"background-color":"#F9F9F9"});
$(".row_even").css({"background-color":"#FFF"});
});
$(".advanced_parameters").click(function() {
if ($("#id_qualify").css("display") == "none") {
$("#id_qualify").css("display","block");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\');
} else {
$("#id_qualify").css("display","none");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\');
}
});
});
</script>';

@ -37,16 +37,6 @@ $htmlHeadXtra[] = '<script type="text/javascript">
$(window).load(function () {
setFocus();
});
function advanced_parameters() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_hide.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
</script>';
$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'user_portal.php', 'name' => get_lang('MyCourses'));
@ -77,9 +67,8 @@ $form->addElement('text', 'title', array(get_lang('CourseName'), get_lang('Ex'))
$form->applyFilter('title', 'html_filter');
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
$advanced = '<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><div style="vertical-align:top;" ><img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</div></span></a>';
$form -> addElement('advanced_settings',$advanced);
$form -> addElement('html','<div id="options" style="display:none">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html','<div id="advanced_params_options" style="display:none">');
// Category category.
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
@ -95,7 +84,7 @@ $form->addElement(
);
// Course code
$form->addText('wanted_code', array(get_lang('Code'), get_lang('OnlyLettersAndNumbers')), '', array('class' => 'span3', 'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE));
$form->addText('wanted_code', array(get_lang('Code'), get_lang('OnlyLettersAndNumbers')), '', array('maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE));
$form->applyFilter('wanted_code', 'html_filter');
$form->addRule('wanted_code', get_lang('Max'), 'maxlength', CourseManager::MAX_COURSE_LENGTH_CODE);
@ -104,13 +93,13 @@ $titular = & $form->addElement('hidden', 'tutor_name', ''); //array(get_lang('Pr
if ($course_validation_feature) {
// Description of the requested course.
$form->addElement('textarea', 'description', get_lang('Description'), array('class' => 'span6', 'rows' => '3'));
$form->addElement('textarea', 'description', get_lang('Description'), array('rows' => '3'));
// Objectives of the requested course.
$form->addElement('textarea', 'objetives', get_lang('Objectives'), array('class' => 'span6', 'rows' => '3'));
$form->addElement('textarea', 'objetives', get_lang('Objectives'), array('rows' => '3'));
// Target audience of the requested course.
$form->addElement('textarea', 'target_audience', get_lang('TargetAudience'), array('class' => 'span6', 'rows' => '3'));
$form->addElement('textarea', 'target_audience', get_lang('TargetAudience'), array('rows' => '3'));
}
// Course language.

@ -2910,6 +2910,10 @@ form .formw .freeze {
display: none;
}
.show_element {
display: block !important;
}
/* agenda js */
#add_event_form fieldset {
width:400px;
@ -4184,6 +4188,7 @@ a.forum_group_link {
}
#hide_bar_template {
vertical-align: middle;
width: 10px;
display: inline;
float:left;
@ -4198,6 +4203,10 @@ a.forum_group_link {
background-position: center center;
}
.hide_bar_template_not_hide {
background-image: url("../img/hide2.png") !important;
}
#hide_bar_template:hover {
background-color:#aaa;
}

@ -54,16 +54,6 @@ function check_unzip() {
}
}
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_hide.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
function setFocus(){
$("#title_file").focus();
}
@ -243,7 +233,13 @@ if (!$is_certificate_mode) {
$action = api_get_self().'?'.api_get_cidreq().'&id='.$document_id;
$form = new FormValidator('upload', 'POST', $action.'#tabs-2', '', 'enctype="multipart/form-data"');
$form = new FormValidator(
'upload',
'POST',
$action.'#tabs-2',
'',
array('enctype' => 'multipart/form-data')
);
$form->addElement('hidden', 'id', $document_id);
$form->addElement('hidden', 'curdirpath', $path);
@ -251,13 +247,12 @@ $course_quota = format_file_size(DocumentManager::get_course_quota() - DocumentM
$label = get_lang('MaxFileSize').': '.ini_get('upload_max_filesize').'<br/>'.get_lang('DocumentQuota').': '.$course_quota;
$form->addElement('file', 'file', array(get_lang('File'), $label), 'style="width: 250px" id="user_upload"');
$form->addElement('text', 'title', get_lang('Title'), array('size' => '20', 'style' => 'width:300px', 'id' => 'title_file'));
$form->addElement('textarea', 'comment', get_lang('Comment'), 'wrap="virtual" style="width:300px;"');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'title_file'));
$form->addElement('textarea', 'comment', get_lang('Comment'));
$advanced = '<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><div style="vertical-align:top;" ><img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</div></span></a>';
// Advanced parameters
$form->addElement('advanced_settings', $advanced);
$form->addElement('html', '<div id="options" style="display:none">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
// Check box options
$form->addElement('checkbox', 'unzip', get_lang('Options'), get_lang('Uncompress'), 'onclick="javascript: check_unzip();" value="1"');

@ -1007,32 +1007,17 @@ class Exercise
// Title.
$form->addElement('text', 'exerciseTitle', get_lang('ExerciseName'), array('class' => 'span6','id'=>'exercise_title'));
$form->addElement('advanced_settings',
'<a href="javascript://" onclick=" return show_media()">
<span id="media_icon">
<img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />'.
addslashes(api_htmlentities(get_lang('ExerciseDescription'))).'
</span>
</a>
');
$form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
if (is_array($type)){
$editor_config = array_merge($editor_config, $type);
}
$form->addElement ('html','<div class="HideFCKEditor" id="HiddenFCKexerciseDescription" style="display:none" >');
$form->addHtmlEditor('exerciseDescription', get_lang('ExerciseDescription'), false, false, $editor_config);
$form->addElement ('html','</div>');
$form->addElement('advanced_settings','<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><div style="vertical-align:top;" >
<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" /> '.addslashes(api_htmlentities(get_lang('AdvancedParameters'))).'</div></span></a>');
// Random questions
// style="" and not "display:none" to avoid #4029 Random and number of attempt menu empty
$form->addElement('html','<div id="options" style="">');
if ($type=='full') {
if ($type == 'full') {
//Can't modify a DirectFeedback question
if ($this->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_DIRECT ) {
// feedback type

@ -20,27 +20,6 @@ if (!api_is_allowed_to_edit(null,true)) {
}
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\' <img style="vertical-align:middle;" src="../img/div_hide.gif" alt="" /> '.addslashes(api_htmlentities(get_lang('AdvancedParameters'))).'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\' <img style="vertical-align:middle;" src="../img/div_show.gif" alt="" /> '.addslashes(api_htmlentities(get_lang('AdvancedParameters'))).'\';
}
}
function show_media() {
var my_display = document.getElementById(\'HiddenFCKexerciseDescription\').style.display;
if(my_display== \'none\' || my_display == \'\') {
document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'block\';
document.getElementById(\'media_icon\').innerHTML=\' <img src="../img/looknfeelna.png" alt="" /> '.addslashes(api_htmlentities(get_lang('ExerciseDescription'))).'\';
} else {
document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'none\';
document.getElementById(\'media_icon\').innerHTML=\' <img src="../img/looknfeel.png" alt="" /> '.addslashes(api_htmlentities(get_lang('ExerciseDescription'))).'\';
}
}
function activate_start_date() {
if(document.getElementById(\'start_date_div\').style.display == \'none\') {
document.getElementById(\'start_date_div\').style.display = \'block\';
@ -111,7 +90,6 @@ function setFocus(){
$(document).ready(function () {
setFocus();
});
window.onload=advanced_parameters;
</script>';
// INIT EXERCISE

@ -5,10 +5,7 @@
* @package chamilo.exercise
* @author Istvan Mandak (original author)
*/
/**
* Code
*/
// Including the global initialization file.
require_once '../inc/global.inc.php';
// Including additional libraries.
@ -71,7 +68,7 @@ $form->addElement('hidden', 'fld', $fld);
$form->addElement('hidden', 'imgcount', $imgcount);
$form->addElement('hidden', 'finish', $finish);
$form->addElement('html', GenerateHiddenList($imgparams));
$form->addElement('advanced_settings', Display::return_icon('hotpotatoes.jpg', get_lang('HotPotatoes')));
$form->addElement('label', '', Display::return_icon('hotpotatoes.jpg', get_lang('HotPotatoes')));
$label = get_lang('DownloadImg').' : ';
if ($finish == 0) {
$label = get_lang('DownloadFile').' : ';

@ -1198,16 +1198,6 @@ abstract class Question
document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
}
}
function show_media(){
var my_display = document.getElementById(\'HiddenFCKquestionDescription\').style.display;
if(my_display== \'none\' || my_display == \'\') {
document.getElementById(\'HiddenFCKquestionDescription\').style.display = \'block\';
document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img style="vertical-align: middle;" src="../img/looknfeelna.png" alt="" />&nbsp;'.get_lang('EnrichQuestion').'\';
} else {
document.getElementById(\'HiddenFCKquestionDescription\').style.display = \'none\';
document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('EnrichQuestion').'\';
}
}
// hub 13-12-2010
@ -1250,13 +1240,10 @@ abstract class Question
$editor_config['UserStatus'] = 'student';
}
$form->addElement('advanced_settings','
<a href="javascript://" onclick=" return show_media()"><span id="media_icon"><img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('EnrichQuestion').'</span></a>
');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$form->addElement ('html','<div class="HideFCKEditor" id="HiddenFCKquestionDescription" style="display: none;" >');
$form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
$form->addElement ('html','</div>');
// hidden values
$my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
@ -1265,9 +1252,6 @@ abstract class Question
if ($this->type != MEDIA_QUESTION) {
// Advanced parameters
$form->addElement('advanced_settings','<a href="javascript:void(0)" onclick="visiblerDevisibler(\'id_advancedOption\')"><img id="id_advancedOptionImg" style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang("AdvancedParameters").'</a>');
$form->addElement('html','<div id="id_advancedOption" style="display:none;">');
$select_level = Question::get_default_levels();
$form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
@ -1288,10 +1272,10 @@ abstract class Question
//Medias
//$course_medias = Question::prepare_course_media_select(api_get_course_int_id());
//$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
$form->addElement('html', '</div>');
}
$form->addElement ('html','</div>');
if (!isset($_GET['fromExercise'])) {
switch ($answerType) {
case 1:

@ -80,7 +80,7 @@ function lp_upload_quiz_main() {
$link = '<a href="../exercice/quiz_template.xls">'.
Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')).get_lang('DownloadExcelTemplate').'</a>';
$form->addElement('advanced_settings', $link);
$form->addElement('label', '', $link);
$form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id'=> 'user_custom_score'));
$form->addElement('html', '<div id="options" style="display:none">');
$form->addElement('text', 'correct_score', get_lang('CorrectScore'));

@ -41,19 +41,6 @@ if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
}
// javascript
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'id_qualify\').style.display == \'none\') {
document.getElementById(\'id_qualify\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'id_qualify\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
</script>';
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum category information */

@ -292,8 +292,8 @@ function show_add_forum_form($inputvalues = array(), $lp_id)
$form->addGroup($group, 'allow_anonymous_group', get_lang('AllowAnonymousPosts'), ' ');
}
$form->addElement('advanced_settings', '<a href="javascript://" onclick="advanced_parameters()" ><span id="plus_minus">&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>', '');
$form->addElement('html', '<div id="options" style="display:none">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$group = array();
$group[] = $form->createElement('radio', 'students_can_edit', null, get_lang('Yes'), 1);
@ -2383,10 +2383,8 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
if (!empty($iframe)) {
$form->addElement('label', get_lang('Thread'), $iframe);
}
$form->addElement('advanced_settings', '<a href="javascript://" onclick="return advanced_parameters()">
<span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>');
$form->addElement('html', '<div id="id_qualify" style="display:none">');
$form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
if ((api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($myThread)) {
@ -2837,9 +2835,9 @@ function show_edit_post_form($forum_setting, $current_post, $current_thread, $cu
)
);
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('advanced_settings', '<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus">'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).''.get_lang('AdvancedParameters').'</span></a>');
$form->addElement('html', '<div id="id_qualify" style="display:none">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
if (!isset($_GET['edit'])) {
if (Gradebook::is_active()) {

@ -37,15 +37,6 @@ function hidecontent(content){
$(content).slideToggle(\'normal\');
}
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
</script>';
// The section (tabs).

@ -46,19 +46,6 @@ if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
}
// javascript
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'id_qualify\').style.display == \'none\') {
document.getElementById(\'id_qualify\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'id_qualify\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
</script>';
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum category information */

@ -38,19 +38,6 @@ if (isset($_GET['origin'])) {
require_once 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
// javascript
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'id_qualify\').style.display == \'none\') {
document.getElementById(\'id_qualify\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'id_qualify\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
</script>';
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum categorie information */

@ -25,20 +25,14 @@
// Including the global initialization file.
require_once '../inc/global.inc.php';
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
$(document).ready(function(){ $(\'.hide-me\').slideUp() });
function hidecontent(content){ $(content).slideToggle(\'normal\'); }
</script>';
$htmlHeadXtra[] = '<script type="text/javascript">
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(\'.hide-me\').slideUp()
});
function hidecontent(content){
$(content).slideToggle(\'normal\');
}
</script>';
// The section (tabs)

@ -653,6 +653,17 @@ EOT;
}
}
/**
* @param string $name
* @param string $label
* @return mixed
*/
public function addButtonAdvancedSettings($name, $label = '')
{
$label = !empty($label) ? $label : get_lang('AdvancedParameters');
return $this->addElement('advanced_settings', $name, $label);
}
/**
* Adds a progress bar to the form.
*
@ -743,7 +754,7 @@ EOT;
* @param array $element The array of elements
* @param string $message The message displayed
*/
function add_multiple_required_rule($elements, $message)
public function add_multiple_required_rule($elements, $message)
{
$this->_required[] = $elements[0];
$this->addRule($elements, $message, 'multiple_required');

@ -157,15 +157,14 @@ class GradeModel extends Model
//New rule added in the formvalidator compare_fields that filters a group of fields in order to compare with the wanted value
$form->addRule($component_array, get_lang('AllMustWeight100'), 'compare_fields', '==@100');
$form->addElement('advanced_settings', get_lang('AllMustWeight100'));
$form->addElement('label', '', get_lang('AllMustWeight100'));
if ($action == 'edit') {
//$form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"');
$form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"');
$form->addButtonUpdate(get_lang('Modify'));
} else {
//$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="save"');
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="save"');
$form->addButtonCreate(get_lang('Add'));
}
if (!empty($components)) {
$counter = 0;
foreach ($components as $component) {

@ -1,36 +1,28 @@
<?php
/**
* HTML class for static data
* @example $form->addElement('advanced_settings', '<a href="#">advanced settings</a>');
*/
/**
* A pseudo-element used for adding raw HTML to form
*
* Intended for use with the default renderer only, template-based
* ones may (and probably will) completely ignore this
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version Release: 3.2.11
* @since 3.0
* @deprecated Please use the templates rather than add raw HTML via this element
* Class HTML_QuickForm_advanced_settings
*/
class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static
{
// {{{ constructor
/**
/**
* Class constructor
*
* @param string $text raw HTML to add
* @access public
* @return void
*/
public function HTML_QuickForm_advanced_settings($text = null)
public function __construct($name = '', $label = '')
{
parent::__construct(null, null, $text);
if (empty($label)) {
$label = get_lang('AdvancedParameters');
}
$this->updateAttributes(
array(
'label' => $label,
'name' => $name
)
);
$this->_type = 'html';
}
@ -41,22 +33,26 @@ class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static
* @access public
* @return void
*/
function accept(&$renderer, $required=false, $error=null)
function accept(&$renderer, $required = false, $error = null)
{
$renderer->renderHtml($this);
}
/**
* @return string
*/
public function toHtml()
{
return '<div class="form-group ">
<label class="control-label col-sm-2"></label>
$name = $this->getAttribute('name');
$text = $this->getAttribute('label');
return '<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<div class="form-control-static">
'.parent::toHtml().'
</div>
<a id="'.$name.'" class="btn btn-default advanced_options" href="#">
<i class="fa fa-bars"></i> '.$text.'
</a>
</div>
</div>
';
</div>';
}
}

@ -209,15 +209,18 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null)
}
if (empty($group_id)) {
$form->addElement('advanced_settings','<div id="filepaths" class="form-group">
$form->addElement('label', '', '<div id="filepaths" class="form-group">
<div id="filepath_1">
<label>'.get_lang('FilesAttachment').'</label>
<input type="file" name="attach_1"/>
<label>'.get_lang('Description').'</label>
<input id="file-descrtiption" type="text" name="legend[]" class="form-control"/>
</div>
</div>');
$form->addElement('advanced_settings','<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
</div>'
);
$form->addElement('label', '', '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
}
$form->addButtonSend(get_lang('SendMessage'), 'compose');

@ -5627,26 +5627,24 @@ class learnpath
}
}
$return .= '<div class="panel panel-default">';
$return .= '<div class="panel-heading">'.$this->name.'</div>';
$return .= '<div class="panel-body">';
$return .= '<ul id="lp_item_list">';
$list = '<ul id="lp_item_list">';
$tree = self::print_recursive($elements, $default_data, $default_content);
if (!empty($tree)) {
$return .= $tree;
$list .= $tree;
} else {
if ($drop_element_here) {
$return .= Display::return_message(get_lang("DragAndDropAnElementHere"));
$list .= Display::return_message(get_lang("DragAndDropAnElementHere"));
}
}
$return .= '</ul>';
$list .= '</ul>';
$return .= Display::panel($list, $this->name);
if ($update_audio == 'true') {
$return = $return_audio;
} else {
$return .= '</div></div>';
}
return $return;
}
@ -5656,7 +5654,7 @@ class learnpath
* @param array $default_content
* @return string
*/
function print_recursive($elements, $default_data, $default_content)
public function print_recursive($elements, $default_data, $default_content)
{
$return = '';
foreach ($elements as $key => $item) {

@ -26,24 +26,6 @@ require 'resourcelinker.inc.php';
$currentstyle = api_get_setting('stylesheets');
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#learnpath_title").focus();
}
$(document).ready(function () {
setFocus();
});
function advanced_parameters() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_hide.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
function activate_start_date() {
if(document.getElementById(\'start_date_div\').style.display == \'none\') {
document.getElementById(\'start_date_div\').style.display = \'block\';
@ -116,16 +98,15 @@ $form = new FormValidator('lp_add', 'post', 'lp_controller.php');
$form->addElement('header', null, get_lang('AddLpToStart'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('class' => 'span6', 'autofocus' => 'autofocus'));
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('autofocus' => 'autofocus'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'post_time', time());
$form->addElement('hidden', 'action', 'add_lp');
$advanced = '<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><div style="vertical-align:top;" ><img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</div></span></a>';
$form -> addElement('advanced_settings',$advanced);
$form -> addElement('html','<div id="options" style="display:none">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
//Start date
$form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));

@ -154,20 +154,10 @@ function confirmation(name) {
}
$(document).ready(function() {
$("#hide_bar_template").toggle(
function() {
$("#lp_sidebar").hide();
$(this).css({'background-image' : 'url("../img/hide2.png")'})
$("#doc_form").removeClass("span8");
$("#doc_form").addClass("span11");
},
function() {
$("#lp_sidebar").show();
$("#doc_form").removeClass("span11");
$("#doc_form").addClass("span8");
$(this).css('background-image', 'url("../img/hide0.png")');
}
);
$("#hide_bar_template").click(function() {
$("#lp_sidebar").toggleClass("hide");
$("#hide_bar_template").toggleClass("hide_bar_template_not_hide");
});
});
</script>
<?php
@ -177,7 +167,7 @@ $(document).ready(function() {
echo $learnPath->build_action_menu();
echo '<div class="row" style="overflow:hidden">';
echo '<div id="lp_sidebar" class="col-md-4">';
echo '<div id="lp_sidebar" class="col-md-3">';
echo $learnPath->return_new_tree(null, true);
@ -193,7 +183,7 @@ echo '</div>';
// hide bar div
if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
echo '<div id="hide_bar_template"></div>';
echo '<div class="col-md-1"><div id="hide_bar_template" style="width:10px"></div></div> ';
}
echo '<div id="doc_form" class="col-md-8">';

@ -17,28 +17,6 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
// Including additional libraries
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
function setFocus(){
$("#surveycode_title").focus();
}
$(document).ready(function () {
setFocus();
});
</script>';
// Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -122,7 +100,7 @@ if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) {
$form->addElement('hidden', 'survey_id');
}
$survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '20', 'maxlength' => '20', 'id' => 'surveycode_title'));
$survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '20', 'maxlength' => '20', 'autofocus' => 'autofocus'));
if ($_GET['action'] == 'edit') {
//$survey_code->freeze();
@ -149,14 +127,8 @@ $form->addElement('html_editor', 'survey_introduction', get_lang('SurveyIntroduc
$form->addElement('html_editor', 'survey_thanks', get_lang('SurveyThanks'), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '130', 'ToolbarStartExpanded' => false));
// Additional Parameters
$form->addElement(
'advanced_settings',
'<a href="javascript: void(0);" onclick="javascript: advanced_parameters();">
<span id="plus_minus">&nbsp;'.
Display::return_icon('div_show.gif', null, array('style' => 'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>'
);
$form->addElement('html', '<div id="options" style="display: none;">');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
if (Gradebook::is_active()) {
// An option: Qualify the fact that survey has been answered in the gradebook

@ -75,11 +75,13 @@
<script>
$("form").on("click", ' .advanced_parameters', function() {
var id = $(this).attr('id') + '_options';
/*var id = $(this).attr('id') + '_options';
console.log(id);
$("#"+id).toggleClass('active');
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
$("#"+id).toggleClass('active');
});*/
});
/* Makes row highlighting possible */
@ -100,9 +102,8 @@
event.preventDefault();
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
button.toggleClass('active');
$("#"+id).toggle();
});
/**

@ -31,15 +31,6 @@ $htmlHeadXtra[] ='<link rel="stylesheet" type="text/css" href="'.api_get_path(WE
// javascript for advanced parameters menu
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
function setFocus() {
$("#search_title").focus();
}

@ -607,17 +607,9 @@ class Wiki
if ((api_is_allowed_to_edit(false,true) || api_is_platform_admin()) && isset($row['reflink']) && $row['reflink'] != 'index') {
$advanced = '<a href="javascript://" onclick="advanced_parameters()" >
<div id="plus_minus">&nbsp;'.
Display::return_icon(
'div_show.gif',
get_lang('Show'),
array('style'=>'vertical-align:middle')
).'&nbsp;'.get_lang('AdvancedParameters').'</div></a>';
$form->addElement('advanced_settings', $advanced);
$form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$form->addElement('html', '<div id="options" style="display:none">');
$form->addHtmlEditor('task', get_lang('DescriptionOfTheTask'), false, false, array('ToolbarSet' => 'wiki_task', 'Width' => '100%', 'Height' => '200'));
$form->addElement('label', null, get_lang('AddFeedback'));
@ -3654,14 +3646,13 @@ class Wiki
// Setting the form elements
$form->addElement('text', 'search_term', get_lang('SearchTerm'),'class="input_titles" id="search_title"');
$form->addText('search_term', get_lang('SearchTerm'), true, array('autofocus' => 'autofocus'));
$form->addElement('checkbox', 'search_content', null, get_lang('AlsoSearchContent'));
$form->addElement('checkbox', 'all_vers', null, get_lang('IncludeAllVersions'));
$form->addElement('style_submit_button', 'SubmitWikiSearch', get_lang('Search'), 'class="search"');
$form->addButtonSearch(get_lang('Search'), 'SubmitWikiSearch');
// setting the rules
$form->addRule('search_term', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('search_term', get_lang('TooShort'),'minlength',3); //TODO: before fixing the pagination rules worked, not now
$form->addRule('search_term', get_lang('TooShort'), 'minlength', 3); //TODO: before fixing the pagination rules worked, not now
if ($form->validate()) {
$form->display();

@ -1449,16 +1449,6 @@ function to_javascript_work()
$origin = isset($_REQUEST['origin']) && !empty($_REQUEST['origin']) ? api_get_tools_lists($_REQUEST['origin']) : '';
$js = '<script>
function plus() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'plus\').innerHTML=\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide', ''), array('style' => 'vertical-align:middle')).'&nbsp;'.addslashes(get_lang('AdvancedParameters', '')).'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'plus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show', ''), array('style' => 'vertical-align:middle')).'&nbsp;'.addslashes(get_lang('AdvancedParameters', '')).'\';
}
}
function updateDocumentTitle(value) {
var temp = value.indexOf("/");
//linux path
@ -4367,27 +4357,17 @@ function getFormWork($form, $defaults = array())
unset($defaults['submit']);
}
}
// Create the form that asks for the directory name
$form->addElement('text', 'new_dir', get_lang('AssignmentName'));
$form->addRule('new_dir', get_lang('ThisFieldIsRequired'), 'required');
$form->addHtmlEditor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
$form->addElement(
'advanced_settings',
'<a href="javascript: void(0);" onclick="javascript: return plus();">
<span id="plus">'.
Display::return_icon(
'div_show.gif',
get_lang('AdvancedParameters'),
array('style' => 'vertical-align:center')
).
' '.get_lang('AdvancedParameters').
'</span></a>'
);
$form->addButtonAdvancedSettings('advanced_params', get_lang('AdvancedParameters'));
if (!empty($defaults) && (isset($defaults['enableEndDate']) || isset($defaults['enableExpiryDate']))) {
$form->addElement('html', '<div id="options" style="display: block;">');
$form->addElement('html', '<div id="advanced_params_options" style="display:block">');
} else {
$form->addElement('html', '<div id="options" style="display: none;">');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
}
// QualificationOfAssignment

Loading…
Cancel
Save