summaryrefslogtreecommitdiff
path: root/plugins/ModPlus
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ModPlus')
-rw-r--r--plugins/ModPlus/ModPlusPlugin.php116
-rw-r--r--plugins/ModPlus/locale/ModPlus.pot43
-rw-r--r--plugins/ModPlus/locale/fr/LC_MESSAGES/ModPlus.po54
-rw-r--r--plugins/ModPlus/locale/mk/LC_MESSAGES/ModPlus.po54
-rw-r--r--plugins/ModPlus/locale/nl/LC_MESSAGES/ModPlus.po54
-rw-r--r--plugins/ModPlus/modplus.css23
-rw-r--r--plugins/ModPlus/modplus.js23
-rw-r--r--plugins/ModPlus/remoteprofileaction.php106
8 files changed, 473 insertions, 0 deletions
diff --git a/plugins/ModPlus/ModPlusPlugin.php b/plugins/ModPlus/ModPlusPlugin.php
new file mode 100644
index 000000000..3e7a8c745
--- /dev/null
+++ b/plugins/ModPlus/ModPlusPlugin.php
@@ -0,0 +1,116 @@
+<?php
+/*
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2010, StatusNet, Inc.
+ *
+ * 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/>.
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * Some UI extras for now...
+ *
+ * @package ModPlusPlugin
+ * @maintainer Brion Vibber <brion@status.net>
+ */
+class ModPlusPlugin extends Plugin
+{
+ function onPluginVersion(&$versions)
+ {
+ $versions[] = array('name' => 'ModPlus',
+ 'version' => STATUSNET_VERSION,
+ 'author' => 'Brion Vibber',
+ 'homepage' => 'http://status.net/wiki/Plugin:ModPlus',
+ 'rawdescription' =>
+ _m('UI extensions for profile moderation actions.'));
+
+ return true;
+ }
+
+ /**
+ * Load JS at runtime if we're logged in.
+ *
+ * @param Action $action
+ * @return boolean hook result
+ */
+ function onEndShowScripts($action)
+ {
+ $user = common_current_user();
+ if ($user) {
+ $action->script('plugins/ModPlus/modplus.js');
+ }
+ return true;
+ }
+
+ function onEndShowStatusNetStyles($action) {
+ $action->cssLink('plugins/ModPlus/modplus.css');
+ return true;
+ }
+
+ /**
+ * Autoloader
+ *
+ * Loads our classes if they're requested.
+ *
+ * @param string $cls Class requested
+ *
+ * @return boolean hook return
+ */
+ function onAutoload($cls)
+ {
+ switch ($cls)
+ {
+ case 'RemoteprofileAction':
+ case 'RemoteProfileAction':
+ require_once dirname(__FILE__) . '/remoteprofileaction.php';
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * Add OpenID-related paths to the router table
+ *
+ * Hook for RouterInitialized event.
+ *
+ * @param Net_URL_Mapper $m URL mapper
+ *
+ * @return boolean hook return
+ */
+ function onStartInitializeRouter($m)
+ {
+ $m->connect('user/remote/:id',
+ array('action' => 'remoteprofile'),
+ array('id' => '[\d]+'));
+
+ return true;
+ }
+
+ function onStartShowNoticeItem($item)
+ {
+ $profile = $item->profile;
+ $isRemote = !(User::staticGet('id', $profile->id));
+ if ($isRemote) {
+ $target = common_local_url('remoteprofile', array('id' => $profile->id));
+ $label = _m('Remote profile options...');
+ $item->out->elementStart('div', 'remote-profile-options');
+ $item->out->element('a', array('href' => $target), $label);
+ $item->out->elementEnd('div');
+ }
+ }
+}
diff --git a/plugins/ModPlus/locale/ModPlus.pot b/plugins/ModPlus/locale/ModPlus.pot
new file mode 100644
index 000000000..025b521a0
--- /dev/null
+++ b/plugins/ModPlus/locale/ModPlus.pot
@@ -0,0 +1,43 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-11-29 15:37+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ModPlusPlugin.php:39
+msgid "UI extensions for profile moderation actions."
+msgstr ""
+
+#: ModPlusPlugin.php:110
+msgid "Remote profile options..."
+msgstr ""
+
+#: remoteprofileaction.php:51
+#, php-format
+msgid "%s on %s"
+msgstr ""
+
+#: remoteprofileaction.php:62
+#, php-format
+msgid ""
+"This remote profile is registered on another site; see [%s's original "
+"profile page on %s](%s)."
+msgstr ""
+
+#: remoteprofileaction.php:70
+msgid ""
+"Site moderators have silenced this profile, which prevents delivery of new "
+"messages to any users on this site."
+msgstr ""
diff --git a/plugins/ModPlus/locale/fr/LC_MESSAGES/ModPlus.po b/plugins/ModPlus/locale/fr/LC_MESSAGES/ModPlus.po
new file mode 100644
index 000000000..5cf777ed6
--- /dev/null
+++ b/plugins/ModPlus/locale/fr/LC_MESSAGES/ModPlus.po
@@ -0,0 +1,54 @@
+# Translation of StatusNet - ModPlus to French (Français)
+# Expored from translatewiki.net
+#
+# Author: Peter17
+# --
+# This file is distributed under the same license as the StatusNet package.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: StatusNet - ModPlus\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-11-30 16:54+0000\n"
+"PO-Revision-Date: 2010-11-30 16:57:41+0000\n"
+"Language-Team: French <http://translatewiki.net/wiki/Portal:fr>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-POT-Import-Date: 2010-11-29 20:20:56+0000\n"
+"X-Generator: MediaWiki 1.17alpha (r77474); Translate extension (2010-09-17)\n"
+"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
+"X-Language-Code: fr\n"
+"X-Message-Group: #out-statusnet-plugin-modplus\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: ModPlusPlugin.php:39
+msgid "UI extensions for profile moderation actions."
+msgstr ""
+"Extensions d’interface utilisateur pour les actions de modération des "
+"profils."
+
+#: ModPlusPlugin.php:110
+msgid "Remote profile options..."
+msgstr "Options de profil distantes..."
+
+#: remoteprofileaction.php:51
+#, php-format
+msgid "%s on %s"
+msgstr "%s sur %s"
+
+#: remoteprofileaction.php:62
+#, php-format
+msgid ""
+"This remote profile is registered on another site; see [%s's original "
+"profile page on %s](%s)."
+msgstr ""
+"Ce profil distant est enregistré sur un autre site ; voir [la page de profil "
+"originale de %s sur %s] (%s)."
+
+#: remoteprofileaction.php:70
+msgid ""
+"Site moderators have silenced this profile, which prevents delivery of new "
+"messages to any users on this site."
+msgstr ""
+"Les modérateurs du site ont réduit ce profil au silence, ce qui empêche "
+"l’envoi de nouveaux messages aux utilisateurs de ce site."
diff --git a/plugins/ModPlus/locale/mk/LC_MESSAGES/ModPlus.po b/plugins/ModPlus/locale/mk/LC_MESSAGES/ModPlus.po
new file mode 100644
index 000000000..d14db652a
--- /dev/null
+++ b/plugins/ModPlus/locale/mk/LC_MESSAGES/ModPlus.po
@@ -0,0 +1,54 @@
+# Translation of StatusNet - ModPlus to Macedonian (Македонски)
+# Expored from translatewiki.net
+#
+# Author: Bjankuloski06
+# --
+# This file is distributed under the same license as the StatusNet package.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: StatusNet - ModPlus\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-11-30 16:54+0000\n"
+"PO-Revision-Date: 2010-11-30 16:57:41+0000\n"
+"Language-Team: Macedonian <http://translatewiki.net/wiki/Portal:mk>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-POT-Import-Date: 2010-11-29 20:20:56+0000\n"
+"X-Generator: MediaWiki 1.17alpha (r77474); Translate extension (2010-09-17)\n"
+"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
+"X-Language-Code: mk\n"
+"X-Message-Group: #out-statusnet-plugin-modplus\n"
+"Plural-Forms: nplurals=2; plural=(n == 1 || n%10 == 1) ? 0 : 1;\n"
+
+#: ModPlusPlugin.php:39
+msgid "UI extensions for profile moderation actions."
+msgstr ""
+"Додатоци за кориснички посредник наменети за постапки за административна "
+"контрола на профили."
+
+#: ModPlusPlugin.php:110
+msgid "Remote profile options..."
+msgstr "Нагодувања на далечински профил..."
+
+#: remoteprofileaction.php:51
+#, php-format
+msgid "%s on %s"
+msgstr "%s на %s"
+
+#: remoteprofileaction.php:62
+#, php-format
+msgid ""
+"This remote profile is registered on another site; see [%s's original "
+"profile page on %s](%s)."
+msgstr ""
+"Овој далечински профил е регистриран на друго мреж. место. Погледајте ја [%"
+"s's изворната профилна страница на %s](%s)."
+
+#: remoteprofileaction.php:70
+msgid ""
+"Site moderators have silenced this profile, which prevents delivery of new "
+"messages to any users on this site."
+msgstr ""
+"Администраторите го замолчиле овој профил, што оневозможува праќање нови "
+"пораки на било кој корисник на мрежното место."
diff --git a/plugins/ModPlus/locale/nl/LC_MESSAGES/ModPlus.po b/plugins/ModPlus/locale/nl/LC_MESSAGES/ModPlus.po
new file mode 100644
index 000000000..2cc8b5b4d
--- /dev/null
+++ b/plugins/ModPlus/locale/nl/LC_MESSAGES/ModPlus.po
@@ -0,0 +1,54 @@
+# Translation of StatusNet - ModPlus to Dutch (Nederlands)
+# Expored from translatewiki.net
+#
+# Author: Siebrand
+# --
+# This file is distributed under the same license as the StatusNet package.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: StatusNet - ModPlus\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-11-30 16:54+0000\n"
+"PO-Revision-Date: 2010-11-30 16:57:41+0000\n"
+"Language-Team: Dutch <http://translatewiki.net/wiki/Portal:nl>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-POT-Import-Date: 2010-11-29 20:20:56+0000\n"
+"X-Generator: MediaWiki 1.17alpha (r77474); Translate extension (2010-09-17)\n"
+"X-Translation-Project: translatewiki.net at http://translatewiki.net\n"
+"X-Language-Code: nl\n"
+"X-Message-Group: #out-statusnet-plugin-modplus\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: ModPlusPlugin.php:39
+msgid "UI extensions for profile moderation actions."
+msgstr ""
+"Uitbreiding van de gebruikersinterface voor handelingen ten aanzien van "
+"profielmoderatie."
+
+#: ModPlusPlugin.php:110
+msgid "Remote profile options..."
+msgstr "Instellingen voor profiel op andere server..."
+
+#: remoteprofileaction.php:51
+#, php-format
+msgid "%s on %s"
+msgstr "%s op %s"
+
+#: remoteprofileaction.php:62
+#, php-format
+msgid ""
+"This remote profile is registered on another site; see [%s's original "
+"profile page on %s](%s)."
+msgstr ""
+"Dit profiel op een andere server is geregistreerd bij een andere site. Zie "
+"[de originele profielpagina van %s op %s](%s)."
+
+#: remoteprofileaction.php:70
+msgid ""
+"Site moderators have silenced this profile, which prevents delivery of new "
+"messages to any users on this site."
+msgstr ""
+"Moderatoren van de site hebben dit profiel het zwijgen opgeleverd waardoor "
+"nieuwe berichten zenden aan gebruikers van deze site niet mogelijk is."
diff --git a/plugins/ModPlus/modplus.css b/plugins/ModPlus/modplus.css
new file mode 100644
index 000000000..8d2fc8fba
--- /dev/null
+++ b/plugins/ModPlus/modplus.css
@@ -0,0 +1,23 @@
+.remote-profile-options {
+ position: absolute;
+ z-index: 999;
+
+ background: url(../../theme/base/images/icons/twotone/green/admin.gif) no-repeat 8px 8px white;
+ border: solid 1px #c0c0c0;
+
+ margin-top: 56px;
+
+ padding: 6px 16px;
+ padding-left: 32px;
+
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
+ -msie-border-radius: 8px;
+ border-radius: 8px;
+
+ box-shadow:3px 3px 7px rgba(194, 194, 194, 0.3);
+ -moz-box-shadow:3px 3px 7px rgba(194, 194, 194, 0.3);
+ -webkit-box-shadow:3px 3px 7px rgba(194, 194, 194, 0.3);
+
+ display: none;
+}
diff --git a/plugins/ModPlus/modplus.js b/plugins/ModPlus/modplus.js
new file mode 100644
index 000000000..2e90de4f1
--- /dev/null
+++ b/plugins/ModPlus/modplus.js
@@ -0,0 +1,23 @@
+/**
+ * modplus.js
+ * (c) 2010 StatusNet, Inc
+ */
+
+$(function() {
+ function ModPlus_setup(notice) {
+ if ($(notice).find('.remote-profile-options').size()) {
+ var $options = $(notice).find('.remote-profile-options');
+ $options.prepend($())
+ $(notice).find('.author').mouseenter(function(event) {
+ $(notice).find('.remote-profile-options').fadeIn();
+ });
+ $(notice).mouseleave(function(event) {
+ $(notice).find('.remote-profile-options').fadeOut();
+ });
+ }
+ }
+
+ $('.notice').each(function() {
+ ModPlus_setup(this);
+ });
+});
diff --git a/plugins/ModPlus/remoteprofileaction.php b/plugins/ModPlus/remoteprofileaction.php
new file mode 100644
index 000000000..caa5e6fbf
--- /dev/null
+++ b/plugins/ModPlus/remoteprofileaction.php
@@ -0,0 +1,106 @@
+<?php
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+class RemoteProfileAction extends ShowstreamAction
+{
+ function prepare($args)
+ {
+ OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
+
+ $id = $this->arg('id');
+ $this->user = false;
+ $this->profile = Profile::staticGet('id', $id);
+
+ if (!$this->profile) {
+ $this->serverError(_('User has no profile.'));
+ return false;
+ }
+
+ $user = User::staticGet('id', $this->profile->id);
+ if ($user) {
+ // This is a local user -- send to their regular profile.
+ $url = common_local_url('showstream', array('nickname' => $user->nickname));
+ common_redirect($url);
+ return false;
+ }
+
+ $this->tag = $this->trimmed('tag');
+ $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
+ common_set_returnto($this->selfUrl());
+ return true;
+ }
+
+ function handle($args)
+ {
+ // skip yadis thingy
+ $this->showPage();
+ }
+
+ function title()
+ {
+ // maybe fixed in 0.9.x
+ if (!empty($this->profile->fullname)) {
+ $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
+ } else {
+ $base = $this->profile->nickname;
+ }
+ $host = parse_url($this->profile->profileurl, PHP_URL_HOST);
+ return sprintf(_m('%s on %s'), $base, $host);
+ }
+
+ /**
+ * Instead of showing notices, link to the original offsite profile.
+ */
+ function showNotices()
+ {
+ $url = $this->profile->profileurl;
+ $host = parse_url($url, PHP_URL_HOST);
+ $markdown = sprintf(
+ _m('This remote profile is registered on another site; see [%s\'s original profile page on %s](%s).'),
+ $this->profile->nickname,
+ $host,
+ $url);
+ $html = common_markup_to_html($markdown);
+ $this->raw($html);
+
+ if ($this->profile->hasRole(Profile_role::SILENCED)) {
+ $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
+ $this->raw(common_markup_to_html($markdown));
+ }
+ }
+
+ function getFeeds()
+ {
+ // none
+ }
+
+ /**
+ * Don't do various extra stuff, and also trim some things to avoid crawlers.
+ */
+ function extraHead()
+ {
+ $this->element('meta', array('name' => 'robots',
+ 'content' => 'noindex,nofollow'));
+ }
+
+ function showLocalNav()
+ {
+ $nav = new PublicGroupNav($this);
+ $nav->show();
+ }
+
+ function showSections()
+ {
+ ProfileAction::showSections();
+ // skip tag cloud
+ }
+
+ function showStatistics()
+ {
+ // skip
+ }
+
+} \ No newline at end of file