Skip to content

Commit

Permalink
init: new repository (release 5.0);
Browse files Browse the repository at this point in the history
  • Loading branch information
ernst-metaventis committed Feb 24, 2020
0 parents commit f688cdf
Show file tree
Hide file tree
Showing 20 changed files with 3,262 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
edu-sharing atto plugin
=========================

The edu-sharing atto plugin adds the option to embed all kinds of edu-sharing content to all WYSIWYG fields. The new button will open the edu-sharing search engine and let you pick an item embed. Audio and video-files will be embedded with a player. Documents will be represented by a link. You may pick which version of the content you would like to provide in the course (always the latest vs. the version you just picked).

Dependencies
------------

Depends on the edu-sharing activity module. To show the embedded content the edu-sharing filter must be activated.

Installation
------------

For a full documentation with screenshots of the installation steps for the edu-sharing plugin pakage visit the [documentation pages](http://docs.edu-sharing.com/confluence/edp/en).

Documentation
-------------

More information can be found on the [homepage](http://www.edu-sharing.com).

Where can I get the latest release?
-----------------------------------
You find our latest releases on our [github repository](https://github.com/edu-sharing).

Contributing
------------

If you plan to contribute on a regular basis, please visit our [community site](http://edu-sharing-network.org/?lang=en).

License
-------
Code is under the [GNU GENERAL PUBLIC LICENSE v3](./LICENSE).
41 changes: 41 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Plugin capabilities
*
* @package atto_edusharing
* @copyright COPYRIGHTINFO
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$capabilities = array(

'atto/edusharing:visible' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'coursecreator' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'student' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
)
);

57 changes: 57 additions & 0 deletions db/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Add the edusharing button to Atto
*
* @package atto_edusharing
* @copyright metaVentis GmbH — http://metaventis.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

/**
* Enable edusharing for Atto buttons on installation.
*/
function xmldb_atto_edusharing_install() {
$toolbar = get_config('editor_atto', 'toolbar');
if (strpos($toolbar, 'edusharing') === false && $toolbar && $toolbar != '') {
$groups = explode("\n", $toolbar);
// Try to put edusharing in files group.
$found = false;
foreach ($groups as $i => $group) {
$parts = explode('=', $group);
if (trim($parts[0]) == 'files') {
$groups[$i] = 'files = ' . trim($parts[1]) . ', edusharing';
$found = true;
}
}
// Otherwise create a edusharing group in the second position starting from
// the end.
if (!$found) {
do {
$last = array_pop($groups);
} while (empty($last) && !empty($groups));

$groups[] = 'edusharing = edusharing';
$groups[] = $last;
}
// Update config variable.
$toolbar = implode("\n", $groups);
set_config('toolbar', $toolbar, 'editor_atto');
}
}
54 changes: 54 additions & 0 deletions db/uninstall.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Atto uninstall script. Removes edusharing button from Atto toolbar.
*
* @package atto_edusharing
* @copyright metaVentis GmbH — http://metaventis.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

function xmldb_atto_edusharing_uninstall() {
// Remove 'edusharing' from the toolbar editor_atto config variable.
$toolbar = get_config('editor_atto', 'toolbar');
if (strpos($toolbar, 'edusharing') !== false) {
$groups = explode("\n", $toolbar);
$newgroups = array();
foreach ($groups as $group) {
if (strpos($group, 'edusharing') !== false) {
$parts = explode('=', $group);
$items = explode(',', $parts[1]);
$newitems = array();
foreach ($items as $item) {
if (trim($item) != 'edusharing') {
$newitems[] = $item;
}
}
if (!empty($newitems)) {
$parts[1] = implode(',', $newitems);
$newgroups[] = implode('=', $parts);
}
} else {
$newgroups[] = $group;
}
}
$toolbar = implode("\n", $newgroups);
set_config('toolbar', $toolbar, 'editor_atto');
}
}
58 changes: 58 additions & 0 deletions delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Called on object deletion
*
* @package editor_edusharing
* @copyright metaVentis GmbH — http://metaventis.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__ . '/../../../../../config.php');
require_once($CFG->dirroot . '/lib/setup.php');

require_login();
require_sesskey();

require_once($CFG->dirroot . '/mod/edusharing/lib.php');

$input = file_get_contents('php://input');
if (!$input) {
throw new Exception(get_string('error_json', 'editor_edusharing'));
}

$delete = json_decode($input);
if (!$delete) {
throw new Exception(get_string('error_json', 'editor_edusharing'));
}

$where = array(
'id' => $delete->id,
'course' => $delete->course,
);
$edusharing = $DB->get_record(EDUSHARING_TABLE, $where);
if (!$edusharing) {
trigger_error(get_string('error_resource_not_found', 'editor_edusharing'), E_USER_WARNING);
header('HTTP/1.1 404 Not found', true, 404);
exit();
}

if (!edusharing_delete_instance($edusharing->id)) {
trigger_error(get_string('error_deleting_instance', 'editor_edusharing'), E_USER_WARNING);

header('', true, 500);
}
61 changes: 61 additions & 0 deletions insert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Called on object insertion
*
* @package editor_edusharing
* @copyright metaVentis GmbH — http://metaventis.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once( __DIR__ . '/../../../../../config.php');
require_once($CFG->dirroot . '/lib/setup.php');

require_login();
require_sesskey();

require_once($CFG->dirroot . '/mod/edusharing/lib.php');

try {

$input = file_get_contents('php://input');
if (!$input) {
throw new Exception(get_string('error_json', 'editor_edusharing'));
}

$edusharing = json_decode($input);
if (!$edusharing) {
throw new Exception(get_string('error_json', 'editor_edusharing'));
}

$edusharing->editor_atto = true;

$id = edusharing_add_instance($edusharing);
if (!$id) {
throw new Exception(get_string('error_adding_instance', 'editor_edusharing'));
}

$edusharing->id = $id;

$edusharing->src = $CFG->wwwroot . '/lib/editor/edusharing/images/edusharing.png';

header('Content-type: application/json', true, 200);
echo json_encode($edusharing);
} catch (Exception $exception) {
trigger_error($exception->getMessage(), E_USER_WARNING);
header('HTTP/1.1 500 Internal Server Error', true, 500);
}
45 changes: 45 additions & 0 deletions lang/de/atto_edusharing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'atto_edusharing', language 'de'.
*
* @package atto_edusharing
* @copyright COPYRIGHTINFO
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['pluginname'] = 'edu-sharing';
$string['dialogtitle'] = 'edu-sharing Material';
$string['settings'] = 'edu-sharing (Atto)';
$string['insert'] = 'EINFÜGEN';
$string['update'] = 'AKTUALISIEREN';
$string['cancel'] = 'ABBRECHEN';
$string['title'] = 'Title';
$string['subtitle'] = 'Untertitel';
$string['alwaysShowLatestVersion'] = 'Immer die neuste Version anzeigen';
$string['alignment'] = 'Ausrichtung';
$string['alignmentLeft'] = 'Links umfließend';
$string['alignmentRight'] = 'Rechts umfließend';
$string['alignmentNone'] = 'Keine';
$string['dimensions'] = 'Dimensionen';
$string['dimensionsWidth'] = 'Breite';
$string['dimensionsheight'] = 'Höhe';
$string['openRepo'] = 'REPOSITORIUM ÖFFNEN';
$string['hint1'] = 'Wählen Sie ein edu-sharing Objekt aus dem Repositorium, um es in Moodle einzubinden. Klicken Sie dazu auf "' . $string['openRepo'] . '".';
$string['hint2'] = 'Suchen Sie nun das gewünschte Objekt und betätigen Sie die "ÜBERNEHMEN" Schaltfläche.';
$string['skipHint'] = 'Beim nächsten Mal direkt zur Suche springen.';
$string['directoryHint'] = 'Der Ordner wird eingebunden. Elemente des Ordners werden angezeigt, nicht aber weitere Unterordner.';
Loading

0 comments on commit f688cdf

Please sign in to comment.