';
+ // load template and replace the macros
+ $t = get_markup_template("settings.tpl", "addon/curweather/" );
+ $s = replace_macros ($t, array(
+ '$submit' => t('Save Settings'),
+ '$header' => t('curweather Settings'),
+ '$noappidtext' => t('No APPID found, please contact your admin to optain one.'),
+ '$info' => t('Enter either the name of your location or the zip code.'),
+ '$curweather_loc' => array( 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. Berlin,DE or 14476,DE.') ),
+ '$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperatur should be displayed in °C or °F'), array('metric'=>'°C', 'imperial'=>'°F')),
+ '$enabled' => array( 'curweather_enable', 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_plugin_admin_post (&$a) {
+ if(! is_site_admin())
+ return;
+ if ($_POST['curweather-submit']) {
+ set_config('curweather','appid',trim($_POST['appid']));
+ info( t('Curweather settings saved.'.EOL));
+ }
+}
+function curweather_plugin_admin (&$a, &$o) {
+ if(! is_site_admin())
+ return;
+ $appid = get_config('curweather','appid');
+ $t = get_markup_template("admin.tpl", "addon/curweather/" );
+ $o = replace_macros ($t, array(
+ '$submit' => t('Save Settings'),
+ '$appid' => array('appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap'))
+ ));
+}