Log Message:
-----------
Added code which prevents anyone but an administrator from editing a wwlink Block.
(security feature -- inspired by Zig Fiedorwicz)
Modified Files:
--------------
wwmoodle/wwassignment4/moodle/blocks/wwlink:
block_wwlink.php
Revision Data
-------------
Index: block_wwlink.php
===================================================================
RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/blocks/wwlink/block_wwlink.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lwwassignment4/moodle/blocks/wwlink/block_wwlink.php -Lwwassignment4/moodle/blocks/wwlink/block_wwlink.php -u -r1.5 -r1.6
--- wwassignment4/moodle/blocks/wwlink/block_wwlink.php
+++ wwassignment4/moodle/blocks/wwlink/block_wwlink.php
@@ -19,31 +19,7 @@
return true;
}
- /**
- * @desc Saves the form data from configuration into the wwassignment_bridge table.
- */
-// function instance_config_save($data) {
-
-// $webworkcourse = $data->webwork_link_id;
-// $moodlecourse = $data->courseid;
-//
-// $wwassignmentbridge = new stdClass;
-// $wwassignmentbridge->course = $moodlecourse;
-// $wwassignmentbridge->webwork_course = $webworkcourse;
-//
-// //has this mapping been defined
-// $record = get_record('wwassignment_bridge','course',$moodlecourse);
-// if(!$record) {
-// //new one
-// insert_record('wwassignment_bridge',$wwassignmentbridge);
-// } else {
-// //update
-// $wwassignmentbridge->id = $record->id;
-// update_record('wwassignment_bridge',$wwassignmentbridge);
-// }
-
-// return parent::instance_config_save($data);
-// }
+
/**
* @desc Makes sure that the only place this block can be added is on course-view page. This insures one block per course.
@@ -52,35 +28,15 @@
return array('all' => false, 'course-view' => true);
}
- /**
- * @desc Prints the content of the block. Whether or not the course is connected to a moodle course.
- */
-// function get_content() {
-// global $COURSE;
-// print_r($this->config );
-// $courseid = $COURSE->id;
-// $record = get_record('wwassignment_bridge','course',$courseid);
-// print_r($record);
-// if(!$record) {
-// $wwlinkdata = $this->config;
-// if (!$wwlinkdata) {
-// $this->content->text = get_string('not_connected','block_wwlink');
-// } else {
-// $this->content->text = "connecting to ". $this->config->webwork_link_id;
-// $wwassignmentbridge->course = $courseid;
-// $wwassignmentbridge->webwork_course = $wwlinkdata->webwork_link_id;
-// insert_record('wwassignment_bridge',$wwassignmentbridge);
-// }
-//
-// } else {
-// $this->content->text = get_string('connected','block_wwlink') . ' ' . $record->webwork_course;
-// }
-// $this->content->footer = '';
-// return $this->content;
-// }
+<<<<<<< block_wwlink.php
+function user_can_edit() {
+ require_capability('moode/site:doanything',get_context_instance(CONTEXT_SYSTEM));
+ return parent::user_can_edit();
+}
// new method for storing state:
// we can store it in the configuration data for the block! we don't need the wwassignment_bridge table to store state.
+
function get_content() {
global $COURSE;
//print_r($this->config );
|