Skip to content

Commit

Permalink
MDL-22813 Credit to Mark Nelson of Pukunui Technologies - tidied up t…
Browse files Browse the repository at this point in the history
…he portfolio management even further. Thanks!!
  • Loading branch information
moodler committed Jul 1, 2010
1 parent a481b2c commit 6902335
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
1 change: 0 additions & 1 deletion lang/en/portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
$string['plugincouldnotpackage'] = 'Failed to package up your data for export: original error was {$a}';
$string['pluginismisconfigured'] = 'Portfolio plugin is misconfigured, skipping. Error was: {$a}';
$string['portfolio'] = 'Portfolio';
$string['portfoliomisconfigured'] = 'Misconfigured';
$string['portfolios'] = 'Portfolios';
$string['queuesummary'] = 'Currently queued transfers';
$string['returntowhereyouwere'] = 'Return to where you were';
Expand Down
49 changes: 30 additions & 19 deletions lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5551,11 +5551,6 @@ public function output_html($data, $query='') {
'delete' => $strdelete
);

$actionchoicesforinsane = array(
'hide' => $strhide,
'delete' => $strdelete
);

$output = $OUTPUT->box_start('generalbox');

$plugins = get_plugin_list('portfolio');
Expand All @@ -5569,46 +5564,62 @@ public function output_html($data, $query='') {
$insane = portfolio_plugin_sanity_check($plugins);
$insaneinstances = portfolio_instance_sanity_check($instances);

$output .= portfolio_report_insane($insane, null, true);
$output .= portfolio_report_insane($insaneinstances, $instances, true);

$table = new html_table();
$table->head = array(get_string('plugin', 'portfolio'), '', '');
$table->data = array();

foreach ($instances as $i) {
$settings = '<a href="' . $this->baseurl . '&amp;action=edit&amp;pf=' . $i->get('id') . '">' . $strsettings .'</a>';
// Set some commonly used variables
$pluginid = $i->get('id');
$plugin = $i->get('plugin');
$pluginname = $i->get('name');

// Check if the instance is misconfigured
if (array_key_exists($i->get('plugin'), $insane) || array_key_exists($i->get('id'), $insaneinstances)) {
$select = new single_select($this->portfolio_action_url($i->get('id'), 'pf'), 'action', $actionchoicesforinsane, 'hide', null, 'applyto' . $i->get('id'));
$table->data[] = array($i->get('name') . " <strong>(" . get_string('portfoliomisconfigured', 'portfolio') . ")</strong>", $OUTPUT->render($select), $settings);
if (array_key_exists($plugin, $insane) || array_key_exists($pluginid, $insaneinstances)) {
if (!empty($insane[$plugin])) {
$information = $insane[$plugin];
} else if (!empty($insaneinstances[$pluginid])) {
$information = $insaneinstances[$pluginid];
}
$table->data[] = array($pluginname, $strdelete . " " . $OUTPUT->help_icon($information, 'portfolio_' . $plugin), $settings);
} else {
if ($i->get('visible')) {
$currentaction = 'show';
} else {
$currentaction = 'hide';
}
$select = new single_select($this->portfolio_action_url($i->get('id'), 'pf'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . $i->get('id'));
$table->data[] = array($i->get('name'), $OUTPUT->render($select), $settings);
$select = new single_select($this->portfolio_action_url($pluginid, 'pf'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . $pluginid);
$table->data[] = array($pluginname, $OUTPUT->render($select), $settings);
}
if (!in_array($i->get('plugin'), $usedplugins)) {
$usedplugins[] = $i->get('plugin');
if (!in_array($plugin, $usedplugins)) {
$usedplugins[] = $plugin;
}
}

// Create insane plugin array
$insaneplugins = array();
if (!empty($plugins)) {
foreach ($plugins as $p) {
// Check if it can not have multiple instances and has already been used
if (!portfolio_static_function($p, 'allows_multiple_instances') && in_array($p, $usedplugins)) {
continue;
}
// Check if it is misconfigured

// Check if it is misconfigured - if so store in array then display later
if (array_key_exists($p, $insane)) {
continue;
$insaneplugins[] = $p;
} else {
$select = new single_select($this->portfolio_action_url($p, 'pf'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . $p);
$table->data[] = array(portfolio_static_function($p, 'get_name'), $OUTPUT->render($select), '');
}
$select = new single_select($this->portfolio_action_url($p, 'pf'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . $p);
$table->data[] = array(portfolio_static_function($p, 'get_name'), $OUTPUT->render($select), '');
}
}

// Loop through all the insane plugins
if (!empty($insaneplugins)) {
foreach ($insaneplugins as $p) {
$table->data[] = array(portfolio_static_function($p, 'get_name'), $strdelete . " " . $OUTPUT->help_icon($insane[$p], 'portfolio_' . $p), '');
}
}

Expand Down
3 changes: 2 additions & 1 deletion portfolio/boxnet/lang/en/portfolio_boxnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
$string['apikey'] = 'API key';
$string['apikeyhelp'] = 'You need to get this by signing up to box.net as a developer and adding an application. The callback url must be yourwwwroot/portfolio/add.php?postcontrol=1&type=boxnet';
$string['apikeyinlinehelp'] = '<p>To configure Box.net, visit the developer page at <a href="http://www.box.net/developers/services">box.net</a> and log in.</p><p>Under My Projects you will need to create one new project for each Moodle site.</p><p>The only setting that matters is the callback url, which should be {$a}. You can put anything you like for the other settings. Save it and you\'re done!';
$string['err_noapikey'] = 'There is no API Key configured for this plugin. You can get one of these from http://enabled.box.net';
$string['err_noapikey'] = 'No API Key';
$string['err_noapikey_help'] = 'There is no API Key configured for this plugin. You can get one of these from http://enabled.box.net';
$string['existingfolder'] = 'Exiting folder to put file(s) into';
$string['folderclash'] = 'The folder you asked to create already exists!';
$string['foldercreatefailed'] = 'Failed to create your target folder on box.net';
Expand Down
3 changes: 2 additions & 1 deletion portfolio/flickr/lang/en/portfolio_flickr.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

$string['apikey'] = 'API key (you need to get this from http://flickr.com/services/api/keys/apply)';
$string['contenttype'] = 'Content types';
$string['err_noapikey'] = 'There is no API Key configured for this plugin. You can get one of these from http://flickr.com/services/api/keys/apply';
$string['err_noapikey'] = 'No API Key';
$string['err_noapikey_help'] = 'There is no API Key configured for this plugin. You can get one of these from http://flickr.com/services/api/keys/apply';
$string['hidefrompublicsearches'] = 'Hide these images from public searches?';
$string['isfamily'] = 'Visible to family';
$string['isfriend'] = 'Visible to friends';
Expand Down
12 changes: 8 additions & 4 deletions portfolio/mahara/lang/en/portfolio_mahara.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
*/

$string['enableleap2a'] = 'Enable Leap2a Portfolio support (requires Mahara 1.3)';
$string['err_invalidhost'] = 'This plugin is misconfigured to point to an invalid (or deleted) mnet host. This plugin relies on Moodle Networking peers with SSO IDP published, SSO_SP subscribed, and portfolio subscribed <b>and</b> published.';
$string['err_networkingoff'] = 'Moodle Networking is off entirely. Please enable it before trying to configure this pugin. Any instances of this plugin have been set to not visible until this is fixed - you will need to set them to visible again manully. They cannot be used until this happens';
$string['err_nomnetauth'] = 'The mnet authentication plugin is disabled, but is required for this service';
$string['err_nomnethosts'] = 'This plugin relies on Moodle Networking peers with SSO IDP published, SSO SP subscribed, Portfolio services published <b>and</b> subscribed as well as the mnet authentication plugin. Any instances of this plugin has been set to not visible until this is fixed - you will need to set them to visible again manually. They cannot be used before this happens.';
$string['err_invalidhost'] = 'Invalid mnet host';
$string['err_invalidhost_help'] = 'This plugin is misconfigured to point to an invalid (or deleted) mnet host. This plugin relies on Moodle Networking peers with SSO IDP published, SSO_SP subscribed, and portfolio subscribed <b>and</b> published.';
$string['err_networkingoff'] = 'Moodle Networking is off';
$string['err_networkingoff_help'] = 'Moodle Networking is off entirely. Please enable it before trying to configure this pugin. Any instances of this plugin have been set to not visible until this is fixed - you will need to set them to visible again manully. They cannot be used until this happens';
$string['err_nomnetauth'] = 'The mnet authentication plugin is disabled';
$string['err_nomnetauth_help'] = 'The mnet authentication plugin is disabled, but is required for this service';
$string['err_nomnethosts'] = 'Relies on Moodle Networking';
$string['err_nomnethosts_help'] = 'This plugin relies on Moodle Networking peers with SSO IDP published, SSO SP subscribed, Portfolio services published <b>and</b> subscribed as well as the mnet authentication plugin. Any instances of this plugin has been set to not visible until this is fixed - you will need to set them to visible again manually. They cannot be used before this happens.';
$string['failedtojump'] = 'Failed to start communication with remote server';
$string['failedtoping'] = 'Failed to start communication with remote server: {$a}';
$string['mnethost'] = 'MNet Host';
Expand Down

0 comments on commit 6902335

Please sign in to comment.