Skip to content

Commit

Permalink
MDL-20534 lti: A3, whitespace fixes (Changes by stronk7)
Browse files Browse the repository at this point in the history
  • Loading branch information
scriby committed Nov 7, 2011
1 parent 61eb12d commit e27cb31
Show file tree
Hide file tree
Showing 21 changed files with 354 additions and 363 deletions.
5 changes: 2 additions & 3 deletions mod/lti/ajax.php
Expand Up @@ -37,15 +37,14 @@
switch($action){
case 'find_tool_config':
$toolurl = required_param('toolurl', PARAM_RAW);

$tool = lti_get_tool_by_url_match($toolurl, $courseid);

if(!empty($tool)){
$response->toolid = $tool->id;
$response->toolname = htmlspecialchars($tool->name);
$response->tooldomain = htmlspecialchars($tool->tooldomain);
}

break;
}

Expand Down
20 changes: 10 additions & 10 deletions mod/lti/backup/moodle2/backup_lti_stepslib.php
Expand Up @@ -59,21 +59,21 @@ protected function define_structure() {

// Define each element separated
$basiclti = new backup_nested_element('lti', array('id'), array(
'name',
'intro',
'introformat',
'timecreated',
'name',
'intro',
'introformat',
'timecreated',
'timemodified',
'typeid',
'toolurl',
'preferheight',
'typeid',
'toolurl',
'preferheight',
'launchcontainer',
'instructorchoicesendname',
'instructorchoicesendemailaddr',
'instructorchoiceacceptgrades',
'instructorchoiceacceptgrades',
'instructorchoiceallowroster',
'instructorchoiceallowsetting',
'grade',
'instructorchoiceallowsetting',
'grade',
'instructorcustomparameters',
'showtitle',
'showdescription'
Expand Down
4 changes: 2 additions & 2 deletions mod/lti/backup/moodle2/restore_lti_stepslib.php
Expand Up @@ -69,9 +69,9 @@ protected function process_lti($data) {
$data->course = $this->get_courseid();

require_once($CFG->dirroot.'/mod/lti/lib.php');

$newitemid = lti_add_instance($data);

// insert the basiclti record
//$newitemid = $DB->insert_record('lti', $data);
// immediately after inserting "activity" record, call this
Expand Down
6 changes: 3 additions & 3 deletions mod/lti/db/access.php
Expand Up @@ -53,7 +53,7 @@
'manager' => CAP_ALLOW
)
),

'mod/lti:manage' => array(
'riskbitmask' => RISK_XSS,

Expand All @@ -65,7 +65,7 @@
'manager' => CAP_ALLOW
)
),

'mod/lti:addcoursetool' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
Expand All @@ -75,7 +75,7 @@
'manager' => CAP_ALLOW
)
),

'mod/lti:requesttooladd' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
Expand Down
20 changes: 9 additions & 11 deletions mod/lti/db/upgrade.php
Expand Up @@ -61,7 +61,7 @@ function xmldb_lti_upgrade($oldversion=0) {
global $DB;

$dbman = $DB->get_manager();

if ($oldversion < 2011100701) {
$table = new xmldb_table('lti');
$field = new xmldb_field('icon', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'servicesalt');
Expand All @@ -71,28 +71,26 @@ function xmldb_lti_upgrade($oldversion=0) {
}

upgrade_mod_savepoint(true, 2011100701, 'lti');
}
}

if ($oldversion < 2011101801) {
$table = new xmldb_table('lti');
$field = new xmldb_field('securetoolurl', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'toolurl');

if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

$field = new xmldb_field('secureicon', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'icon');

if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
}

upgrade_mod_savepoint(true, 2011101801, 'lti');
}

$result = true;


$result = true;

