Permalink
Browse files

Merge remote-tracking branch 'rl/master'

  • Loading branch information...
2 parents 97b5604 + 9621c97 commit 8ea3b3e61ef7acef030f61eea1fcf0c8842fbfed @jfilip jfilip committed May 23, 2012
Showing with 4,007 additions and 889 deletions.
  1. BIN addons/blocks/repository/AlfrescoLogo32.png
  2. +11 −3 addons/blocks/repository/block_repository.php
  3. +7 −1 addons/blocks/repository/db/events.php
  4. +56 −0 addons/blocks/repository/db/upgrade.php
  5. +8 −1 addons/blocks/repository/lang/en_utf8/block_repository.php
  6. +10 −0 addons/blocks/repository/lang/en_utf8/help/repository/categoryfilter.html
  7. +10 −0 addons/blocks/repository/lang/en_utf8/help/repository/search.html
  8. +41 −1 addons/blocks/repository/lib.php
  9. +12 −8 core/file/repository/alfresco/admin_settings_alfresco.php
  10. +75 −35 core/file/repository/alfresco/coursefiles.php
  11. +1 −0 core/file/repository/alfresco/insert_image.php
  12. +31 −14 core/file/repository/alfresco/link.php
  13. +867 −264 core/file/repository/alfresco/repository.php
  14. +1 −1 core/file/repository/alfresco/rootfolder.js
  15. +1 −1 core/file/repository/alfresco/version.php
  16. +107 −62 core/file/repository/index.php
  17. +9 −3 core/file/repository/repository.class.php
  18. +1 −0 core/lang/en_utf8/repository.php
  19. +1 −1 core/lang/en_utf8/repository_alfresco.php
  20. +476 −245 core/lib/alfresco30/lib.php
  21. +30 −0 core/lib/cmis-php/README
  22. +107 −0 core/lib/cmis-php/cmis_demo.php
  23. +71 −0 core/lib/cmis-php/cmis_ls.php
  24. +79 −0 core/lib/cmis-php/cmis_mkdir.php
  25. +79 −0 core/lib/cmis-php/cmis_mktextfile.php
  26. +61 −0 core/lib/cmis-php/cmis_query.php
  27. +1,175 −0 core/lib/cmis-php/cmis_repository_wrapper.php
  28. +53 −0 core/lib/cmis-php/cmis_search.php
  29. +149 −0 core/lib/cmis-php/cmis_test_suite.php
  30. +7 −10 patches/admin/cron.php.patch
  31. +6 −11 patches/admin/index.php.patch
  32. +203 −35 patches/files/index.php.patch
  33. +1 −1 patches/lib/editor/htmlarea/coursefiles.php.patch
  34. +78 −41 patches/lib/editor/htmlarea/popups/insert_image.php.patch
  35. +159 −130 patches/lib/editor/htmlarea/popups/insert_image_std.php.patch
  36. +12 −11 patches/lib/editor/htmlarea/popups/link.php.patch
  37. +1 −1 patches/lib/editor/htmlarea/popups/preview.php.patch
  38. +1 −1 patches/mod/resource/lib.php.patch
  39. +8 −6 patches/user/tabs.php.patch
  40. +2 −2 version.php
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -21,13 +21,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+require_once(dirname(__FILE__) .'/lib.php');
class block_repository extends block_base {
function block_repository() {
$this->title = get_string('blockname', 'block_repository');
- $this->version = 2010090900;
- $this->release = '1.9.0';
+ $this->version = 2010090901;
+ $this->release = '1.9.3';
}
@@ -41,14 +42,21 @@ function get_content() {
$content = '';
$footer = '';
+ $nologin_auths = block_repository_nopasswd_auths();
+ if (!empty($USER->auth) && in_array($USER->auth, $nologin_auths)) {
+ return '';
+ }
+
if (isloggedin() && file_exists($CFG->dirroot . '/file/repository/alfresco/repository.php')) {
require_once($CFG->dirroot . '/file/repository/repository.class.php');
if (isset($CFG->repository_plugins_enabled) && strstr($CFG->repository_plugins_enabled, 'alfresco')) {
if ($repo = repository_factory::factory('alfresco')) {
if ($repo->alfresco_userdir($USER->username) !== false) {
+ // Fix username
+ $username = repository_plugin_alfresco::fix_username($USER->username);
// So that we don't conflict with the default Alfresco admin account.
- $username = $USER->username == 'admin' ? $CFG->repository_alfresco_admin_username : $USER->username;
+ $username = $username == 'admin' ? $CFG->repository_alfresco_admin_username : $username;
$hastenant = false;
@@ -48,7 +48,13 @@
'handlerfile' => '/blocks/repository/lib.php',
'handlerfunction' => 'block_repository_cluster_deassigned',
'schedule' => 'instant'
+ ),
+
+ 'user_created' => array (
+ 'handlerfile' => '/blocks/repository/lib.php',
+ 'handlerfunction' => 'block_repository_user_created',
+ 'schedule' => 'instant'
)
);
-?>
+?>
@@ -0,0 +1,56 @@
+<?php
+/**
+ * ELIS(TM): Enterprise Learning Intelligence Suite
+ * Copyright (C) 2008-2012 Remote-Learner.net Inc (http://www.remote-learner.net)
+ *
+ * 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @package elis
+ * @subpackage block_repository (Alfresco)
+ * @author Remote-Learner.net Inc
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
+ * @copyright (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
+ *
+ */
+
+require_once("{$CFG->dirroot}/blocks/repository/lib.php");
+require_once("{$CFG->dirroot}/file/repository/alfresco/repository.php");
+
+function xmldb_block_repository_upgrade($oldversion = 0) {
+ $result = true;
+
+ if ($oldversion < 2010090901) {
+ $errors = false;
+ $auths = block_repository_nopasswd_auths();
+ $authlist = "'". implode("', '", $auths) ."'";
+ $users = get_records_select('user', "auth IN ({$authlist})", '', 'id, auth');
+ if (!empty($users)) {
+ foreach ($users as $user) {
+ $user = get_complete_user_data('id', $user->id);
+ $migrate_ok = block_repository_user_created($user);
+ if (!$migrate_ok) {
+ $errors = true;
+ error_log("xmldb_block_repository_upgrade({$oldversion}) - failed migrating user ({$user->id}) to Alfresco.");
+ }
+ }
+ }
+ if (!$errors) {
+ set_config('initialized', 1, repository_plugin_alfresco::$plugin_name);
+ }
+ }
+
+ return $result;
+}
+
+?>
@@ -1,6 +1,12 @@
<?php
+$string['alfrescocategoryfilter'] = 'Alfresco category filter';
+$string['badqueryresponse'] = 'Bad query response!<br/>Your query has returned bad XML due to a Repository Server Error.';
+
$string['blockname'] = 'Alfresco Repository';
+$string['categoryfilter'] = 'Category filter';
+
+$string['details'] = 'Details';
$string['repository:createsitecontent'] = 'Create site-level content';
$string['repository:viewsitecontent'] = 'View site-level content';
@@ -22,6 +28,7 @@
$string['embeddedwebdavlink'] = 'To access Alfresco via an embedded WebDAV client, click <a href=\"$a\">this link</a>.';
$string['helpfileslink'] = '<a href=\"$a\">Alfresco documentation</a>';
$string['helplink'] = 'Link to help documents';
+$string['incompletequeryresponse'] = 'Incomplete query response!<br/>Your query failed to complete successfully due to a Repository Server Error.';
$string['norepositorypluginsystem'] = 'Your system is missing the repository plug-in system. This block requires that ' .
'to be present with the Alfresco plug-in enabled in order to work.';
$string['usernameinfo'] = 'Use the same username and password that you use to access Moodle to login to Alfresco.';
@@ -31,4 +38,4 @@
'alfrescowebapp\">this link</a>.';
$string['webdavclient'] = 'Link to embedded WebDAV client';
-?>
+?>
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Category Filter Help</title>
+</head>
+<body>
+<p>Check the desired <b>categories</b> to filter listing.</p>
+</body>
+</html>
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Repository Search Help</title>
+</head>
+<body>
+<p>Enter a <b>search</b> string to filter file listing.</p>
+</body>
+</html>
@@ -24,6 +24,46 @@
require_once($CFG->dirroot . '/file/repository/repository.class.php');
+/**
+ * Method to return authentication methods that DO NOT use passwords
+ *
+ * @return array list of authentications that DO NOT use passwords
+ */
+function block_repository_nopasswd_auths() {
+ // TBD: determine from auth plugin which don't support passwords ???
+ return array('openid', 'cas');
+}
+
+/**
+ * Handle the event when a user is created in Moodle.
+ *
+ * @uses $CFG
+ * @param object $user Moodle user record object.
+ * @return bool True on success, False otherwise.
+ */
+function block_repository_user_created($user) {
+ global $CFG;
+ $result = true;
+
+ // Only proceed here if the Alfresco plug-in is actually enabled.
+ if (!isset($CFG->repository_plugins_enabled) || (strstr($CFG->repository_plugins_enabled, 'alfresco') === false) ||
+ !($repo = repository_factory::factory('alfresco')) || !$repo->is_configured() || !$repo->verify_setup()) {
+ error_log("block_repository_user_created(): Alfresco NOT enabled!");
+ return true; // TBD
+ }
+
+ // create a random password for certain authentications
+ $auths = block_repository_nopasswd_auths();
+ if (!empty($user->auth) && in_array($user->auth, $auths)) {
+ $passwd = random_string(8);
+ //$user->password = md5($passwd); // TBD: or reversible encrypt
+ //update_record('user', $user);
+ //error_log("block_repository_user_created(): generating password for {$user->id} ({$user->auth}) => {$passwd}");
+ $result = $repo->migrate_user($user, $passwd);
+ }
+
+ return $result;
+}
/**
* Handle the event when a user is deleted in Moodle.
@@ -384,4 +424,4 @@ function block_repository_cluster_deassigned($clusterinfo) {
return true;
}
-?>
+?>
@@ -44,8 +44,8 @@ function write_setting($data) {
if ($repo = repository_factory::factory('alfresco')) {
if ($repo->is_configured() && $repo->verify_setup()) {
if (alfresco_validate_path($data)) {
- $newuuid = alfresco_uuid_from_path($data);
-
+// $newuuid = alfresco_uuid_from_path($data);
+ $newuuid = $repo->get_uuid_from_path($data);
if (($newuuid != $repo->muuid) && !alfresco_root_move($repo->muuid, $newuuid)) {
return get_string('couldnotmoveroot', 'repository_alfresco');
} else {
@@ -74,9 +74,14 @@ function output_html($data, $query = '') {
/// Validate the path, if we can.
if ($repo = repository_factory::factory('alfresco')) {
$repoisup = $repo->is_configured() && $repo->verify_setup();
-
if ($repoisup) {
- if (alfresco_validate_path($data)) {
+ if (empty($CFG->repository_alfresco_root_folder)) {
+ // if alfresco root folder is currently empty, set it to moodle (the default)
+ $root_folder = '/moodle';
+ } else {
+ $root_folder = $CFG->repository_alfresco_root_folder;
+ }
+ if ($root_folder == s($data) && !empty($repo->muuid)) {
$valid = '<span class="pathok">&#x2714;</span>';
} else {
$valid = '<span class="patherror">&#x2718;</span>';
@@ -114,11 +119,10 @@ function write_setting() {
}
function output_html($data, $query='') {
- $default = $this->get_defaultsetting();
+ $buttonname = get_string('configurecategoryfilter', 'repository_alfresco');
- $button = button_to_popup_window('/file/repository/alfresco/config-categories.php',
- 'config-categories', get_string('configurecategoryfilter', 'repository_alfresco'),
- 480, 640, '', '', true);
+ $button = button_to_popup_window('/file/repository/alfresco/config-categories.php', 'alfrescoconfigcategories',
+ $buttonname, 480, 640, $buttonname, 'scrollbars=yes,resizable=yes', true);
return format_admin_setting($this, $this->visiblename, $button, $this->description, true, '', NULL, $query);
}
Oops, something went wrong.

0 comments on commit 8ea3b3e

Please sign in to comment.