]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14591 - added a get_name static method to portfolio plugins and use this as a...
authormjollnir_ <mjollnir_>
Tue, 2 Sep 2008 16:21:14 +0000 (16:21 +0000)
committermjollnir_ <mjollnir_>
Tue, 2 Sep 2008 16:21:14 +0000 (16:21 +0000)
also fixed a small bug in 'cleanup' function. nico - your flickr plugin is missing a string for the name

lang/en_utf8/portfolio_boxnet.php
lang/en_utf8/portfolio_download.php
lang/en_utf8/portfolio_mahara.php
lib/adminlib.php
lib/portfoliolib.php
portfolio/type/boxnet/lib.php
portfolio/type/download/lib.php
portfolio/type/flickr/lib.php
portfolio/type/mahara/lib.php

index fc04ab299b35e14e924801131af275c04ff7377e..783d347ede2d9fe3139d78073742f1a386fcc745 100644 (file)
@@ -11,6 +11,7 @@ $string['noauthtoken'] = 'Could not retrieve an authentication token for use in
 $string['noticket'] = 'Could not retrieve a ticket from box.net to begin the authentication session';
 $string['notarget'] = 'You must specify either an existing folder or a new folder to upload into';
 $string['password'] = 'Your box.net password (will not be stored)';
+$string['pluginname'] = 'Box.net internet storage';
 $string['sharedfolder'] = 'Shared';
 $string['targetfolder'] = 'Target folder';
 $string['username'] = 'Your box.net username (will not be stored)';
index 3f7e50bbf046a94ea96558363c2096ff886e2aa2..f2a3b9864b5e0172c0c31e425e20abd142318556 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
 $string['downloadfile'] = 'Download your portfolio export file';
+$string['pluginname'] = 'File download';
 
 ?>
index c19aa4d78e6a43a89a3a176544ae7114446c11fc..95d646a8eb072e61082be2d82804e8bfba99986d 100644 (file)
@@ -15,4 +15,5 @@ $string['pf_description'] = 'Allow users to push Moodle content to this host<br
                                  '<ul><li><em>Dependency</em>: You must also <strong>publish</strong> the SSO (Identify Provider) service to $a.</li>' .
                                  '<li><em>Dependency</em>: You must also <strong>subscribe</strong> to the SSO (Service Provider) service on $a</li>' .
                                  '<li><em>Dependency</em>: You must also enable the mnet authentication plugin.</li></ul><br />';
+$string['pluginname'] = 'Mahara ePortfolio';
 ?>
index 1e7edc4b7e94ec61994ddc7458a1c2cd1ec00e93..000cd145e62e0e6f53b70abe5684454bd5a6f445 100644 (file)
@@ -4699,7 +4699,7 @@ class admin_setting_manageportfolio extends admin_setting {
                 $row .= ' <a href="' . $this->baseurl . '&hide=' . $i->get('id') . '"><img src="' . $CFG->pixpath . '/t/'
                     . ($i->get('visible') ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get('visible') ? 'hide' : 'show') . '" /></a>' . "\n";
             }
-            $table->data[] = array($i->get('name'), $i->get('plugin'), $row);
+            $table->data[] = array($i->get('name'), $i->get_name() . ' (' . $i->get('plugin') . ')', $row);
             if (!in_array($i->get('plugin'), $alreadyplugins)) {
                 $alreadyplugins[] = $i->get('plugin');
             }
@@ -4717,7 +4717,7 @@ class admin_setting_manageportfolio extends admin_setting {
                 continue;
             }
 
-            $instancehtml .= '<a href="' . $this->baseurl . '&amp;new=' . $p . '">' . s($p) . '</a><br />' . "\n";
+            $instancehtml .= '<a href="' . $this->baseurl . '&amp;new=' . $p . '">' . portfolio_static_function($p, 'get_name') . ' (' . s($p) . ')' . '</a><br />' . "\n";
             $addable++;
         }
 
index 1cbf1818846f1a697597d305032b797d4a9cfc96..0e5396bb208ac8815c4bb9ec51462c8e2d67ef3b 100644 (file)
@@ -1017,6 +1017,8 @@ abstract class portfolio_plugin_base {
     */
     public abstract function is_push();
 
+    public static abstract function get_name();
+
     /**
     * check sanity of plugin
     * if this function returns something non empty, ALL instances of your plugin
@@ -1734,7 +1736,7 @@ final class portfolio_admin_form extends moodleform {
             }
         }
 
-        if (is_array($insane)) {
+        if (isset($insane) && is_array($insane)) {
             $insane = array_shift($insane);
         }
         if (isset($insane) && is_string($insane)) { // something went wrong, warn...
@@ -1752,7 +1754,10 @@ final class portfolio_admin_form extends moodleform {
                 $data[$config] = $this->instance->get_config($config);
             }
             $this->set_data($data);
+        } else {
+            $this->set_data(array('name' => portfolio_static_function($this->plugin, 'get_name')));
         }
+
         $this->add_action_buttons(true, get_string('save', 'portfolio'));
     }
 
@@ -2162,7 +2167,10 @@ final class portfolio_exporter {
             unset($SESSION->portfolioexport);
             return true;
         }
-        $this->get('instance')->cleanup();
+        if ($this->get('instance')) {
+            // might not be set - before export really starts
+            $this->get('instance')->cleanup();
+        }
         $DB->delete_records('portfolio_tempdata', array('id' => $this->id));
         $fs = get_file_storage();
         $fs->delete_area_files(SYSCONTEXTID, 'portfolio_exporter', $this->id);
index 108a27645ccb016d4071d958f280cd3cbeb948ba..a2726cc07884ccdbc8721f86dc0786cd99ba728d 100644 (file)
@@ -10,6 +10,10 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
     private $folders;
     private $accounttree;
 
+    public static function get_name() {
+        return get_string('pluginname', 'portfolio_boxnet');
+    }
+
     public function prepare_package() {
         return true; // don't do anything else for this plugin, we want to send all files as they are.
     }
index f09ff5961cc531ed553bb9448ec50bab70010c4b..2296a54fcd1de55cccc1bbf49679e0f5da8ea3ed 100644 (file)
@@ -7,6 +7,10 @@ class portfolio_plugin_download extends portfolio_plugin_pull_base {
 
     protected $exportconfig;
 
+    public static function get_name() {
+        return get_string('pluginname', 'portfolio_download');
+    }
+
     public static function allows_multiple() {
         return false;
     }
index 139c797526d739e69e839cedfaf8c41481a44d1d..dbf3a2519422dd170a2d3171c49aa819ddbfe578 100755 (executable)
@@ -6,6 +6,10 @@ class portfolio_plugin_flickr extends portfolio_plugin_push_base {
 
     private $flickr;
 
+    public static function get_name() {
+        return get_string('pluginname', 'portfolio_flickr');
+    }
+
     public function prepare_package() {
         $this->flickr = new phpFlickr($this->get_config('apikey'), $this->get_config('sharedsecret'));
         return true; // don't do anything else for this plugin, we want to send all files as they are.
index b0ef8c87e83fbf1c51099e40b03d17db03de5722..93f58145cca6dcaffd4849d567fa43869a4dd345 100644 (file)
@@ -20,6 +20,10 @@ class portfolio_plugin_mahara extends portfolio_plugin_pull_base {
     private $sendtype; // whatever mahara has said it can handle (immediate or queued)
     private $filesmanifest; // manifest of files to send to mahara (set during prepare_package and sent later)
 
+    public static function get_name() {
+        return get_string('pluginname', 'portfolio_mahara');
+    }
+
     public static function get_allowed_config() {
         return array('mnethostid');
     }