Merge branch 'MDL-33999' of git://github.com/nebgor/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 25 Jun 2012 08:35:09 +0000 (16:35 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 25 Jun 2012 08:35:09 +0000 (16:35 +0800)
12 files changed:
course/yui/dragdrop/dragdrop.js
files/renderer.php
lib/filestorage/zip_packer.php
lib/yui/blocks/blocks.js
repository/equella/callback.php
repository/equella/lib.php
repository/lib.php
theme/anomaly/style/dock.css
theme/base/pix/fp/alias_sm.png [new file with mode: 0644]
theme/base/pix/fp/link_sm.png [new file with mode: 0644]
theme/base/style/course.css
theme/base/style/filemanager.css

index 2b492ad..435b355 100644 (file)
@@ -91,7 +91,7 @@ YUI.add('moodle-course-dragdrop', function(Y) {
                             // Keep it inside the .course-content
                             constrain: '#'+CSS.PAGECONTENT,
                             stickY: true
-                        });
+                        }).plug(Y.Plugin.DDWinScroll);
                     }
                 }
             }, this);
@@ -306,7 +306,7 @@ YUI.add('moodle-course-dragdrop', function(Y) {
                     }).plug(Y.Plugin.DDConstrained, {
                         // Keep it inside the .course-content
                         constrain: '#'+CSS.PAGECONTENT
-                    });
+                    }).plug(Y.Plugin.DDWinScroll);
                 }
             }, this);
         },
@@ -411,4 +411,4 @@ YUI.add('moodle-course-dragdrop', function(Y) {
     M.course.init_section_dragdrop = function(params) {
         new DRAGSECTION(params);
     }
-}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'moodle-core-dragdrop', 'moodle-enrol-notification', 'moodle-course-coursebase']});
+}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'dd-scroll', 'moodle-core-dragdrop', 'moodle-enrol-notification', 'moodle-course-coursebase']});
index a403144..33a70f6 100644 (file)
@@ -279,6 +279,8 @@ class core_files_renderer extends plugin_renderer_base {
 <span class="fp-filename-icon">
     <a href="#">
     <span class="{!}fp-icon"></span>
+    <span class="fp-reficons1"></span>
+    <span class="fp-reficons2"></span>
     <span class="{!}fp-filename"></span>
     </a>
     <a class="{!}fp-contextmenu" href="#" onclick="return false;">'.$this->pix_icon('i/menu', '▶').'</a>
index 2cae435..a7726a6 100644 (file)
@@ -299,7 +299,7 @@ class zip_packer extends file_packer {
         global $CFG;
 
         if (!is_string($archivefile)) {
-            return $archivefile->extract_to_pathname($this, $contextid, $component, $filearea, $itemid, $pathbase, $userid);
+            return $archivefile->extract_to_storage($this, $contextid, $component, $filearea, $itemid, $pathbase, $userid);
         }
 
         check_dir_exists($CFG->tempdir.'/zip');
index 8555f32..21cc5f1 100644 (file)
@@ -87,7 +87,7 @@ YUI.add('moodle-core-blocks', function(Y) {
                         }).plug(Y.Plugin.DDConstrained, {
                             // Keep it inside the .course-content
                             constrain: '#'+CSS.PAGECONTENT
-                        });
+                        }).plug(Y.Plugin.DDWinScroll);
                     }
                 }, this);
             }, this);
@@ -267,5 +267,5 @@ YUI.add('moodle-core-blocks', function(Y) {
     M.core_blocks.init_dragdrop = function(params) {
         new DRAGBLOCK(params);
     }
-}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'moodle-core-dragdrop', 'moodle-enrol-notification']});
+}, '@VERSION@', {requires:['base', 'node', 'io', 'dom', 'dd', 'dd-scroll', 'moodle-core-dragdrop', 'moodle-enrol-notification']});
 
index 0a5b083..01fc27d 100644 (file)
@@ -55,6 +55,8 @@ if (isset($info->license)) {
     $license = s(clean_param($info->license, PARAM_ALPHAEXT));
 }
 
+$source = base64_encode(serialize((object)array('url'=>$url,'filename'=>$filename)));
+
 $js =<<<EOD
 <html>
 <head>
