dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxPageEdit.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxAdmin;
3
4
Class dbxPageEdit {
5
6
private
function
save_tpl($type,$design,$file,$lng,$content) {
7
$config
=dbx()->get_config(
'dbx'
);
8
$default_lng=
$config
[
'default_lng'
];
9
dbx()->debug(
"SAVE-TPL T=($type) F=($file) D=($design) L=($lng)"
);
10
$file_type=$file.
'.'
.$type;
11
$dir_file=
dbx_get_base_dir
().
"dbx/design/$design/$type/$file"
;
12
if
($lng >
''
&& $lng != $default_lng) {
13
$dir_file.=
'_'
.$lng;
14
}
15
$dir_file.=
'.'
.$type;
16
//dbx_debug("#TPL-SAVE=($dir_file)");
17
$dir_file=
dbx_os_path_file
($dir_file);
18
file_put_contents($dir_file,$content);
19
//dbx_debug($tpl);
20
return
$dir_file;
21
}
22
23
24
public
function
run
($rid=0) {
25
$content=
''
; $ok=
false
;
26
27
$oTPL =dbx()->get_system_obj(
'dbxTPL'
);
28
29
$uid =dbx()->user();
30
$design=dbx()->get_modul_var(
'design'
);
31
$file =dbx()->get_modul_var(
'file'
);
32
$lng =dbx()->get_modul_var(
'lng'
);
33
$type =
'htm'
;
34
35
dbx()->set_system_var(
'dbx_page'
,
'_pageedit'
);
36
dbx()->set_system_var(
'dbx_editor'
,1);
37
dbx()->set_system_var(
'dbx_window'
,1);
38
39
//dbx_debug("Uid=($uid) Design=($design) File=($file) Design=($design) Lng=($lng)");
40
41
//$tpl=$oTPL->read_tpl($file,$type,$modul,$design,$lng,0,0,0,0);
42
$path_file
=$oTPL->get_design_tpl_dir_file(
'htm'
,$design,$file);
43
$tpl=$oTPL->get_design_tpl($design,$file,$lng,
'htm'
,0);
44
45
46
$data[
'tpl'
] = $tpl;
47
$data[
'file'
] = $file;
48
$data[
'design'
] = $design;
49
$data[
'lng'
] = $lng;
50
$data[
'type'
] = $type;
51
52
$oForm=dbx()->get_system_obj(
'dbxForm'
);
53
$oForm->init(
'form-page-edit'
);
54
55
$oForm->_data = $data;
56
$oForm->_action =
'?dbx_modul=dbxAdmin&dbx_run1=_editpage'
;
// &modul='.$modul.'&file='.$file.'&design='.$design.'&lng='.$lng;
57
$oForm->_msg_info =
'TPL: '
.$path_file;
58
//$oForm->_editor_fld='tpl';
59
60
$oForm->add_fld(
'design'
,
'text-label'
,rules:
'parameter'
,label:
'TPL-Design'
);
//#+
61
$oForm->add_fld(
'lng'
,
'text-label'
,rules:
'parameter'
,label:
'TPL-Language'
);
// |
62
$oForm->add_fld(
'file'
,
'text-label'
,rules:
'parameter'
,label:
'TPL-File'
);
63
$oForm->add_fld(
'tpl'
,
'textarea-tpl'
,rules:
'*'
,label:
'TPL-Content'
,data:
'rows=24'
);
64
$oForm->add_obj(
'button_save'
,
'button-submit'
,
'label=Speichern'
);
//#+
65
$oForm->add_js_call(
'tpl'
,
'editor-ace'
);
66
67
if
($oForm->submit()) {
68
$oForm->_msg_success =
"No change: ($file)"
;
69
if
($oForm->changed()) {
// submit && no errors // we ignore warnings
70
$tpl =$oForm->get_post(
'tpl'
,
''
,
'*'
);
71
$file =$oForm->get_post(
'file'
);
72
$design=$oForm->get_post(
'design'
);
73
$lng =$oForm->get_post(
'lng'
);
74
if
(!$oForm->errors()) {
75
$path_file
=$this->save_tpl($type,$design,$file,$lng,$tpl);
76
if
(!
$path_file
) $oForm->_msg_error =
"Error: ($path_file)"
;
77
if
(
$path_file
) {
78
$oForm->_msg_success =
"Save: ($path_file)"
;
79
}
80
}
else
{
81
$oForm->_msg_success =
'#no_change#'
;
82
}
83
}
else
{
84
$oForm->_msg_error =
'#check_input#'
;
85
}
86
}
87
$content= $oForm->run();
88
dbx()->set_system_var(
'dbx_editor'
,0);
89
//$content=dbx()->norep($content);
90
return
$content;
91
}
// run()
92
93
94
}
95
96
?>
$config
$config['version']
Definition
config.php:2
dbx_os_path_file
dbx_os_path_file($path_file)
Definition
index.php:164
$path_file
$path_file
Definition
index.php:270
dbx_get_base_dir
dbx_get_base_dir($cut_Data=0)
Definition
index.php:157
dbx\dbxContent_admin\run
run($work='')
Definition
dbxContent_folder.class.php:379
dbx
modules
dbxAdmin
include
dbxPageEdit.class.php
Generated by
1.17.0