';
+ // load template and replace the macros
+ $t = get_markup_template("settings.tpl", "addon/curweather/" );
+ $s = replace_macros ($t, [
+ '$submit' => L10n::t('Save Settings'),
+ '$header' => L10n::t('Current Weather').' '.L10n::t('Settings'),
+ '$noappidtext' => $noappidtext,
+ '$info' => L10n::t('Enter either the name of your location or the zip code.'),
+ '$curweather_loc' => [ 'curweather_loc', L10n::t('Your Location'), $curweather_loc, L10n::t('Identifier of your location (name or zip code), e.g. Berlin,DE or 14476,DE.') ],
+ '$curweather_units' => [ 'curweather_units', L10n::t('Units'), $curweather_units, L10n::t('select if the temperature should be displayed in °C or °F'), ['metric'=>'°C', 'imperial'=>'°F']],
+ '$enabled' => [ 'curweather_enable', L10n::t('Show weather data'), $enable, '']
+ ]);
+ return;
}
-
-
+// Config stuff for the admin panel to let the admin of the node set a APPID
+// for accessing the API of openweathermap
+function curweather_addon_admin_post (&$a) {
+ if(! is_site_admin())
+ return;
+ if ($_POST['curweather-submit']) {
+ Config::set('curweather','appid',trim($_POST['appid']));
+ Config::set('curweather','cachetime',trim($_POST['cachetime']));
+ info(L10n::t('Curweather settings saved.'.EOL));
+ }
+}
+function curweather_addon_admin (&$a, &$o) {
+ if(! is_site_admin())
+ return;
+ $appid = Config::get('curweather','appid');
+ $cachetime = Config::get('curweather','cachetime');
+ $t = get_markup_template("admin.tpl", "addon/curweather/" );
+ $o = replace_macros ($t, [
+ '$submit' => L10n::t('Save Settings'),
+ '$cachetime' => ['cachetime', L10n::t('Caching Interval'), $cachetime, L10n::t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>L10n::t('no cache'), '300'=>'5 '.L10n::t('minutes'), '900'=>'15 '.L10n::t('minutes'), '1800'=>'30 '.L10n::t('minutes'), '3600'=>'60 '.L10n::t('minutes')]],
+ '$appid' => ['appid', L10n::t('Your APPID'), $appid, L10n::t('Your API key provided by OpenWeatherMap')]
+ ]);
+}