diff options
author | Robin Appelman <icewind1991@gmail.com> | 2010-08-12 17:30:20 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2010-08-12 17:30:20 +0200 |
commit | 1e4432c5d5b5cd26247e9fec6a82f3cef800fd68 (patch) | |
tree | d0ee7618d70c4d89340ab731f8cad3f08cf946ef | |
parent | 08454ce463a725facb86479e3aba7a337b8f42f2 (diff) | |
download | nextcloud-server-1e4432c5d5b5cd26247e9fec6a82f3cef800fd68.tar.gz nextcloud-server-1e4432c5d5b5cd26247e9fec6a82f3cef800fd68.zip |
new settings page that allows plugins to integrate their own settings dialogs more with the existing ones
-rw-r--r-- | css/default.php | 18 | ||||
-rw-r--r-- | inc/lib_config.php | 25 | ||||
-rw-r--r-- | inc/templates/adminform.php | 10 | ||||
-rw-r--r-- | inc/templates/configform.php | 3 | ||||
-rw-r--r-- | inc/templates/settings.php | 38 | ||||
-rw-r--r-- | settings/index.php | 7 |
6 files changed, 88 insertions, 13 deletions
diff --git a/css/default.php b/css/default.php index 6500b31cb6d..dd96b97a86e 100644 --- a/css/default.php +++ b/css/default.php @@ -62,6 +62,11 @@ h1 { text-align:center; } +.body>.center { + height:100%; + width:100%; +} + .center * { margin-left:auto; margin-right:auto; @@ -419,4 +424,17 @@ div.moreActionsList td{ div.moreActionsList tr:hover{ background-color:#DDD; +} + +#settingsNav{ + background-color:#EEEEEE; + float:left; + height:100%; + overflow:auto; + text-align:left; +} + +#settingsNav ul{ + padding-left:20px; + padding-right:20px; }
\ No newline at end of file diff --git a/inc/lib_config.php b/inc/lib_config.php index ff4ead8b6be..a6b8fba7020 100644 --- a/inc/lib_config.php +++ b/inc/lib_config.php @@ -1,18 +1,23 @@ <?php class OC_CONFIG{ + static public $forms=array(); + + /** + * add a form to the settings page + * @param string name + * @param string url + */ + public static function addForm($name,$url){ + self::$forms[$name]=$url; + } + /** - * show the configform + * settings page * */ - public static function showConfigForm(){ - global $CONFIG_ADMINLOGIN; - global $CONFIG_ADMINPASSWORD; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_DBNAME; - oc_require('templates/configform.php'); - } + public static function showSettings(){ + oc_require('templates/settings.php'); + } /** * show the configform diff --git a/inc/templates/adminform.php b/inc/templates/adminform.php index 882c0dd3778..394df38da70 100644 --- a/inc/templates/adminform.php +++ b/inc/templates/adminform.php @@ -1,4 +1,5 @@ <?php +global $WEBROOT; global $FIRSTRUN; global $CONFIG_ENABLEBACKUP; global $CONFIG_DATADIRECTORY_ROOT; @@ -50,7 +51,14 @@ function dbtypechange(){ } } </script> -<form method="post" enctype="multipart/form-data" action="#"> +<?php +if(!$FIRSTRUN){ + $action=$WEBROOT.'/settings'; +}else{ + $action='#'; +} +echo('<form method="post" enctype="multipart/form-data" action="'.$action.'">') +?> <table cellpadding="5" cellspacing="5" border="0" class="loginform"> <?php if(!empty($CONFIG_ERROR) and !$FIRSTRUN){ diff --git a/inc/templates/configform.php b/inc/templates/configform.php index e53235cf820..d24c138612e 100644 --- a/inc/templates/configform.php +++ b/inc/templates/configform.php @@ -1,5 +1,6 @@ <?php global $FIRSTRUN; +global $WEBROOT; global $CONFIG_ERROR; if(!isset($fillDB)) $fillDB=true; if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost'; @@ -18,7 +19,7 @@ changepassset=function(){ } } </script> -<form method="post" enctype="multipart/form-data" action="#"> +<form method="post" enctype="multipart/form-data" action="<?php echo($WEBROOT);?>/settings/#"> <div><input type='hidden' name='config' value='1' /></div> <table cellpadding="5" cellspacing="5" border="0" class="loginform"> <?php diff --git a/inc/templates/settings.php b/inc/templates/settings.php new file mode 100644 index 00000000000..ef181164d04 --- /dev/null +++ b/inc/templates/settings.php @@ -0,0 +1,38 @@ +<script type="text/javascript"> +function showForm(id){ + hideAllForms(); + form=document.getElementById('settingsContent_'+id); + form.setAttribute('class','settingsContent'); +} + +function hideAllForms(){ + forms=document.getElementById('settingsHolder').childNodes; + for(var i=0;i<forms.length;i++){ + form=forms.item(i); + if(form.nodeType==1 && (form.tagName=='div' || form.tagName=='DIV')){ + form.setAttribute('class','settingsContent hidden'); + } + } +} +</script> +<div id='settingsNav'> +<ul> +<?php +foreach(OC_CONFIG::$forms as $name=>$url){ + $clean=strtolower(str_replace(' ','_',$name)); + echo("<li><a onclick='showForm(\"$clean\")' href='settings/#$clean'>$name</a></li>\n"); +} +?> +</ul> +</div> +<div id='settingsHolder'> +<div class='settingsContent'>Settings</div> +<?php +foreach(OC_CONFIG::$forms as $name=>$url){ + $clean=strtolower(str_replace(' ','_',$name)); + echo("<div id='settingsContent_$clean' class='settingsContent hidden'>\n"); + oc_include($url); + echo("</div>\n"); +} +?> +</div> diff --git a/settings/index.php b/settings/index.php index d5e7451d08b..582e7601e51 100644 --- a/settings/index.php +++ b/settings/index.php @@ -30,8 +30,13 @@ OC_UTIL::showheader(); $FIRSTRUN=false; +OC_CONFIG::addForm('System Settings','/inc/templates/adminform.php'); +if(OC_USER::ingroup($_SESSION['username'],'admin')){ + OC_CONFIG::addForm('User Settings','/inc/templates/configform.php'); +} + echo('<div class="center">'); -OC_CONFIG::showconfigform(); +OC_CONFIG::showSettings(); echo('</div>'); |