return $result;
}
Expand Down
26 changes: 12 additions & 14 deletions mod/lti/edit_form.php
Expand Up @@ -59,11 +59,10 @@ function definition() {
//-------------------------------------------------------------------------------
// Add basiclti elements
$mform->addElement('header', 'setup', get_string('tool_settings', 'lti'));

$mform->addElement('text', 'lti_typename', get_string('typename', 'lti'));
$mform->setType('lti_typename', PARAM_INT);
$mform->addHelpButton('lti_typename', 'typename','lti');

$mform->addRule('lti_typename', null, 'required', null, 'client');

$mform->addElement('text', 'lti_toolurl', get_string('toolurl', 'lti'), array('size'=>'64'));
Expand All @@ -74,24 +73,24 @@ function definition() {
$mform->addElement('text', 'lti_resourcekey', get_string('resourcekey_admin', 'lti'));
$mform->setType('lti_resourcekey', PARAM_TEXT);
$mform->addHelpButton('lti_resourcekey', 'resourcekey_admin', 'lti');

$mform->addElement('passwordunmask', 'lti_password', get_string('password_admin', 'lti'));
$mform->setType('lti_password', PARAM_TEXT);
$mform->addHelpButton('lti_password', 'password_admin', 'lti');

$mform->addElement('textarea', 'lti_customparameters', get_string('custom', 'lti'), array('rows'=>4, 'cols'=>60));
$mform->setType('lti_customparameters', PARAM_TEXT);
$mform->addHelpButton('lti_customparameters', 'custom', 'lti');

if(!empty($this->_customdata->isadmin)){
$mform->addElement('checkbox', 'lti_coursevisible', '&nbsp;', ' ' . get_string('show_in_course', 'lti'));
$mform->addHelpButton('lti_coursevisible', 'show_in_course', 'lti');
} else {
$mform->addElement('hidden', 'lti_coursevisible', '1');
}

$mform->addElement('hidden', 'typeid');

$launchoptions=array();
$launchoptions[LTI_LAUNCH_CONTAINER_EMBED] = get_string('embed', 'lti');
$launchoptions[LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS] = get_string('embed_no_blocks', 'lti');
Expand All @@ -100,7 +99,7 @@ function definition() {
$mform->addElement('select', 'lti_launchcontainer', get_string('default_launch_container', 'lti'), $launchoptions);
$mform->setDefault('lti_launchcontainer', LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS);
$mform->addHelpButton('lti_launchcontainer', 'default_launch_container', 'lti');

// Add privacy preferences fieldset where users choose whether to send their data
$mform->addElement('header', 'privacy', get_string('privacy', 'lti'));

Expand Down Expand Up @@ -132,9 +131,8 @@ function definition() {

$mform->addElement('checkbox', 'lti_forcessl','&nbsp;', ' ' . get_string('force_ssl', 'lti'), $options);
$mform->setDefault('lti_forcessl', '0');

$mform->addHelpButton('lti_forcessl', 'force_ssl', 'lti');

if(!empty($this->_customdata->isadmin)){
//-------------------------------------------------------------------------------
// Add setup parameters fieldset
Expand All @@ -153,7 +151,7 @@ function definition() {
$mform->setType('lti_organizationurl', PARAM_TEXT);
$mform->addHelpButton('lti_organizationurl', 'organizationurl', 'lti');
}

/* Suppress this for now - Chuck
$mform->addElement('text', 'lti_organizationdescr', get_string('organizationdescr', 'lti'));
$mform->setType('lti_organizationdescr', PARAM_TEXT);
Expand All @@ -163,13 +161,13 @@ function definition() {
//-------------------------------------------------------------------------------
// Add a hidden element to signal a tool fixing operation after a problematic backup - restore process
//$mform->addElement('hidden', 'lti_fix');

$tab = optional_param('tab', '', PARAM_ALPHAEXT);
$mform->addElement('hidden', 'tab', $tab);

$courseid = optional_param('course', 1, PARAM_INT);
$mform->addElement('hidden', 'course', $courseid);

//-------------------------------------------------------------------------------
// Add standard buttons, common to all modules
$this->add_action_buttons();
Expand Down
10 changes: 4 additions & 6 deletions mod/lti/grade.php
Expand Up @@ -96,9 +96,7 @@
'name' => 'mod_lti_submissions',
'fullpath' => '/mod/lti/submissions.js',
'requires' => array('base'),
'strings' => array(

),
'strings' => array(),
);

$PAGE->requires->js_init_call('M.mod_lti.submissions.init', array(), true, $module);
Expand Down Expand Up @@ -158,15 +156,15 @@

foreach($submissions as $submission){
$row = $rowtemplate;

foreach($submission as $key => $value){
if($key === 'datesubmitted'){
$value = userdate($value);
}

$row = str_replace('<!--' . $key . '-->', $value, $row);
}

$rows .= $row;
}

Expand Down
35 changes: 15 additions & 20 deletions mod/lti/instructor_edit_tool_type.php
Expand Up @@ -42,7 +42,6 @@
$type = lti_get_type($typeid);
if($type->course != $courseid){
throw new Exception('You do not have permissions to edit this tool type.');

die;
}
}
Expand All @@ -53,65 +52,61 @@

if (isset($data->submitbutton) && confirm_sesskey()) {
$type = new stdClass();

if (!empty($typeid)) {
$type->id = $typeid;
$name = json_encode($data->lti_typename);

lti_update_type($type, $data);

$fromdb = lti_get_type($typeid);
$json = json_encode($fromdb);

//Output script to update the calling window.
$script = <<<SCRIPT
<script type="text/javascript">
window.opener.M.mod_lti.editor.updateToolType({$json});
window.close();
</script>
SCRIPT;

echo $script;

die;
} else {
$type->state = LTI_TOOL_STATE_CONFIGURED;
$type->course = $COURSE->id;

$id = lti_add_type($type, $data);

$fromdb = lti_get_type($id);
$json = json_encode($fromdb);

//Output script to update the calling window.
$script = <<<SCRIPT
<script type="text/javascript">
window.opener.M.mod_lti.editor.addToolType({$json});
window.close();
</script>
SCRIPT;

echo $script;

die;
}
} else if(isset($data->cancel)){
$script = <<<SCRIPT
<script type="text/javascript">
window.close();
</script>
$script = <<<SCRIPT
<script type="text/javascript">
window.close();
</script>
SCRIPT;
echo $script;

echo $script;
die;
}

//Delete action is called via ajax
if ($action == 'delete'){
lti_delete_type($typeid);

die;
}

Expand Down

0 comments on commit e27cb31

Please sign in to comment.