From: nicolasconnault Date: Wed, 29 Aug 2007 11:43:48 +0000 (+0000) Subject: MDL-11028 GUI complete, language strings complete, user key creation done. Validation... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0f78c4de3d83d5db8439102b091d295d64bb24e0;p=moodle.git MDL-11028 GUI complete, language strings complete, user key creation done. Validation is not yet coded. --- diff --git a/grade/export/grade_export_form.php b/grade/export/grade_export_form.php index 10c05630c0..c85fed32ba 100755 --- a/grade/export/grade_export_form.php +++ b/grade/export/grade_export_form.php @@ -12,21 +12,35 @@ class grade_export_form extends moodleform { $plugin = 'unknown'; } - $mform->addElement('header', 'options', get_string('options')); + $mform->addElement('header', 'options', get_string('options', 'grades')); $mform->addElement('advcheckbox', 'export_letters', get_string('exportletters', 'grades')); $mform->setDefault('export_letters', 0); - $mform->setHelpButton('export_letters', array(false, get_string('exportletters', 'grades'), false, true, false, get_string("exportlettershelp", 'grades'))); + $mform->setHelpButton('export_letters', array(false, get_string('exportletters', 'grades'), + false, true, false, get_string("exportlettershelp", 'grades'))); $mform->addElement('header', 'publishing', get_string('publishing', 'grades')); - $options = array('no'); + $options = array(get_string('nopublish', 'grades'), get_string('createnewkey', 'userkey')); if ($keys = get_records_select('user_private_key', "script='grade/export' AND instance={$COURSE->id} AND userid={$USER->id}")) { foreach ($keys as $key) { $options[$key->value] = $key->value; // TODO: add ip, date, etc.?? } } - $mform->addElement('select', 'key', get_string('userkey', 'grades'), $options); - $mform->addElement('static', 'keymanagerlink', get_string('key_manager'), ''.get_string('keymanager').''); + $mform->addElement('select', 'key', get_string('userkey', 'userkey'), $options); + $mform->setHelpButton('key', array(false, get_string('userkey', 'userkey'), + false, true, false, get_string("userkeyhelp", 'grades'))); + $mform->addElement('static', 'keymanagerlink', get_string('keymanager', 'userkey'), + ''.get_string('keymanager', 'userkey').''); + + $mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80)); + $mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'), + false, true, false, get_string("keyiprestrictionhelp", 'userkey'))); + + $mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true)); + $mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'), + false, true, false, get_string("keyvaliduntilhelp", 'userkey'))); + $mform->disabledIf('iprestriction', 'key', get_string('createnewkey', 'userkey')); + $mform->disabledIf('validuntil', 'key', get_string('createnewkey', 'userkey')); $mform->addElement('header', 'general', get_string('gradeitemsinc', 'grades')); // TODO: localize diff --git a/grade/export/key.php b/grade/export/key.php index a65fef8cec..767e04ee09 100644 --- a/grade/export/key.php +++ b/grade/export/key.php @@ -49,7 +49,7 @@ if ($id and $delete) { print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey')); $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsno = array('id'=>$courseid); - notice_yesno(get_string('deletekeyconfirm', 'key', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get'); + notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get'); print_footer(); die; @@ -81,13 +81,13 @@ if ($editform->is_cancelled()) { redirect($returnurl); } -$strkeys = get_string('userkeys'); +$strkeys = get_string('userkeys', 'userkey'); $strgrades = get_string('grades'); if ($id) { - $strheading = get_string('edituserkey', 'key'); + $strheading = get_string('edituserkey', 'userkey'); } else { - $strheading = get_string('createuserkey', 'key'); + $strheading = get_string('createuserkey', 'userkey'); } diff --git a/grade/export/key_form.php b/grade/export/key_form.php index 3a326d0519..ff0a6dea8a 100644 --- a/grade/export/key_form.php +++ b/grade/export/key_form.php @@ -10,10 +10,13 @@ class key_form extends moodleform { $mform =& $this->_form; - $mform->addElement('static', 'value', get_string('keyvalue')); - $mform->addElement('text', 'iprestriction', get_string('keyiprestriction'), array('size'=>80)); - $mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil'), array('optional'=>true)); + $mform->addElement('static', 'value', get_string('keyvalue', 'userkey')); + $mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80)); + $mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true)); + $mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'), + false, true, false, get_string("keyiprestrictionhelp", 'userkey'))); + $mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'), false, true, false, get_string("keyvaliduntilhelp", 'userkey'))); $mform->addElement('hidden','id'); $mform->setType('id', PARAM_INT); diff --git a/grade/export/keymanager.php b/grade/export/keymanager.php index 782e2b011c..7af872b304 100644 --- a/grade/export/keymanager.php +++ b/grade/export/keymanager.php @@ -63,7 +63,7 @@ if ($keys = get_records_select('user_private_key', "script='grade/export' AND in $data[] = $line; } } -$table->head = array(get_string('keyvalue'), get_string('keyiprestriction'), get_string('keyvaliduntil'), $stredit); +$table->head = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit); $table->size = array('50%', '30%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center'); $table->width = '90%'; @@ -71,7 +71,7 @@ $table->data = $data; print_table($table); echo '
'; -print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey')); +print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')); echo '
'; print_footer(); diff --git a/grade/lib.php b/grade/lib.php index 31898c9783..8d24f4096a 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -352,8 +352,6 @@ function grade_build_nav($path, $pagename=null, $id=null) { $path_elements_count = count($path_elements); - $last_element = $path_elements[$path_elements_count-1]; // Should be the filename (including extension) - // First link is always 'grade' $navlinks = array(); $navlinks[] = array('name' => $strgrades, @@ -377,6 +375,11 @@ function grade_build_nav($path, $pagename=null, $id=null) { $navlink4 = null; + // Remove file extensions from filenames + foreach ($path_elements as $key => $filename) { + $path_elements[$key] = str_replace('.php', '', $filename); + } + // Second level links switch ($path_elements[1]) { case 'edit': // No link diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index b8ecda0c5c..ec03fc2796 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -225,6 +225,7 @@ $string['items'] = 'Items'; $string['itemsedit'] = 'Edit grade item'; $string['keephigh'] = 'Keep the highest'; $string['keephighhelp'] = 'If set, this option will only keep the X highest grades, X being the selected value for this option.'; +$string['keymanager'] = 'Key manager'; $string['left'] = 'Left'; $string['lettergrade'] = 'Letter Grade'; $string['lettergradenonnumber'] = 'Low and/or High grade were non-numeric for'; @@ -253,6 +254,7 @@ $string['movingelement'] = 'Moving $a'; $string['multfactor'] = 'Multiplicator'; $string['multfactorhelp'] = 'Factor by which all grades for this grade item will be multiplied.'; $string['newcategory'] = 'New category'; +$string['newuserkey'] = 'New user key'; $string['no'] = 'No'; $string['nocategories'] = 'Grade categories could not be added or found for this course'; $string['nocategoryname'] = 'No category name was given.'; @@ -264,12 +266,14 @@ $string['nomode'] = 'NA'; $string['nonnumericweight'] = 'Received non-numeric value for'; $string['nonweightedpct'] = 'non-weighted %%'; $string['nooutcome'] = 'No outcome'; +$string['nopublish'] = 'Do not publish'; $string['noselectedcategories'] = 'no categories were selected.'; $string['noselecteditems'] = 'no items were selected.'; $string['notteachererror'] = 'You must be a teacher to use this feature.'; $string['numberofgrades'] = 'Number of grades'; $string['onascaleof'] = ' on a scale of $a->grademin to $a->grademax'; $string['operations'] = 'Operations'; +$string['options'] = 'Options'; $string['outcome'] = 'Outcome'; $string['outcomecategory'] = 'Create outcomes in category'; $string['outcomecategorynew'] = 'New category'; @@ -310,6 +314,7 @@ $string['prefgeneral'] = 'General'; $string['prefletters'] = 'Grade letters and boundaries'; $string['prefrows'] = 'Special rows'; $string['prefshow'] = 'Show/hide toggles'; +$string['publishing'] = 'Publishing'; $string['quickfeedback'] = 'Quick Feedback'; $string['quickgrading'] = 'Quick Grading'; $string['range'] = 'Range'; @@ -387,6 +392,7 @@ $string['usenooutcome'] = 'Use no outcome'; $string['usenoscale'] = 'Use no scale'; $string['usepercent'] = 'Use Percent'; $string['user'] = 'User'; +$string['userkeyhelp'] = 'Select a saved key that will give users access to the data published by this export plugin, without having to log into Moodle. Select `create a new user key` to generate a new key when submitting this form.'; $string['userpreferences'] = 'User preferences'; $string['useweighted'] = 'Use Weighted'; $string['viewbygroup'] = 'Group'; diff --git a/lang/en_utf8/userkey.php b/lang/en_utf8/userkey.php new file mode 100644 index 0000000000..d65693e4b9 --- /dev/null +++ b/lang/en_utf8/userkey.php @@ -0,0 +1,15 @@ + diff --git a/lib/formslib.php b/lib/formslib.php index c91ea29d7b..0a4a0ab483 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -562,7 +562,6 @@ class moodleform { * get data with get_data(). * * @param boolean $cancel whether to show cancel button, default true - * @param boolean $revert whether to show revert button, default true * @param string $submitlabel label for submit button, defaults to get_string('savechanges') */ function add_action_buttons($cancel = true, $submitlabel=null){ diff --git a/mod/lams/mod.html b/mod/lams/mod.html index d34bae9ccd..45e80a7202 100644 --- a/mod/lams/mod.html +++ b/mod/lams/mod.html @@ -25,17 +25,17 @@ if (!isset($form->create_sequence_url)) { $hash = sha1(strtolower($plaintext)); $form->create_sequence_url = $CFG->lams_serverurl.$LAMSCONSTANTS->login_request. '?'.$LAMSCONSTANTS->param_uid.'='.$USER->username. - '&'.$LAMSCONSTANTS->param_method.'='.$LAMSCONSTANTS->author_method. - '&'.$LAMSCONSTANTS->param_timestamp.'='.urlencode($datetime). - '&'.$LAMSCONSTANTS->param_serverid.'='.$CFG->lams_serverid. - '&'.$LAMSCONSTANTS->param_hash.'='.$hash. - '&'.$LAMSCONSTANTS->param_courseid.'='.$form->course; + '&'.$LAMSCONSTANTS->param_method.'='.$LAMSCONSTANTS->author_method. + '&'.$LAMSCONSTANTS->param_timestamp.'='.urlencode($datetime). + '&'.$LAMSCONSTANTS->param_serverid.'='.$CFG->lams_serverid. + '&'.$LAMSCONSTANTS->param_hash.'='.$hash. + '&'.$LAMSCONSTANTS->param_courseid.'='.$form->course; } ?>
-

Please wait .......

+

Please wait .......

@@ -58,7 +58,7 @@ if (!isset($form->create_sequence_url)) {
:

:


- +
-
+
introduc
-" onClick="return validate();"> +" onClick="return validate();" /> " onClick="openAuthor(create_sequence_url."&".$LAMSCONSTANTS->param_ldid."=".$form->sequence."'";?>);"> + echo "'".$form->create_sequence_url."&".$LAMSCONSTANTS->param_ldid."=".@$form->sequence."'";?>);" /> " onClick="openAuthor(create_sequence_url."'";?>);"> -" onclick="refreshLists();"> -"> + echo "'".$form->create_sequence_url."'";?>);" /> +" onclick="refreshLists();" /> +" /> @@ -111,7 +111,7 @@ print_textarea($usehtmleditor, 20, 50, 680, 400, "introduction", $form->introduc