diff --git a/lib/googleapi.php b/lib/googleapi.php
index 51292947113..5994dd382d8 100644
--- a/lib/googleapi.php
+++ b/lib/googleapi.php
@@ -1,276 +1,62 @@
.
+
/**
- * Moodle - Modular Object-Oriented Dynamic Learning Environment
- * http://moodle.org
- * Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
+ * Simple implementation of some Google API functions for Moodle.
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
+ * @package core
+ * @copyright Dan Poltawski
{$a->callbackurl}
'; $string['noauthtoken'] = 'An authentication token has not been recieved from google. Please ensure you are allowing moodle to access your google account'; $string['nosessiontoken'] = 'A session token does not exist preventing export to google.'; $string['pluginname'] = 'Google Docs'; $string['sendfailed'] = 'The file {$a} failed to transfer to google'; +$string['secret'] = 'Secret'; diff --git a/portfolio/googledocs/lib.php b/portfolio/googledocs/lib.php index 2223f9d4831..c641f096df1 100644 --- a/portfolio/googledocs/lib.php +++ b/portfolio/googledocs/lib.php @@ -1,4 +1,19 @@ . + /** * Google Documents Portfolio Plugin * @@ -9,18 +24,10 @@ require_once($CFG->libdir.'/portfolio/plugin.php'); require_once($CFG->libdir.'/googleapi.php'); class portfolio_plugin_googledocs extends portfolio_plugin_push_base { - private $sessiontoken; + private $googleoauth = null; public function supported_formats() { - return array( - PORTFOLIO_FORMAT_PLAINHTML, - PORTFOLIO_FORMAT_IMAGE, - PORTFOLIO_FORMAT_TEXT, - PORTFOLIO_FORMAT_PDF, - PORTFOLIO_FORMAT_DOCUMENT, - PORTFOLIO_FORMAT_PRESENTATION, - PORTFOLIO_FORMAT_SPREADSHEET - ); + return array(PORTFOLIO_FORMAT_FILE); } public static function get_name() { @@ -28,29 +35,27 @@ class portfolio_plugin_googledocs extends portfolio_plugin_push_base { } public function prepare_package() { - // we send the files as they are, no prep required + // We send the files as they are, no prep required. return true; } - public function get_interactive_continue_url(){ + public function get_interactive_continue_url() { return 'http://docs.google.com/'; } public function expected_time($callertime) { - // we trust what the portfolio says + // We trust what the portfolio says. return $callertime; } public function send_package() { - - if(!$this->sessiontoken){ - throw new portfolio_plugin_exception('nosessiontoken', 'portfolio_googledocs'); + if (!$this->googleoauth) { + throw new portfolio_plugin_exception('noauthtoken', 'portfolio_googledocs'); } - $gdocs = new google_docs(new google_authsub($this->sessiontoken)); - + $gdocs = new google_docs($this->googleoauth); foreach ($this->exporter->get_tempfiles() as $file) { - if(!$gdocs->send_file($file)){ + if (!$gdocs->send_file($file)) { throw new portfolio_plugin_exception('sendfailed', 'portfolio_gdocs', $file->get_filename()); } } @@ -62,20 +67,12 @@ class portfolio_plugin_googledocs extends portfolio_plugin_push_base { return false; } - $sesskey = google_docs::get_sesskey($this->get('user')->id); - - if($sesskey){ - try{ - $gauth = new google_authsub($sesskey); - $this->sessiontoken = $sesskey; - return false; - }catch(Exception $e){ - // sesskey is not valid, delete store and re-auth - google_docs::delete_sesskey($this->get('user')->id); - } + $this->initialize_oauth(); + if ($this->googleoauth->is_logged_in()) { + return false; + } else { + return $this->googleoauth->get_login_url(); } - - return google_authsub::login_url($CFG->wwwroot.'/portfolio/add.php?postcontrol=1&id=' . $this->exporter->get('id') . '&sesskey=' . sesskey(), google_docs::REALM); } public function post_control($stage, $params) { @@ -83,43 +80,50 @@ class portfolio_plugin_googledocs extends portfolio_plugin_push_base { return; } - if(!array_key_exists('token', $params)){ - throw new portfolio_plugin_exception('noauthtoken', 'portfolio_googledocs'); + $this->initialize_oauth(); + if ($this->googleoauth->is_logged_in()) { + return false; + } else { + return $this->googleoauth->get_login_url(); } - - // we now have our auth token, get a session token.. - $gauth = new google_authsub(false, $params['token']); - $this->sessiontoken = $gauth->get_sessiontoken(); - - google_docs::set_sesskey($this->sessiontoken, $this->get('user')->id); } public static function allows_multiple_instances() { return false; } -} -/** - * Registers to the user_deleted event to revoke any - * subauth tokens we have from them - * - * @param $user user object - * @return boolean true in all cases as its only minor cleanup - */ -function portfolio_googledocs_user_deleted($user){ - // it is only by luck that the user prefstill exists now? - // We probably need a pre-delete event? - if($sesskey = google_docs::get_sesskey($user->id)){ - try{ - $gauth = new google_authsub($sesskey); - - $gauth->revoke_session_token(); - }catch(Exception $e){ - // we don't care that much about success- just being good - // google api citzens - return true; - } + public static function has_admin_config() { + return true; } - return true; + public static function get_allowed_config() { + return array('clientid', 'secret'); + } + + public function admin_config_form(&$mform) { + $a = new stdClass; + $a->docsurl = get_docs_url('Google_OAuth2_Setup'); + $a->callbackurl = google_oauth::callback_url()->out(false); + + $mform->addElement('static', null, '', get_string('oauthinfo', 'portfolio_googledocs', $a)); + + $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_googledocs')); + $mform->addElement('text', 'secret', get_string('secret', 'portfolio_googledocs')); + + $strrequired = get_string('required'); + $mform->addRule('clientid', $strrequired, 'required', null, 'client'); + $mform->addRule('secret', $strrequired, 'required', null, 'client'); + } + + private function initialize_oauth() { + $returnurl = new moodle_url('/portfolio/add.php'); + $returnurl->param('postcontrol', 1); + $returnurl->param('id', $this->exporter->get('id')); + $returnurl->param('sesskey', sesskey()); + + $clientid = $this->get_config('clientid'); + $secret = $this->get_config('secret'); + + $this->googleoauth = new google_oauth($clientid, $secret, $returnurl->out(false), google_docs::REALM); + } } diff --git a/portfolio/googledocs/version.php b/portfolio/googledocs/version.php index 20446664e67..a64c628b0b5 100644 --- a/portfolio/googledocs/version.php +++ b/portfolio/googledocs/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2011112900; // Requires this Moodle version -$plugin->component = 'portfolio_googledocs'; // Full name of the plugin (used for diagnostics) +$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2012051100; // Requires this Moodle version. +$plugin->component = 'portfolio_googledocs'; // Full name of the plugin (used for diagnostics). $plugin->cron = 0; diff --git a/portfolio/picasa/lang/en/portfolio_picasa.php b/portfolio/picasa/lang/en/portfolio_picasa.php index fec154b9391..10c12e66152 100644 --- a/portfolio/picasa/lang/en/portfolio_picasa.php +++ b/portfolio/picasa/lang/en/portfolio_picasa.php @@ -1,5 +1,4 @@ To use the Picasa portfolio you must be registered with Google. Instructions for registing your installation with Google are described in Moodle Docs. The redirect url should be set to:{$a->callbackurl}
'; $string['noauthtoken'] = 'An authentication token has not been recieved from google. Please ensure you are allowing moodle to access your google account'; $string['pluginname'] = 'Picasa'; $string['sendfailed'] = 'The file {$a} failed to transfer to picasa'; +$string['secret'] = 'Secret'; diff --git a/portfolio/picasa/lib.php b/portfolio/picasa/lib.php index a9ba23fd886..6d21336214b 100644 --- a/portfolio/picasa/lib.php +++ b/portfolio/picasa/lib.php @@ -1,4 +1,19 @@ . + /** * Picasa Portfolio Plugin * @@ -9,7 +24,7 @@ require_once($CFG->libdir.'/portfolio/plugin.php'); require_once($CFG->libdir.'/googleapi.php'); class portfolio_plugin_picasa extends portfolio_plugin_push_base { - private $sessionkey; + private $googleoauth = null; public function supported_formats() { return array(PORTFOLIO_FORMAT_IMAGE, PORTFOLIO_FORMAT_VIDEO); @@ -20,11 +35,11 @@ class portfolio_plugin_picasa extends portfolio_plugin_push_base { } public function prepare_package() { - // we send the files as they are, no prep required + // We send the files as they are, no prep required. return true; } - public function get_interactive_continue_url(){ + public function get_interactive_continue_url() { return 'http://picasaweb.google.com/'; } @@ -33,40 +48,31 @@ class portfolio_plugin_picasa extends portfolio_plugin_push_base { } public function send_package() { - if(!$this->sessionkey){ + if (!$this->googleoauth) { throw new portfolio_plugin_exception('noauthtoken', 'portfolio_picasa'); } - $picasa = new google_picasa(new google_authsub($this->sessionkey)); - + $picasa = new google_picasa($this->googleoauth); foreach ($this->exporter->get_tempfiles() as $file) { - if(!$picasa->send_file($file)){ + if (!$picasa->send_file($file)) { throw new portfolio_plugin_exception('sendfailed', 'portfolio_picasa', $file->get_filename()); } } } public function steal_control($stage) { - global $CFG; if ($stage != PORTFOLIO_STAGE_CONFIG) { return false; } - $sesskey = google_picasa::get_sesskey($this->get('user')->id); + $this->initialize_oauth(); - if($sesskey){ - try{ - $gauth = new google_authsub($sesskey); - $this->sessionkey = $sesskey; - return false; - }catch(Exception $e){ - // sesskey is not valid, delete store and re-auth - google_picasa::delete_sesskey($this->get('user')->id); - } + if ($this->googleoauth->is_logged_in()) { + return false; + } else { + return $this->googleoauth->get_login_url(); } - - return google_authsub::login_url($CFG->wwwroot.'/portfolio/add.php?postcontrol=1&id=' . $this->exporter->get('id') . '&sesskey=' . sesskey(), google_picasa::REALM); } public function post_control($stage, $params) { @@ -74,44 +80,50 @@ class portfolio_plugin_picasa extends portfolio_plugin_push_base { return; } - if(!array_key_exists('token', $params)){ - throw new portfolio_plugin_exception('noauthtoken', 'portfolio_picasa'); + $this->initialize_oauth(); + if ($this->googleoauth->is_logged_in()) { + return false; + } else { + return $this->googleoauth->get_login_url(); } + } - // we now have our auth token, get a session token.. - $gauth = new google_authsub(false, $params['token']); - - $this->sessionkey = $gauth->get_sessiontoken(); - - google_picasa::set_sesskey($this->sessionkey, $this->get('user')->id); + public static function has_admin_config() { + return true; } public static function allows_multiple_instances() { return false; } -} -/** - * Registers to the user_deleted event to revoke any - * subauth tokens we have from them - * - * @param $user user object - * @return boolean true in all cases as its only minor cleanup - */ -function portfolio_picasa_user_deleted($user){ - // it is only by luck that the user prefstill exists now? - // We probably need a pre-delete event? - if($sesskey = google_picasa::get_sesskey($user->id)){ - try{ - $gauth = new google_authsub($sesskey); - - $gauth->revoke_session_token(); - }catch(Exception $e){ - // we don't care that much about success- just being good - // google api citzens - return true; - } + public static function get_allowed_config() { + return array('clientid', 'secret'); } - return true; + public function admin_config_form(&$mform) { + $a = new stdClass; + $a->docsurl = get_docs_url('Google_OAuth2_Setup'); + $a->callbackurl = google_oauth::callback_url()->out(false); + + $mform->addElement('static', null, '', get_string('oauthinfo', 'portfolio_picasa', $a)); + + $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_picasa')); + $mform->addElement('text', 'secret', get_string('secret', 'portfolio_picasa')); + + $strrequired = get_string('required'); + $mform->addRule('clientid', $strrequired, 'required', null, 'client'); + $mform->addRule('secret', $strrequired, 'required', null, 'client'); + } + + private function initialize_oauth() { + $returnurl = new moodle_url('/portfolio/add.php'); + $returnurl->param('postcontrol', 1); + $returnurl->param('id', $this->exporter->get('id')); + $returnurl->param('sesskey', sesskey()); + + $clientid = $this->get_config('clientid'); + $secret = $this->get_config('secret'); + + $this->googleoauth = new google_oauth($clientid, $secret, $returnurl->out(false), google_picasa::REALM); + } } diff --git a/portfolio/picasa/version.php b/portfolio/picasa/version.php index 7906a251af3..113c9cf9e0d 100644 --- a/portfolio/picasa/version.php +++ b/portfolio/picasa/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2011112900; // Requires this Moodle version -$plugin->component = 'portfolio_picasa'; // Full name of the plugin (used for diagnostics) +$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2012051100; // Requires this Moodle version. +$plugin->component = 'portfolio_picasa'; // Full name of the plugin (used for diagnostics). $plugin->cron = 0; diff --git a/portfolio/picasa/db/events.php b/repository/googledocs/db/upgrade.php similarity index 58% rename from portfolio/picasa/db/events.php rename to repository/googledocs/db/upgrade.php index 09ef7cca20c..76876a19ba2 100644 --- a/portfolio/picasa/db/events.php +++ b/repository/googledocs/db/upgrade.php @@ -15,19 +15,19 @@ // along with Moodle. If not, see{$a->callbackurl}
'; $string['pluginname'] = 'Google Docs'; -$string['configplugin'] = 'Configurate Google Docs plugin'; +$string['secret'] = 'Secret'; + diff --git a/repository/googledocs/lib.php b/repository/googledocs/lib.php index 36648bdb81e..6ccb33bc436 100644 --- a/repository/googledocs/lib.php +++ b/repository/googledocs/lib.php @@ -34,55 +34,40 @@ require_once($CFG->libdir.'/googleapi.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class repository_googledocs extends repository { - private $subauthtoken = ''; + private $googleoauth = null; public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { - global $USER; parent::__construct($repositoryid, $context, $options); - // TODO: I wish there was somewhere we could explicitly put this outside of constructor.. - $googletoken = optional_param('token', false, PARAM_RAW); - if($googletoken){ - $gauth = new google_authsub(false, $googletoken); // will throw exception if fails - google_docs::set_sesskey($gauth->get_sessiontoken(), $USER->id); - } + $returnurl = new moodle_url('/repository/repository_callback.php', + array('callback' => 'yes', 'repo_id' =>$this->id)); + + $clientid = get_config('googledocs', 'clientid'); + $secret = get_config('googledocs', 'secret'); + $this->googleoauth = new google_oauth($clientid, $secret, $returnurl->out(false), google_docs::REALM); + $this->check_login(); } public function check_login() { - global $USER; - - $sesskey = google_docs::get_sesskey($USER->id); - - if($sesskey){ - try{ - $gauth = new google_authsub($sesskey); - $this->subauthtoken = $sesskey; - return true; - }catch(Exception $e){ - // sesskey is not valid, delete store and re-auth - google_docs::delete_sesskey($USER->id); - } - } - - return false; + return $this->googleoauth->is_logged_in(); } - public function print_login($ajax = true){ - global $CFG; - if($ajax){ - $ret = array(); - $popup_btn = new stdClass(); - $popup_btn->type = 'popup'; - $returnurl = $CFG->wwwroot.'/repository/repository_callback.php?callback=yes&repo_id='.$this->id; - $popup_btn->url = google_authsub::login_url($returnurl, google_docs::REALM); - $ret['login'] = array($popup_btn); - return $ret; + public function print_login() { + $url = $this->googleoauth->get_login_url(); + + if ($this->options['ajax']) { + $popup = new stdClass(); + $popup->type = 'popup'; + $popup->url = $url->out(false); + return array('login' => array($popup)); + } else { + echo ''.get_string('login', 'repository').''; } } public function get_listing($path='', $page = '') { - $gdocs = new google_docs(new google_authsub($this->subauthtoken)); + $gdocs = new google_docs($this->googleoauth); $ret = array(); $ret['dynload'] = true; @@ -91,7 +76,7 @@ class repository_googledocs extends repository { } public function search($search_text, $page = 0) { - $gdocs = new google_docs(new google_authsub($this->subauthtoken)); + $gdocs = new google_docs($this->googleoauth); $ret = array(); $ret['dynload'] = true; @@ -99,37 +84,44 @@ class repository_googledocs extends repository { return $ret; } - public function logout(){ - global $USER; - - $token = google_docs::get_sesskey($USER->id); - - $gauth = new google_authsub($token); - // revoke token from google - $gauth->revoke_session_token(); - - google_docs::delete_sesskey($USER->id); - $this->subauthtoken = ''; - + public function logout() { + $this->googleoauth->log_out(); return parent::logout(); } public function get_file($url, $file = '') { - global $CFG; + $gdocs = new google_docs($this->googleoauth); + $path = $this->prepare_file($file); - - $fp = fopen($path, 'w'); - $gdocs = new google_docs(new google_authsub($this->subauthtoken)); - $gdocs->download_file($url, $fp); - - return array('path'=>$path, 'url'=>$url); + return $gdocs->download_file($url, $path); } public function supported_filetypes() { - return array('document'); + return '*'; } public function supported_returntypes() { return FILE_INTERNAL; } + + public static function get_type_option_names() { + return array('clientid', 'secret', 'pluginname'); + } + + public static function type_config_form($mform, $classname = 'repository') { + + $a = new stdClass; + $a->docsurl = get_docs_url('Google_OAuth2_Setup'); + $a->callbackurl = google_oauth::callback_url()->out(false); + + $mform->addElement('static', null, '', get_string('oauthinfo', 'repository_googledocs', $a)); + + parent::type_config_form($mform); + $mform->addElement('text', 'clientid', get_string('clientid', 'repository_googledocs')); + $mform->addElement('text', 'secret', get_string('secret', 'repository_googledocs')); + + $strrequired = get_string('required'); + $mform->addRule('clientid', $strrequired, 'required', null, 'client'); + $mform->addRule('secret', $strrequired, 'required', null, 'client'); + } } -//Icon from: http://www.iconspedia.com/icon/google-2706.html +// Icon from: http://www.iconspedia.com/icon/google-2706.html. diff --git a/repository/googledocs/version.php b/repository/googledocs/version.php index 79c6db7ff39..7269aa52195 100644 --- a/repository/googledocs/version.php +++ b/repository/googledocs/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2011112900; // Requires this Moodle version -$plugin->component = 'repository_googledocs'; // Full name of the plugin (used for diagnostics) +$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2012051100; // Requires this Moodle version. +$plugin->component = 'repository_googledocs'; // Full name of the plugin (used for diagnostics). diff --git a/portfolio/googledocs/db/events.php b/repository/picasa/db/upgrade.php similarity index 58% rename from portfolio/googledocs/db/events.php rename to repository/picasa/db/upgrade.php index b0d3d0c702f..545ce3b4fa5 100644 --- a/portfolio/googledocs/db/events.php +++ b/repository/picasa/db/upgrade.php @@ -15,21 +15,19 @@ // along with Moodle. If not, see{$a->callbackurl}
'; $string['picasa:view'] = 'View picasa repository'; $string['pluginname'] = 'Picasa web album'; -$string['configplugin'] = 'Picasa repository configuration'; +$string['secret'] = 'Secret'; diff --git a/repository/picasa/lib.php b/repository/picasa/lib.php index 6a83ca08238..902238025fa 100644 --- a/repository/picasa/lib.php +++ b/repository/picasa/lib.php @@ -36,58 +36,40 @@ require_once($CFG->libdir.'/googleapi.php'); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class repository_picasa extends repository { - private $subauthtoken = ''; + private $googleoauth = null; public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { - global $USER; parent::__construct($repositoryid, $context, $options); - // TODO: I wish there was somewhere we could explicitly put this outside of constructor.. - $googletoken = optional_param('token', false, PARAM_RAW); - if($googletoken){ - $gauth = new google_authsub(false, $googletoken); // will throw exception if fails - google_picasa::set_sesskey($gauth->get_sessiontoken(), $USER->id); - } + $returnurl = new moodle_url('/repository/repository_callback.php', + array('callback' => 'yes', 'repo_id' =>$this->id)); + + $clientid = get_config('picasa', 'clientid'); + $secret = get_config('picasa', 'secret'); + $this->googleoauth = new google_oauth($clientid, $secret, $returnurl->out(false), google_picasa::REALM); + $this->check_login(); } public function check_login() { - global $USER; - - $sesskey = google_picasa::get_sesskey($USER->id); - - if($sesskey){ - try{ - $gauth = new google_authsub($sesskey); - $this->subauthtoken = $sesskey; - return true; - }catch(Exception $e){ - // sesskey is not valid, delete store and re-auth - google_picasa::delete_sesskey($USER->id); - } - } - - return false; + return $this->googleoauth->is_logged_in(); } - public function print_login(){ - global $CFG; - $returnurl = $CFG->wwwroot.'/repository/repository_callback.php?callback=yes&repo_id='.$this->id; - $authurl = google_authsub::login_url($returnurl, google_picasa::REALM); - if($this->options['ajax']){ - $ret = array(); - $popup_btn = new stdClass(); - $popup_btn->type = 'popup'; - $popup_btn->url = $authurl; - $ret['login'] = array($popup_btn); - return $ret; + public function print_login() { + $url = $this->googleoauth->get_login_url(); + + if ($this->options['ajax']) { + $popup = new stdClass(); + $popup->type = 'popup'; + $popup->url = $url->out(false); + return array('login' => array($popup)); } else { - echo 'Login'; + echo ''.get_string('login', 'repository').''; } } public function get_listing($path='', $page = '') { - $picasa = new google_picasa(new google_authsub($this->subauthtoken)); + $picasa = new google_picasa($this->googleoauth); $ret = array(); $ret['dynload'] = true; @@ -101,7 +83,7 @@ class repository_picasa extends repository { } public function search($search_text, $page = 0) { - $picasa = new google_picasa(new google_authsub($this->subauthtoken)); + $picasa = new google_picasa($this->googleoauth); $ret = array(); $ret['manage'] = google_picasa::MANAGE_URL; @@ -109,22 +91,12 @@ class repository_picasa extends repository { return $ret; } - public function logout(){ - global $USER; - - $token = google_picasa::get_sesskey($USER->id); - - $gauth = new google_authsub($token); - // revoke token from google - $gauth->revoke_session_token(); - - google_picasa::delete_sesskey($USER->id); - $this->subauthtoken = ''; - + public function logout() { + $this->googleoauth->log_out(); return parent::logout(); } - public function get_name(){ + public function get_name() { return get_string('pluginname', 'repository_picasa'); } public function supported_filetypes() { @@ -133,7 +105,27 @@ class repository_picasa extends repository { public function supported_returntypes() { return (FILE_INTERNAL | FILE_EXTERNAL); } + + public static function get_type_option_names() { + return array('clientid', 'secret', 'pluginname'); + } + + public static function type_config_form($mform, $classname = 'repository') { + $a = new stdClass; + $a->docsurl = get_docs_url('Google_OAuth2_Setup'); + $a->callbackurl = google_oauth::callback_url()->out(false); + + $mform->addElement('static', null, '', get_string('oauthinfo', 'repository_picasa', $a)); + + parent::type_config_form($mform); + $mform->addElement('text', 'clientid', get_string('clientid', 'repository_picasa')); + $mform->addElement('text', 'secret', get_string('secret', 'repository_picasa')); + + $strrequired = get_string('required'); + $mform->addRule('clientid', $strrequired, 'required', null, 'client'); + $mform->addRule('secret', $strrequired, 'required', null, 'client'); + } } // Icon for this plugin retrieved from http://www.iconspedia.com/icon/picasa-2711.html -// Where the license is said documented to be Free +// Where the license is said documented to be Free. diff --git a/repository/picasa/version.php b/repository/picasa/version.php index 5ee9d18b00a..471007a4cac 100644 --- a/repository/picasa/version.php +++ b/repository/picasa/version.php @@ -26,6 +26,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2011112900; // Requires this Moodle version -$plugin->component = 'repository_picasa'; // Full name of the plugin (used for diagnostics) +$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2012051100; // Requires this Moodle version. +$plugin->component = 'repository_picasa'; // Full name of the plugin (used for diagnostics).