new settings page that allows plugins to integrate their own settings dialogs more with the existing ones
This commit is contained in:
parent
08454ce463
commit
1e4432c5d5
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
|
@ -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>');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue