Permalink
Browse files

new options: 'vector_copyright_translate' and 'vector_sitenotice_tran…

…slate'

Enables the user to use language specific wiki pages as translated side wide
notice / copyright notice if the Translation plugin (cf.
http://www.dokuwiki.org/plugin:translation) is available. Works	the same way
as the multilingual navigation (cf. option 'vector_navigation_translate').
  • Loading branch information...
1 parent ddab627 commit 4d8721d7b397e86dd3378afad3de7f8c84ae19d5 @andreashaerter andreashaerter committed Oct 12, 2012
Showing with 87 additions and 33 deletions.
  1. +7 −5 conf/default.php
  2. +7 −5 conf/metadata.php
  3. +7 −5 lang/de-informal/settings.php
  4. +7 −5 lang/de/settings.php
  5. +7 −5 lang/en/settings.php
  6. +52 −8 main.php
View
@@ -41,8 +41,9 @@
$conf["vector_discuss_ns"] = ":talk:"; //namespace to use for discussion page storage
//site notice
-$conf["vector_sitenotice"] = true; //TRUE: use/show sitenotice
-$conf["vector_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
+$conf["vector_sitenotice"] = true; //TRUE: use/show sitenotice
+$conf["vector_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
+$conf["vector_sitenotice_translate"] = true; //TRUE: load translated sitenotice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
//navigation
$conf["vector_navigation"] = true; //TRUE: use/show navigation
@@ -60,9 +61,10 @@
$conf["vector_toolbox_location"] = ":wiki:toolbox"; //page/article used to store a custom toolbox
//custom copyright notice
-$conf["vector_copyright"] = true; //TRUE: use/show copyright notice
-$conf["vector_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
-$conf["vector_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
+$conf["vector_copyright"] = true; //TRUE: use/show copyright notice
+$conf["vector_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
+$conf["vector_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
+$conf["vector_copyright_translate"] = true; //TRUE: load translated copyright notice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
//donation link/button
$conf["vector_donate"] = true; //TRUE: use/show donation link/button
View
@@ -41,8 +41,9 @@
$meta["vector_discuss_ns"] = array("string", "_pattern" => "/^:.{1,}:$/");
//site notice
-$meta["vector_sitenotice"] = array("onoff");
-$meta["vector_sitenotice_location"] = array("string");
+$meta["vector_sitenotice"] = array("onoff");
+$meta["vector_sitenotice_location"] = array("string");
+$meta["vector_sitenotice_translate"] = array("onoff");
//navigation
$meta["vector_navigation"] = array("onoff");
@@ -60,9 +61,10 @@
$meta["vector_toolbox_location"] = array("string");
//custom copyright notice
-$meta["vector_copyright"] = array("onoff");
-$meta["vector_copyright_default"] = array("onoff");
-$meta["vector_copyright_location"] = array("string");
+$meta["vector_copyright"] = array("onoff");
+$meta["vector_copyright_default"] = array("onoff");
+$meta["vector_copyright_location"] = array("string");
+$meta["vector_copyright_translate"] = array("onoff");
//donation link/button
$meta["vector_donate"] = array("onoff");
@@ -39,8 +39,9 @@
$lang["vector_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
//site notice
-$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
-$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
+$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
+$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
+$lang["vector_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'vector_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
//navigation
$lang["vector_navigation"] = "Navigation anzeigen?";
@@ -58,9 +59,10 @@
$lang["vector_toolbox_location"] = "Falls nicht die Standard-Toolbox, folgende wiki-Seite als Toolbox verwenden:";
//custom copyright notice
-$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
-$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
-$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
+$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
+$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
+$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
+$lang["vector_copyright_translate"] = "Falls nicht den Standard-Copyright-Hinweis und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'vector_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
//donation link/button
$lang["vector_donate"] = "'Spenden'-Link/button anzeigen?";
View
@@ -39,8 +39,9 @@
$lang["vector_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
//site notice
-$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
-$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
+$lang["vector_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
+$lang["vector_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
+$lang["vector_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'vector_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
//navigation
$lang["vector_navigation"] = "Navigation anzeigen?";
@@ -58,9 +59,10 @@
$lang["vector_toolbox_location"] = "Falls nicht die Standard-Toolbox, folgende wiki-Seite als Toolbox verwenden:";
//custom copyright notice
-$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
-$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
-$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
+$lang["vector_copyright"] = "Copyright-Hinweis einblenden?";
+$lang["vector_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
+$lang["vector_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
+$lang["vector_copyright_translate"] = "Falls nicht den Standard-Copyright-Hinweis und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'vector_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
//donation link/button
$lang["vector_donate"] = "'Spenden'-Link/button anzeigen?";
View
@@ -39,8 +39,9 @@
$lang["vector_discuss_ns"] = "If yes, use following ':namespace:' as root for discussions:";
//site notice
-$lang["vector_sitenotice"] = "Show site wide notice?";
-$lang["vector_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
+$lang["vector_sitenotice"] = "Show site wide notice?";
+$lang["vector_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
+$lang["vector_sitenotice_translate"] = "If yes and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific site wide notice?<br />The wiki page of the translated site notice(s) is [value of 'vector_sitenotice_location']_[iso lang code] (e.g. ':wiki:site_notice_de').";
//navigation
$lang["vector_navigation"] = "Show navigation?";
@@ -58,9 +59,10 @@
$lang["vector_toolbox_location"] = "If not default, use following wiki page as toolbox location:";
//custom copyright notice
-$lang["vector_copyright"] = "Show copyright notice?";
-$lang["vector_copyright_default"] = "If yes, use default copyright notice?";
-$lang["vector_copyright_location"] = "If not default, use following wiki page as copyright notice:";
+$lang["vector_copyright"] = "Show copyright notice?";
+$lang["vector_copyright_default"] = "If yes, use default copyright notice?";
+$lang["vector_copyright_location"] = "If not default, use following wiki page as copyright notice:";
+$lang["vector_copyright_translate"] = "If not default and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific copyright notice?<br />The wiki page of the translated copyright notice(s) is [value of 'vector_copyright_location']_[iso lang code] (e.g. ':wiki:copyright_de').";
//donation link/button
$lang["vector_donate"] = "Show donation link/button?";
View
@@ -526,18 +526,40 @@ function _vector_renderButtons($arr)
html_msgarea();
//show site notice
if (tpl_getConf("vector_sitenotice")){
- //we have to show a custom sitenotice
+ //detect wiki page to load as content
+ if (!empty($transplugin) && //var comes from conf/boxes.php
+ is_object($transplugin) &&
+ tpl_getConf("vector_sitenotice_translate")){
+ //translated site notice?
+ $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
+ $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
+ if (empty($transplugin_langs) ||
+ empty($transplugin_langcur) ||
+ !is_array($transplugin_langs) ||
+ !in_array($transplugin_langcur, $transplugin_langs)) {
+ //current page is no translation or something is wrong, load default site notice
+ $sitenotice_location = tpl_getConf("vector_sitenotice_location");
+ } else {
+ //load language specific site notice
+ $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
+ }
+ }else{
+ //default site notice, no translation
+ $sitenotice_location = tpl_getConf("vector_sitenotice_location");
+ }
+
+ //we have to show a custom site notice
if (empty($conf["useacl"]) ||
- auth_quickaclcheck(cleanID(tpl_getConf("vector_sitenotice_location"))) >= AUTH_READ){ //current user got access?
+ auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
//get the rendered content of the defined wiki article to use as
- //custom sitenotice.
- $interim = tpl_include_page(tpl_getConf("vector_sitenotice_location"), false);
+ //custom site notice.
+ $interim = tpl_include_page($sitenotice_location, false);
if ($interim === "" ||
$interim === false){
//show creation/edit link if the defined page got no content
echo "[&#160;";
- tpl_pagelink(tpl_getConf("vector_sitenotice_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_sitenotice_location").")"));
+ tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
echo "&#160;]<br />";
}else{
//show the rendered page content
@@ -774,16 +796,38 @@ function _vector_renderButtons($arr)
echo "</div>\n </li>\n";
//show custom notice.
}else{
+ //detect wiki page to load as content
+ if (!empty($transplugin) && //var comes from conf/boxes.php
+ is_object($transplugin) &&
+ tpl_getConf("vector_copyright_translate")){
+ //translated copyright notice?
+ $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
+ $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
+ if (empty($transplugin_langs) ||
+ empty($transplugin_langcur) ||
+ !is_array($transplugin_langs) ||
+ !in_array($transplugin_langcur, $transplugin_langs)) {
+ //current page is no translation or something is wrong, load default copyright notice
+ $copyright_location = tpl_getConf("vector_copyright_location");
+ } else {
+ //load language specific copyright notice
+ $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
+ }
+ }else{
+ //default copyright notice, no translation
+ $copyright_location = tpl_getConf("vector_copyright_location");
+ }
+
if (empty($conf["useacl"]) ||
- auth_quickaclcheck(cleanID(tpl_getConf("vector_copyright_location"))) >= AUTH_READ){ //current user got access?
+ auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
echo "<li id=\"footer-info-copyright\">\n ";
//get the rendered content of the defined wiki article to use as custom notice
- $interim = tpl_include_page(tpl_getConf("vector_copyright_location"), false);
+ $interim = tpl_include_page($copyright_location, false);
if ($interim === "" ||
$interim === false){
//show creation/edit link if the defined page got no content
echo "[&#160;";
- tpl_pagelink(tpl_getConf("vector_copyright_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_copyright_location").")"));
+ tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
echo "&#160;]<br />";
}else{
//show the rendered page content

0 comments on commit 4d8721d

Please sign in to comment.