diff --git a/README.md b/README.md index c521c2f..d75b5e3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ for an API key on each service. ## License and copyright -Copyright (C) 2012-2016 Gregor Anzelj, and others including: +Copyright (C) 2012-2017 Gregor Anzelj, and others including: * Aaron Wells at Catalyst IT This program is free software: you can redistribute it and/or modify diff --git a/blocktype/box/account.php b/blocktype/box/account.php index ec6f440..b11a673 100644 --- a/blocktype/box/account.php +++ b/blocktype/box/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/callback.php b/blocktype/box/callback.php index b5d00bb..68480ff 100644 --- a/blocktype/box/callback.php +++ b/blocktype/box/callback.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/details.php b/blocktype/box/details.php index 2a8a59b..03945ce 100644 --- a/blocktype/box/details.php +++ b/blocktype/box/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/download.php b/blocktype/box/download.php index b55b77a..d648d21 100644 --- a/blocktype/box/download.php +++ b/blocktype/box/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/lang/en.utf8/blocktype.box.php b/blocktype/box/lang/en.utf8/blocktype.box.php index 18b1c2c..25dc48a 100644 --- a/blocktype/box/lang/en.utf8/blocktype.box.php +++ b/blocktype/box/lang/en.utf8/blocktype.box.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/lib.php b/blocktype/box/lib.php index e60ff7a..890359a 100644 --- a/blocktype/box/lib.php +++ b/blocktype/box/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/manage.php b/blocktype/box/manage.php index 97b1d2f..538adba 100644 --- a/blocktype/box/manage.php +++ b/blocktype/box/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/box/version.php b/blocktype/box/version.php index ed679f1..f22b9ae 100644 --- a/blocktype/box/version.php +++ b/blocktype/box/version.php @@ -5,7 +5,7 @@ * @subpackage blocktype-box * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/dropbox/version.php b/blocktype/dropbox/version.php index aaff0ae..11373ea 100644 --- a/blocktype/dropbox/version.php +++ b/blocktype/dropbox/version.php @@ -12,6 +12,6 @@ defined('INTERNAL') || die(); $config = new StdClass; -$config->version = 2017060600; +$config->version = 2017061700; $config->release = '17.06.1'; $config->auth = 'OAuth 2.0'; diff --git a/blocktype/googledrive/account.php b/blocktype/googledrive/account.php index f28c16b..4d45725 100644 --- a/blocktype/googledrive/account.php +++ b/blocktype/googledrive/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/callback.php b/blocktype/googledrive/callback.php index 39432bb..d91009b 100644 --- a/blocktype/googledrive/callback.php +++ b/blocktype/googledrive/callback.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/details.php b/blocktype/googledrive/details.php index 67c590e..518079c 100644 --- a/blocktype/googledrive/details.php +++ b/blocktype/googledrive/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/download.php b/blocktype/googledrive/download.php index c7afe76..7ed7d48 100644 --- a/blocktype/googledrive/download.php +++ b/blocktype/googledrive/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/export.php b/blocktype/googledrive/export.php index baacaca..99d0c9a 100644 --- a/blocktype/googledrive/export.php +++ b/blocktype/googledrive/export.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/lang/en.utf8/blocktype.googledrive.php b/blocktype/googledrive/lang/en.utf8/blocktype.googledrive.php index 6f501a0..bd5d650 100644 --- a/blocktype/googledrive/lang/en.utf8/blocktype.googledrive.php +++ b/blocktype/googledrive/lang/en.utf8/blocktype.googledrive.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/lib.php b/blocktype/googledrive/lib.php index 474cb09..e94b276 100644 --- a/blocktype/googledrive/lib.php +++ b/blocktype/googledrive/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/manage.php b/blocktype/googledrive/manage.php index 5503453..dcb1f9c 100644 --- a/blocktype/googledrive/manage.php +++ b/blocktype/googledrive/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/googledrive/version.php b/blocktype/googledrive/version.php index c728e88..a87a3f8 100644 --- a/blocktype/googledrive/version.php +++ b/blocktype/googledrive/version.php @@ -5,7 +5,7 @@ * @subpackage blocktype-googledrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/account.php b/blocktype/microsoftdrive/account.php index 2536485..5e2e461 100644 --- a/blocktype/microsoftdrive/account.php +++ b/blocktype/microsoftdrive/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/callback.php b/blocktype/microsoftdrive/callback.php index 196129d..1d77899 100644 --- a/blocktype/microsoftdrive/callback.php +++ b/blocktype/microsoftdrive/callback.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/details.php b/blocktype/microsoftdrive/details.php index 60f3fa3..67be494 100644 --- a/blocktype/microsoftdrive/details.php +++ b/blocktype/microsoftdrive/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/download.php b/blocktype/microsoftdrive/download.php index 68a5f06..48a9628 100644 --- a/blocktype/microsoftdrive/download.php +++ b/blocktype/microsoftdrive/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/lang/en.utf8/blocktype.microsoftdrive.php b/blocktype/microsoftdrive/lang/en.utf8/blocktype.microsoftdrive.php index 8f905eb..ec1a64b 100644 --- a/blocktype/microsoftdrive/lang/en.utf8/blocktype.microsoftdrive.php +++ b/blocktype/microsoftdrive/lang/en.utf8/blocktype.microsoftdrive.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ @@ -19,6 +19,7 @@ $string['basicinformation'] = 'Basic Information'; $string['applicationdesc'] = 'You must create %san application%s, if you wish to access and use OneDrive API. When you will create the application, the Client ID and Client secret will be generated. Copy and paste them here. Then copy Redirect URL and paste it into application settings. Save application settings and this plugin settings.'; +$string['applicationdesc2'] = 'You have to create your application in Live SDK applications section.'; $string['applicationname'] = 'Application name'; $string['applicationnamedesc'] = 'You must provide unique application name, e.g. the name of this site.'; $string['applicationicon'] = 'Application logo'; diff --git a/blocktype/microsoftdrive/lib.php b/blocktype/microsoftdrive/lib.php index 26b7a5a..c29c5ea 100644 --- a/blocktype/microsoftdrive/lib.php +++ b/blocktype/microsoftdrive/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ @@ -184,6 +184,11 @@ public static function get_config_options() { 'type' => 'html', 'value' => get_string('applicationdesc', 'blocktype.cloud/microsoftdrive', '', ''), ); + $elements['applicationdesc2'] = array( + 'type' => 'html', + 'class' => 'bg-danger text-danger', + 'value' => '
' . get_string('applicationdesc2', 'blocktype.cloud/microsoftdrive') . '
', + ); $elements['basicinformation'] = array( 'type' => 'fieldset', 'class' => 'first', @@ -308,7 +313,7 @@ public function service_list() { } else { $service->pending = true; - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } return $service; } @@ -332,7 +337,7 @@ public function request_token() { redirect($request_url); } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -381,7 +386,7 @@ public function access_token($oauth_code) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -448,7 +453,7 @@ public function check_access_token($owner=null) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -472,7 +477,7 @@ public function revoke_access() { redirect($request_url); } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -543,7 +548,7 @@ public function account_info() { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -627,7 +632,7 @@ public function get_filelist($folder_id='0', $selected=array(), $owner=null) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -715,7 +720,6 @@ public function get_folder_content($folder_id=0, $options, $block=0) { foreach($data['data'] as $artefact) { $id = $artefact['id']; $type = ($artefact['type'] == 'folder' ? 'folder' : 'file'); - // Get artefactname by removing parent path from beginning... $artefactname = $artefact['name']; if ($artefact['type'] == 'folder') { $icon = ''; @@ -756,7 +760,7 @@ public function get_folder_content($folder_id=0, $options, $block=0) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -802,7 +806,7 @@ public function get_folder_info($folder_id=0, $owner=null) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -848,7 +852,7 @@ public function get_file_info($file_id=0, $owner=null) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -882,7 +886,7 @@ public function download_file($file_id=0, $owner=null) { return $result; } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } @@ -920,7 +924,7 @@ public function embed_file($file_id=0, $options=array(), $owner=null) { } } else { - $SESSION->add_error_msg('Can\'t find Live consumer key and/or consumer secret.'); + $SESSION->add_error_msg('Can\'t find Microsoft Live consumer key and/or consumer secret.'); } } diff --git a/blocktype/microsoftdrive/manage.php b/blocktype/microsoftdrive/manage.php index 15723b9..62a7706 100644 --- a/blocktype/microsoftdrive/manage.php +++ b/blocktype/microsoftdrive/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/microsoftdrive/version.php b/blocktype/microsoftdrive/version.php index 564d412..8a44c8c 100644 --- a/blocktype/microsoftdrive/version.php +++ b/blocktype/microsoftdrive/version.php @@ -5,13 +5,13 @@ * @subpackage blocktype-microsoftdrive * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ defined('INTERNAL') || die(); $config = new StdClass; -$config->version = 2016022600; -$config->release = '16.02.1'; +$config->version = 2017061700; +$config->release = '17.06.1'; $config->auth = 'OAuth 2.0'; diff --git a/blocktype/microsoftdrivebiz/account.php b/blocktype/microsoftdrivebiz/account.php new file mode 100644 index 0000000..1731324 --- /dev/null +++ b/blocktype/microsoftdrivebiz/account.php @@ -0,0 +1,47 @@ + 0) { + $USER->set_account_preference('lasteditedview', $viewid); +} +else { + $USER->set_account_preference('lasteditedview', 0); +} + +switch ($action) { + case 'login': + PluginBlocktypeMicrosoftdrivebiz::request_token(); + break; + case 'logout': + PluginBlocktypeMicrosoftdrivebiz::delete_token(); + PluginBlocktypeMicrosoftdrivebiz::revoke_access(); + // Redirect is not needed, because Microsoft Graph authorization web service + // will redirect to that URL after successfully signing the user out. + //redirect(get_config('wwwroot').'artefact/cloud'); + break; + default: + throw new ParameterException("Parameter for login to or logout from Microsoft Graph is missing."); +} diff --git a/blocktype/microsoftdrivebiz/callback.php b/blocktype/microsoftdrivebiz/callback.php new file mode 100644 index 0000000..59402b9 --- /dev/null +++ b/blocktype/microsoftdrivebiz/callback.php @@ -0,0 +1,43 @@ +get('id'), $prefs); + $SESSION->add_ok_msg(get_string('accesstokensaved', 'artefact.cloud')); +} +else { + $SESSION->add_error_msg(get_string('accesstokensavefailed', 'artefact.cloud')); +} + +// If user edited a page, then return to that page +$viewid = $USER->get_account_preference('lasteditedview'); +if (isset($viewid) && $viewid > 0) { + $USER->set_account_preference('lasteditedview', 0); + redirect(get_config('wwwroot').'view/blocks.php?id='.$viewid); +} + +// Otherwise return to Cloud plugin dashboard +redirect(get_config('wwwroot').'artefact/cloud'); diff --git a/blocktype/microsoftdrivebiz/details.php b/blocktype/microsoftdrivebiz/details.php new file mode 100644 index 0000000..131db86 --- /dev/null +++ b/blocktype/microsoftdrivebiz/details.php @@ -0,0 +1,73 @@ + 0) { + $view = new View($viewid); + $owner = $view->get('owner'); + if (!can_view_view($viewid)) { + throw new AccessDeniedException(); + } +} + +$data = array(); +if ($type == 'folder') { + $data = PluginBlocktypeMicrosoftdrivebiz::get_folder_info($id, $owner); +} else { + $data = PluginBlocktypeMicrosoftdrivebiz::get_file_info($id, $owner); +} + +if ($viewid > 0) { + define('TITLE', $data['name'] . ' ' . get_string('in', 'view') . ' ' . $view->get('title')); +} else { + define('TITLE', get_string('filedetails', 'artefact.cloud', $data['name'])); +} + + +$smarty = smarty( + array(), + array(), + array(), + array('sidebars' => false) +); + +$smarty->assign('SERVICE', 'microsoftdrivebiz'); +$smarty->assign('id', $id); +$smarty->assign('type', $type); +$smarty->assign('viewid', $viewid); +if ($viewid > 0) { + $viewtitle = $view->get('title'); +} else { + $viewtitle = get_string('filedetails', 'artefact.cloud', $data['name']); +} +$smarty->assign('viewtitle', $viewtitle); +$smarty->assign('data', $data); + +if ($viewid > 0) { + $viewowner = $view->get('owner'); + if ($viewowner) { + $smarty->assign('ownerlink', 'user/view.php?id=' . $viewowner); + } + $smarty->assign('ownername', $view->formatted_owner()); +} + +$smarty->display('artefact:cloud:details.tpl'); diff --git a/blocktype/microsoftdrivebiz/download.php b/blocktype/microsoftdrivebiz/download.php new file mode 100644 index 0000000..4e5cdf2 --- /dev/null +++ b/blocktype/microsoftdrivebiz/download.php @@ -0,0 +1,165 @@ + 0) { + $view = new View($viewid); + $owner = $view->get('owner'); + if (!can_view_view($viewid)) { + throw new AccessDeniedException(); + } +} + + +if ($save) { + // Save file to Mahara + $saveform = pieform(array( + 'name' => 'saveform', + 'plugintype' => 'artefact', + 'pluginname' => 'cloud', + 'template' => 'saveform.php', + 'templatedir' => pieform_template_dir('saveform.php', 'artefact/cloud'), + 'elements' => array( + 'fileid' => array( + 'type' => 'hidden', + 'value' => $id, + ), + 'folderid' => array( + 'type' => 'select', + 'title' => get_string('savetofolder', 'artefact.cloud'), + 'options' => get_foldertree_options(), + //'size' => 8, + 'rules' => array( + 'required' => true + ) + ), + 'submit' => array( + 'type' => 'submitcancel', + 'value' => array(get_string('save'), get_string('cancel')), + 'goto' => get_config('wwwroot') . 'artefact/cloud/blocktype/microsoftdrivebiz/manage.php', + ) + ), + )); + + $smarty = smarty(); + //$smarty->assign('SERVICE', 'microsoftdrivebiz'); + $smarty->assign('PAGEHEADING', get_string('savetomahara', 'artefact.cloud')); + $smarty->assign('form', $saveform); + $smarty->display('form.tpl'); +} +else { + // Download file + $file = PluginBlocktypeMicrosoftdrivebiz::get_file_info($id, $owner); + $content = PluginBlocktypeMicrosoftdrivebiz::download_file($id, $owner); + + header('Pragma: no-cache'); + header('Content-disposition: attachment; filename="' . $file['name'] . '"'); + header('Content-Transfer-Encoding: binary'); + header('Content-type: application/octet-stream'); + echo $content; +} + +function saveform_submit(Pieform $form, $values) { + global $USER; + + $file = PluginBlocktypeMicrosoftdrivebiz::get_file_info($values['fileid']); + // Determine (by file extension) if file is an image file or not + $extension = pathinfo($file['name'], PATHINFO_EXTENSION); + if (in_array($extension, array('bmp', 'gif', 'jpg', 'jpeg', 'png'))) { + $image = true; + } + else { + $image = false; + } + + // Insert file data into 'artefact' table... + $time = db_format_timestamp(time()); + $artefact = (object) array( + 'artefacttype' => ($image ? 'image' : 'file'), + 'parent' => ($values['folderid'] > 0 ? $values['folderid'] : null), + 'owner' => $USER->get('id'), + 'ctime' => $time, + 'mtime' => $time, + 'atime' => $time, + 'title' => $file['name'], + 'author' => $USER->get('id') + ); + $artefactid = insert_record('artefact', $artefact, 'id', true); + + // Insert file data into 'artefact_file_files' table... + $mimetypes = get_records_sql_assoc('SELECT m.description, m.mimetype FROM {artefact_file_mime_types} m ORDER BY description', array()); + $filetype = 'application/octet-stream'; + if (isset($mimetypes[$extension])) { + $filetype = $mimetypes[$extension]->mimetype; + } + elseif ($extension == 'docx') { + $filetype = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; + } + elseif ($extension == 'jpg') { + $filetype = 'image/jpeg'; + } + elseif ($extension == 'pps') { + $filetype = 'application/vnd.ms-powerpoint'; + } + elseif ($extension == 'ppsx') { + $filetype = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; + } + elseif ($extension == 'pptx') { + $filetype = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; + } + elseif ($extension == 'xlsx') { + $filetype = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + } + + $fileartefact = (object) array( + 'artefact' => $artefactid, + 'size' => $file['bytes'], + 'oldextension' => $extension, + 'fileid' => $artefactid, + 'filetype' => $filetype, + ); + insert_record('artefact_file_files', $fileartefact); + + // Write file content to local Mahara file repository + $content = PluginBlocktypeMicrosoftdrivebiz::download_file($file['id']); + if (!file_exists(get_config('dataroot') . 'artefact/file/originals/' . $artefactid)) { + mkdir(get_config('dataroot') . 'artefact/file/originals/' . $artefactid, 0777); + } + $localfile = get_config('dataroot') . 'artefact/file/originals/' . $artefactid . '/' . $artefactid; + file_put_contents($localfile, $content); + + // If file is an image file, than + // insert image data into 'artefact_file_image' table... + if ($image) { + list($width, $height, $type, $attr) = getimagesize($localfile); + $imgartefact = (object) array( + 'artefact' => $artefactid, + 'width' => $width, + 'height' => $height, + ); + insert_record('artefact_file_image', $imgartefact); + } + + // Redirect + redirect(get_config('wwwroot') . 'artefact/cloud/blocktype/microsoftdrivebiz/manage.php'); +} diff --git a/blocktype/microsoftdrivebiz/lang/en.utf8/blocktype.microsoftdrivebiz.php b/blocktype/microsoftdrivebiz/lang/en.utf8/blocktype.microsoftdrivebiz.php new file mode 100644 index 0000000..c76189c --- /dev/null +++ b/blocktype/microsoftdrivebiz/lang/en.utf8/blocktype.microsoftdrivebiz.php @@ -0,0 +1,46 @@ +Client ID and Client secret will be generated. Copy and paste them here. Then copy Redirect URL and paste it into application settings. Save application settings and this plugin settings.'; +$string['applicationdesc2'] = 'You have to create your application in Converged applications section. In application properties you must uncheck the Live SDK support option.'; +$string['applicationname'] = 'Application name'; +$string['applicationnamedesc'] = 'You must provide unique application name, e.g. the name of this site.'; +$string['applicationicon'] = 'Application logo'; +$string['applicationicondesc'] = 'You can upload logo for your application. The logo must be a transparent 48x48 pixel GIF or PNG. 15 KB size limit.'; +$string['applicationterms'] = 'Terms of service URL'; +$string['applicationprivacy'] = 'Privacy URL'; + +$string['apisettings'] = 'API Settings & App Settings'; +$string['consumerkey'] = 'Client ID'; +$string['consumerkeydesc'] = 'When you\'ll create an application, you\'ll get a Client ID. Paste it here.'; +$string['consumersecret'] = 'Client secret'; +$string['consumersecretdesc'] = 'When you\'ll create an application, you\'ll get a Client secret. Paste it here.'; +$string['redirecturl'] = 'Redirect URL'; +$string['redirecturldesc'] = 'URL to return user to, after successful authentication. Copy it and paste it to the list of Redirect URLs.'; + +$string['selectfiles'] = 'Select files'; +$string['revokeconnection'] = 'Revoke connection to OneDrive for Business'; +$string['connecttomicrosoftdrive'] = 'Connect to OneDrive for Business'; + +$string['display'] = 'Display'; +$string['displaydesc'] = 'Files that cannot be embedded are displayed as file icons with links to file previews.'; +$string['displaydesc2'] = 'Please note that the more files you select to embed, the more time the embedding takes.'; +$string['displaylist'] = 'List of files'; +$string['displayembed'] = 'Embedded files'; diff --git a/blocktype/microsoftdrivebiz/lib.php b/blocktype/microsoftdrivebiz/lib.php new file mode 100644 index 0000000..b4fd2af --- /dev/null +++ b/blocktype/microsoftdrivebiz/lib.php @@ -0,0 +1,876 @@ +get('configdata'); + $viewid = $instance->get('view'); + + $view = new View($viewid); + $ownerid = $view->get('owner'); + + $selected = (!empty($configdata['artefacts']) ? $configdata['artefacts'] : array()); + + $smarty = smarty_core(); + $file = self::get_file_info($selected[0]); + $folder = $file['parent_id']; + $data = self::get_filelist($folder, $selected, $ownerid); + $smarty->assign('folders', $data['folders']); + $smarty->assign('files', $data['files']); + $smarty->assign('viewid', $viewid); + return $smarty->fetch('blocktype:microsoftdrivebiz:list.tpl'); + } + + public static function has_instance_config() { + return true; + } + + public static function instance_config_form($instance) { + global $USER; + $instanceid = $instance->get('id'); + $configdata = $instance->get('configdata'); + $allowed = (!empty($configdata['allowed']) ? $configdata['allowed'] : array()); + safe_require('artefact', 'cloud'); + $instance->set('artefactplugin', 'cloud'); + $viewid = $instance->get('view'); + + $view = new View($viewid); + $ownerid = $view->get('owner'); + + $data = ArtefactTypeCloud::get_user_preferences('office365_files', $ownerid); + if ($data) { + return array( + 'microsoftdrivebizlogo' => array( + 'type' => 'html', + 'value' => '', + ), + 'microsoftdrivebizisconnect' => array( + 'type' => 'cancel', + 'value' => get_string('revokeconnection', 'blocktype.cloud/microsoftdrivebiz'), + 'goto' => get_config('wwwroot') . 'artefact/cloud/blocktype/microsoftdrivebiz/account.php?action=logout&sesskey=' . $USER->get('sesskey'), + ), + 'microsoftdrivebizfiles' => array( + 'type' => 'datatables', + 'title' => get_string('selectfiles','blocktype.cloud/microsoftdrivebiz'), + 'service' => 'microsoftdrivebiz', + 'block' => $instanceid, + 'fullpath' => (isset($configdata['fullpath']) ? $configdata['fullpath'] : null), + 'options' => array( + 'showFolders' => true, + 'showFiles' => true, + 'selectFolders' => false, + 'selectFiles' => true, + 'selectMultiple' => true + ), + ), + 'display' => array( + 'type' => 'radio', + 'title' => get_string('display','blocktype.cloud/microsoftdrivebiz'), + 'description' => get_string('displaydesc','blocktype.cloud/microsoftdrivebiz') . '
' . get_string('displaydesc2','blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => (!empty($configdata['display']) ? hsc($configdata['display']) : 'list'), + 'options' => array( + 'list' => get_string('displaylist','blocktype.cloud/microsoftdrivebiz'), + //'icon' => get_string('displayicon','blocktype.cloud/microsoftdrivebiz'), + 'embed' => get_string('displayembed','blocktype.cloud/microsoftdrivebiz') + ), + 'separator' => '
', + ), + ); + } + else { + return array( + 'microsoftdrivebizlogo' => array( + 'type' => 'html', + 'value' => '', + ), + 'microsoftdrivebizisconnect' => array( + 'type' => 'cancel', + 'value' => get_string('connecttomicrosoftdrivebiz', 'blocktype.cloud/microsoftdrivebiz'), + 'goto' => get_config('wwwroot') . 'artefact/cloud/blocktype/microsoftdrivebiz/account.php?action=login&view=' . $viewid . '&sesskey=' . $USER->get('sesskey'), + ), + ); + } + } + + public static function instance_config_save($values) { + // Folder and file IDs (and other values) are returned as JSON/jQuery serialized string. + // We have to parse that string and urldecode it (to correctly convert square brackets) + // in order to get cloud folder and file IDs - they are stored in $artefacts array. + parse_str(urldecode($values['microsoftdrivebizfiles'])); + if (!isset($artefacts) || empty($artefacts)) { + $artefacts = array(); + } + + $values = array( + 'title' => $values['title'], + 'artefacts' => $artefacts, + 'display' => $values['display'], + ); + return $values; + } + + public static function get_artefacts(BlockInstance $instance) { + // Not needed, but must be implemented. + } + + public static function artefactchooser_element($default=null) { + // Not needed, but must be implemented. + } + + public static function has_config() { + return true; + } + + public static function get_config_options() { + global $THEME; + $elements = array(); + $elements['applicationdesc'] = array( + 'type' => 'html', + 'value' => get_string('applicationdesc', 'blocktype.cloud/microsoftdrivebiz', '', ''), + ); + $elements['applicationdesc2'] = array( + 'type' => 'html', + 'class' => 'bg-danger text-danger', + 'value' => '
' . get_string('applicationdesc2', 'blocktype.cloud/microsoftdrivebiz') . '
', + ); + $elements['basicinformation'] = array( + 'type' => 'fieldset', + 'class' => 'first', + 'collapsible' => true, + 'collapsed' => false, + 'legend' => get_string('basicinformation', 'blocktype.cloud/microsoftdrivebiz'), + 'elements' => array( + 'applicationname' => array( + 'type' => 'text', + 'title' => get_string('applicationname', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config('sitename'), + 'description' => get_string('applicationnamedesc', 'blocktype.cloud/microsoftdrivebiz'), + ), + 'applicationicon' => array( + 'type' => 'html', + 'title' => get_string('applicationicon', 'blocktype.cloud/microsoftdrivebiz'), + 'value' => ' + +

48x48
', + 'description' => get_string('applicationicondesc', 'blocktype.cloud/microsoftdrivebiz'), + ), + 'applicationterms' => array( + 'type' => 'text', + 'title' => get_string('applicationterms', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config('wwwroot').'terms.php', + ), + 'applicationprivacy' => array( + 'type' => 'text', + 'title' => get_string('applicationprivacy', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config('wwwroot').'privacy.php', + ), + ) + ); + $elements['apisettings'] = array( + 'type' => 'fieldset', + 'class' => 'last', + 'collapsible' => true, + 'collapsed' => false, + 'legend' => get_string('apisettings', 'blocktype.cloud/microsoftdrivebiz'), + 'elements' => array( + 'consumerkey' => array( + 'type' => 'text', + 'title' => get_string('consumerkey', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config_plugin('blocktype', 'microsoftdrivebiz', 'consumerkey'), + 'description' => get_string('consumerkeydesc', 'blocktype.cloud/microsoftdrivebiz'), + 'rules' => array('required' => true), + ), + 'consumersecret' => array( + 'type' => 'text', + 'title' => get_string('consumersecret', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config_plugin('blocktype', 'microsoftdrivebiz', 'consumersecret'), + 'description' => get_string('consumersecretdesc', 'blocktype.cloud/microsoftdrivebiz'), + 'rules' => array('required' => true), + ), + 'redirecturl' => array( + 'type' => 'text', + 'title' => get_string('redirecturl', 'blocktype.cloud/microsoftdrivebiz'), + 'defaultvalue' => get_config('wwwroot'), + 'description' => get_string('redirecturldesc', 'blocktype.cloud/microsoftdrivebiz'), + 'rules' => array('required' => true), + ), + ) + ); + return array( + 'class' => 'panel panel-body', + 'elements' => $elements, + ); + + } + + public static function save_config_options($form, $values) { + set_config_plugin('blocktype', 'microsoftdrivebiz', 'consumerkey', $values['consumerkey']); + set_config_plugin('blocktype', 'microsoftdrivebiz', 'consumersecret', $values['consumersecret']); + } + + public static function default_copy_type() { + return 'shallow'; + } + + /***************************************************** + * Methods & stuff for accessing Microsoft Graph API * + *****************************************************/ + + private function get_service_consumer($owner=null) { + global $USER; + if (!isset($owner) || is_null($owner)) { + $owner = $USER->get('id'); + } + $wwwroot = get_config('wwwroot'); + $service = new StdClass(); + $service->ssl = true; + $service->aad_version = 'v2.0'; // Azure Active Directory (AAD) version + $service->graph_version = 'v1.0'; // Microsoft Graph API version + $service->graphurl = 'https://graph.microsoft.com/'; + $service->authurl = 'https://login.microsoftonline.com/organizations/oauth2/'; + $service->key = get_config_plugin('blocktype', 'microsoftdrivebiz', 'consumerkey'); + $service->secret = get_config_plugin('blocktype', 'microsoftdrivebiz', 'consumersecret'); + // If SSL is set then force SSL URL for callback + if ($service->ssl) { + $wwwroot = str_replace('http://', 'https://', get_config('wwwroot')); + } + $service->callback = $wwwroot . 'artefact/cloud/blocktype/microsoftdrivebiz/callback.php'; + $service->usrprefs = ArtefactTypeCloud::get_user_preferences('microsoftdrivebiz', $owner); + return $service; + } + + public function service_list() { + global $SESSION; + global $USER; + $consumer = self::get_service_consumer(); + $service = new StdClass(); + $service->name = 'microsoftdrivebiz'; + $service->url = 'https://portal.office.com'; + $service->auth = false; + $service->manage = false; + $service->pending = false; + + if (!empty($consumer->key) && !empty($consumer->secret)) { + if (isset($consumer->usrprefs['refresh_token']) && !empty($consumer->usrprefs['refresh_token'])) { + $service->auth = true; + $service->manage = true; + $service->account = self::account_info(); + } + } + else { + $service->pending = true; + $SESSION->add_error_msg('Can\'t find Microsoft Graph consumer key and/or consumer secret.'); + } + return $service; + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user#2-get-authorization + public function request_token() { + $consumer = self::get_service_consumer(); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->authurl.$consumer->aad_version.'/authorize'; + $scope = 'offline_access user.read files.read'; + $params = array( + 'response_type' => 'code', + 'client_id' => $consumer->key, + 'redirect_uri' => $consumer->callback, + 'response_mode' => 'query', + 'scope' => $scope + ); + $query = oauth_http_build_query($params); + $request_url = $url . ($query ? ('?' . $query) : '' ); + redirect($request_url); + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer key and/or consumer secret.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user#3-get-a-token + public function access_token($oauth_code) { + global $SESSION; + $consumer = self::get_service_consumer(); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->authurl.$consumer->aad_version.'/token'; + $port = $consumer->ssl ? '443' : '80'; + $scope = 'offline_access user.read files.read'; + $params = array( + 'client_id' => $consumer->key, + 'client_secret' => $consumer->secret, + 'code' => $oauth_code, + 'grant_type' => 'authorization_code', + 'redirect_uri' => $consumer->callback, + 'scope' => $scope + ); + $query = oauth_http_build_query($params); + $header = array(); + $header[] = build_oauth_header($params, "Office 365 API PHP Client"); + $header[] = 'Content-Length: ' . strlen($query); + $header[] = 'Content-Type: application/x-www-form-urlencoded'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $query, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + return $data; + } + else { + $SESSION->add_error_msg(get_string('accesstokennotreturned', 'blocktype.cloud/microsoftdrivebiz')); + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user#5-use-the-refresh-token-to-get-a-new-access-token + public function check_access_token($owner=null) { + global $USER, $SESSION; + $consumer = self::get_service_consumer($owner); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $tokendate = get_field('artefact', 'mtime', 'artefacttype', 'cloud', 'title', 'microsoftdrivebiz', 'owner', $USER->get('id')); + // Find out when access token actually expires and take away 10 seconds + // to avoid access token expiry problems between API calls... + $valid = strtotime($tokendate) + intval($consumer->usrprefs['expires_in']) - 10; + $now = time(); + // If access token is expired, than get new one using refresh token + // save it and return it... + if ($valid < $now) { + $url = $consumer->authurl.$consumer->aad_version.'/token'; + $port = $consumer->ssl ? '443' : '80'; + $scope = 'offline_access user.read files.read'; + $params = array( + 'client_id' => $consumer->key, + 'client_secret' => $consumer->secret, + 'grant_type' => 'refresh_token', + 'refresh_token' => $consumer->usrprefs['refresh_token'], + 'redirect_uri' => $consumer->callback, + 'scope' => $scope + ); + $query = oauth_http_build_query($params); + $header = array(); + $header[] = build_oauth_header($params, "Office 365 API PHP Client"); + $header[] = 'Content-Length: ' . strlen($query); + $header[] = 'Content-Type: application/x-www-form-urlencoded'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $query, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $prefs = json_decode(substr($result->data, $result->info['header_size']), true); + // These values are set only on user consent and are not sent anytime later + $prefs['refresh_token'] = $consumer->usrprefs['refresh_token']; + $prefs['authentication_token'] = $consumer->usrprefs['authentication_token']; + + ArtefactTypeCloud::set_user_preferences('microsoftdrivebiz', $USER->get('id'), $prefs); + return $prefs['access_token']; + } + else { + $SESSION->add_error_msg(get_string('accesstokennotreturned', 'blocktype.cloud/microsoftdrivebiz')); + return null; + } + } + // If access token is not expired, than return it... + else { + return $consumer->usrprefs['access_token']; + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + public function delete_token() { + global $USER; + ArtefactTypeCloud::set_user_preferences('microsoftdrivebiz', $USER->get('id'), null); + } + + // OneDrive for Business sign out (logout) is not supported. + // Apparently https://login.microsoftonline.com/organizations/oauth2/v2.0/logout endpoint works anyway... + public function revoke_access() { + $consumer = self::get_service_consumer(); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->authurl.$consumer->aad_version.'/logout'; + $params = array( + 'client_id' => $consumer->key, + 'redirect_uri' => $consumer->callback + ); + $query = oauth_http_build_query($params); + $request_url = $url . ($query ? ('?' . $query) : '' ); + redirect($request_url); + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_get + // SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/drive_get + public function account_info() { + global $SESSION; + $consumer = self::get_service_consumer(); + $token = self::check_access_token(); + + $info = new StdClass(); + $info->service_name = 'microsoftdrivebiz'; + $info->service_auth = false; + $info->user_id = null; + $info->user_name = null; + $info->user_email = null; + $info->user_profile = null; + $info->space_used = null; + $info->space_amount = null; + $info->space_ratio = null; + + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me'; + $port = $consumer->ssl ? '443' : '80'; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + if (isset($result->data) && !empty($result->data) && + isset($result->info) && !empty($result->info) && $result->info['http_code'] == 200) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + + $url2 = $consumer->graphurl.$consumer->graph_version.'/me/drive'; + $config2 = array( + CURLOPT_URL => $url2, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result2 = mahara_http_request($config2); + $quota = json_decode(substr($result2->data, $result2->info['header_size']), true); + + $info->service_name = 'microsoftdrivebiz'; + $info->service_auth = true; + $info->user_id = $data['id']; + $info->user_name = $data['displayName']; + $info->user_email = strtolower($data['mail']); + $info->space_used = bytes_to_size1024(floatval($quota['quota']['used'])); + $info->space_amount = bytes_to_size1024(floatval($quota['quota']['total'])); + $info->space_ratio = number_format((floatval($quota['quota']['used'])/floatval($quota['quota']['total']))*100, 2); + return $info; + } + else { + $httpstatus = get_http_status($result->info['http_code']); + $SESSION->add_error_msg($httpstatus); + log_warn($httpstatus); + } + } + else { + $SESSION->add_error_msg('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + return $info; + } + + + /* + * This function returns list of selected files/folders which will be displayed in a view/page. + * + * $folder_id integer ID of the folder (on Cloud Service), which contents we wish to retrieve + * $output array Function returns array, used to generate list of files/folders to show in Mahara view/page + * + * SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_list_children + * + */ + public function get_filelist($folder_id='root', $selected=array(), $owner=null) { + global $THEME; + + // $folder_id is globally set to '0', set it to 'root' + // as it is the OneDrive for Business default root folder ... + if ($folder_id == '0') { + $folder_id = 'root'; + } + + // Get folder contents... + $consumer = self::get_service_consumer(); + $token = self::check_access_token(); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/items/'.$folder_id.'/children'; + $port = $consumer->ssl ? '443' : '80'; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + $output = array( + 'folders' => array(), + 'files' => array() + ); + if (isset($data['value']) && !empty($data['value'])) { + foreach($data['value'] as $artefact) { + if (in_array($artefact['id'], $selected)) { + $id = $artefact['id']; + $type = (array_key_exists('folder', $artefact) ? 'folder' : 'file'); + $title = $artefact['name']; + $description = null; + $size = bytes_to_size1024($artefact['size']); + $created = ($artefact['createdDateTime'] ? format_date(strtotime($artefact['createdDateTime']), 'strftimedaydate') : null); + if ($type == 'folder') { + $output['folders'][] = array( + 'id' => $id, + 'title' => $title, + 'description' => $description, + 'artefacttype' => $type, + 'size' => $size, + 'ctime' => $created, + ); + } + else { + $output['files'][] = array( + 'id' => $id, + 'title' => $title, + 'description' => $description, + 'artefacttype' => $type, + 'size' => $size, + 'ctime' => $created + ); + } + } + } + } + return $output; + } + else { + return array(); + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + /* + * This function gets folder contents and formats it, so it can be used in blocktype config form + * (Pieform element) and in manage page. + * + * $folder_id integer ID of the folder (on Cloud Service), which contents we wish to retrieve + * $options integer List of 6 integers (booleans) to indicate (for all 6 options) if option is used or not + * $block integer ID of the block in given Mahara view/page + * + * $output array Function returns JSON encoded array of values that is suitable to feed jQuery Datatables with. + jQuery Datatable than draw an enriched HTML table according to values, contained in $output. + * PLEASE NOTE: For jQuery Datatable to work, the $output array must be properly formatted and JSON encoded. + * Please see: http://datatables.net/usage/server-side (Reply from the server)! + * + * SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_list_children + * + */ + public function get_folder_content($folder_id='root', $options, $block=0) { + global $USER, $THEME; + + // $folder_id is globally set to '0', set it to 'root' + // as it is the OneDrive for Business default root folder ... + if ($folder_id == '0') { + $folder_id = 'root'; + } + + // Get selected artefacts (folders and/or files) + if ($block > 0) { + $data = unserialize(get_field('block_instance', 'configdata', 'id', $block)); + if (!empty($data) && isset($data['artefacts'])) { + $artefacts = $data['artefacts']; + } else { + $artefacts = array(); + } + } else { + $artefacts = array(); + } + + // Get pieform element display options... + $manageButtons = (boolean) $options[0]; + $showFolders = (boolean) $options[1]; + $showFiles = (boolean) $options[2]; + $selectFolders = (boolean) $options[3]; + $selectFiles = (boolean) $options[4]; + $selectMultiple = (boolean) $options[5]; + + // Get folder parent... + $parent_id = 'root'; // either 'root' folder itself or parent is 'root' folder + $folder = self::get_folder_info($folder_id); + if (!empty($folder['parent_id'])) { + $parent_id = $folder['parent_id']; + } + + // Get folder contents... + $consumer = self::get_service_consumer(); + $token = self::check_access_token(); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/items/'.$folder_id.'/children'; + $port = $consumer->ssl ? '443' : '80'; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + $output = array(); + $count = 0; + // Add 'parent' row entry to jQuery Datatable... + if ($parent_id != 'root') { + $type = 'parentfolder'; + $foldername = get_string('parentfolder', 'artefact.file'); + $icon = ''; + $title = '' . $foldername . ''; + $output['data'][] = array($icon, $title, '', $type); + } + if (!empty($data['value'])) { + foreach($data['value'] as $artefact) { + $id = $artefact['id']; + $type = (array_key_exists('folder', $artefact) ? 'folder' : 'file'); + $artefactname = $artefact['name']; + if ($type == 'folder') { + $icon = ''; + $title = '' . $artefactname . ''; + } + else { + $icon = ''; + $title = '' . $artefactname . ''; + } + $controls = ''; + $selected = (in_array($id, $artefacts) ? ' checked' : ''); + if ($type == 'folder') { + if ($selectFolders) { + $controls = ''; + } + } + else { + if ($selectFiles && !$manageButtons) { + $controls = ''; + } + elseif ($manageButtons && $type == 'file') { + $controls = '
'; + $controls .= ''; + $controls .= ''; + $controls .= '
'; + } + } + $output['data'][] = array($icon, $title, $controls, $type); + $count++; + } + } + $output['iTotalRecords'] = $count; + $output['iTotalDisplayRecords'] = $count; + return json_encode($output); + } + else { + return array(); + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_get + public function get_folder_info($folder_id='root', $owner=null) { + $consumer = self::get_service_consumer($owner); + $token = self::check_access_token($owner); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/items/'.$folder_id; + if ($folder_id == 'root') { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/root'; + } + $port = $consumer->ssl ? '443' : '80'; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + $info = array( + 'id' => $data['id'], + 'parent_id' => (isset($data['parentReference']) ? $data['parentReference']['id'] : null), + 'name' => $data['name'], + 'type' => (array_key_exists('folder', $data) ? 'folder' : $data['@odata.type']), + 'preview' => $data['webUrl'], + //'description' => $data['description'], + 'created' => ($data['createdDateTime'] ? format_date(strtotime($data['createdDateTime']), 'strfdaymonthyearshort') : null), + 'updated' => ($data['lastModifiedDateTime'] ? format_date(strtotime($data['lastModifiedDateTime']), 'strfdaymonthyearshort') : null), + ); + return $info; + } + else { + return null; + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_get + public function get_file_info($file_id='0', $owner=null) { + $consumer = self::get_service_consumer($owner); + $token = self::check_access_token($owner); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/items/'.$file_id; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + + if ($result->info['http_code'] == 200 && !empty($result->data)) { + $data = json_decode(substr($result->data, $result->info['header_size']), true); + $info = array( + 'id' => $data['id'], + 'parent_id' => (isset($data['parentReference']) ? $data['parentReference']['id'] : null), + 'name' => $data['name'], + 'type' => (array_key_exists('file', $data) ? 'file' : $data['@odata.type']), + 'bytes' => $data['size'], + 'size' => bytes_to_size1024($data['size']), + 'preview' => $data['webUrl'], + //'description' => $data['description'], + 'created' => ($data['createdDateTime'] ? format_date(strtotime($data['createdDateTime']), 'strfdaymonthyearshort') : null), + 'updated' => ($data['lastModifiedDateTime'] ? format_date(strtotime($data['lastModifiedDateTime']), 'strfdaymonthyearshort') : null), + ); + return $info; + } + else { + return null; + } + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + // SEE: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_downloadcontent + public function download_file($file_id='0', $owner=null) { + $consumer = self::get_service_consumer($owner); + $token = self::check_access_token($owner); + if (!empty($consumer->key) && !empty($consumer->secret)) { + $url = $consumer->graphurl.$consumer->graph_version.'/me/drive/items/'.$file_id.'/content'; + $header = array(); + $header[] = 'Authorization: Bearer ' . $token; + $header[] = 'Content-Type: application/json'; + $config = array( + CURLOPT_URL => $url, + CURLOPT_PORT => $port, + CURLOPT_HEADER => true, + CURLOPT_HTTPHEADER => $header, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_CAINFO => get_config('docroot').'artefact/cloud/cert/cacert.crt' + ); + $result = mahara_http_request($config); + $data = substr($result->data, $result->info['header_size']); + return $data; + } + else { + throw new ConfigException('Can\'t find Microsoft Graph consumer ID and/or consumer key.'); + } + } + + public function embed_file($file_id='0', $options=array(), $owner=null) { + // Not supported + } + +} diff --git a/blocktype/microsoftdrivebiz/manage.php b/blocktype/microsoftdrivebiz/manage.php new file mode 100644 index 0000000..4964e58 --- /dev/null +++ b/blocktype/microsoftdrivebiz/manage.php @@ -0,0 +1,51 @@ + 'manageform', + 'plugintype' => 'artefact', + 'pluginname' => 'cloud', + 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/cloud/form/'), + 'elements' => array( + 'manage' => array( + 'type' => 'datatables', + 'title' => '', //get_string('selectfiles','blocktype.cloud/microsoftdrivebiz'), + 'service' => 'microsoftdrivebiz', + 'block' => 0, + 'fullpath' => null, + 'options' => array( + 'manageButtons' => true, + 'showFolders' => true, + 'showFiles' => true, + 'selectFolders' => false, + 'selectFiles' => false, + 'selectMultiple' => false + ), + ), + ), +)); + + +$smarty = smarty(); +$smarty->assign('SERVICE', 'microsoftdrivebiz'); +$smarty->assign('manageform', $manageform); +$smarty->display('artefact:cloud:manage.tpl'); diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/favicon.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/favicon.png new file mode 100644 index 0000000..9ea6097 Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/favicon.png differ diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/icon.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/icon.png new file mode 100644 index 0000000..6d6e61b Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/icon.png differ diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/logo.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/logo.png new file mode 100644 index 0000000..3483b29 Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/logo.png differ diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/logo2.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/logo2.png new file mode 100644 index 0000000..c566219 Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/logo2.png differ diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/service.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/service.png new file mode 100644 index 0000000..1240939 Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/service.png differ diff --git a/blocktype/microsoftdrivebiz/theme/raw/static/images/thumb.png b/blocktype/microsoftdrivebiz/theme/raw/static/images/thumb.png new file mode 100644 index 0000000..0bc1a44 Binary files /dev/null and b/blocktype/microsoftdrivebiz/theme/raw/static/images/thumb.png differ diff --git a/blocktype/microsoftdrivebiz/version.php b/blocktype/microsoftdrivebiz/version.php new file mode 100644 index 0000000..448992f --- /dev/null +++ b/blocktype/microsoftdrivebiz/version.php @@ -0,0 +1,17 @@ +version = 2017061700; +$config->release = '17.06.1'; +$config->auth = 'OAuth 2.0'; diff --git a/blocktype/owncloud/account.php b/blocktype/owncloud/account.php index a230a92..8f5f76d 100644 --- a/blocktype/owncloud/account.php +++ b/blocktype/owncloud/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/details.php b/blocktype/owncloud/details.php index 145a2bd..b716b23 100644 --- a/blocktype/owncloud/details.php +++ b/blocktype/owncloud/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/download.php b/blocktype/owncloud/download.php index 0b19399..04d3057 100644 --- a/blocktype/owncloud/download.php +++ b/blocktype/owncloud/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/lang/en.utf8/blocktype.owncloud.php b/blocktype/owncloud/lang/en.utf8/blocktype.owncloud.php index 5b7bbe1..553f005 100644 --- a/blocktype/owncloud/lang/en.utf8/blocktype.owncloud.php +++ b/blocktype/owncloud/lang/en.utf8/blocktype.owncloud.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2014 Gregor Anzelj, gregor.anzelj@gmail.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/lib.php b/blocktype/owncloud/lib.php index a79e470..53b2d0c 100644 --- a/blocktype/owncloud/lib.php +++ b/blocktype/owncloud/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/manage.php b/blocktype/owncloud/manage.php index 84101b6..8740045 100644 --- a/blocktype/owncloud/manage.php +++ b/blocktype/owncloud/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/owncloud/version.php b/blocktype/owncloud/version.php index 3cb6cd0..b0b50d4 100644 --- a/blocktype/owncloud/version.php +++ b/blocktype/owncloud/version.php @@ -5,7 +5,7 @@ * @subpackage blocktype-owncloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/account.php b/blocktype/picasa/account.php index 49aa159..5a2b6a3 100644 --- a/blocktype/picasa/account.php +++ b/blocktype/picasa/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/callback.php b/blocktype/picasa/callback.php index 4a5232b..4b4c5e2 100644 --- a/blocktype/picasa/callback.php +++ b/blocktype/picasa/callback.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/details.php b/blocktype/picasa/details.php index 2d76384..1afa59f 100644 --- a/blocktype/picasa/details.php +++ b/blocktype/picasa/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/download.php b/blocktype/picasa/download.php index 914f1ff..5e5c738 100644 --- a/blocktype/picasa/download.php +++ b/blocktype/picasa/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/lang/en.utf8/blocktype.picasa.php b/blocktype/picasa/lang/en.utf8/blocktype.picasa.php index b0c07d7..a4b2d3e 100644 --- a/blocktype/picasa/lang/en.utf8/blocktype.picasa.php +++ b/blocktype/picasa/lang/en.utf8/blocktype.picasa.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/lib.php b/blocktype/picasa/lib.php index 34f4123..a3e2944 100644 --- a/blocktype/picasa/lib.php +++ b/blocktype/picasa/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/manage.php b/blocktype/picasa/manage.php index c9fc330..32524de 100644 --- a/blocktype/picasa/manage.php +++ b/blocktype/picasa/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/picasa/version.php b/blocktype/picasa/version.php index c7e4256..af23e2a 100644 --- a/blocktype/picasa/version.php +++ b/blocktype/picasa/version.php @@ -5,7 +5,7 @@ * @subpackage blocktype-picasa * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/account.php b/blocktype/zotero/account.php index 1c37cf9..f42c1fe 100644 --- a/blocktype/zotero/account.php +++ b/blocktype/zotero/account.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/callback.php b/blocktype/zotero/callback.php index 05b20ad..3029da6 100644 --- a/blocktype/zotero/callback.php +++ b/blocktype/zotero/callback.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2014 Gregor Anzelj, gregor.anzelj@gmail.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/details.php b/blocktype/zotero/details.php index 08ee031..9829fb7 100644 --- a/blocktype/zotero/details.php +++ b/blocktype/zotero/details.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/download.php b/blocktype/zotero/download.php index 8213cce..9b2583a 100644 --- a/blocktype/zotero/download.php +++ b/blocktype/zotero/download.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/export.php b/blocktype/zotero/export.php index 1dafadd..7c691eb 100644 --- a/blocktype/zotero/export.php +++ b/blocktype/zotero/export.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/lang/en.utf8/blocktype.zotero.php b/blocktype/zotero/lang/en.utf8/blocktype.zotero.php index d9047df..f06e923 100644 --- a/blocktype/zotero/lang/en.utf8/blocktype.zotero.php +++ b/blocktype/zotero/lang/en.utf8/blocktype.zotero.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/lib.php b/blocktype/zotero/lib.php index b6349ba..ccf174b 100644 --- a/blocktype/zotero/lib.php +++ b/blocktype/zotero/lib.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/manage.php b/blocktype/zotero/manage.php index 7bf0efe..66da8b0 100644 --- a/blocktype/zotero/manage.php +++ b/blocktype/zotero/manage.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/blocktype/zotero/version.php b/blocktype/zotero/version.php index b3da91e..8b18539 100644 --- a/blocktype/zotero/version.php +++ b/blocktype/zotero/version.php @@ -5,7 +5,7 @@ * @subpackage blocktype-zotero * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/db/upgrade.php b/db/upgrade.php index 52e1c2c..a5a7998 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -5,7 +5,7 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/form/elements/datatables.json.php b/form/elements/datatables.json.php index a690e0d..7119f13 100644 --- a/form/elements/datatables.json.php +++ b/form/elements/datatables.json.php @@ -5,7 +5,7 @@ * @subpackage element * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/form/elements/datatables.php b/form/elements/datatables.php index da41734..bd0c197 100644 --- a/form/elements/datatables.php +++ b/form/elements/datatables.php @@ -5,7 +5,7 @@ * @subpackage element * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/index.php b/index.php index 44f3249..1280b47 100644 --- a/index.php +++ b/index.php @@ -5,7 +5,7 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/lang/en.utf8/artefact.cloud.php b/lang/en.utf8/artefact.cloud.php index 29f5105..12b78ce 100644 --- a/lang/en.utf8/artefact.cloud.php +++ b/lang/en.utf8/artefact.cloud.php @@ -5,7 +5,7 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/lib.php b/lib.php index b86dad8..e97bb47 100644 --- a/lib.php +++ b/lib.php @@ -5,7 +5,7 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ diff --git a/lib/oauth.php b/lib/oauth.php index 7b049eb..c346f0f 100644 --- a/lib/oauth.php +++ b/lib/oauth.php @@ -5,7 +5,7 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * * * This file incorporates work covered by the following copyright and diff --git a/theme/raw/static/images/016x016.jpg b/theme/raw/static/images/016x016.jpg index caad036..d989f56 100644 Binary files a/theme/raw/static/images/016x016.jpg and b/theme/raw/static/images/016x016.jpg differ diff --git a/theme/raw/static/images/016x016.png b/theme/raw/static/images/016x016.png index 1cfe056..00e339b 100644 Binary files a/theme/raw/static/images/016x016.png and b/theme/raw/static/images/016x016.png differ diff --git a/theme/raw/static/images/032x032.png b/theme/raw/static/images/032x032.png index d9731a9..d957c01 100644 Binary files a/theme/raw/static/images/032x032.png and b/theme/raw/static/images/032x032.png differ diff --git a/theme/raw/static/images/048x048.png b/theme/raw/static/images/048x048.png index b4da4d7..6abd5a8 100644 Binary files a/theme/raw/static/images/048x048.png and b/theme/raw/static/images/048x048.png differ diff --git a/theme/raw/static/images/064x064.jpg b/theme/raw/static/images/064x064.jpg index 8e3fbcc..c891f54 100644 Binary files a/theme/raw/static/images/064x064.jpg and b/theme/raw/static/images/064x064.jpg differ diff --git a/theme/raw/static/images/064x064.png b/theme/raw/static/images/064x064.png index cd02742..c3477aa 100644 Binary files a/theme/raw/static/images/064x064.png and b/theme/raw/static/images/064x064.png differ diff --git a/theme/raw/static/images/080x080.png b/theme/raw/static/images/080x080.png index 6771715..81dc39c 100644 Binary files a/theme/raw/static/images/080x080.png and b/theme/raw/static/images/080x080.png differ diff --git a/theme/raw/static/images/096x096.png b/theme/raw/static/images/096x096.png index 5e8a1fa..a59af9d 100644 Binary files a/theme/raw/static/images/096x096.png and b/theme/raw/static/images/096x096.png differ diff --git a/theme/raw/static/images/100x080.jpg b/theme/raw/static/images/100x080.jpg index 287589f..5c67234 100644 Binary files a/theme/raw/static/images/100x080.jpg and b/theme/raw/static/images/100x080.jpg differ diff --git a/theme/raw/static/images/120x060.png b/theme/raw/static/images/120x060.png index 9f9d457..2f2d036 100644 Binary files a/theme/raw/static/images/120x060.png and b/theme/raw/static/images/120x060.png differ diff --git a/theme/raw/static/images/120x120.png b/theme/raw/static/images/120x120.png index b7f6bfe..fff0377 100644 Binary files a/theme/raw/static/images/120x120.png and b/theme/raw/static/images/120x120.png differ diff --git a/theme/raw/static/images/128x128.png b/theme/raw/static/images/128x128.png index 0af0137..354f668 100644 Binary files a/theme/raw/static/images/128x128.png and b/theme/raw/static/images/128x128.png differ diff --git a/theme/raw/static/images/160x160.png b/theme/raw/static/images/160x160.png index 53763ff..63a5836 100644 Binary files a/theme/raw/static/images/160x160.png and b/theme/raw/static/images/160x160.png differ diff --git a/theme/raw/static/images/256x256.png b/theme/raw/static/images/256x256.png index bdfbb09..ec773a0 100644 Binary files a/theme/raw/static/images/256x256.png and b/theme/raw/static/images/256x256.png differ diff --git a/theme/raw/static/images/300x090.gif b/theme/raw/static/images/300x090.gif index a4b8e9e..27928c7 100644 Binary files a/theme/raw/static/images/300x090.gif and b/theme/raw/static/images/300x090.gif differ diff --git a/theme/raw/static/images/512x512.png b/theme/raw/static/images/512x512.png index c809e55..087053e 100644 Binary files a/theme/raw/static/images/512x512.png and b/theme/raw/static/images/512x512.png differ diff --git a/theme/raw/static/images/MaharaLogo2017_RGB.svg b/theme/raw/static/images/MaharaLogo2017_RGB.svg new file mode 100644 index 0000000..f6caf43 --- /dev/null +++ b/theme/raw/static/images/MaharaLogo2017_RGB.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/theme/raw/static/images/MaharaRauiri2017_RGB.svg b/theme/raw/static/images/MaharaRauiri2017_RGB.svg new file mode 100644 index 0000000..1308498 --- /dev/null +++ b/theme/raw/static/images/MaharaRauiri2017_RGB.svg @@ -0,0 +1,15 @@ + + + + + + diff --git a/theme/raw/static/images/original.png b/theme/raw/static/images/original.png deleted file mode 100644 index dc4e7c2..0000000 Binary files a/theme/raw/static/images/original.png and /dev/null differ diff --git a/version.php b/version.php index 2eb3b98..9321c6f 100644 --- a/version.php +++ b/version.php @@ -5,12 +5,12 @@ * @subpackage artefact-cloud * @author Gregor Anzelj * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2012-2016 Gregor Anzelj, info@povsod.com + * @copyright (C) 2012-2017 Gregor Anzelj, info@povsod.com * */ defined('INTERNAL') || die(); $config = new StdClass; -$config->version = 2016040400; -$config->release = '15.10.2'; +$config->version = 2017061700; +$config->release = '17.06.1';