Adjusting layout of editor pages & starting changes of blti properties
authorChris Scribner <scriby@gmail.com>
Fri, 26 Aug 2011 21:06:32 +0000 (17:06 -0400)
committerChris Scribner <scriby@gmail.com>
Mon, 7 Nov 2011 01:41:44 +0000 (20:41 -0500)
mod/blti/db/install.xml
mod/blti/edit_form.php
mod/blti/lang/en/blti.php
mod/blti/lib.php
mod/blti/locallib.php
mod/blti/mod_form.php
mod/blti/styles.css
mod/blti/typessettings.php

index c9d1023..a0a84d8 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/blti/db" VERSION="20080912" COMMENT="XMLDB file for Moodle mod/blti"
+<XMLDB PATH="mod/blti/db" VERSION="20110826" COMMENT="XMLDB file for Moodle mod/blti"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
 >
@@ -9,31 +9,23 @@
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="course"/>
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Course basiclti activity belongs to" PREVIOUS="id" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances" PREVIOUS="course" NEXT="intro"/>
-        <FIELD NAME="intro" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the basiclti activity" PREVIOUS="name" NEXT="introformat"/>
-        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)" PREVIOUS="intro" NEXT="timecreated"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the basiclti activity" PREVIOUS="name" NEXT="introformat"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)" PREVIOUS="intro" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="introformat" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="typeid"/>
-        <FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Basic LTI type" PREVIOUS="timemodified" NEXT="toolurl"/>
-        <FIELD NAME="toolurl" TYPE="char" LENGTH="1023" NOTNULL="true" SEQUENCE="false" COMMENT="Remote tool url" PREVIOUS="typeid" NEXT="preferheight"/>
-        <FIELD NAME="preferheight" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="400" SEQUENCE="false" COMMENT="Peferred widget height" PREVIOUS="toolurl" NEXT="instructorchoicesendname"/>
-        <FIELD NAME="instructorchoicesendname" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Send user's name" PREVIOUS="preferheight" NEXT="instructorchoicesendemailaddr"/>
-        <FIELD NAME="instructorchoicesendemailaddr" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Send user's email" PREVIOUS="instructorchoicesendname" NEXT="instructorchoiceallowroster"/>
-        <FIELD NAME="instructorchoiceallowroster" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allow the roster to be retrieved" PREVIOUS="instructorchoicesendemailaddr" NEXT="instructorchoiceallowsetting"/>
-        <FIELD NAME="instructorchoiceallowsetting" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allow a tool to store a setting" PREVIOUS="instructorchoiceallowroster" NEXT="setting"/>
-        <FIELD NAME="setting" TYPE="char" LENGTH="8192" NOTNULL="false" UNSIGNED="false"  SEQUENCE="false" COMMENT="The setting value from the tool" PREVIOUS="instructorchoiceallowsetting" NEXT="instructorcustomparameters"/>
-        <FIELD NAME="instructorcustomparameters" TYPE="char" LENGTH="255" NOTNULL="false" UNSIGNED="false"  SEQUENCE="false" COMMENT="Additional custom parameters provided by the instructor" PREVIOUS="setting" NEXT="instructorchoiceacceptgrades"/>
-        <FIELD NAME="instructorchoiceacceptgrades" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Accept grades from tool" PREVIOUS="instructorcustomparameters" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="100" SEQUENCE="false" COMMENT="Grade scale" PREVIOUS="instructorchoiceacceptgrades" NEXT="placementsecret"/>
-        <FIELD NAME="placementsecret" TYPE="char" LENGTH="1023" NOTNULL="false" SEQUENCE="false" COMMENT="Remote tool grade secret" PREVIOUS="grade" NEXT="timeplacementsecret"/>
-        <FIELD NAME="timeplacementsecret" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT='When placementsecret was set' PREVIOUS="placementsecret" NEXT="oldplacementsecret"/>
-        <FIELD NAME="oldplacementsecret" TYPE="char" LENGTH="1023" NOTNULL="false" SEQUENCE="false" COMMENT="Previous remote tool grade secret" PREVIOUS="timeplacementsecret" NEXT="organizationid"/>
-        <FIELD NAME="organizationid" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" COMMENT="Organization ID" PREVIOUS="oldplacementsecret" NEXT="organizationurl"/>
-        <FIELD NAME="organizationurl" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Organization URL" PREVIOUS="organizationid" NEXT="organizationdescr"/>
-        <FIELD NAME="organizationdescr" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Organization description" PREVIOUS="organizationurl" NEXT="launchinpopup"/>
-        <FIELD NAME="launchinpopup" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Launch external tool in a pop-up" PREVIOUS="organizationdescr" NEXT="debuglaunch"/>
-        <FIELD NAME="debuglaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Enable the debug-style launch which pauses before auto-submit" PREVIOUS="launchinpopup" NEXT="moodle_course_field"/>
-        <FIELD NAME="moodle_course_field" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Chose which id field to use for setting up the tool" PREVIOUS="debuglaunch" NEXT="module_class_type"/>
-        <FIELD NAME="module_class_type" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Tool can be an activity or a resource" PREVIOUS="moodle_course_field"/>
+        <FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Basic LTI type" PREVIOUS="timemodified" NEXT="toolurl"/>
+        <FIELD NAME="toolurl" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" COMMENT="Remote tool url" PREVIOUS="typeid" NEXT="instructorchoicesendname"/>
+        <FIELD NAME="instructorchoicesendname" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Send user's name" PREVIOUS="toolurl" NEXT="instructorchoicesendemailaddr"/>
+        <FIELD NAME="instructorchoicesendemailaddr" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Send user's email" PREVIOUS="instructorchoicesendname" NEXT="instructorchoiceallowroster"/>
+        <FIELD NAME="instructorchoiceallowroster" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Allow the roster to be retrieved" PREVIOUS="instructorchoicesendemailaddr" NEXT="instructorchoiceallowsetting"/>
+        <FIELD NAME="instructorchoiceallowsetting" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Allow a tool to store a setting" PREVIOUS="instructorchoiceallowroster" NEXT="instructorcustomparameters"/>
+        <FIELD NAME="instructorcustomparameters" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Additional custom parameters provided by the instructor" PREVIOUS="instructorchoiceallowsetting" NEXT="instructorchoiceacceptgrades"/>
+        <FIELD NAME="instructorchoiceacceptgrades" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="Accept grades from tool" PREVIOUS="instructorcustomparameters" NEXT="grade"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="100" SEQUENCE="false" DECIMALS="5" COMMENT="Grade scale" PREVIOUS="instructorchoiceacceptgrades" NEXT="launchcontainer"/>
+        <FIELD NAME="launchcontainer" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="Launch external tool in a pop-up" PREVIOUS="grade" NEXT="debuglaunch"/>
+        <FIELD NAME="debuglaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Enable the debug-style launch which pauses before auto-submit" PREVIOUS="launchcontainer" NEXT="showtitle"/>
+        <FIELD NAME="showtitle" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="debuglaunch" NEXT="showdescription"/>
+        <FIELD NAME="showdescription" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="showtitle"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
       </INDEXES>
     </TABLE>
