]> git.mxchange.org Git - friendica.git/commitdiff
add selector for mobile theme to admin panel
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Wed, 15 Aug 2012 08:16:42 +0000 (10:16 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Wed, 15 Aug 2012 08:16:42 +0000 (10:16 +0200)
mod/admin.php
view/admin_site.tpl

index 1752b3fe8fd8f6291a0935df5c44f98fdfc24ef3..c4a984dcd0ed41f491af8127819c0eb035720ac9 100644 (file)
@@ -237,6 +237,7 @@ function admin_page_site_post(&$a){
        $banner                         =       ((x($_POST,'banner'))                   ? trim($_POST['banner'])                                        : false);
        $language                       =       ((x($_POST,'language'))                 ? notags(trim($_POST['language']))                      : '');
        $theme                          =       ((x($_POST,'theme'))                    ? notags(trim($_POST['theme']))                         : '');
+       $theme_mobile                   =       ((x($_POST,'theme_mobile'))             ? notags(trim($_POST['theme_mobile']))                  : '');
        $maximagesize           =       ((x($_POST,'maximagesize'))             ? intval(trim($_POST['maximagesize']))          :  0);
        
        
@@ -325,6 +326,11 @@ function admin_page_site_post(&$a){
        }
        set_config('system','language', $language);
        set_config('system','theme', $theme);
+        if ( $theme_mobile === '---' ) {
+            del_config('system','mobile-theme');
+        } else {
+           set_config('system','mobile-theme', $theme_mobile);
+        }
        set_config('system','maximagesize', $maximagesize);
        
        set_config('config','register_policy', $register_policy);
@@ -386,12 +392,17 @@ function admin_page_site(&$a) {
        
        /* Installed themes */
        $theme_choices = array();
+       $theme_choices_mobile = array();
+        $theme_choices_mobile["---"] = t("Don't apply a special theme for mobile devices.");
        $files = glob('view/theme/*');
        if($files) {
                foreach($files as $file) {
                        $f = basename($file);
                        $theme_name = ((file_exists($file . '/experimental')) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
-                       $theme_choices[$f] = $theme_name;
+                        $theme_choices[$f] = $theme_name;
+                        if (file_exists($file . '/mobile')) {
+                            $theme_choices_mobile[$f] = $theme_name;
+                        }
                }
        }
        
@@ -433,6 +444,7 @@ function admin_page_site(&$a) {
                '$banner'                       => array('banner', t("Banner/Logo"), $banner, ""),
                '$language'             => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
                '$theme'                        => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
+               '$theme_mobile'                         => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile),
                '$ssl_policy'       => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
                '$maximagesize'         => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
 
index e918ff7872af978ff967617f1829f461baec0a1f..eb19afeede141a97d55aaecdefc25ec6549fd31b 100644 (file)
@@ -6,6 +6,7 @@
                        autoDimensions: false,
                        onStart: function(){
                                var theme = $("#id_theme :selected").val();
+                               var theme_mobile = $("#id_theme_mobile :selected").val();
                                $("#cnftheme").attr('href',"$baseurl/admin/themes/"+theme);
                        }, 
                        onComplete: function(){
@@ -44,6 +45,7 @@
        {{ inc field_textarea.tpl with $field=$banner }}{{ endinc }}
        {{ inc field_select.tpl with $field=$language }}{{ endinc }}
        {{ inc field_select.tpl with $field=$theme }}{{ endinc }}
+       {{ inc field_select.tpl with $field=$theme_mobile }}{{ endinc }}
        {{ inc field_select.tpl with $field=$ssl_policy }}{{ endinc }}
        
        <div class="submit"><input type="submit" name="page_site" value="$submit" /></div>