]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16422 add option to share files and new folders in box.net portfolio plugin
authormjollnir_ <mjollnir_>
Thu, 11 Sep 2008 14:13:58 +0000 (14:13 +0000)
committermjollnir_ <mjollnir_>
Thu, 11 Sep 2008 14:13:58 +0000 (14:13 +0000)
lang/en_utf8/portfolio_boxnet.php
portfolio/type/boxnet/lib.php

index af6ab8f0ba8364c92d31a9c462bf32d204dcd09b..92e57fa31446d9aaf671a658da50342e58333842 100644 (file)
@@ -14,6 +14,8 @@ $string['notarget'] = 'You must specify either an existing folder or a new folde
 $string['password'] = 'Your box.net password (will not be stored)';
 $string['pluginname'] = 'Box.net internet storage';
 $string['sharedfolder'] = 'Shared';
+$string['sharefile'] = 'Share this file?';
+$string['sharefolder'] = 'Share this new folder?';
 $string['targetfolder'] = 'Target folder';
 $string['tobecreated'] = 'To be created';
 $string['username'] = 'Your box.net username (will not be stored)';
index 94ae3ce179ac12b61137e5832476483fee40c15b..45a5e6e34b7e06e17bb4e8288a411bf2102e8ab9 100644 (file)
@@ -17,7 +17,7 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
     public function prepare_package() {
         // if we need to create the folder, do it now
         if ($newfolder = $this->get_export_config('newfolder')) {
-            if (!$created = $this->boxclient->createFolder($newfolder, array('share' => 0))) {
+            if (!$created = $this->boxclient->createFolder($newfolder, array('share' => $this->get_export_config('sharefolder')))) {
                 throw new portfolio_plugin_exception('foldercreatefailed', 'portfolio_boxnet');
             }
             $this->folders[$created['folder_id']] = $created['folder_name'];
@@ -33,7 +33,7 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
                 array(
                     'file'      => $file,
                     'folder_id' => $this->get_export_config('folder'),
-                    'share'     => 0,
+                    'share'     => $this->get_export_config('sharefile'),
                 )
             );
             if (array_key_exists('status', $return) && $return['status'] == 'upload_ok'
@@ -85,13 +85,15 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
     }
 
     public function get_allowed_export_config() {
-        return array('folder', 'newfolder');
+        return array('folder', 'newfolder', 'sharefile', 'sharefolder');
     }
 
     public function export_config_form(&$mform) {
         $folders = $this->get_folder_list();
         $strrequired = get_string('required');
+        $mform->addElement('checkbox', 'plugin_sharefile', get_string('sharefile', 'portfolio_boxnet'));
         $mform->addElement('text', 'plugin_newfolder', get_string('newfolder', 'portfolio_boxnet'));
+        $mform->addElement('checkbox', 'plugin_sharefolder', get_string('sharefolder', 'portfolio_boxnet'));
         if (empty($folders)) {
             $mform->addRule('plugin_newfolder', $strrequired, 'required', null, 'client');
         }