@@ -63,7 +65,7 @@ $js =<<<EOD
     window.onload = function() {
         var resource = {};
         resource.title = "$filename";
-        resource.source = "$url";
+        resource.source = "$source";
         resource.thumbnail = '$thumbnail';
         resource.author = "$author";
         resource.license = "$license";
index 3665ef1..d520a2c 100644 (file)
@@ -85,7 +85,7 @@ class repository_equella extends repository {
                 . '&returnprefix=tle'
                 . '&template=standard'
                 . '&token='.urlencode($this->getssotoken('write'))
-                . '&courseId='.urlencode($COURSE->id)
+                . '&courseId='.urlencode($COURSE->idnumber)
                 . '&courseCode='.urlencode($COURSE->shortname)
                 . '&action=searchThin'
                 . '&forcePost=true'
@@ -119,7 +119,7 @@ class repository_equella extends repository {
      * @return string file referece
      */
     public function get_file_reference($source) {
-        return base64_encode($source);
+        return $source;
     }
 
     /**
@@ -156,8 +156,8 @@ class repository_equella extends repository {
      * @return null|stdClass containing attribute 'filepath'
      */
     public function get_file_by_reference($reference) {
-        $ref = base64_decode($reference->reference);
-        $url = $this->appendtoken($ref);
+        $ref = unserialize(base64_decode($reference->reference));
+        $url = $this->appendtoken($ref->url);
 
         if (!$url) {
             // Occurs when the user isn't known..
@@ -188,8 +188,8 @@ class repository_equella extends repository {
      * @param array $options additional options affecting the file serving
      */
     public function send_file($stored_file, $lifetime=86400 , $filter=0, $forcedownload=false, array $options = null) {
-        $reference = base64_decode($stored_file->get_reference());
-        $url = $this->appendtoken($reference);
+        $reference  = unserialize(base64_decode($stored_file->get_reference()));
+        $url = $this->appendtoken($reference->url);
         if ($url) {
             header('Location: ' . $url);
         } else {
@@ -337,4 +337,32 @@ class repository_equella extends repository {
     private static function to_mime_type($value) {
         return mimeinfo('type', $value);
     }
+
+    /**
+     * Return the source information
+     *
+     * @param stdClass $url
+     * @return string|null
+     */
+    public function get_file_source_info($url) {
+        $ref = unserialize(base64_decode($url));
+        return 'EQUELLA: ' . $ref->filename;
+    }
+
+    /**
+     * Return human readable reference information
+     * {@link stored_file::get_reference()}
+     *
+     * @param string $reference
+     * @param int $filestatus status of the file, 0 - ok, 666 - source missing
+     * @return string
+     */
+    public function get_reference_details($reference, $filestatus = 0) {
+        if (!$filestatus) {
+            $ref = unserialize(base64_decode($reference));
+            return $this->get_name(). ': '. $ref->filename;
+        } else {
+            return get_string('lostsource', 'repository', '');
+        }
+    }
 }
index f897bf2..6231209 100644 (file)
@@ -1662,12 +1662,14 @@ abstract class repository {
     }
 
     /**
-     * Does it return a file url or a item_id
+     * Tells how the file can be picked from this repository
      *
-     * @return string
+     * Maximum value is FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE
+     *
+     * @return int
      */
     public function supported_returntypes() {
-        return (FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE);
+        return (FILE_INTERNAL | FILE_EXTERNAL);
     }
 
     /**
index 8c7086d..497cf7c 100644 (file)
@@ -60,7 +60,6 @@ body.has_dock {
 }
 #dock .dockedtitle.activeitem {
     background-color: #697F55;
-    width: 35px;
     -webkit-border-top-left-radius: 10px;
     -moz-border-radius-topleft: 10px;
     border-top-left-radius: 10px;
@@ -101,7 +100,7 @@ Docked Item Panel
 
 }
 #dockeditempanel .dockeditempanel_hd {
-    border-width: 0;
+    border-color: #eee;
     background-color: #eee;
     padding: 2px;
 }
diff --git a/theme/base/pix/fp/alias_sm.png b/theme/base/pix/fp/alias_sm.png
new file mode 100644 (file)
index 0000000..80fbfaf
Binary files /dev/null and b/theme/base/pix/fp/alias_sm.png differ
diff --git a/theme/base/pix/fp/link_sm.png b/theme/base/pix/fp/link_sm.png
new file mode 100644 (file)
index 0000000..f7160b4
Binary files /dev/null and b/theme/base/pix/fp/link_sm.png differ
index b2f0a39..4d3039e 100644 (file)
@@ -171,5 +171,3 @@ input.titleeditor {
 .dndupload-progress-outer {width:70px;border:solid black 1px;height:10px;display:inline-block;margin:0;padding:0;overflow:hidden;position:relative;}
 .dndupload-progress-inner {width:0%;height:100%;background-color:green;display:inline-block;margin:0;padding:0;float:left;}
 .dndupload-hidden {display:none;}
-
-.dir-rtl.path-course-view li.activity form.togglecompletion, .dir-rtl.path-course-view li.activity span.autocompletion
index c8d79ef..86d0446 100644 (file)
@@ -310,6 +310,9 @@ a.ygtvspacer:hover {color: transparent;text-decoration: none;}
 .filemanager .yui3-datatable-odd .yui3-datatable-cell {background-color: #F6F6F6!important;border-left: 0px solid #F6F6F6;}
 .filemanager .yui3-datatable-even .yui3-datatable-cell {background-color: #FFFFFF!important;border-left: 0px solid #FFFFFF;}
 
+.filemanager .fp-filename-icon.fp-hasreferences .fp-reficons1{background: url('[[pix:theme|fp/link_sm]]') no-repeat 0 0;height:100%;width:100%;position:absolute;top: 8px;left: 17px;z-index:1000;}
+.filemanager .fp-filename-icon.fp-isreference .fp-reficons2 {background: url('[[pix:theme|fp/alias_sm]]') no-repeat 0 0;height:100%;width:100%;position:absolute;top: 9px;left: -6px;z-index:1001;}
+
 /*
  * Folder Context Menu (File Manager only)
  */