-
     <TABLE NAME="blti_types" COMMENT="Basic LTI pre-configured activities" PREVIOUS="blti" NEXT="blti_types_config">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="basiclti Activity" SEQUENCE="false" COMMENT="Activity name" PREVIOUS="id" NEXT="rawname"/>
-        <FIELD NAME="rawname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="basiclti Activity" SEQUENCE="false" COMMENT="Activity name" PREVIOUS="id" NEXT="baseurl"/>
+        <FIELD NAME="baseurl" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="name" NEXT="state"/>
+        <FIELD NAME="state" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="2" SEQUENCE="false" COMMENT="Active = 1, Pending = 2, Rejected = 3" PREVIOUS="baseurl" NEXT="course"/>
+        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="state" NEXT="coursevisible"/>
+        <FIELD NAME="coursevisible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="course" NEXT="createdby"/>
+        <FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="coursevisible" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="createdby" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="timecreated"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
-
+      <INDEXES>
+        <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
+      </INDEXES>
     </TABLE>
     <TABLE NAME="blti_types_config" COMMENT="Basic LTI types configuration" PREVIOUS="blti_types">
       <FIELDS>
         <FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Param value" PREVIOUS="name"/>
       </FIELDS>
       <KEYS>
-
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
+      <INDEXES>
+        <INDEX NAME="typeid" UNIQUE="false" FIELDS="typeid"/>
+      </INDEXES>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index b13f259..55e0787 100644 (file)
@@ -57,8 +57,8 @@ class mod_blti_edit_types_form extends moodleform{
 \r
 //-------------------------------------------------------------------------------\r
         // Add basiclti elements\r
-        $mform->addElement('header', 'setup', get_string('modstandardels', 'form'));\r
-\r
+        $mform->addElement('header', 'setup', get_string('tool_settings', 'blti'));\r
+        \r
         $mform->addElement('text', 'lti_typename', get_string('typename', 'blti'));\r
         $mform->setType('lti_typename', PARAM_INT);\r
 //        $mform->addHelpButton('lti_typename', 'typename','blti');\r
@@ -78,96 +78,66 @@ class mod_blti_edit_types_form extends moodleform{
         $mform->addElement('passwordunmask', 'lti_password', get_string('password', 'blti'));\r
         $mform->setType('lti_password', PARAM_TEXT);\r
 \r
-//-------------------------------------------------------------------------------\r
-        // Add size parameters\r
-        $mform->addElement('header', 'size', get_string('size', 'blti'));\r
-\r
-        $mform->addElement('text', 'lti_preferheight', get_string('preferheight', 'blti'));\r
-        $mform->setType('lti_preferheight', PARAM_INT);\r
-//        $mform->addHelpButton('lti_preferheight', 'preferheight', 'blti');\r
-\r
-\r
-//-------------------------------------------------------------------------------\r
+        $mform->addElement('textarea', 'lti_customparameters', get_string('custom', 'blti'), array('rows'=>4, 'cols'=>60));\r
+        $mform->setType('lti_customparameters', PARAM_TEXT);\r
+        \r
+        $mform->addElement('checkbox', 'lti_coursevisible', '&nbsp;', ' ' . get_string('show_in_course', 'blti'));\r
+        \r
         // Add privacy preferences fieldset where users choose whether to send their data\r
         $mform->addElement('header', 'privacy', get_string('privacy', 'blti'));\r
 \r
         $options=array();\r
         $options[0] = get_string('never', 'blti');\r
         $options[1] = get_string('always', 'blti');\r
-        $options[2] = get_string('delegate', 'blti');\r
-\r
-        $defaults=array();\r
-        $defaults[0] = get_string('donot', 'blti');\r
-        $defaults[1] = get_string('send', 'blti');\r
+        $options[2] = get_string('delegate_yes', 'blti');\r
+        $options[3] = get_string('delegate_no', 'blti');\r
 \r
         $mform->addElement('select', 'lti_sendname', get_string('sendname', 'blti'), $options);\r
-        $mform->setDefault('lti_sendname', '0');\r
+        $mform->setDefault('lti_sendname', '2');\r
 //        $mform->addHelpButton('lti_sendname', 'sendname', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_instructorchoicesendname', get_string('setdefault', 'blti'), $defaults);\r
-        $mform->setDefault('lti_instructorchoicesendname', '0');\r
-        $mform->disabledIf('lti_instructorchoicesendname', 'lti_sendname', 'neq', 2);\r
-\r
         $mform->addElement('select', 'lti_sendemailaddr', get_string('sendemailaddr', 'blti'), $options);\r
-        $mform->setDefault('lti_sendemailaddr', '0');\r
+        $mform->setDefault('lti_sendemailaddr', '2');\r
 //        $mform->addHelpButton('lti_sendemailaddr', 'sendemailaddr', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_instructorchoicesendemailaddr', get_string('setdefault', 'blti'), $defaults);\r
-        $mform->setDefault('lti_instructorchoicesendemailaddr', '0');\r
-        $mform->disabledIf('lti_instructorchoicesendemailaddr', 'lti_sendemailaddr', 'neq', 2);\r
-\r
 //-------------------------------------------------------------------------------\r
         // BLTI Extensions\r
-        $mform->addElement('header', 'extensions', get_string('extensions', 'blti'));\r
-\r
-        $defaults_accept=array();\r
-        $defaults_accept[0] = get_string('donotaccept', 'blti');\r
-        $defaults_accept[1] = get_string('accept', 'blti');\r
-\r
-        $defaults_allow=array();\r
-        $defaults_allow[0] = get_string('donotallow', 'blti');\r
-        $defaults_allow[1] = get_string('allow', 'blti');\r
 \r
         // Add grading preferences fieldset where the tool is allowed to return grades\r
         $mform->addElement('select', 'lti_acceptgrades', get_string('acceptgrades', 'blti'), $options);\r
-        $mform->setDefault('lti_acceptgrades', '0');\r
+        $mform->setDefault('lti_acceptgrades', '2');\r
 //        $mform->addHelpButton('lti_acceptgrades', 'acceptgrades', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_instructorchoiceacceptgrades', get_string('setdefault', 'blti'), $defaults_accept);\r
-        $mform->setDefault('lti_instructorchoiceacceptgrades', '0');\r
-        $mform->disabledIf('lti_instructorchoiceacceptgrades', 'lti_acceptgrades', 'neq', 2);\r
-\r
         // Add grading preferences fieldset where the tool is allowed to retrieve rosters\r
         $mform->addElement('select', 'lti_allowroster', get_string('allowroster', 'blti'), $options);\r
-        $mform->setDefault('lti_allowroster', '0');\r
+        $mform->setDefault('lti_allowroster', '2');\r
 //        $mform->addHelpButton('lti_allowroster', 'allowroster', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_instructorchoiceallowroster', get_string('setdefault', 'blti'), $defaults_allow);\r
-        $mform->setDefault('lti_instructorchoiceallowroster', '0');\r
-        $mform->disabledIf('lti_instructorchoiceallowroster', 'lti_allowroster', 'neq', 2);\r
-\r
+        /*\r
         // Add grading preferences fieldset where the tool is allowed to update settings\r
         $mform->addElement('select', 'lti_allowsetting', get_string('allowsetting', 'blti'), $options);\r
         $mform->setDefault('lti_allowsetting', '0');\r
 //        $mform->addHelpButton('lti_allowsetting', 'allowsetting', 'blti');\r
-\r
-        $mform->addElement('select', 'lti_instructorchoiceallowsetting', get_string('setdefault', 'blti'), $defaults_allow);\r
-        $mform->setDefault('lti_instructorchoiceallowsetting', '0');\r
-        $mform->disabledIf('lti_instructorchoiceallowsetting', 'lti_allowsetting', 'neq', 2);\r
+         */\r
 \r
 //-------------------------------------------------------------------------------\r
-        // Add custom parameters fieldset\r
-        $mform->addElement('header', 'custom', get_string('custom', 'blti'));\r
+        // Add launch parameters fieldset\r
+        $mform->addElement('header', 'launchoptions', get_string('launchoptions', 'blti'));\r
 \r
-        $mform->addElement('textarea', 'lti_customparameters', '', array('rows'=>15, 'cols'=>60));\r
-        $mform->setType('lti_customparameters', PARAM_TEXT);\r
+        $launchoptions=array();\r
+        $launchoptions[0] = get_string('embed', 'blti');\r
+        $launchoptions[1] = get_string('embed_no_blocks', 'blti');\r
+        $launchoptions[2] = get_string('popup_window', 'blti');\r
+        $launchoptions[3] = get_string('new_window', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_allowinstructorcustom', get_string('allowinstructorcustom', 'blti'), $defaults_allow);\r
-        $mform->setDefault('lti_allowinstructorcustom', '0');\r
+        $mform->addElement('select', 'lti_launchinpopup', get_string('launchinpopup', 'blti'), $launchoptions);\r
+        $mform->setDefault('lti_launchinpopup', '0');\r
+//        $mform->addHelpButton('lti_launchinpopup', 'launchinpopup', 'blti');\r
 \r
+                \r
 //-------------------------------------------------------------------------------\r
         // Add setup parameters fieldset\r
-        $mform->addElement('header', 'setupoptions', get_string('setupoptions', 'blti'));\r
+        $mform->addElement('header', 'setupoptions', get_string('miscellaneous', 'blti'));\r
 \r
         // Adding option to change id that is placed in context_id\r
         $idoptions = array();\r
@@ -176,18 +146,7 @@ class mod_blti_edit_types_form extends moodleform{
 \r
         $mform->addElement('select', 'lti_moodle_course_field', get_string('moodle_course_field', 'blti'), $idoptions);\r
         $mform->setDefault('lti_moodle_course_field', '0');\r
-\r
-        // Added option to allow user to specify if this is a resource or activity type\r
-        $classoptions = array();\r
-        $classoptions[0] = get_string('activity', 'blti');\r
-        $classoptions[1] = get_string('resource', 'blti');\r
-\r
-        $mform->addElement('select', 'lti_module_class_type', get_string('module_class_type', 'blti'), $classoptions);\r
-        $mform->setDefault('lti_module_class_type', '0');\r
-\r
-//-------------------------------------------------------------------------------\r
-        // Add organization parameters fieldset\r
-        $mform->addElement('header', 'organization', get_string('organization', 'blti'));\r
+        \r
 \r
         $mform->addElement('text', 'lti_organizationid', get_string('organizationid', 'blti'));\r
         $mform->setType('lti_organizationid', PARAM_TEXT);\r
@@ -203,18 +162,6 @@ class mod_blti_edit_types_form extends moodleform{
         $mform->addHelpButton('lti_organizationdescr', 'organizationdescr', 'blti');\r
         */\r
 \r
-//-------------------------------------------------------------------------------\r
-        // Add launch parameters fieldset\r
-        $mform->addElement('header', 'launchoptions', get_string('launchoptions', 'blti'));\r
-\r
-        $launchoptions=array();\r
-        $launchoptions[0] = get_string('launch_in_moodle', 'blti');\r
-        $launchoptions[1] = get_string('launch_in_popup', 'blti');\r
-\r
-        $mform->addElement('select', 'lti_launchinpopup', get_string('launchinpopup', 'blti'), $launchoptions);\r
-        $mform->setDefault('lti_launchinpopup', '0');\r
-//        $mform->addHelpButton('lti_launchinpopup', 'launchinpopup', 'blti');\r
-\r
 //-------------------------------------------------------------------------------\r
         // Add a hidden element to signal a tool fixing operation after a problematic backup - restore process\r
         $mform->addElement('hidden', 'lti_fix');\r
index 62d95d4..b13eeb7 100644 (file)
@@ -53,7 +53,7 @@ $string['addserver'] = 'Add new trusted server';
 $string['addtype'] = 'Create a new Basic LTI activity';\r
 $string['allow'] = 'Allow';\r
 $string['allowinstructorcustom'] = 'Allow instructors to add custom parameters';\r
-$string['allowroster'] = 'Allow tool access to course roster';\r
+$string['allowroster'] = 'Tool may access course roster';\r
 $string['allowsetting'] = 'Allow tool to store 8K of settings in Moodle';\r
 $string['always'] = 'Always';\r
 $string['blti'] = 'Basic LTI';\r
@@ -109,13 +109,13 @@ $string['imsrolelearner'] = 'Learner';
 $string['invalidid'] = 'basic LTI ID was incorrect';\r
 $string['launch_in_moodle'] = 'Launch tool in moodle';\r
 $string['launch_in_popup'] = 'Launch tool in a pop-up';\r
-$string['launchinpopup'] = 'Popup Option';\r
+$string['launchinpopup'] = 'Launch Container';\r
 $string['launchoptions'] = 'Launch Options';\r
 $string['lti_errormsg'] = 'The tool returned the following error message: \"$a\"';\r
 $string['misconfiguredtools'] = 'Misconfigured tool instances were detected';\r
 $string['missingparameterserror'] = 'The page is misconfigured: \"$a\"';\r
 $string['module_class_type'] = 'Moodle module type';\r
-$string['modulename'] = 'Basic LTI';\r
+$string['modulename'] = 'External Tool';\r
 $string['modulenameplural'] = 'basicltis';\r
 $string['modulenamepluralformatted'] = 'Basic LTI Instances';\r
 $string['moodle_course_field'] = 'Course identification field';\r
@@ -130,7 +130,7 @@ $string['organizationdescr'] ='Organization Description';
 $string['organizationid'] ='Organization ID';\r
 $string['organizationurl'] ='Organization URL';\r
 $string['pagesize'] = 'Submissions shown per page';\r
-$string['password'] = 'Remote Tool Password';\r
+$string['password'] = 'Shared Secret';\r
 $string['pluginadministration'] = 'Basic LTI administration';\r
 $string['pluginname'] = 'BLTI';\r
 $string['preferheight'] = 'Preferred Height';\r
@@ -142,12 +142,12 @@ $string['quickgrade'] = 'Allow quick grading';
 $string['quickgrade_help'] = 'If enabled, multiple tools can be graded on one page. Add grades and comments then click the "Save all my feedback" button to save all changes for that page.';\r
 $string['redirect'] = 'You will be redirected in few seconds. If you are not, press the button.';\r
 $string['resource'] = 'Resource';\r
-$string['resourcekey'] = 'Resource Key';\r
+$string['resourcekey'] = 'Consumer Key';\r
 $string['resourceurl'] = 'Resource URL';\r
 $string['saveallfeedback'] = 'Save all my feedback';\r
 $string['send'] = 'Send';\r
-$string['sendemailaddr'] = 'Send user email address to the external tool';\r
-$string['sendname'] = 'Send user name and surname to the external tool';\r
+$string['sendemailaddr'] = 'Share launcher\'s email with tool';\r
+$string['sendname'] = 'Share launcher\'s name with tool';\r
 $string['setdefault'] = 'Set a default value for the professor if delegating';\r
 $string['setupbox'] = 'Basic LTI Tool Setup Box';\r
 $string['setupoptions'] = 'Setup Options';\r
@@ -155,9 +155,31 @@ $string['size'] = 'Size parameters';
 $string['submission'] = 'Submission';\r
 $string['toggle_debug_data'] = 'Toggle Debug Data';\r
 $string['toolsetup'] = 'Basic LTI Tool Setup';\r
-$string['toolurl'] = 'Remote Tool URL';\r
-$string['typename'] = 'Remote Tool Name';\r
+$string['toolurl'] = 'Tool Base URL';\r
+$string['typename'] = 'Tool Name';\r
 $string['types'] = 'Types';\r
 $string['validurl'] = 'A valid URL must start with http(s)://';\r
 $string['viewsubmissions'] = 'View submissions and grading screen';\r
 \r
+//New admin strings\r
+\r
+$string['show_in_course'] = 'Show tool type when creating tool instances';\r
+$string['delegate_yes'] = 'Delegate to Instructor (Default: Yes)';\r
+$string['delegate_no'] = 'Delegate to Instructor (Default: No)';\r
+$string['tool_settings'] = 'Tool Settings';\r
+$string['miscellaneous'] = 'Miscellaneous';\r
+$string['embed'] = 'Embed';\r
+$string['embed_no_blocks'] = 'Embed, without blocks';\r
+$string['popup_window'] = 'Popup window';\r
+$string['new_window'] = 'New browser window / tab';\r
+\r
+//New instructor strings\r
+$string['display_name'] = 'Display activity name when launched';\r
+$string['display_description'] = 'Display activity description when launched';\r
+$string['external_tool_type'] = 'External tool type';\r
+$string['launch_url'] = 'Launch URL';\r
+$string['share_name'] = 'Share launcher\'s name with the tool';\r
+$string['share_email'] = 'Share launcher\'s email with the tool';\r
+$string['accept_grades'] = 'Accept grades from the tool';\r
+$string['share_roster'] = 'Allow the tool to access this course\'s roster';\r
+$string['automatic'] = 'Automatic, based on Launch URL';
\ No newline at end of file
index e0888ef..2c13f93 100644 (file)
@@ -79,18 +79,19 @@ function blti_supports($feature) {
  * @param object $instance An object from the form in mod.html\r
  * @return int The id of the newly inserted basiclti record\r
  **/\r
-function blti_add_instance($basiclti) {\r
+function blti_add_instance($formdata) {\r
     global $DB;\r
-    $basiclti->timecreated = time();\r
-    $basiclti->timemodified = $basiclti->timecreated;\r
-    $basiclti->placementsecret = uniqid('', true);\r
-    $basiclti->timeplacementsecret = time();\r
+    $formdata->timecreated = time();\r
+    $formdata->timemodified = $formdata->timecreated;\r
+    //$basiclti->placementsecret = uniqid('', true);\r
+    //$basiclti->timeplacementsecret = time();\r
 \r
-    $id = $DB->insert_record("blti", $basiclti);\r
+    $id = $DB->insert_record("blti", $formdata);\r
 \r
-    $basiclti = $DB->get_record('blti', array('id'=>$id));\r
-\r
-    if ($basiclti->instructorchoiceacceptgrades == 1) {\r
+    if ($formdata->instructorchoiceacceptgrades == 1) {\r
+        $basiclti = $DB->get_record('blti', array('id'=>$id));\r
+        $basiclti->cmidnumber = $formdata->cmidnumber;\r
+        \r
         blti_grade_item_update($basiclti);\r
     }\r
 \r
@@ -105,26 +106,22 @@ function blti_add_instance($basiclti) {
  * @param object $instance An object from the form in mod.html\r
  * @return boolean Success/Fail\r
  **/\r
-function blti_update_instance($basiclti) {\r
+function blti_update_instance($formdata) {\r
     global $DB;\r
 \r
-    $basiclti->timemodified = time();\r
-    $basiclti->id = $basiclti->instance;\r
-\r
-    $basicltirec = $DB->get_record("blti", array("id" => $basiclti->id));\r
-    $basiclti->grade = $basicltirec->grade;\r
+    $formdata->timemodified = time();\r
+    $formdata->id = $formdata->instance;\r
 \r
-    if (empty($basiclti->preferwidget)) {\r
-        $basiclti->preferwidget = 0;\r
-    }\r
-\r
-    if ($basiclti->instructorchoiceacceptgrades == 1) {\r
-        blti_grade_item_update($basiclti);\r
+    if ($formdata->instructorchoiceacceptgrades == 1) {\r
+        $basicltirec = $DB->get_record("blti", array("id" => $formdata->id));\r
+        $basicltirec->cmidnumber = $formdata->cmidnumber;\r
+        \r
+        blti_grade_item_update($basicltirec);\r
     } else {\r
-        blti_grade_item_delete($basiclti);\r
+        blti_grade_item_delete($formdata);\r
     }\r
 \r
-    return $DB->update_record("blti", $basiclti);\r
+    return $DB->update_record("blti", $formdata);\r
 }\r
 \r
 /**\r
@@ -312,7 +309,7 @@ function blti_get_blti_types() {
  *\r
  * @return array of basicLTI types\r
  */\r
-function blti_get_types() {\r
+/*function blti_get_types() {\r
     $types = array();\r
 \r
     $basicltitypes = blti_get_blti_types();\r
@@ -336,7 +333,7 @@ function blti_get_types() {
     }\r
 \r
     return $types;\r
-}\r
+}*/\r
 \r
 //////////////////////////////////////////////////////////////////////////////////////\r
 /// Any other basiclti functions go here.  Each of them must have a name that\r
@@ -964,10 +961,6 @@ function blti_grade_item_update($basiclti, $grades=null) {
     global $CFG;\r
     require_once($CFG->libdir.'/gradelib.php');\r
 \r
-    if (!isset($basiclti->courseid)) {\r
-        $basiclti->courseid = $basiclti->course;\r
-    }\r
-\r
     $params = array('itemname'=>$basiclti->name, 'idnumber'=>$basiclti->cmidnumber);\r
 \r
     if ($basiclti->grade > 0) {\r
@@ -988,7 +981,7 @@ function blti_grade_item_update($basiclti, $grades=null) {
         $grades = null;\r
     }\r
 \r
-    return grade_update('mod/blti', $basiclti->courseid, 'mod', 'blti', $basiclti->id, 0, $grades, $params);\r
+    return grade_update('mod/blti', $basiclti->course, 'mod', 'blti', $basiclti->id, 0, $grades, $params);\r
 }\r
 \r
 /**\r
@@ -1001,10 +994,6 @@ function blti_grade_item_delete($basiclti) {
     global $CFG;\r
     require_once($CFG->libdir.'/gradelib.php');\r
 \r
-    if (!isset($basiclti->courseid)) {\r
-        $basiclti->courseid = $basiclti->course;\r
-    }\r
-\r
-    return grade_update('mod/blti', $basiclti->courseid, 'mod', 'blti', $basiclti->id, 0, null, array('deleted'=>1));\r
+    return grade_update('mod/blti', $basiclti->course, 'mod', 'blti', $basiclti->id, 0, null, array('deleted'=>1));\r
 }\r
 \r
index 2310b0a..1885cb1 100644 (file)
@@ -321,6 +321,19 @@ function blti_filter_get_types() {
     return $DB->get_records('blti_types');\r
 }\r
 \r
+function blti_get_types_for_add_instance(){\r
+    $admintypes = blti_filter_get_types();\r
+    \r
+    $types = array();\r
+    $types[0] = get_string('automatic', 'blti');\r
+    \r
+    foreach($admintypes as $type) {\r
+        $types[$type->id] = $type->name;\r
+    }\r
+    \r
+    return $types;\r
+}\r
+\r
 /**\r
  * Prints the various configured tool types\r
  *\r
index 9eceb6a..670f421 100644 (file)
@@ -87,113 +87,65 @@ class mod_blti_mod_form extends moodleform_mod {
         $mform->setType('name', PARAM_TEXT);\r
         $mform->addRule('name', null, 'required', null, 'client');\r
     /// Adding the optional "intro" and "introformat" pair of fields\r
-        $this->add_intro_editor(true, get_string('basicltiintro', 'blti'));\r
-\r
+        $this->add_intro_editor(false, get_string('basicltiintro', 'blti'));\r
+        $mform->setAdvanced('introeditor');\r
+\r
+        $mform->addElement('checkbox', 'showtitle', '&nbsp;', ' ' . get_string('display_name', 'blti'));\r
+        $mform->setAdvanced('showtitle');\r
+        \r
+        $mform->addElement('checkbox', 'showdescription', '&nbsp;', ' ' . get_string('display_description', 'blti'));\r
+        $mform->setAdvanced('showdescription');\r
+        \r
+        //Tool settings\r
+        $mform->addElement('select', 'typeid', get_string('external_tool_type', 'blti'), blti_get_types_for_add_instance());\r
+        //$mform->setDefault('typeid', '0');\r
+        \r
+        $mform->addElement('text', 'toolurl', get_string('launch_url', 'blti'), array('size'=>'64'));\r
+        $mform->setType('toolurl', PARAM_TEXT);\r
+        \r
+        $mform->addElement('text', 'resourcekey', get_string('resourcekey', 'blti'));\r
+        $mform->setType('resourcekey', PARAM_TEXT);\r
+        $mform->setAdvanced('resourcekey');\r
+\r
+        $mform->addElement('passwordunmask', 'password', get_string('password', 'blti'));\r
+        $mform->setType('password', PARAM_TEXT);\r
+        $mform->setAdvanced('password');\r
+        \r
+        $mform->addElement('textarea', 'instructorcustomparameters', get_string('custom', 'blti'), array('rows'=>4, 'cols'=>60));\r
+        $mform->setType('instructorcustomparameters', PARAM_TEXT);\r
+        $mform->setAdvanced('instructorcustomparameters');\r
+        \r
 //-------------------------------------------------------------------------------\r
-        $mform->addElement('hidden', 'typeid', $this->typeid);\r
-        $mform->addElement('hidden', 'toolurl', $this->typeconfig['toolurl']);\r
+        //$mform->addElement('hidden', 'typeid', $this->typeid);\r
+        //$mform->addElement('hidden', 'toolurl', $this->typeconfig['toolurl']);\r
         $mform->addElement('hidden', 'type', $typename);\r
 \r
 //-------------------------------------------------------------------------------\r
         // Add privacy preferences fieldset where users choose whether to send their data\r
         $mform->addElement('header', 'privacy', get_string('privacy', 'blti'));\r
 \r
-        $privacyoptions=array();\r
-        $privacyoptions[0] = get_string('donot', 'blti');\r
-        $privacyoptions[1] = get_string('send', 'blti');\r
-\r
-        $mform->addElement('select', 'instructorchoicesendname', get_string('sendname', 'blti'), $privacyoptions);\r
-\r
-        if (isset($this->typeconfig['instructorchoicesendname'])) {\r
-            if ($this->typeconfig['instructorchoicesendname'] == 0) {\r
-                $mform->setDefault('instructorchoicesendname', '0');\r
-            } else if ($this->typeconfig['instructorchoicesendname'] == 1) {\r
-                $mform->setDefault('instructorchoicesendname', '1');\r
-            }\r
-        }\r
-//        $mform->addHelpButton('instructorchoicesendname', 'sendname', 'blti');\r
-\r
-          $mform->addElement('select', 'instructorchoicesendemailaddr', get_string('sendemailaddr', 'blti'), $privacyoptions);\r
-\r
-        if (isset($this->typeconfig['instructorchoicesendemailaddr'])) {\r
-            if ($this->typeconfig['instructorchoicesendemailaddr'] == 0) {\r
-                $mform->setDefault('instructorchoicesendemailaddr', '0');\r
-            } else if ($this->typeconfig['instructorchoicesendemailaddr'] == 1) {\r
-                $mform->setDefault('instructorchoicesendemailaddr', '1');\r
-            }\r
-        }\r
-    //            $mform->addHelpButton('instructorchoicesendemailaddr', 'sendemailaddr', 'blti');\r
-\r
-//-------------------------------------------------------------------------------\r
-        // Add grading preferences fieldset where the instructor determines whether to accept grades\r
-        $mform->addElement('header', 'extensions', get_string('extensions', 'blti'));\r
-\r
-        $extensionoptions=array();\r
-        $extensionoptions[0] = get_string('donotaccept', 'blti');\r
-        $extensionoptions[1] = get_string('accept', 'blti');\r
-\r
-        $mform->addElement('select', 'instructorchoiceacceptgrades', get_string('acceptgrades', 'blti'), $extensionoptions);\r
-        if (isset($this->typeconfig['instructorchoiceacceptgrades'])) {\r
-            if ($this->typeconfig['instructorchoiceacceptgrades'] == 0) {\r
-                $mform->setDefault('instructorchoiceacceptgrades', '0');\r
-            } else if ($this->typeconfig['instructorchoiceacceptgrades'] == 1) {\r
-                $mform->setDefault('instructorchoiceacceptgrades', '1');\r
-            }\r
-        }\r
-    //        $mform->addHelpButton('instructorchoiceacceptgrades', 'acceptgrades', 'blti');\r
-\r
-        $extensionoptions=array();\r
-        $extensionoptions[0] = get_string('donotallow', 'blti');\r
-        $extensionoptions[1] = get_string('allow', 'blti');\r
-\r
-        $mform->addElement('select', 'instructorchoiceallowroster', get_string('allowroster', 'blti'), $extensionoptions);\r
-        if (isset($this->typeconfig['instructorchoiceallowroster'])) {\r
-            if ($this->typeconfig['instructorchoiceallowroster'] == 0) {\r
-                $mform->setDefault('instructorchoiceallowroster', '0');\r
-            } else if ($this->typeconfig['instructorchoiceallowroster'] == 1) {\r
-                $mform->setDefault('instructorchoiceallowroster', '1');\r
-            }\r
-        }\r
-    //        $mform->addHelpButton('instructorchoiceallowroster', 'allowroster', 'blti');\r
-        $mform->setAdvanced('instructorchoiceallowroster');\r
-\r
-        $mform->addElement('select', 'instructorchoiceallowsetting', get_string('allowsetting', 'blti'), $extensionoptions);\r
-\r
-        if (isset($this->typeconfig['instructorchoiceallowsetting'])) {\r
-            if ($this->typeconfig['instructorchoiceallowsetting'] == 0) {\r
-                $mform->setDefault('instructorchoiceallowsetting', '0');\r
-            } else if ($this->typeconfig['instructorchoiceallowsetting'] == 1) {\r
-                $mform->setDefault('instructorchoiceallowsetting', '1');\r
-            }\r
-        }\r
-//        $mform->addHelpButton('instructorchoiceallowsetting', 'allowsetting', 'blti');\r
-        $mform->setAdvanced('instructorchoiceallowsetting');\r
+        $mform->addElement('checkbox', 'instructorchoicesendname', '&nbsp;', ' ' . get_string('share_name', 'blti'));\r
+        $mform->setDefault('instructorchoicesendname', '1');\r
+        \r
+        $mform->addElement('checkbox', 'instructorchoicesendemailaddr', '&nbsp;', ' ' . get_string('share_email', 'blti'));\r
+        $mform->setDefault('instructorchoicesendemailaddr', '1');\r
+        \r
+        $mform->addElement('checkbox', 'instructorchoiceacceptgrades', '&nbsp;', ' ' . get_string('accept_grades', 'blti'));\r
+        $mform->setDefault('instructorchoiceacceptgrades', '1');\r
+        \r
+        $mform->addElement('checkbox', 'instructorchoiceallowroster', '&nbsp;', ' ' . get_string('share_roster', 'blti'));\r
+        $mform->setDefault('instructorchoiceallowroster', '1');\r
 \r
 //-------------------------------------------------------------------------------\r
-        if (isset($this->typeconfig['allowinstructorcustom'])) {\r
-            if ($this->typeconfig['allowinstructorcustom'] == 1) {\r
-                // Add custom parameters fieldset\r
-                $mform->addElement('header', 'launchoptions', get_string('custominstr', 'blti'));\r
-\r
-                $mform->addElement('textarea', 'instructorcustomparameters', '', array('rows'=>15, 'cols'=>60));\r
-                $mform->setType('instructorcustomparameters', PARAM_TEXT);\r
-                $mform->setAdvanced('instructorcustomparameters');\r
-            }\r
-        }\r
 \r
-//-------------------------------------------------------------------------------\r
         // Add launch parameters fieldset\r
         $mform->addElement('header', 'launchoptions', get_string('launchoptions', 'blti'));\r
 \r
-        // Size parameters\r
-        $mform->addElement('text', 'preferheight', get_string('preferheight', 'blti'));\r
-        if (isset($this->typeconfig['preferheight'])) {\r
-            $mform->setDefault('preferheight', $this->typeconfig['preferheight']);\r
-        }\r
-\r
         $launchoptions=array();\r
-        $launchoptions[0] = get_string('launch_in_moodle', 'blti');\r
-        $launchoptions[1] = get_string('launch_in_popup', 'blti');\r
+        $launchoptions[0] = get_string('embed', 'blti');\r
+        $launchoptions[1] = get_string('embed_no_blocks', 'blti');\r
+        $launchoptions[2] = get_string('popup_window', 'blti');\r
+        $launchoptions[3] = get_string('new_window', 'blti');\r
 \r
         $mform->addElement('select', 'launchinpopup', get_string('launchinpopup', 'blti'), $launchoptions);\r
 \r
@@ -205,7 +157,7 @@ class mod_blti_mod_form extends moodleform_mod {
             }\r
         }\r
 \r
-        $debugoptions=array();\r
+/*        $debugoptions=array();\r
         $debugoptions[0] = get_string('debuglaunchoff', 'blti');\r
         $debugoptions[1] = get_string('debuglaunchon', 'blti');\r
 \r
@@ -218,16 +170,7 @@ class mod_blti_mod_form extends moodleform_mod {
                 $mform->setDefault('debuglaunch', '1');\r
             }\r
         }\r
-\r
-//-------------------------------------------------------------------------------\r
-        // Organization parameters\r
-        if (isset($this->typeconfig['organizationid'])) {\r
-            $mform->addElement('hidden', 'organizationid', $this->typeconfig['organizationid']);\r
-        }\r
-        if (isset($this->typeconfig['organizationurl'])) {\r
-            $mform->addElement('hidden', 'organizationurl', $this->typeconfig['organizationurl']);\r
-        }\r
-//       $mform->addElement('hidden', 'organizationdescr', $this->typeconfig['organizationdescr']);\r
+*/\r
 \r
 //-------------------------------------------------------------------------------\r
         // add standard elements, common to all modules\r
@@ -243,7 +186,7 @@ class mod_blti_mod_form extends moodleform_mod {
      */\r
     function definition_after_data() {\r
         parent::definition_after_data();\r
-        $mform     =& $this->_form;\r
+       /* $mform     =& $this->_form;\r
         $typeid      =& $mform->getElement('typeid');\r
         $typeidvalue = $mform->getElementValue('typeid');\r
 \r
@@ -283,7 +226,7 @@ class mod_blti_mod_form extends moodleform_mod {
                 $field->freeze();\r
                 $field->setPersistantFreeze(true);\r
             }\r
-        }\r
+        }*/\r
     }\r
 \r
     /**\r
@@ -293,7 +236,7 @@ class mod_blti_mod_form extends moodleform_mod {
      * @param array $default_values passed by reference\r
      */\r
     function data_preprocessing(&$default_values) {\r
-        global $CFG;\r
+/*        global $CFG;\r
         $default_values['typeid'] = $this->typeid;\r
 \r
         if (!isset($default_values['toolurl'])) {\r
@@ -475,7 +418,7 @@ class mod_blti_mod_form extends moodleform_mod {
                 $default_values['launchinpopup'] = $CFG->blti_launchinpopup;\r
             }\r
         }\r
-\r
+*/\r
     }\r
 }\r
 \r
index 0be6d5f..72126e4 100644 (file)
@@ -27,3 +27,6 @@
 #page-mod-blti-submissions .submissions .outcome,
 #page-mod-blti-submissions .submissions .finalgrade {text-align: right;}
 #page-mod-blti-submissions .qgprefs #optiontable {text-align:right;margin-left:auto;}
+
+/* Styles for admin */
+.path-admin-mod-blti .mform .fitem .fitemtitle { min-width:15em;padding-right:1em } /* Prevent setting titles from wrapping */
index 0ef7c4a..4421401 100644 (file)
@@ -74,11 +74,16 @@ $errormsg  = '';
 $focus = '';\r
 \r
 if ($data = data_submitted() and confirm_sesskey() and isset($data->submitbutton)) {\r
+    $type = new StdClass();\r
+    $type->name = $data->lti_typename;\r
+    $type->baseurl = $data->lti_toolurl;\r
+    $type->course = $SITE->id;\r
+    $type->coursevisible = 1;\r
+    $type->timemodified = time();\r
+    \r
     if (isset($id)) {\r
-        $type = new StdClass();\r
         $type->id = $id;\r
-        $type->name = $data->lti_typename;\r
-        $type->rawname = preg_replace('/[^a-zA-Z]/', '', $type->name);\r
+        \r
         if ($DB->update_record('blti_types', $type)) {\r
             unset ($data->lti_typename);\r
             //@TODO: update work\r
@@ -95,23 +100,13 @@ if ($data = data_submitted() and confirm_sesskey() and isset($data->submitbutton
                     }\r
                 }\r
             }\r
-\r
-            // Update toolurl for all existing instances - it is the only common parameter\r
-            // between configurations and instances\r
-            $instances = $DB->get_records('blti', array('typeid' => $id));\r
-            foreach ($instances as $instance) {\r
-                if ($instance->toolurl != $data->lti_toolurl) {\r
-                    $instance->toolurl = $data->lti_toolurl;\r
-                    $DB->update_record('blti', $instance);\r
-                }\r
-            }\r
         }\r
         redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=modsettingblti");\r
         die;\r
     } else {\r
-        $type = new StdClass();\r
-        $type->name = $data->lti_typename;\r
-        $type->rawname = preg_replace('/[^a-zA-Z]/', '', $type->name);\r
+        $type->createdby = $USER->id;\r
+        $type->timecreated = time();\r
+        \r
         if ($id = $DB->insert_record('blti_types', $type)) {\r
             if (!empty($data->lti_fix)) {\r
                 $instance = $DB->get_record('blti', array('id' => $data->lti_fix));\r