1
|
|
|
<?php |
2
|
|
|
$ARCurrent->nolangcheck=true; |
3
|
|
|
|
4
|
|
|
$arNewType=$this->getdata("arNewType","none"); |
5
|
|
|
if (!$arNewType) { |
6
|
|
|
error($ARnls["err:nonewtype"]); |
7
|
|
|
$this->store->close(); |
8
|
|
|
exit(); |
9
|
|
|
} |
10
|
|
|
|
11
|
|
|
if ($this->CheckLogin("add", $arNewType) && $this->CheckConfig()) { |
12
|
|
|
|
13
|
|
|
$arNewFilename=$this->getdata("arNewFilename","none"); |
14
|
|
|
$arNewData=new baseObject; |
15
|
|
|
$arNewPath=$this->make_path($arNewFilename); |
16
|
|
|
$wgWizCallObject=$this->store->newobject($arNewPath, $this->path, $arNewType, $arNewData); |
17
|
|
|
$wgWizCallObject->arIsNewObject=true; |
18
|
|
|
$hascustomdata=false; |
19
|
|
|
|
20
|
|
|
$configcache=$ARConfig->cache[$this->path]; // use parent path |
21
|
|
View Code Duplication |
if ($configcache->custom) { |
22
|
|
|
foreach( $configcache->custom as $key => $definition ) { |
23
|
|
|
if (($definition["type"]==$arNewType) || // use new type |
24
|
|
|
($definition["inherit"] && ($wgWizCallObject->AR_implements($definition["type"])))) { // check new object |
25
|
|
|
$hascustomdata=true; |
26
|
|
|
break; |
27
|
|
|
} |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
include($this->store->get_config("code")."widgets/wizard/code.php"); |
32
|
|
|
|
33
|
|
|
$wgWizFlow = array(); |
34
|
|
|
$wgWizFlow[] = array( |
35
|
|
|
"current" => $this->getdata("wgWizCurrent","none"), |
36
|
|
|
"cancel" => "dialog.edit.cancel.php", |
37
|
|
|
"save" => "dialog.edit.save.php" |
38
|
|
|
); |
39
|
|
|
// inject filename step |
40
|
|
|
$wgWizFlow[] = array( |
41
|
|
|
"title" => $ARnls["filename"], |
42
|
|
|
"image" => $AR->dir->images.'wizard/info.png', |
43
|
|
|
"template" => "dialog.new.filename.php", |
44
|
|
|
"nolang" => true |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
$wgWizFlow[] = array( |
48
|
|
|
"title" => $ARnls["data"], |
49
|
|
|
"image" => $AR->dir->images.'wizard/data.png', |
50
|
|
|
"template" => "dialog.edit.form.php" |
51
|
|
|
); |
52
|
|
|
|
53
|
|
|
// Call edit flow which will add the remaining flow to the wizard if appropriate |
54
|
|
|
$wgWizFlow = $wgWizCallObject->call("dialog.edit.flow.php", array( "wgWizFlow" => $wgWizFlow )); |
55
|
|
|
// Call new flow which will can override the edit flow |
56
|
|
|
$wgWizFlow = $wgWizCallObject->call("dialog.new.flow.php", array( "wgWizFlow" => $wgWizFlow )); |
57
|
|
|
|
58
|
|
|
// Custom data and locking gets added last. |
59
|
|
View Code Duplication |
if( $hascustomdata ) { |
60
|
|
|
$wgWizFlow[] = array( |
61
|
|
|
"title" => $ARnls["customdata"], |
62
|
|
|
"image" => $AR->dir->images.'wizard/customdata.png', |
63
|
|
|
"template" => "dialog.edit.custom.php" |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
$arLanguage=$this->getdata("arLanguage","none"); |
68
|
|
|
if (!$arLanguage) { // language select hasn't been done yet, so start with default language |
69
|
|
|
$arLanguage=$ARConfig->nls->default; |
70
|
|
|
$ARCurrent->arLanguage=$arLanguage; |
71
|
|
|
} |
72
|
|
|
// call user overridable new flow |
73
|
|
|
$wgWizFlow = $wgWizCallObject->call("user.wizard.new.html", array("wgWizFlow" => $wgWizFlow)); |
74
|
|
|
|
75
|
|
|
$this->call("typetree.ini"); |
76
|
|
|
$name=$ARCurrent->arTypeNames[$wgWizCallObject->type]; |
77
|
|
|
|
78
|
|
|
// spawn wizard |
79
|
|
|
$wgWizHeaderIcon = $wgWizCallObject->call("system.get.icon.php"); |
80
|
|
|
$wgWizTitle=$ARnls["new"]." ".$name; |
81
|
|
|
$wgWizHeader=$wgWizTitle; |
82
|
|
|
$wgWizTabsTemplate="dialog.edit.languagetabs.php"; |
83
|
|
|
|
84
|
|
|
include($this->store->get_config("code")."widgets/wizard/yui.wizard.html"); |
85
|
|
|
} |
86
|
|
|
?> |
|
|
|
|
87
|
|
|
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.