mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-11028 GUI complete, language strings complete, user key creation done. Validation is not yet coded.
This commit is contained in:
parent
b16393cb07
commit
0f78c4de3d
9 changed files with 80 additions and 39 deletions
|
@ -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'), '<a href="'.$CFG->wwwroot.'/grade/export/keymanager.php?id='.$COURSE->id.'">'.get_string('keymanager').'</a>');
|
||||
$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'),
|
||||
'<a href="'.$CFG->wwwroot.'/grade/export/keymanager.php?id='.$COURSE->id.'">'.get_string('keymanager', 'userkey').'</a>');
|
||||
|
||||
$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
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 '<div class="buttons">';
|
||||
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 '</div>';
|
||||
|
||||
print_footer();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
|
15
lang/en_utf8/userkey.php
Normal file
15
lang/en_utf8/userkey.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php // $Id$
|
||||
$string['createnewkey'] = 'Create a new user key';
|
||||
$string['createuserkey'] = 'Create user key';
|
||||
$string['deletekeyconfirm'] = 'Do you really want to delete this user key?';
|
||||
$string['edituserkey'] = 'Edit user key';
|
||||
$string['keyiprestriction'] = 'Key IP restriction';
|
||||
$string['keyiprestrictionhelp'] = 'Enter a specific IP address, or a range of IP addresses that will be the only IP addresses allowed to access this data. Enter nothing to disable IP restriction (not recommended).';
|
||||
$string['keymanager'] = 'Key manager';
|
||||
$string['keyvaliduntil'] = 'Key valid until';
|
||||
$string['keyvaliduntilhelp'] = 'Select an optional date after which the key will no longer be valid (recommended for added security).';
|
||||
$string['keyvalue'] = 'Key value';
|
||||
$string['newuserkey'] = 'New user key';
|
||||
$string['userkey'] = 'User key';
|
||||
|
||||
?>
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="form" method="post" action="mod.php" onSubmit="disableSumbit(this);">
|
||||
<center>
|
||||
<span id="message"><p>Please wait .......</p></span>
|
||||
<p id="message">Please wait .......</p>
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("workspace", "lams") ?>:</b></td>
|
||||
|
@ -58,7 +58,7 @@ if (!isset($form->create_sequence_url)) {
|
|||
<tr>
|
||||
<td align="right"><p><b><?php print_string("introduction", "lams") ?>:</b></p>
|
||||
<br />
|
||||
<font size="1">
|
||||
<!-- <font size="1"> DEPRECATED, USE CSS -->
|
||||
<?php
|
||||
if ($usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
|
@ -70,7 +70,7 @@ if ($usehtmleditor) {
|
|||
}
|
||||
?>
|
||||
<br />
|
||||
</font>
|
||||
<!-- </font> DEPRECATED, USE CSS -->
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
|
@ -87,13 +87,13 @@ print_textarea($usehtmleditor, 20, 50, 680, 400, "introduction", $form->introduc
|
|||
</table>
|
||||
<input type="hidden" name="learning_session_id"/>
|
||||
<input type="hidden" name="create_sequence_url" id="create_sequence_url"/>
|
||||
<input type="submit" id="save" name="save" value="<?php print_string("useSequence","lams") ?>" onClick="return validate();">
|
||||
<input type="submit" id="save" name="save" value="<?php print_string("useSequence","lams") ?>" onClick="return validate();" />
|
||||
<input type="button" id="edit" name="edit" value="<?php print_string("editSequence","lams") ?>" onClick="openAuthor(<?php
|
||||
echo "'".$form->create_sequence_url."&".$LAMSCONSTANTS->param_ldid."=".$form->sequence."'";?>);">
|
||||
echo "'".$form->create_sequence_url."&".$LAMSCONSTANTS->param_ldid."=".@$form->sequence."'";?>);" />
|
||||
<input type="button" id="create" name="create" value="<?php print_string("createSequence","lams") ?>" onClick="openAuthor(<?php
|
||||
echo "'".$form->create_sequence_url."'";?>);">
|
||||
<input type="button" id="refresh" name="refresh" value="<?php print_string("refreshSequenceList","lams")?>" onclick="refreshLists();">
|
||||
<input type="submit" id="cancel" name=cancel value="<?php print_string("cancel") ?>">
|
||||
echo "'".$form->create_sequence_url."'";?>);" />
|
||||
<input type="button" id="refresh" name="refresh" value="<?php print_string("refreshSequenceList","lams")?>" onclick="refreshLists();" />
|
||||
<input type="submit" id="cancel" name=cancel value="<?php print_string("cancel") ?>" />
|
||||
|
||||
|
||||
<!-- These hidden variables are always the same -->
|
||||
|
@ -111,7 +111,7 @@ print_textarea($usehtmleditor, 20, 50, 680, 400, "introduction", $form->introduc
|
|||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
<!--
|
||||
function validate(){
|
||||
workspaceObj = document.getElementById("workspace");
|
||||
if (workspaceObj.options.length == 0){
|
||||
|
@ -214,7 +214,7 @@ var req;
|
|||
* This function is to initialize elements' status and refresh workspace and sequence lists
|
||||
*/
|
||||
function refreshLists(){
|
||||
document.getElementById("message").innerHTML = "<p>Please wait .......</p>";
|
||||
document.getElementById("message").innerHTML = "<p>Please wait .......<" + "/p>";
|
||||
disableSubmit(document.forms[0]);
|
||||
document.getElementById("create").disabled = true;
|
||||
document.getElementById("edit").disabled = true;
|
||||
|
@ -291,25 +291,25 @@ function processStateChange() {
|
|||
}
|
||||
initDynamicOptionLists(); //construct the list
|
||||
document.getElementById("message").innerHTML =
|
||||
"<p>Select an existing sequence or create a new sequence.</p>";
|
||||
"<p>Select an existing sequence or create a new sequence.<" + "/p>";
|
||||
}else if(req.status == 504){//gateway timeout. probabaly LAMS server is not available.
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">It seems the LAMS server is not available!<br/> Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">It seems the LAMS server is not available!<br/> Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}else if(req.status == 401){//AuthenticationException thrown by LAMS server.
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">This moodle server is not authenticated by LAMS!<br/> Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">This moodle server is not authenticated by LAMS!<br/> Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}else if(req.status == 502){//Unknow exception thrown by LAMS server
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">An unexpected error returned from LAMS server:'+req.responseText+'! Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">An unexpected error returned from LAMS server:'+req.responseText+'! Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}else if(req.status == 417){//ServerNotFound exception thrown by LAMS server
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">This moodle server has not registered in LAMS!<br/> Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">This moodle server has not registered in LAMS!<br/> Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}else if(req.status == 402){//All LAMS module settings have not not been set up
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">All the LAMS module settings have not been set up!<br/> Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">All the LAMS module settings have not been set up!<br/> Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}else{//this error should come from moodle server itself
|
||||
document.getElementById("message").innerHTML =
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">It should be a moodle server error:'+req.status + ' ' + req.statusText+'! Please contact your administrator.</h4></td></tr></table>';
|
||||
'<table align="center" width="57%" class="noticebox" border="0" cellpadding="15" cellspacing="0"><tr><td bgcolor="#FFAAAA" class="noticeboxcontent"><h4 class="main">It should be a moodle server error:'+req.status + ' ' + req.statusText+'! Please contact your administrator.<'+'/h4><'+'/td><'+'/tr><'+'/table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -776,5 +776,6 @@ function DOL_selectChildOptions(obj,usePreselected) {
|
|||
}
|
||||
|
||||
refreshLists();//refresh the lists when form is displayed.
|
||||
-->
|
||||
//]]>
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue