aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:44:13 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:44:13 -0300
commit33de97cc48cc2f7d79db38568ee74cb93f7b0041 (patch)
treec9089edfc036a56dbf7a00703be9ad859a64e767
downloadelgg-33de97cc48cc2f7d79db38568ee74cb93f7b0041.tar.gz
elgg-33de97cc48cc2f7d79db38568ee74cb93f7b0041.tar.bz2
Squashed 'mod/curatedgroups/' content from commit fb2fc6f
git-subtree-dir: mod/curatedgroups git-subtree-split: fb2fc6f267b9c3c7e6c5055412b716ce22b34a32
-rw-r--r--languages/ca.php33
-rwxr-xr-xlanguages/en.php33
-rwxr-xr-xlanguages/es.php33
-rwxr-xr-xmanifest.xml18
-rw-r--r--start.php38
-rw-r--r--views/default/forms/groups/edit.php77
-rw-r--r--views/default/settings/curatedgroups/edit.php39
7 files changed, 271 insertions, 0 deletions
diff --git a/languages/ca.php b/languages/ca.php
new file mode 100644
index 000000000..c7513aad1
--- /dev/null
+++ b/languages/ca.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Curated Groups -- Translation strings for Catalan
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This file is part of the CuratedGroups plugin for Elgg.
+ *
+ * CuratedGroups is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * CuratedGroups 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+$catalan = array(
+ "curatedgroups:message" => "Tan sols es poden crear grups oficials. Si estàs intentant crear un grup oficial contacta amb els administradors.",
+ "curatedgroups:settings:message" => "Escriu un missatge personalitzat per mostrar quan s'estigui intentant crear un grup. Si no s'especifica, s'utilizarà un missatge per defecte internacionalitzable",
+ "curatedgroups:settings:creators" => "Escriu una llista de noms d'usuari separats per comes que podràn crear grups"
+);
+
+add_translation("ca", $catalan);
diff --git a/languages/en.php b/languages/en.php
new file mode 100755
index 000000000..88990a42d
--- /dev/null
+++ b/languages/en.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Curated Groups -- Translation strings for English
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This file is part of the CuratedGroups plugin for Elgg.
+ *
+ * CuratedGroups is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * CuratedGroups 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+$english = array(
+ "curatedgroups:message" => "Only official groups are allowed. If you're trying to create an official group please contact the admins.",
+ "curatedgroups:settings:message" => "Write a personalized message to show when trying to create a group. If not defined a default internationalizable one will be shown",
+ "curatedgroups:settings:creators" => "Write a comma separated list of usernames that will be allowed to create groups"
+);
+
+add_translation("en",$english);
diff --git a/languages/es.php b/languages/es.php
new file mode 100755
index 000000000..7c44cf812
--- /dev/null
+++ b/languages/es.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Curated Groups -- Translation strings for Spanish
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This file is part of the CuratedGroups plugin for Elgg.
+ *
+ * CuratedGroups is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * CuratedGroups 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+$spanish = array(
+ "curatedgroups:message" => "Solo se pueden crear grupos oficiales. Si est&aacute; tratando de crear un grupo oficial contacta con las administradoras.",
+ "curatedgroups:settings:message" => "Escribe un mensaje personalizado que mostrar cuando se esté intentando crear un grupo. Si no se especifica se utilizará un mensaje por defecto internacionalizable",
+ "curatedgroups:settings:creators" => "Escribe una lista de nombres de usuario separados por comas que podrán crear grupos"
+);
+
+add_translation("es", $spanish);
diff --git a/manifest.xml b/manifest.xml
new file mode 100755
index 000000000..8bef940e9
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Curated Groups</name>
+ <author>Lorea developers</author>
+ <version>1.1</version>
+ <category>lorea</category>
+ <category>groups</category>
+ <description>Limit group creation to administrators.</description>
+ <website>https://lorea.org/plugin/curatedgroups</website>
+ <repository>https://gitorious.org/lorea/curatedgroups</repository>
+ <donations>https://lorea.org/support</donations>
+ <license>GNU Affero GeneralPublic License version 3 or later</license>
+ <requires>
+ <type>elgg_version</type>
+ <version>2011061200</version>
+ </requires>
+ <admin_interface>advanced</admin_interface>
+</plugin_manifest>
diff --git a/start.php b/start.php
new file mode 100644
index 000000000..e4bca1ff7
--- /dev/null
+++ b/start.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Curated Groups -- Limit group creation to administrators
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ * @homepage http://lorea.org/plugin/curatedgroups
+ * @copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ * @license COPYING, http://www.gnu.org/licenses/agpl
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Elgg Curated Groups plugin
+ *
+ * @package ElggCuratedGroups
+ */
+elgg_register_event_handler('init','system','curatedgroups_init');
+
+function curatedgroups_init(){
+}
+
+?>
diff --git a/views/default/forms/groups/edit.php b/views/default/forms/groups/edit.php
new file mode 100644
index 000000000..72b017832
--- /dev/null
+++ b/views/default/forms/groups/edit.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Curated Groups -- Form
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This file is part of the CuratedGroups plugin for Elgg.
+ *
+ * CuratedGroups is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * CuratedGroups 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+ $creator=false;
+ // check if user is admin
+ if (isadminloggedin()) $creator=true;
+
+ // check if user is one of the specified group creators
+ if (!$creator) {
+ $creators_text = str_replace(' ', '', elgg_get_plugin_setting("creators", "curatedgroups"));
+ $creators = explode(",", $creators_text);
+ if (!empty($creators)) {
+ if (in_array(elgg_get_logged_in_user_entity()->username, $creators)) {
+ $creator = true;
+ // Compatibility with CuratedGroups 1.0
+ } elseif (in_array(elgg_get_logged_in_user_guid(), $creators)) {
+ $creator = true;
+ }
+ }
+ }
+
+ // check if user is admin of the current group (for editing an
+ // existing group)
+ if (!$creator && isset($vars['entity'])) {
+ if ($vars['entity']->canEdit())
+ $creator = true;
+ }
+
+ // check if user is admin of the parent group if defined (for
+ // subgroups)
+ if (!$creator) {
+ $parent_guid = (int)get_input("parent", 0);
+ if (!empty($parent_guid)) {
+ $parent = get_entity($parent_guid);
+ if ($parent->canEdit())
+ $creator = true;
+ }
+ }
+
+ // show group creation form if we're a creator, otherwise show the not
+ // allowed message
+ if ($creator) {
+ if (elgg_is_active_plugin("subgroups"))
+ include elgg_get_plugins_path() . "subgroups/views/default/forms/groups/edit.php";
+ else
+ include elgg_get_plugins_path() . "groups/views/default/forms/groups/edit.php";
+ }
+ else {
+ $message = elgg_get_plugin_setting("message", "curatedgroups");
+ if (empty($message))
+ $message = elgg_echo("curatedgroups:message");
+ echo $message;
+ }
+?>
diff --git a/views/default/settings/curatedgroups/edit.php b/views/default/settings/curatedgroups/edit.php
new file mode 100644
index 000000000..9c383b258
--- /dev/null
+++ b/views/default/settings/curatedgroups/edit.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Curated Groups -- Plugin settings
+ *
+ * @package Lorea
+ * @subpackage CuratedGroups
+ *
+ * Copyright 2011-2012 Lorea Faeries <federation@lorea.org>
+ *
+ * This file is part of the CuratedGroups plugin for Elgg.
+ *
+ * CuratedGroups is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * CuratedGroups 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
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+?>
+<p>
+ <?php echo elgg_echo('curatedgroups:settings:message'); ?>:
+ <?php
+ echo elgg_view('input/text', array('name' => 'params[message]', 'value' => $vars['entity']->message));
+ ?>
+</p>
+
+<p>
+ <?php echo elgg_echo('curatedgroups:settings:creators'); ?>:
+ <?php
+ echo elgg_view('input/text', array('name' => 'params[creators]', 'value' => $vars['entity']->creators));
+ ?>
+</p>