aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-04-13 11:20:05 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2012-04-13 11:20:05 +0200
commit138a0e06b88b0c9163ea0bffff8e3521e6c7ee22 (patch)
tree112248e7cab7dfc9616db24e672d0e593c102e8b
parent8be7b5c65b8e43b7128bcd565cd50a710fc66b55 (diff)
downloadvolse-hubzilla-138a0e06b88b0c9163ea0bffff8e3521e6c7ee22.tar.gz
volse-hubzilla-138a0e06b88b0c9163ea0bffff8e3521e6c7ee22.tar.bz2
volse-hubzilla-138a0e06b88b0c9163ea0bffff8e3521e6c7ee22.zip
admin: change global theme settings
-rw-r--r--mod/admin.php46
-rw-r--r--view/admin_plugins_details.tpl2
-rw-r--r--view/admin_site.tpl36
3 files changed, 74 insertions, 10 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 961002786..7386dc5a3 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -40,6 +40,20 @@ function admin_post(&$a){
goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
return; // NOTREACHED
break;
+ case 'themes':
+ $theme = $a->argv[2];
+ if (is_file("view/theme/$theme/config.php")){
+ require_once("view/theme/$theme/config.php");
+ if (function_exists("theme_admin_post")){
+ theme_admin_post($a);
+ }
+ }
+ info(t('Theme settings updated.'));
+ if(is_ajax()) return;
+
+ goaway($a->get_baseurl(true) . '/admin/themes/' . $theme );
+ return;
+ break;
case 'logs':
admin_page_logs_post($a);
break;
@@ -129,7 +143,13 @@ function admin_content(&$a) {
} else {
$o = admin_page_summary($a);
}
- return $o;
+
+ if(is_ajax()) {
+ echo $o;
+ killme();
+ } else {
+ return $o;
+ }
}
@@ -362,7 +382,7 @@ function admin_page_site(&$a) {
'$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
'$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"), $theme_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),
'$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.")),
@@ -768,14 +788,22 @@ function admin_page_themes(&$a){
}
$readme=Null;
- if (is_file("view/$theme/README.md")){
- $readme = file_get_contents("view/$theme/README.md");
+ if (is_file("view/theme/$theme/README.md")){
+ $readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme);
- } else if (is_file("view/$theme/README")){
- $readme = "<pre>". file_get_contents("view/$theme/README") ."</pre>";
+ } else if (is_file("view/theme/$theme/README")){
+ $readme = "<pre>". file_get_contents("view/theme/$theme/README") ."</pre>";
}
$admin_form="";
+ if (is_file("view/theme/$theme/config.php")){
+ require_once("view/theme/$theme/config.php");
+ if(function_exists("theme_admin")){
+ $admin_form = theme_admin($a);
+ }
+
+ }
+
$screenshot = array( get_theme_screenshot($theme), t('Screenshot'));
if(! stristr($screenshot[0],$theme))
@@ -793,10 +821,10 @@ function admin_page_themes(&$a){
'$status' => $status,
'$action' => $action,
'$info' => get_theme_info($theme),
- '$function' => 'themes',
+ '$function' => 'themes',
'$admin_form' => $admin_form,
'$str_author' => t('Author: '),
- '$str_maintainer' => t('Maintainer: '),
+ '$str_maintainer' => t('Maintainer: '),
'$screenshot' => $screenshot,
'$readme' => $readme
));
@@ -805,7 +833,7 @@ function admin_page_themes(&$a){
/**
- * List plugins
+ * List themes
*/
$xthemes = array();
diff --git a/view/admin_plugins_details.tpl b/view/admin_plugins_details.tpl
index cbaef2d66..aaa366f65 100644
--- a/view/admin_plugins_details.tpl
+++ b/view/admin_plugins_details.tpl
@@ -17,7 +17,7 @@
</p>
{{ if $screenshot }}
- <a href="$screenshot.0" ><img src="$screenshot.0" width="320" height="240" alt="$screenshot.1" /></a>
+ <a href="$screenshot.0" class='screenshot'><img src="$screenshot.0" alt="$screenshot.1" /></a>
{{ endif }}
{{ if $admin_form }}
diff --git a/view/admin_site.tpl b/view/admin_site.tpl
index ec144fbba..9de6bd9c5 100644
--- a/view/admin_site.tpl
+++ b/view/admin_site.tpl
@@ -1,3 +1,39 @@
+<script>
+ $(function(){
+
+ $("#cnftheme").fancybox({
+ width: 800,
+ autoDimensions: false,
+ onStart: function(){
+ var theme = $("#id_theme :selected").val();
+ $("#cnftheme").attr('href',"$baseurl/admin/themes/"+theme);
+ },
+ onComplete: function(){
+ $("div#fancybox-content form").submit(function(e){
+ var url = $(this).attr('action');
+ // can't get .serialize() to work...
+ var data={};
+ $(this).find("input").each(function(){
+ data[$(this).attr('name')] = $(this).val();
+ });
+ $(this).find("select").each(function(){
+ data[$(this).attr('name')] = $(this).children(":selected").val();
+ });
+ console.log(":)", url, data);
+
+ $.post(url, data, function(data) {
+ if(timer) clearTimeout(timer);
+ NavUpdate();
+ $.fancybox.close();
+ })
+
+ return false;
+ });
+
+ }
+ });
+ });
+</script>
<div id='adminpage'>
<h1>$title - $page</h1>