Merge branch 'wip-MDL-29672-master' of git://github.com/samhemelryk/moodle
authorAparup Banerjee <aparup@moodle.com>
Mon, 10 Oct 2011 14:45:01 +0000 (22:45 +0800)
committerAparup Banerjee <aparup@moodle.com>
Mon, 10 Oct 2011 14:45:01 +0000 (22:45 +0800)
enrol/cohort/yui/quickenrolment/quickenrolment.js
lib/googleapi.php
lib/simpletest/testpagelib_moodlepage.php
lib/xmldb/xmldb_key.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php
mod/choice/renderer.php
theme/yui_combo.php

index 004acf1..6607566 100644 (file)
@@ -122,11 +122,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
                     break;
                 case 'defaultcohortroleloaded':
                     defaultrole = this.get(DEFAULTCOHORTROLE);
-                    panel.get('contentBox').one('.'+CSS.PANELROLES).all('option').each(function(){
-                        if (this.get('value')==defaultrole) {
-                            this.setAttribute('selected', true);
-                        }
-                    });
+                    panel.get('contentBox').one('.'+CSS.PANELROLES+' select').set('value', defaultrole);
                     break;
             }
         },
@@ -339,4 +335,4 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
         }
     }
 
-}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
\ No newline at end of file
+}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
index cb09710..af545a0 100644 (file)
@@ -241,8 +241,8 @@ class google_authsub extends google_auth_request {
  */
 class google_docs {
     // need both docs and the spreadsheets realm
-    const REALM            = 'http://docs.google.com/feeds/ http://spreadsheets.google.com/feeds/ http://docs.googleusercontent.com/';
-    const DOCUMENTFEED_URL = 'http://docs.google.com/feeds/default/private/full';
+    const REALM            = 'https://docs.google.com/feeds/ https://spreadsheets.google.com/feeds/ https://docs.googleusercontent.com/';
+    const DOCUMENTFEED_URL = 'https://docs.google.com/feeds/default/private/full';
     const USER_PREF_NAME   = 'google_authsub_sesskey';
 
     private $google_curl = null;
@@ -292,8 +292,6 @@ class google_docs {
         $xml = new SimpleXMLElement($content);
 
 
-
-
         $files = array();
         foreach($xml->entry as $gdoc){
             $docid  = (string) $gdoc->children('http://schemas.google.com/g/2005')->resourceId;
@@ -307,15 +305,15 @@ class google_docs {
             switch($type){
                 case 'document':
                     $title = $gdoc->title.'.rtf';
-                    $source = 'http://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
+                    $source = 'https://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
                     break;
                 case 'presentation':
                     $title = $gdoc->title.'.ppt';
-                    $source = 'http://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
+                    $source = 'https://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
                     break;
                 case 'spreadsheet':
                     $title = $gdoc->title.'.xls';
-                    $source = 'http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
+                    $source = 'https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
                     break;
                 case 'pdf':
                     $title  = (string)$gdoc->title;
@@ -374,10 +372,10 @@ class google_docs {
 class google_picasa {
     const REALM             = 'http://picasaweb.google.com/data/';
     const USER_PREF_NAME    = 'google_authsub_sesskey_picasa';
-    const UPLOAD_LOCATION   = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/default';
-    const ALBUM_PHOTO_LIST  = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/';
-    const PHOTO_SEARCH_URL  = 'http://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
-    const LIST_ALBUMS_URL   = 'http://picasaweb.google.com/data/feed/api/user/default';
+    const UPLOAD_LOCATION   = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/default';
+    const ALBUM_PHOTO_LIST  = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/';
+    const PHOTO_SEARCH_URL  = 'https://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
+    const LIST_ALBUMS_URL   = 'https://picasaweb.google.com/data/feed/api/user/default';
 
     private $google_curl = null;
 
index 2c66b45..ccaf287 100644 (file)
@@ -67,7 +67,7 @@ class moodle_page_test extends UnitTestCase {
     }
 
     public function tearDown() {
-        global $COURSE;
+        global $COURSE, $PAGE;
         $this->testpage = NULL;
         $COURSE = $this->originalcourse;
         $PAGE = $this->originalpage;
index 6a1a132..96c6091 100644 (file)
@@ -59,7 +59,7 @@ class xmldb_key extends xmldb_object {
     /**
      * Set all the attributes of one xmldb_key
      *
-     * @param string type XMLDB_KEY_PRIMARY, XMLDB_KEY_UNIQUE, XMLDB_KEY_FOREIGN
+     * @param string type XMLDB_KEY_[PRIMARY|UNIQUE|FOREIGN|FOREIGN_UNIQUE]
      * @param array fields an array of fieldnames to build the key over
      * @param string reftable name of the table the FK points to or null
      * @param array reffields an array of fieldnames in the FK table or null
@@ -418,6 +418,9 @@ class xmldb_key extends xmldb_object {
             case XMLDB_KEY_FOREIGN:
                 $result .= 'XMLDB_KEY_FOREIGN' . ', ';
                 break;
+            case XMLDB_KEY_FOREIGN_UNIQUE:
+                $result .= 'XMLDB_KEY_FOREIGN_UNIQUE' . ', ';
+                break;
         }
     /// The fields
         $keyfields = $this->getFields();
@@ -427,7 +430,8 @@ class xmldb_key extends xmldb_object {
             $result .= 'null';
         }
     /// The FKs attributes
-        if ($this->getType() == XMLDB_KEY_FOREIGN) {
+        if ($this->getType() == XMLDB_KEY_FOREIGN ||
+            $this->getType() == XMLDB_KEY_FOREIGN_UNIQUE) {
         /// The reftable
             $reftable = $this->getRefTable();
             if (!empty($reftable)) {
index f698054..c4a390c 100644 (file)
@@ -1922,8 +1922,12 @@ class assignment_base {
                     $button->set_format_by_file($file);
                     $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                 }
-                $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
-                $output .= '<br />';
+
+                if ($CFG->enableplagiarism) {
+                    require_once($CFG->libdir.'/plagiarismlib.php');
+                    $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
+                    $output .= '<br />';
+                }
             }
             if ($CFG->enableportfolios && count($files) > 1  && $this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                 $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'submissionid' => $submission->id), '/mod/assignment/locallib.php');
index 3cbcc2f..b909f25 100644 (file)
@@ -110,11 +110,6 @@ class assignment_upload extends assignment_base {
         }
 
         if (empty($submission->timemarked)) {   /// Nothing to show, so print nothing
-            if ($this->count_responsefiles($USER->id)) {
-                echo $OUTPUT->heading(get_string('responsefiles', 'assignment'), 3);
-                $responsefiles = $this->print_responsefiles($USER->id, true);
-                echo $OUTPUT->box($responsefiles, 'generalbox boxaligncenter');
-            }
             return;
         }
 
@@ -126,7 +121,12 @@ class assignment_upload extends assignment_base {
             return;
         }
 
-        if ($grade->grade === null and empty($grade->str_feedback)) {   /// Nothing to show yet
+        if ($grade->grade === null and empty($grade->str_feedback)) {   // No grade to show yet
+            if ($this->count_responsefiles($USER->id)) {   // but possibly response files are present
+                echo $OUTPUT->heading(get_string('responsefiles', 'assignment'), 3);
+                $responsefiles = $this->print_responsefiles($USER->id, true);
+                echo $OUTPUT->box($responsefiles, 'generalbox boxaligncenter');
+            }
             return;
         }
 
index 4df3f6a..4ef840d 100644 (file)
@@ -204,11 +204,11 @@ class mod_choice_renderer extends plugin_renderer_base {
         if ($choices->viewresponsecapability && $choices->deleterepsonsecapability) {
             $selecturl = new moodle_url('#');
 
-            $selectallactions = new component_action('click',"select_all_in", array('div',null,'tablecontainer'));
+            $selectallactions = new component_action('click',"checkall");
             $selectall = new action_link($selecturl, get_string('selectall'), $selectallactions);
             $actiondata .= $this->output->render($selectall) . ' / ';
 
-            $deselectallactions = new component_action('click',"deselect_all_in", array('div',null,'tablecontainer'));
+            $deselectallactions = new component_action('click',"checknone");
             $deselectall = new action_link($selecturl, get_string('deselectall'), $deselectallactions);
             $actiondata .= $this->output->render($deselectall);
 
index 8d46a1d..209f54f 100644 (file)
@@ -48,7 +48,7 @@ if (substr($parts, -3) === '.js') {
 // if they are requesting a revision that's not -1, and they have supplied an
 // If-Modified-Since header, we can send back a 304 Not Modified since the
 // content never changes (the rev number is increased any time the content changes)
-if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
+if (strpos($parts, '/-1/') === false and (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))) {
     $lifetime = 60*60*24*30; // 30 days
     header('HTTP/1.1 304 Not Modified');
     header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');