MDL-13766, fix lang strings and small bugs
authordongsheng <dongsheng>
Wed, 27 Aug 2008 06:23:01 +0000 (06:23 +0000)
committerdongsheng <dongsheng>
Wed, 27 Aug 2008 06:23:01 +0000 (06:23 +0000)
lang/en_utf8/repository.php
repository/boxnet/boxlibphp5.php
repository/lib.php
repository/ws.php

index b44065b7c6e8021d75dfe6cc3dae6cb973e408b4..e974d7a2277c656af85813a2cb6d858c860f065e 100644 (file)
@@ -15,6 +15,7 @@ $string['downloadsucc'] = 'The file has been downloaded successfully';
 $string['error'] = 'An unknown error occurred!';
 $string['filename'] = 'Filename';
 $string['filesaved'] = 'The file has been saved';
+$string['getfile'] = 'Select this file';
 $string['instance'] = 'instance';
 $string['invalidrepositoryid'] = 'Invalid repository ID';
 $string['invalidplugin'] = 'Invalid repository plug-in';
@@ -32,6 +33,7 @@ $string['plugin'] = 'Repository plug-ins';
 $string['repository'] = 'Repository';
 $string['repositories'] = 'Repositories';
 $string['save'] = 'Save';
+$string['saveas'] = 'Save As';
 $string['saved'] = 'Saved';
 $string['saving'] = 'Saving';
 $string['settings'] = 'Settings';
index 1b485e8ac61994c94a2a5f459cbf7ded07d4a61e..a4312d6d745592408fc9724b38d3b2d80fe49694 100755 (executable)
@@ -20,7 +20,7 @@
 class boxclient {
     public $auth_token = '';
 
-    private $_box_api_url = 'http://www.box.net/api/1.0/rest';
+    private $_box_api_url = 'http://box.net/api/1.0/rest';
     private $_box_api_upload_url = 'http://upload.box.net/api/1.0/upload';
     private $_error_code = '';
     private $_error_msg = '';
@@ -144,7 +144,7 @@ class boxclient {
         } catch (Exception $e){
         }
         $ret = array();
-        $o = simplexml_load_string($xml);
+        $o = simplexml_load_string(trim($xml));
         if($o->status == 'listing_ok') {
             $tree = $o->tree->folder;
             $this->buildtree($tree, $ret);
index fa472afb137238ea2888497543fb57599e92402f..f9399b84e3b309caa64137a684605c904506df50 100644 (file)
@@ -530,16 +530,18 @@ function repository_static_function($plugin, $function) {
  * @param string file path in download folder
  * @param string file name
  * @param int itemid to identify a file in filepool
+ * @param string file area
+ * @param string filepath in file area
  * @return array information of file in file pool
  */
-function move_to_filepool($path, $name, $itemid) {
+function move_to_filepool($path, $name, $itemid, $filearea = 'user_draft', $filepath = '/') {
     global $DB, $CFG, $USER;
     $context = get_context_instance(CONTEXT_USER, $USER->id);
     $entry = new object();
-    $entry->filearea  = 'user_draft';
+    $entry->filearea  = $filearea;
     $entry->contextid = $context->id;
     $entry->filename  = $name;
-    $entry->filepath  = '/';
+    $entry->filepath  = $filepath;
     $entry->timecreated  = time();
     $entry->timemodified = time();
     if(is_numeric($itemid)) {
@@ -572,7 +574,7 @@ function get_repository_client($context){
     $stradd  = get_string('add', 'repository');
     $strback      = get_string('back', 'repository');
     $strclose     = get_string('close', 'repository');
-    $strdownbtn   = get_string('download', 'repository');
+    $strdownbtn   = get_string('getfile', 'repository');
     $strdownload  = get_string('downloadsucc', 'repository');
     $strdate      = get_string('date', 'repository').': ';
     $strerror     = get_string('error', 'repository');
index ad71f65227aabbcf9349bae5b4aec43bda0f3662..37edbe255e367c4507a10b5c2f239afa6c98ab77 100644 (file)
@@ -7,7 +7,7 @@ require_once('../lib/filelib.php');
 require_once('lib.php');
 // set one hour here
 $CFG->repository_cache_expire = 60*60;
-// page
+// page or path
 $p     = optional_param('p', '', PARAM_INT);
 // opened in editor or moodleform
 $env   = optional_param('env', 'form', PARAM_ALPHA);
@@ -24,6 +24,8 @@ $repo_id = optional_param('repo_id', 1, PARAM_INT);
 // what will happen if user use a fake ctx_id?
 // Think about using $SESSION save it
 $ctx_id  = optional_param('ctx_id', SITEID, PARAM_INT);
+$filearea = optional_param('filearea', 'user_draft', PARAM_RAW);
+$filepath = optional_param('filepath', '/', PARAM_RAW);
 $userid  = $USER->id;
 
 if(!$repository = repository_instance($repo_id))
@@ -71,7 +73,7 @@ if ($action == 'list' || $action == 'search') {
     $path = $repo->get_file($file, $title);
     $itemid = (int)substr(hexdec(uniqid()), 0, 9)+rand(1,100);
     try {
-        $info = move_to_filepool($path, $title, $itemid);
+        $info = move_to_filepool($path, $title, $itemid, $filearea, $filepath);
         if($env == 'form'){
             echo json_encode($info['id']);
         } elseif($env == 'editor') {