Commit cf71a467 authored by tbrehm's avatar tbrehm

Rebuild the complete interface to use ajax.

parent cc4f64a6
......@@ -169,6 +169,7 @@ class app {
}
$this->tpl->setVar('app_title',$conf["app_title"]);
$this->tpl->setVar('delete_confirmation',$this->lng('delete_confirmation'));
$this->tpl->setVar('app_module',$_SESSION["s"]["module"]["name"]);
}
......
......@@ -194,7 +194,7 @@ class listform {
$pages = intval(($record_count["anzahl"] - 1) / $records_per_page);
$vars["list_file"] = $this->listDef["file"];
$vars["list_file"] = $_SESSION["s"]["module"]["name"].'/'.$this->listDef["file"];
$vars["page"] = $_SESSION["search"][$list_name]["page"];
$vars["last_page"] = $_SESSION["search"][$list_name]["page"] - 1;
$vars["next_page"] = $_SESSION["search"][$list_name]["page"] + 1;
......@@ -202,6 +202,7 @@ class listform {
$vars["max_pages"] = $pages + 1;
$vars["records_gesamt"] = $record_count["anzahl"];
$vars["page_params"] = $this->listDef["page_params"];
//$vars["module"] = $_SESSION["s"]["module"]["name"];
if($_SESSION["search"][$list_name]["page"] > 0) $vars["show_page_back"] = 1;
......@@ -217,11 +218,11 @@ class listform {
function getPagingHTML($vars) {
global $app;
$content = '<a href="'.$vars["list_file"].'?page=0'.$vars["page_params"].'"><img src="../themes/grey/images/btn_left.png" border="0"></a> &nbsp; ';
if($vars["show_page_back"] == 1) $content .= '<a href="'.$vars["list_file"].'?page='.$vars["last_page"].$vars["page_params"].'"><img src="../themes/grey/images/btn_back.png" border="0"></a> ';
$content = '<a href="'."javascript:loadContent('".$vars["list_file"].'?page=0'.$vars["page_params"]."');".'"><img src="themes/grey/images/btn_left.png" border="0"></a> &nbsp; ';
if($vars["show_page_back"] == 1) $content .= '<a href="'."javascript:loadContent('".$vars["list_file"].'?page='.$vars["last_page"].$vars["page_params"]."');".'"><img src="themes/grey/images/btn_back.png" border="0"></a> ';
$content .= ' '.$app->lng('Page').' '.$vars["next_page"].' '.$app->lng('of').' '.$vars["max_pages"].' ';
if($vars["show_page_next"] == 1) $content .= '<a href="'.$vars["list_file"].'?page='.$vars["next_page"].$vars["page_params"].'"><img src="../themes/grey/images/btn_next.png" border="0"></a> &nbsp; ';
$content .= '<a href="'.$vars["list_file"].'?page='.$vars["pages"].$vars["page_params"].'"> <img src="../themes/grey/images/btn_right.png" border="0"></a>';
if($vars["show_page_next"] == 1) $content .= '<a href="'."javascript:loadContent('".$vars["list_file"].'?page='.$vars["next_page"].$vars["page_params"]."');".'"><img src="themes/grey/images/btn_next.png" border="0"></a> &nbsp; ';
$content .= '<a href="'."javascript:loadContent('".$vars["list_file"].'?page='.$vars["pages"].$vars["page_params"]."');".'"> <img src="themes/grey/images/btn_right.png" border="0"></a>';
return $content;
}
......
This diff is collapsed.
......@@ -27,13 +27,17 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Header("Pragma: no-cache");
Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
Header("Content-Type: text/html");
ini_set('register_globals',0);
$conf["app_title"] = "ISPConfig";
$conf["app_version"] = "3.0.0";
$conf["rootpath"] = "D:\\server\\www\\ispconfig3\\interface";
$conf["rootpath"] = "D:\\server\\www\\ispconfig3_ajax\\interface";
//$conf["rootpath"] = "D:\\www\\ispconfig3\\interface";
//$conf["rootpath"] = "/home/www/ispconfig3/web/cms";
......@@ -43,7 +47,7 @@ $conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp";
define("DIR_TRENNER","\\");
define("SERVER_ROOT","D:\\server\\www\\ispconfig3\\interface");
define("SERVER_ROOT","D:\\server\\www\\ispconfig3_ajax\\interface");
define("INCLUDE_ROOT",SERVER_ROOT.DIR_TRENNER."lib");
define("CLASSES_ROOT",INCLUDE_ROOT.DIR_TRENNER."classes");
......@@ -79,7 +83,7 @@ $conf["programs"]["wput"] = $conf["rootpath"]."\\tools\\wput\\wput.exe";
Themes
*/
$conf["theme"] = 'grey';
$conf["theme"] = 'default';
$conf["html_content_encoding"] = 'text/html; charset=iso-8859-1';
$conf["logo"] = 'themes/default/images/mydnsconfig_logo.gif';
......
......@@ -228,7 +228,7 @@ $form["tabs"]['dbsync'] = array (
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
......@@ -241,7 +241,7 @@ $form["tabs"]['dbsync'] = array (
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
......@@ -254,7 +254,7 @@ $form["tabs"]['dbsync'] = array (
'regex' => '',
'errmsg' => '',
'default' => '1',
'value' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
......
......@@ -189,7 +189,7 @@ $form["tabs"]['filesync'] = array (
'regex' => '',
'errmsg' => '',
'default' => '1',
'value' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
......
......@@ -70,44 +70,46 @@ $form["tabs"]['services'] = array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
'web_server' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
'dns_server' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
'file_server' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
'db_server' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
'vserver_server' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'default' => '0',
'value' => '1'
'value' => array(0 => 0,1 => 1)
),
/*
'update' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '1',
'value' => array(0 => 'No', 1 => 'Yes')
),
*/
'active' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
......
......@@ -214,7 +214,7 @@ $form["tabs"]['users'] = array (
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
......
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -26,39 +27,28 @@ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/groups.list.php";
$tform_def_file = "form/groups.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Checke Berechtigungen für Modul
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
header("Location: ../index.php");
exit;
}
include_once($list_def_file);
// ID importieren
$id = intval($_REQUEST["id"]);
if($id > 0) {
if($_SESSION["s"]["user"]["typ"] == "admin") {
$app->db->query("DELETE FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = $id");
} else {
$app->db->query("DELETE FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = $id and userid = ".$_SESSION["s"]["user"]["userid"]);
}
}
$app->uses("tform_actions");
$app->tform_actions->onDelete();
header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
exit;
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -26,8 +26,7 @@ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
......@@ -39,98 +38,19 @@ $tform_def_file = "form/groups.tform.php";
* End Form configuration
******************************************/
// Checke Berechtigungen für Modul
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Checking module permissions
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
header("Location: ../index.php");
exit;
}
// Lade Template
$app->uses('tpl,tform');
$app->tpl->newTemplate("tabbed_form.tpl.htm");
// Tabellendefinition und Formdefinition laden
$app->tform->loadFormDef($tform_def_file);
// ID importieren
$id = intval($_REQUEST["id"]);
if(count($_POST) > 1) {
// Bestimme aktion
if($id > 0) {
$action = 'UPDATE';
} else {
$action = 'INSERT';
}
$sql = $app->tform->getSQL($_POST,$_SESSION["s"]["form"]["tab"],$action,$id,$ext_where);
if($app->tform->errorMessage == '') {
$app->db->query($sql);
if($action == "INSERT") $id = $app->db->insertID();
// Liste anzeigen, wenn speichern geklickt wurde
if($_REQUEST["next_tab"] == '') {
header("Location: ".$app->tform->formDef['list_default']);
exit;
}
} else {
$app->tpl->setVar("error","<b>Fehler:</b><br>".$app->tform->errorMessage);
$app->tpl->setVar($_POST);
}
}
// Welcher Tab wird angezeigt
if($app->tform->errorMessage == '') {
// wenn kein Fehler vorliegt
if($_REQUEST["next_tab"] != '') {
// wenn nächster Tab bekannt
$active_tab = $_REQUEST["next_tab"];
} else {
// ansonsten ersten tab nehmen
$active_tab = $app->tform->formDef['tab_default'];
}
} else {
// bei Fehlern den gleichen Tab nochmal anzeigen
$active_tab = $_SESSION["s"]["form"]["tab"];
}
if($id > 0) {
// bestehenden Datensatz anzeigen
if($app->tform->errorMessage == '') {
if($app->tform->formDef['auth'] == 'no') {
$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = $id";
} else {
$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = $id AND ".$app->tform->getAuthSQL('u');
}
if(!$record = $app->db->queryOneRecord($sql)) die("You dont have the permission to view this record or this record does not exist.");
} else {
$record = $app->tform->encode($_POST,$active_tab);
}
// Userdaten umwandeln
$record = $app->tform->getHTML($record, $active_tab,'EDIT');
$record['id'] = $id;
} else {
if($app->tform->errorMessage == '') {
$record = array();
$record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'],'NEW');
} else {
$record = $app->tform->getHTML($app->tform->encode($_POST,$active_tab),$active_tab,'EDIT');
}
}
$app->tpl->setVar($record);
// Formular und Tabs erzeugen
$app->tform->showForm();
// Defaultwerte setzen
$app->tpl_defaults();
// Loading classes
$app->uses('tpl,tform,tform_actions');
// Template parsen
$app->tpl->pparse();
// let tform_actions handle the page
$app->tform_actions->onLoad();
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......@@ -26,6 +27,7 @@ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
......@@ -39,73 +41,14 @@ $list_def_file = "list/groups.list.php";
* End Form configuration
******************************************/
// Checke Berechtigungen für Modul
// Checking module permissions
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
header("Location: ../index.php");
exit;
}
$app->uses('tpl,listform');
// Listen Definition laden
$app->listform->loadListDef($list_def_file);
if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) {
$app->uses('listform_tpl_generator');
$app->listform_tpl_generator->buildHTML($app->listform->listDef);
}
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm');
// SQL für Suche generieren
if($app->listform->listDef["name"] != 'no') {
if($_SESSION["s"]["user"]["typ"] == "admin") {
$sql_where = "";
} else {
$sql_where = "userid = ".$_SESSION["s"]["user"]["userid"]." and";
}
}
$sql_where = $app->listform->getSearchSQL($sql_where);
$app->tpl->setVar($app->listform->searchValues);
// SQL für Paging generieren
$limit_sql = $app->listform->getPagingSQL($sql_where);
$app->tpl->setVar("paging",$app->listform->pagingHTML);
// hole alle Datensätze
$records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $limit_sql");
$bgcolor = "#FFFFFF";
if(is_array($records)) {
$idx_key = $app->listform->listDef["table_idx"];
foreach($records as $rec) {
$rec = $app->listform->decode($rec);
// Farbwechsel
$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
$rec["bgcolor"] = $bgcolor;
// die Variable "id" enthält immer die Index variable
$rec["id"] = $rec[$idx_key];
$records_new[] = $rec;
}
}
$app->tpl->setLoop('records',$records_new);
// Language File setzen
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
include($lng_file);
$app->tpl->setVar($wb);
$app->tpl_defaults();
$app->tpl->pparse();
$app->uses('listform_actions');
$app->listform_actions->onLoad();
?>
\ No newline at end of file
......@@ -26,14 +26,53 @@ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setVar('error',$error);
$app->tpl->setInclude('content_tpl','templates/index.htm');
$app->tpl->pparse();
class admin_index {
var $status = 'OK';
var $target = '';
function render() {
global $app;
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setVar('error',$error);
$app->tpl->setInclude('content_tpl','admin/templates/index.htm');
return $app->tpl->grab();
/*
$filename = 'test.txt';
$somecontent = $app->tpl->grab();
// Sichergehen, dass die Datei existiert und beschreibbar ist
// Wir öffnen $filename im "Anhänge" - Modus.
// Der Dateizeiger befindet sich am Ende der Datei, und
// dort wird $somecontent später mit fwrite() geschrieben.
if (!$handle = fopen($filename, "w")) {
print "Kann die Datei $filename nicht öffnen";
exit;
}
// Schreibe $somecontent in die geöffnete Datei.
if (!fwrite($handle, $somecontent)) {
print "Kann in die Datei $filename nicht schreiben";
exit;
}
fclose($handle);
return 'dd';
*/
}
}
?>
\ No newline at end of file
......@@ -2,4 +2,6 @@
$wb["description_txt"] = 'Description';
$wb["name_txt"] = 'Group';
$wb["name_err"] = 'Group must be min 1, max 30 Chars.';