diff --git a/newmemberwidget/README.md b/newmemberwidget/README.md new file mode 100644 index 00000000..827ee1f7 --- /dev/null +++ b/newmemberwidget/README.md @@ -0,0 +1,61 @@ +New Member Widget +================= + +With this addon you can enable a widget for the sidebar of the network tab, +which will be displayed for new members. It contains a linkt to friendicas +introduction pages at /newmember and optionally + + * a link to the global support forum + * a link to an eventually existing local support forum + * a welcome message you might want to send to your new members. + +There is no extra styling added for this added, so it should work with any +theme you have selected, or your user selects. But it was only tested with +duepuntozero,quattro and clean. + +Testing it +---------- +You want to test it, but you don't want to create a new account? Take your fav +text editor (yeah emacs will do as well) and edit the newmemberwidget.php file. +In line 21 you will find a if clause, just add a ! infront of the + + x(!_SESSION + +that will negate the requirement of being a new member, so don't forget the +remove that ! again after testing ;-) + +Translations +------------ +If you want to translate this addon, please grab a copy of lang/C/message.po +and copy it to lang/XX/message.po where XX is the language you want to +translate for (i.e. de, fr, nb-no). After you translated the content go to the +root of your friendica directory and run + + php util/po2php.php addon/newmember/lang/XX/message.po + +to translate the message.po file into the strings.php file needed by friendica +to catch your translations. + +With the translated files, either do a pull request at github, or send me the +two files (message.po and strings.php) you just worked with as attachment to an +email. + +Author +------ + * Tobias Diekershoff + +History +------- + * **Version 1** (2014-06-01): Initial Release + +License +------- +This addon is licensed under the [MIT License](http://opensource.org/licenses/MIT). + +> Copyright (c) 2014 Tobias Diekershoff + +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/newmemberwidget/lang/C/messages.po b/newmemberwidget/lang/C/messages.po new file mode 100644 index 00000000..d69b29e3 --- /dev/null +++ b/newmemberwidget/lang/C/messages.po @@ -0,0 +1,74 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-06-01 14:12+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: newmemberwidget.php:21 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:22 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:24 +msgid "Global Support Forum" +msgstr "" + +#: newmemberwidget.php:26 +msgid "Local Support Forum" +msgstr "" + +#: newmemberwidget.php:49 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:50 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:50 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:51 +msgid "Add a link to global support forum" +msgstr "" + +#: newmemberwidget.php:51 +msgid "Should a link to the global support forum be displayed?" +msgstr "" + +#: newmemberwidget.php:52 +msgid "Add a link to the local support forum" +msgstr "" + +#: newmemberwidget.php:52 +msgid "" +"If you have a local support forum and wand to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:53 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:53 +msgid "" +"If you checked the above, specify the nickname of the local support " +"group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/de/messages.po b/newmemberwidget/lang/de/messages.po new file mode 100644 index 00000000..1181bb08 --- /dev/null +++ b/newmemberwidget/lang/de/messages.po @@ -0,0 +1,74 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-06-01 12:06+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: newmemberwidget.php:21 +msgid "New Member" +msgstr "Neue Nutzer" + +#: newmemberwidget.php:22 +msgid "Tips for New Members" +msgstr "Tipps für neue Nutzer" + +#: newmemberwidget.php:24 +msgid "Global Support Forum" +msgstr "Globales Forum für Hilfsanfragen" + +#: newmemberwidget.php:26 +msgid "Local Support Forum" +msgstr "Lokales Forum für Hilfsanfragen" + +#: newmemberwidget.php:47 +msgid "Save Settings" +msgstr "Einstellungen Speichern" + +#: newmemberwidget.php:48 +msgid "Message" +msgstr "Nachricht" + +#: newmemberwidget.php:48 +msgid "Your message for new members. You can use bbcode here." +msgstr "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden." + +#: newmemberwidget.php:49 +msgid "Add a link to global support forum" +msgstr "Link zum globalen Support Forum anzeigen" + +#: newmemberwidget.php:49 +msgid "Should a link to the global support forum be displayed?" +msgstr "Soll ein Link zum globalen Support Forum angezeigt werden?" + +#: newmemberwidget.php:50 +msgid "Add a link to the local support forum" +msgstr "Link zum lokalen Support Forum anzeigen" + +#: newmemberwidget.php:50 +msgid "" +"If you have a local support forum and wand to have a link displayed in the " +"widget, check this box." +msgstr "Wenn du ein lokales Support Forum eingerichtet hast und Link darauf angezeigt werden soll, hier klicken" + +#: newmemberwidget.php:51 +msgid "Name of the local support group" +msgstr "Name des lokalen Support Forums" + +#: newmemberwidget.php:51 +msgid "" +"If you checked the above, specify the nickname of the local support " +"group here (i.e. helpers)" +msgstr "Wenn der Link angezeigt werden soll, dann trage hier den Spitznamen des Forums ein (z.B. helpers)" diff --git a/newmemberwidget/lang/de/strings.php b/newmemberwidget/lang/de/strings.php new file mode 100644 index 00000000..60d21bd7 --- /dev/null +++ b/newmemberwidget/lang/de/strings.php @@ -0,0 +1,16 @@ +strings["New Member"] = "Neue Nutzer"; +$a->strings["Tips for New Members"] = "Tipps für neue Nutzer"; +$a->strings["Global Support Forum"] = "Globales Forum für Hilfsanfragen"; +$a->strings["Local Support Forum"] = "Lokales Forum für Hilfsanfragen"; +$a->strings["Save Settings"] = "Einstellungen Speichern"; +$a->strings["Message"] = "Nachricht"; +$a->strings["Your message for new members. You can use bbcode here."] = "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden."; +$a->strings["Add a link to global support forum"] = "Link zum globalen Support Forum anzeigen"; +$a->strings["Should a link to the global support forum be displayed?"] = "Soll ein Link zum globalen Support Forum angezeigt werden?"; +$a->strings["Add a link to the local support forum"] = "Link zum lokalen Support Forum anzeigen"; +$a->strings["If you have a local support forum and wand to have a link displayed in the widget, check this box."] = "Wenn du ein lokales Support Forum eingerichtet hast und Link darauf angezeigt werden soll, hier klicken"; +$a->strings["Name of the local support group"] = "Name des lokalen Support Forums"; +$a->strings["If you checked the above, specify the nickname of the local support group here (i.e. helpers)"] = "Wenn der Link angezeigt werden soll, dann trage hier den Spitznamen des Forums ein (z.B. helpers)"; diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php new file mode 100644 index 00000000..04ca86cc --- /dev/null +++ b/newmemberwidget/newmemberwidget.php @@ -0,0 +1,58 @@ + + ***/ + +require_once('include/bbcode.php'); + +function newmemberwidget_install () { + register_hook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); + logger('newmemberwidget installed'); +} +function newmemberwidget_uninstall () { + unregister_hook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); +} + +function newmemberwidget_network_mod_init ( $a, $b) { + if (x($_SESSION['new_member'])) { + $t = '
'.EOL; + $t .= '

'.t('New Member').'

'.EOL; + $t .= '' . t('Tips for New Members') . 'i
'.EOL; + if (get_config('newmemberwidget','linkglobalsupport')==1) + $t .= ''.t('Global Support Forum').'
'.EOL; + if (get_config('newmemberwidget','linklocalsupport')==1) + $t .= ''.t('Local Support Forum').'
'.EOL; + $ft = get_config('newmemberwidget','freetext'); + if (!trim($ft)=="") + $t .= '

'.bbcode(trim($ft)).'

'; + $t .= '
'; + $a->page['aside'] = $t . $a->page['aside']; + } +} + +function newmemberwidget_plugin_admin_post( &$a ) { + $ft = ((x($_POST, 'freetext')) ? trim($_POST['freetext']) : ""); + $lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : ""); + $gs = intval($_POST['linkglobalsupport']); + $ls = intval($_POST['linklocalsupport']); + set_config ( 'newmemberwidget', 'freetext', trim($ft)); + set_config ( 'newmemberwidget', 'linkglobalsupport', $gs); + set_config ( 'newmemberwidget', 'linklocalsupport', $ls); + set_config ( 'newmemberwidget', 'localsupport', trim($lsn)); +} + +function newmemberwidget_plugin_admin(&$a, &$o){ + $t = get_markup_template('admin.tpl','addon/newmemberwidget'); + $o = replace_macros($t, array( + '$submit' => t('Save Settings'), + '$freetext' => array( "freetext", t("Message"), get_config( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")), + '$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), get_config( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers)"), + '$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), get_config( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and wand to have a link displayed in the widget, check this box.')), + '$localsupportname' => array( "localsupportname", t('Name of the local support group'), get_config( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')), + )); +} + diff --git a/newmemberwidget/templates/admin.tpl b/newmemberwidget/templates/admin.tpl new file mode 100644 index 00000000..613fc9d0 --- /dev/null +++ b/newmemberwidget/templates/admin.tpl @@ -0,0 +1,6 @@ +{{include file="field_textarea.tpl" field=$freetext}} +{{include file="field_checkbox.tpl" field=$linkglobalsupport}} +{{include file="field_checkbox.tpl" field=$linklocalsupport}} +{{include file="field_input.tpl" field=$localsupportname}} + +