diff --git a/languages/ca.ini b/languages/ca.ini index fe60760cbac94c77171b6d34d20d78f05b6af9a6..1b9cef191b6b4ff1ba143a44d78a0dc2ec4b5e8b 100644 --- a/languages/ca.ini +++ b/languages/ca.ini @@ -495,7 +495,6 @@ My Favorites = "Els meu favorits" My Fines = "Les meves sancions" My Holds = "Les meves reserves" My Profile = "El meu perfil" -MyResearch Help = "Ajuda a la meva recerca" Narrow Search = "Refinar cerca" navigate_back = "Back" Need Help? = "Necessites ajuda?" diff --git a/languages/cs.ini b/languages/cs.ini index e570b0b75c0ec693889623154c70c7bedc93feff..93ba5d5732fb34b285ba6280ec062698477b497a 100644 --- a/languages/cs.ini +++ b/languages/cs.ini @@ -363,6 +363,7 @@ Group = Skupina group_AND = "VÅ ECHNY skupiny" group_OR = "LIBOVOLNÉ skupiny" Has Illustrations = "Obsahuje ilustrace" +Help = "NápovÄ›da" Help with Advanced Search = "NápovÄ›da k pokroÄilému vyhledávánÃ" Help with Search Operators = "NápovÄ›da pro vyhledávacà operátory" hierarchy_hide_tree = "Skrýt úplnou hierarchii" @@ -550,7 +551,6 @@ My Favorites = "OblÃbené" My Fines = "VaÅ¡e upomÃnky" My Holds = "VaÅ¡e rezervace" My Profile = "Váš profil" -MyResearch Help = "NápovÄ›da" Narrow Search = "UpÅ™esnit hledánÃ" navigate_back = "ZpÄ›t" Need Help? = "Hledáte pomoc?" diff --git a/languages/cy.ini b/languages/cy.ini index 811d53c1175d551919b9689cab247f38be300413..736ec3b15b0731b59b41b2ca52dcac02c292a420 100644 --- a/languages/cy.ini +++ b/languages/cy.ini @@ -486,7 +486,6 @@ My Favorites ="Fy Ffefrynnau" My Fines ="Fy Nirwyon" My Holds ="Fy Naliadau" My Profile ="Fy Mhroffil" -MyResearch Help ="MyResearch Help" Narrow Search ="Manylu'r Chwiliad" navigate_back = "Yn Ôl" Need Help? ="Angen Help?" diff --git a/languages/da.ini b/languages/da.ini index e6465efb2e3b5ddbb5c056e354e9f15373b23be2..88365fe7c2dc7a24afa31cb888a090215beb53f7 100644 --- a/languages/da.ini +++ b/languages/da.ini @@ -398,7 +398,6 @@ My Favorites = "Mine favoritter" My Fines = "Mine bøder" My Holds = "Mine beholdninger" My Profile = "Min profil" -MyResearch Help = "MyResearch Hjælp" Narrow Search = "Indsnæver søgning" Need Help? = "Har du brug for hjælp?" New Item Feed = "Nyt emne" diff --git a/languages/de.ini b/languages/de.ini index 9ee87d9caf7bf0c951d5f158e255c83534cb5db2..4c6a546fd0d9c6690fdd670235d391b18e009e92 100644 --- a/languages/de.ini +++ b/languages/de.ini @@ -552,7 +552,6 @@ My Favorites = "Meine Favoriten" My Fines = "Meine Gebühren" My Holds = "Meine Bestellungen" My Profile = "Persönliche Angaben" -MyResearch Help = "Suchhilfe" Narrow Search = "Suche einschränken" navigate_back = "Zurück" Need Help? = "Hilfe" diff --git a/languages/el.ini b/languages/el.ini index bcae726492d752c4ec3d42834474d01f769c5dd3..963927c39899a4fb7510b391a374a678f50e7102 100644 --- a/languages/el.ini +++ b/languages/el.ini @@ -551,7 +551,6 @@ My Favorites = "Τα αγαπημÎνα μου" My Fines = "Τα Ï€Ïόστιμά μου" My Holds = "Οι κÏατήσεις μου" My Profile = "Τα στοιχεία μου" -MyResearch Help = "Βοήθεια για την ÎÏευνά μου" Narrow Search = "ΠεÏιοÏισμός αναζήτησης" navigate_back = "Πίσω" Need Help? = "ΧÏειάζεστε βοήθεια;" diff --git a/languages/en.ini b/languages/en.ini index d435f45d277f6823f3946ba1e9797d023d178685..76bd755bfd681d8cbda88f0ee65b5e246eb74f34 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -366,8 +366,10 @@ Group = Group group_AND = "ALL Groups" group_OR = "ANY Groups" Has Illustrations = "Has Illustrations" +Help = "Help" Help with Advanced Search = "Help with Advanced Search" Help with Search Operators = "Help with Search Operators" +help_page_missing = "The requested help page does not exist." hierarchy_hide_tree = "Hide Full Hierarchy" hierarchy_show_tree = "Show Full Hierarchy" hierarchy_tree = "Context" @@ -553,7 +555,6 @@ My Favorites = "My Favorites" My Fines = "My Fines" My Holds = "My Holds" My Profile = "My Profile" -MyResearch Help = "MyResearch Help" Narrow Search = "Narrow Search" navigate_back = "Back" Need Help? = "Need Help?" @@ -796,10 +797,10 @@ Series = Series Set = Set Showing = Showing Similar Items = "Similar Items" +Skip to content = "Skip to content" skip_confirm = "Are you sure you want to skip this step?" skip_fix_metadata = "Do not fix the metadata at this time." skip_step = "Skip this step" -Skip to content = "Skip to content" Slide = Slide sms_failure = "Error! Could not send message." sms_phone_number = "10-Digit Phone Number" @@ -872,10 +873,10 @@ Supplied by Amazon = "Supplied by Amazon" Switch view to = "Switch view to" switchquery_intro = "You may be able to get more results by adjusting your search query." switchquery_lowercasebools = "If you are trying to use Boolean operators, they must be ALL CAPS" +switchquery_truncatechar = "Shorten your search to broaden it" switchquery_unwantedbools = "The words AND, OR and NOT may confuse the search; try adding quotes" switchquery_unwantedquotes = "Removing quotes may allow a broader search" switchquery_wildcard = "Adding a wildcard symbol may retrieve word variants" -switchquery_truncatechar = "Shorten your search to broaden it" System Unavailable = "System Unavailable" Table of Contents = "Table of Contents" Table of Contents unavailable = "Table of Contents unavailable" @@ -984,4 +985,4 @@ Your Profile = "Your Profile" Your search terms = "Your search terms" Your Tags = "Your Tags" Zip = Zip -zoom = "Zoom" +zoom = "Zoom" \ No newline at end of file diff --git a/languages/es.ini b/languages/es.ini index ebc8f63d951846b75bee1abdcbd16c29a3ce1efa..6d2a3c1986720db970421ac77eb7f7ff6f5fe577 100644 --- a/languages/es.ini +++ b/languages/es.ini @@ -484,7 +484,6 @@ My Favorites = "Mis Favoritos" My Fines = "Mis Multas" My Holds = "Mis Reservas" My Profile = "Mi Perfil" -MyResearch Help = "Ayuda a mi investigación" Narrow Search = "Resultados Agrupados" navigate_back = "Atrás" Need Help? = "¿Necesita Ayuda?" diff --git a/languages/eu.ini b/languages/eu.ini index 89ca97d0fad18f086190ac63af20f6f7e4deff46..e6b3113dd0375d06bab7a7d692d177386da0caa0 100644 --- a/languages/eu.ini +++ b/languages/eu.ini @@ -945,6 +945,7 @@ Group = Taldea group_AND = ETA group_OR = EDO Has Illustrations = "Irudiduna" +Help = Laguntza Help with Advanced Search = "Bilaketa aurreratuan lagundu" Help with Search Operators = "Eragileak nola erabili" hierarchy_hide_tree = "Ezkutatu Hierarkia Osoa" @@ -1104,7 +1105,6 @@ My Favorites = "Nire gogokoenak" My Fines = "Nire penalizazioak" My Holds = "Nire erreserbak" My Profile = "Nire profila" -MyResearch Help = Laguntza Narrow Search = "Emaitzak murriztu" navigate_back = "Atzera" Need Help? = "Laguntza behar al duzu?" @@ -1222,17 +1222,17 @@ Range = Maila Range slider = "Rango de Deslizamiento" Read the full review online... = "Azterketa osoa linean irakurri" Recall This = "Jakinarazi" -recaptcha_visual_challenge = "Eskuratu ikusizko erronka" recaptcha_audio_challenge = "Eskuratu audio-erronka" -recaptcha_refresh_btn = "Eskuratu erronka berria" -recaptcha_instructions_visual = "" -recaptcha_instructions_audio = "Idatzi entzuten duzuna:" -recaptcha_help_btn = "Laguntza" -recaptcha_play_again = "Erreproduzitu soinua berriro" recaptcha_cant_hear_this = "Deskargatu soinua MP3 gisa" -recaptcha_incorrect_try_again = "Ez da zuzena. Saiatu berriro." +recaptcha_help_btn = "Laguntza" recaptcha_image_alt_text = "reCAPTCHA erronkaren irudia" +recaptcha_incorrect_try_again = "Ez da zuzena. Saiatu berriro." +recaptcha_instructions_audio = "Idatzi entzuten duzuna:" +recaptcha_instructions_visual = "" +recaptcha_play_again = "Erreproduzitu soinua berriro" recaptcha_privacy_and_terms = "Pribatutasuna eta baldintzak" +recaptcha_refresh_btn = "Eskuratu erronka berria" +recaptcha_visual_challenge = "Eskuratu ikusizko erronka" Record Citations = "Dokumentuaren aipamena" Record Count = "Erregistro-zenbatzea" Region = Eskualdea diff --git a/languages/fi.ini b/languages/fi.ini index 06dcaf2a1f90a820737f5d79ed957f47c0ea4e15..fda489126e674b3b43ae6404af0f7777518f311b 100644 --- a/languages/fi.ini +++ b/languages/fi.ini @@ -511,7 +511,6 @@ My Favorites = "Omat suosikit" My Fines = "Omat maksut" My Holds = "Omat varaukset" My Profile = "Oma profiili" -MyResearch Help = "Omien sivujen ohje" Narrow Search = "Rajaa hakua" navigate_back = "Takaisin" Need Help? = "Tarvitsetko apua?" diff --git a/languages/fr.ini b/languages/fr.ini index 005d3bf3cb6d3171589180e07b9f5747e2262cf7..4896b6322594551a53e4d8f4a4c226b0e39efa03 100644 --- a/languages/fr.ini +++ b/languages/fr.ini @@ -551,7 +551,6 @@ My Favorites = "Mes favoris" My Fines = "Mes frais" My Holds = "Mes empruntes" My Profile = "Mon profil" -MyResearch Help = "Aide à la Recherche" Narrow Search = "Affiner la recherche" navigate_back = "Retour" Need Help? = "Besoin d'aide ?" diff --git a/languages/ga.ini b/languages/ga.ini index b1bfbe4b1cb9c8ccaf6d324d9df374a639d04c8a..0ee7da7c1cd1eafaaffef5d3caeff4c5d7f246f6 100644 --- a/languages/ga.ini +++ b/languages/ga.ini @@ -385,7 +385,6 @@ My Favorites = "Mo Chuid Ceanán" My Fines = "Mo Chuid FÃneálacha" My Holds = "Mo Chuid Leabhar ar Coimeád" My Profile = "Mo PhróifÃl" -MyResearch Help = "Cabhair MyResearch" Narrow Search = "Cuardach Cúng" Need Help? = "Cabhair ag teastáil?" New Item Feed = "Fotha MÃre Nua" diff --git a/languages/he.ini b/languages/he.ini index 8e059b8a0af420e8897d2fcd5dce76d478119efc..ca20f2b14c0537deb501b5828c3d889a042c12d4 100644 --- a/languages/he.ini +++ b/languages/he.ini @@ -449,7 +449,6 @@ My Favorites = "×”×ž×•×¢×“×¤×™× ×©×œ×™" My Fines = "×§× ×¡×•×ª שלי" My Holds = "×”×–×ž× ×•×ª שלי" My Profile = "פרופיל שלי" -MyResearch Help = "עזרה עבור ×”×יזור ×”×ישי" Narrow Search = "×¦×ž×¦× ×—×™×¤×•×©" navigate_back = "חזרה" Need Help? = "×¦×¨×™×›×™× ×¢×–×¨×”?" diff --git a/languages/it.ini b/languages/it.ini index c2d52d1a6d63bfaf089769777392e0b9b5f3d2d6..bc513ede59f614897c6e9891fe2efcb2410108f1 100644 --- a/languages/it.ini +++ b/languages/it.ini @@ -364,6 +364,7 @@ Group = Gruppo group_AND = "Tutti i gruppi" group_OR = "Qualsiasi gruppo" Has Illustrations = "Contiene illustrazioni" +Help = "Help" Help with Advanced Search = "Aiuto (ricerca avanzata)" Help with Search Operators = "Aiuto (strumenti e operatori)" hierarchy_hide_tree = "Nascondi l'intera gerarchia" @@ -551,7 +552,6 @@ My Favorites = "I miei preferiti" My Fines = "Le mie multe" My Holds = "Le mie prenotazioni" My Profile = "Il mio profilo" -MyResearch Help = "Help" Narrow Search = "Restringi la ricerca" navigate_back = "Indietro" Need Help? = "Serve aiuto?" diff --git a/languages/ja.ini b/languages/ja.ini index 47fa2aff7085bd7c4ee226191c6d3617a87ffdd2..da3b7a04c259746171595343e421972b337ed52f 100644 --- a/languages/ja.ini +++ b/languages/ja.ini @@ -551,7 +551,6 @@ My Favorites = "ç§ã®ãŠæ°—ã«å…¥ã‚Š" My Fines = "ç§ã®å»¶æ»žé‡‘" My Holds = "ç§ã®äºˆç´„" My Profile = "ç§ã®ãƒ—ãƒãƒ•ã‚£ãƒ¼ãƒ«" -MyResearch Help = "マイ・リサーãƒã®ä½¿ã„æ–¹" Narrow Search = "絞込ã¿æ¤œç´¢" navigate_back = "戻る" Need Help? = "ヘルプ" diff --git a/languages/nl.ini b/languages/nl.ini index 357fa441738cd314036c00e0f74b4135116303ea..6430e84643767dcff5ae2e7467086bbabba075e8 100644 --- a/languages/nl.ini +++ b/languages/nl.ini @@ -350,7 +350,6 @@ My Favorites = "Mijn favorieten" My Fines = "Mijn boetes" My Holds = "Mijn reserveringen" My Profile = "Mijn profiel" -MyResearch Help = "Hulp bij mijn onderzoek" Narrow Search = "Verfijnd zoeken" Need Help? = "Hulp nodig?" New Item Feed = "Abonnement op nieuwe items" diff --git a/languages/pl.ini b/languages/pl.ini index d290f82a920984529134bf9f481262d342f37d3b..422d436a3d6e06d81919e9ec2a16a98e7857a8f5 100644 --- a/languages/pl.ini +++ b/languages/pl.ini @@ -386,6 +386,7 @@ Group = Grupa group_AND = "z WSZYSTKIMI grupami" group_OR = "z JAKÄ„KOLWIEK z grup" Has Illustrations = "z ilustracjami" +Help = Pomoc Help with Advanced Search = "Pomoc do wyszukiwania zaawansowanego" Help with Search Operators = "Pomoc do operatorów wyszukiwania" hierarchy_hide_tree = "Ukryj caÅ‚Ä… hierarchiÄ™" @@ -545,7 +546,6 @@ My Favorites = "Moje listy ulubionych" My Fines = "Moje opÅ‚aty" My Holds = "Moje zamówienia i rezerwacje" My Profile = "Mój profil" -MyResearch Help = Pomoc Narrow Search = "Redukuj rezultaty" navigate_back = "z powrotem" Need Help? = Pomoc @@ -663,17 +663,17 @@ Range = "Okres czasu" Range slider = "Slider" Read the full review online... = "Przeczytaj caÅ‚Ä… recenzjÄ™..." Recall This = OdwoÅ‚aj -recaptcha_visual_challenge = "Pokaż podpowiedź wizualnÄ…" recaptcha_audio_challenge = "Odtwórz podpowiedź dźwiÄ™kowÄ…" -recaptcha_refresh_btn = "Nowa podpowiedź" -recaptcha_instructions_visual = "Przepisz tekst:" -recaptcha_instructions_audio = "Wpisz usÅ‚yszane sÅ‚owa:" -recaptcha_help_btn = "Pomoc" -recaptcha_play_again = "Odtwórz dźwiÄ™k ponownie" recaptcha_cant_hear_this = "Pobierz dźwiÄ™k jako plik MP3" -recaptcha_incorrect_try_again = "NieprawidÅ‚owo. Spróbuj ponownie." +recaptcha_help_btn = "Pomoc" recaptcha_image_alt_text = "Zadanie obrazkowe reCAPTCHA" +recaptcha_incorrect_try_again = "NieprawidÅ‚owo. Spróbuj ponownie." +recaptcha_instructions_audio = "Wpisz usÅ‚yszane sÅ‚owa:" +recaptcha_instructions_visual = "Przepisz tekst:" +recaptcha_play_again = "Odtwórz dźwiÄ™k ponownie" recaptcha_privacy_and_terms = "Prywatność i warunki" +recaptcha_refresh_btn = "Nowa podpowiedź" +recaptcha_visual_challenge = "Pokaż podpowiedź wizualnÄ…" Record Citations = "Cytaty zapisu" Record Count = "Ilość zapisów" Region = Region diff --git a/languages/pt-br.ini b/languages/pt-br.ini index 2dc909eb7943ec420d83113ae1a695cafb878d10..8393cd2148932bb115a2b2b66675af21eeee1a46 100644 --- a/languages/pt-br.ini +++ b/languages/pt-br.ini @@ -551,7 +551,6 @@ My Favorites = "Os meus favoritos" My Fines = "As minha multas" My Holds = "As minhas reservas" My Profile = O meu perfil -MyResearch Help = "Ajuda no MyResearch" Narrow Search = "Refinar a Busca" navigate_back = "Voltar" Need Help? = "Precisa de ajuda?" diff --git a/languages/pt.ini b/languages/pt.ini index 0142d2221b51abbc91445667b616b27be9187133..338ec29d3bff56fbf8a0abc8fa167a7a61123764 100644 --- a/languages/pt.ini +++ b/languages/pt.ini @@ -484,7 +484,6 @@ My Favorites = "Os meus favoritos" My Fines = "As minha multas" My Holds = "As minhas reservas" My Profile = O meu perfil -MyResearch Help = "Ajuda no MyResearch" Narrow Search = "Refinar a Pesquisa" navigate_back = "Voltar" Need Help? = "Precisa de ajuda?" diff --git a/languages/ru.ini b/languages/ru.ini index 5741a00d9aab7f4192ba6a543920f926f8ea5905..2299493ba1c4912456236bdfedb1bd71ba3d0f3e 100644 --- a/languages/ru.ini +++ b/languages/ru.ini @@ -567,7 +567,6 @@ My Favorites = "Мои Избранные" My Fines = "Мои штрафы" My Holds = "Мои задолженноÑти" My Profile = "Мой профиль" -MyResearch Help = "ÐœÐ¾Ñ Ð¸ÑÑледовательÑÐºÐ°Ñ Ñправка" Narrow Search = "Сужение результатов поиÑка" navigate_back = "Ðазад" Need Help? = "Ðужна ли Справка? Она ниже." diff --git a/languages/sl.ini b/languages/sl.ini index 3d2b2ce6c3f12c14c20409a6507db09ea61337ac..9c7ecb49097626de6baf0dd9865f4a2530a7578e 100644 --- a/languages/sl.ini +++ b/languages/sl.ini @@ -482,7 +482,6 @@ My Favorites = "Moje priljubljene" My Fines = "Moje zamudnine" My Holds = "Moje izposojene" My Profile = "Moj profil" -MyResearch Help = "Moja raziskovalna pomoÄ" Narrow Search = "Zoži iskanje" navigate_back = "Nazaj" Need Help? = "Potrebujete pomoÄ?" diff --git a/languages/sv.ini b/languages/sv.ini index 47193d0bb1d03660273bbba6b3e3206cbe45fe3f..f489bcda44428c86b6ada54cebb37660c2ea8a5d 100644 --- a/languages/sv.ini +++ b/languages/sv.ini @@ -511,7 +511,6 @@ My Favorites = "Mina favoriter" My Fines = "Mina avgifter" My Holds = "Mina reserveringar" My Profile = "Min profil" -MyResearch Help = "Hjälp för mina uppgifter" Narrow Search = "Begränsa sökningen" navigate_back = "Back" Need Help? = "Behöver du hjälp?" diff --git a/languages/tr.ini b/languages/tr.ini index 5e746bd1125ad7af5efb9368cc997bf54b357710..ac5796f5636a5a3c120446766145b8f90009601d 100644 --- a/languages/tr.ini +++ b/languages/tr.ini @@ -561,7 +561,6 @@ My Favorites ="Favori Listem" My Fines = "Cezalarım" My Holds = "Rezervelerim" My Profile = "Profilim" -MyResearch Help = "Tarama Yardımı" Narrow Search = "Taramayı Daralt" navigate_back = "Geri" Need Help? = Yardım diff --git a/languages/zh-cn.ini b/languages/zh-cn.ini index 2dcd0945cb4997f11b0c07995b6a97ddfb721204..cecef07d88c20ef67061da5a9f3aabc14a490e51 100644 --- a/languages/zh-cn.ini +++ b/languages/zh-cn.ini @@ -385,7 +385,6 @@ My Favorites = "我的最爱" My Fines = "我的罚款" My Holds = "My Holds" My Profile = "我的档案" -MyResearch Help = "æˆ‘çš„ç ”ç©¶å¸®åŠ©" Narrow Search = "缩å°æœç´¢" Need Help? = "需è¦å¸®åŠ©?" New Item Feed = "新项目" diff --git a/languages/zh.ini b/languages/zh.ini index 0d109792533b221a6842a1f821fdea3dcdc903df..3d0872163c3fdcd2237d051e6af705379858e039 100644 --- a/languages/zh.ini +++ b/languages/zh.ini @@ -385,7 +385,6 @@ My Favorites = "我的最愛" My Fines = "我的罰款" My Holds = "My Holds" My Profile = "我的檔案" -MyResearch Help = "æˆ‘çš„ç ”ç©¶å¹«åŠ©" Narrow Search = "縮å°æœç´¢" Need Help? = "需è¦å¹«åŠ©?" New Item Feed = "æ–°é …ç›®" diff --git a/module/VuFind/src/VuFind/Controller/HelpController.php b/module/VuFind/src/VuFind/Controller/HelpController.php index fe6ea409d23c72dbf86653ea3b2e207e9b36d1a7..9f593daf2ad099a31e9f5f49f93e8bf771126f92 100644 --- a/module/VuFind/src/VuFind/Controller/HelpController.php +++ b/module/VuFind/src/VuFind/Controller/HelpController.php @@ -51,26 +51,8 @@ class HelpController extends AbstractBase public function homeAction() { $this->layout()->setTemplate('layout/help'); - - // Sanitize the topic name to include only alphanumeric characters - // or underscores. - $safe_topic - = preg_replace('/[^\w]/', '', $this->params()->fromQuery('topic')); - - // Construct two possible template names -- the help screen in the - // current selected language and help in English (most likely to exist). - // The code will attempt to display the most appropriate existing help screen - $language = $this->getServiceLocator()->has('VuFind\Translator') - ? $this->getServiceLocator()->get('VuFind\Translator')->getLocale() - : 'en'; - - $tpl_lang = 'HelpTranslations/' . $language - . '/' . $safe_topic . '.phtml'; - $tpl_en = 'HelpTranslations/en/' . $safe_topic . '.phtml'; - - // Best case -- help is available in the user's chosen language return $this->createViewModel( - array('tpl_lang' => $tpl_lang, 'tpl_en' => $tpl_en) + array('topic' => $this->params()->fromQuery('topic')) ); } } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php index bc9371e9cc45a89f3b2880aa87be15fa4b8e8015..d1ace6957dfe103f1b4581b261b8c6da40562a81 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php @@ -202,6 +202,21 @@ class Factory ); } + /** + * Construct the HelpText helper. + * + * @param ServiceManager $sm Service manager. + * + * @return HelpText + */ + public static function getHelpText(ServiceManager $sm) + { + $lang = $sm->getServiceLocator()->has('VuFind\Translator') + ? $sm->getServiceLocator()->get('VuFind\Translator')->getLocale() + : 'en'; + return new HelpText($sm->get('context'), $lang); + } + /** * Construct the HistoryLabel helper. * diff --git a/module/VuFind/src/VuFind/View/Helper/Root/HelpText.php b/module/VuFind/src/VuFind/View/Helper/Root/HelpText.php new file mode 100644 index 0000000000000000000000000000000000000000..24f320070fd4af55002af8c5a77c87ac8d4885c3 --- /dev/null +++ b/module/VuFind/src/VuFind/View/Helper/Root/HelpText.php @@ -0,0 +1,139 @@ +<?php +/** + * "Load help text" view helper + * + * PHP version 5 + * + * Copyright (C) Villanova University 2010. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace VuFind\View\Helper\Root; + +use Zend\View\Exception\RuntimeException; + +/** + * "Load help text" view helper + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class HelpText extends \Zend\View\Helper\AbstractHelper +{ + /** + * The current language + * + * @var string + */ + protected $language; + + /** + * The default fallback language + * + * @var string + */ + protected $defaultLanguage; + + /** + * The context view helper + * + * @var Context + */ + protected $contextHelper; + + /** + * Warning messages + * + * @var array + */ + protected $warnings = array(); + + /** + * Constructor + * + * @param Context $context The context view helper + * @param string $language The current user-selected language + * @param string $defaultLanguage The default fallback language + */ + public function __construct(Context $context, $language, $defaultLanguage = 'en') + { + $this->contextHelper = $context; + $this->language = $language; + $this->defaultLanguage = $defaultLanguage; + } + + /** + * Get warnings generated during rendering (if any). + * + * @return array + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * Render a help template (or return false if none found). + * + * @param string $name Template name to render + * @param array $context Variables needed for rendering template; these will + * be temporarily added to the global view context, then reverted after the + * template is rendered (default = empty). + * + * @return string|bool + */ + public function render($name, $context = null) + { + // Set up the needed context in the view: + $this->contextHelper->__invoke($this->getView()); + $oldContext = $this->contextHelper + ->apply(null === $context ? array() : $context); + + // Sanitize the template name to include only alphanumeric characters + // or underscores. + $safe_topic = preg_replace('/[^\w]/', '', $name); + + // Clear warnings + $this->warnings = array(); + + try { + $tpl = "HelpTranslations/{$this->language}/{$safe_topic}.phtml"; + $html = $this->getView()->render($tpl); + } catch (RuntimeException $e) { + try { + // language missing -- try default language + $tplFallback = 'HelpTranslations/' . $this->defaultLanguage . '/' + . $safe_topic . '.phtml'; + $html = $this->getView()->render($tplFallback); + $this->warnings[] = 'Sorry, but the help you requested is ' + . 'unavailable in your language.'; + } catch (RuntimeException $e) { + // no translation available at all! + $html = false; + } + } + + $this->contextHelper->restore($oldContext); + return $html; + } +} \ No newline at end of file diff --git a/themes/bootstrap/templates/help/home.phtml b/themes/bootstrap/templates/help/home.phtml new file mode 100644 index 0000000000000000000000000000000000000000..6e4705a4dfe03e58ce89e99ffb38ea5c2bd0f011 --- /dev/null +++ b/themes/bootstrap/templates/help/home.phtml @@ -0,0 +1,9 @@ +<? $this->headTitle($this->translate('Help')); ?> +<? if ($help = $this->helpText()->render($topic)): ?> + <? foreach ($this->helpText()->getWarnings() as $warning): ?> + <p class="alert alert-warning"><?=$this->transEsc($warning)?></p> + <? endforeach; ?> + <?=$help?> +<? else: ?> + <p class="alert alert-error"><?=$this->transEsc('help_page_missing')?></p> +<? endif; ?> \ No newline at end of file diff --git a/themes/bootstrap3/templates/help/home.phtml b/themes/bootstrap3/templates/help/home.phtml new file mode 100644 index 0000000000000000000000000000000000000000..92b678d6963b369c69619b2428df4a32256e9a5c --- /dev/null +++ b/themes/bootstrap3/templates/help/home.phtml @@ -0,0 +1,9 @@ +<? $this->headTitle($this->translate('Help')); ?> +<? if ($help = $this->helpText()->render($topic)): ?> + <? foreach ($this->helpText()->getWarnings() as $warning): ?> + <p class="alert alert-warning"><?=$this->transEsc($warning)?></p> + <? endforeach; ?> + <?=$help?> +<? else: ?> + <p class="alert alert-danger"><?=$this->transEsc('help_page_missing')?></p> +<? endif; ?> \ No newline at end of file diff --git a/themes/root/templates/help/home.phtml b/themes/root/templates/help/home.phtml index 982d19965e4386189b5966cf53ce5fb64475f970..bbea276caf237c836675adca17f7aecb0623e571 100644 --- a/themes/root/templates/help/home.phtml +++ b/themes/root/templates/help/home.phtml @@ -1,16 +1,9 @@ -<? - $this->headTitle($this->translate('MyResearch Help')); - - try { // language missing - echo $this->render($this->tpl_lang); - } catch (Exception $e) { - try { // for missing file error message - $en = $this->render($this->tpl_en); // existence check - ?><p class="warning"><?=$this->transEsc('Sorry, but the help you requested is unavailable in your language.') ?></p><? - echo $en; - } catch (Exception $e) { - $this->layout->setLayout('layout'); - throw new Exception('Unknown Help Page'); - } - } -?> \ No newline at end of file +<? $this->headTitle($this->translate('Help')); ?> +<? if ($help = $this->helpText()->render($topic)): ?> + <? foreach ($this->helpText()->getWarnings() as $warning): ?> + <p class="warning"><?=$this->transEsc($warning)?></p> + <? endforeach; ?> + <?=$help?> +<? else: ?> + <p class="warning"><?=$this->transEsc('help_page_missing')?></p> +<? endif; ?> \ No newline at end of file diff --git a/themes/root/theme.config.php b/themes/root/theme.config.php index f4449138ef3e14e0808db088032d8eda9ba1c0d6..eecfd12bdd7f2f69f36368a693286cbb7b2dd993 100644 --- a/themes/root/theme.config.php +++ b/themes/root/theme.config.php @@ -15,6 +15,7 @@ return array( 'flashmessages' => 'VuFind\View\Helper\Root\Factory::getFlashmessages', 'googleanalytics' => 'VuFind\View\Helper\Root\Factory::getGoogleAnalytics', 'getlastsearchlink' => 'VuFind\View\Helper\Root\Factory::getGetLastSearchLink', + 'helptext' => 'VuFind\View\Helper\Root\Factory::getHelpText', 'historylabel' => 'VuFind\View\Helper\Root\Factory::getHistoryLabel', 'ils' => 'VuFind\View\Helper\Root\Factory::getIls', 'jstranslations' => 'VuFind\View\Helper\Root\Factory::getJsTranslations',