1 | <?php |
---|
2 | require_once(LIB_PATH.'widgets/WDialogForm.inc'); |
---|
3 | |
---|
4 | /** |
---|
5 | * CustomAsyncTreeDialog |
---|
6 | * |
---|
7 | * @final |
---|
8 | * @author Tomasz Świenty |
---|
9 | * @version 0.1 |
---|
10 | * @copyright Copyright (c) BetaSoft |
---|
11 | */ |
---|
12 | final class CustomAsyncTreeDialog extends WDialogForm { |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | /** |
---|
17 | * __construct |
---|
18 | * |
---|
19 | * @param string $name |
---|
20 | * @param string $caption |
---|
21 | * @param string $dstyle |
---|
22 | * @return void |
---|
23 | */ |
---|
24 | public function __construct($name, $caption = NULL, $dstyle = BS_DIALOG) { |
---|
25 | |
---|
26 | parent::__construct($name, Translator::translate('Wybór z async drzewka'), BS_DIALOG); |
---|
27 | $this->path = Application::makeRelativePath(__FILE__); |
---|
28 | |
---|
29 | //$this->HWND = $this->name; |
---|
30 | |
---|
31 | $this->sizeable = TRUE; |
---|
32 | |
---|
33 | $this->width = '400px'; |
---|
34 | $this->height = '276px'; |
---|
35 | |
---|
36 | if (($this->isOpened()) AND (!$this->noNeedForCreate())) { |
---|
37 | $this->create(); |
---|
38 | } |
---|
39 | |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | public function save() { |
---|
45 | |
---|
46 | $sData = $this->getSData(); |
---|
47 | $wData = $this->getWData(); |
---|
48 | |
---|
49 | // tutaj musi nastąpić zapisanie do relacji types_of_vcosts i zapisanie zmiennej $tovcid |
---|
50 | |
---|
51 | if (isset($sData['js_after'])) { |
---|
52 | JScript::add($sData['js_after']); |
---|
53 | } |
---|
54 | |
---|
55 | if (isset($sData['onAdd']) AND $sData['onAdd']) { |
---|
56 | JScript::add($sData['onAdd'].'(41)'); |
---|
57 | } |
---|
58 | |
---|
59 | $this->jsClose(TRUE, TRUE); |
---|
60 | |
---|
61 | return TRUE; |
---|
62 | |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | /** |
---|
68 | * open |
---|
69 | * |
---|
70 | * @param string $params |
---|
71 | * @return void |
---|
72 | */ |
---|
73 | public function open($params = array()) { |
---|
74 | |
---|
75 | parent::open($params, $data); |
---|
76 | $this->setSData($data); |
---|
77 | $this->create(); |
---|
78 | |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | /** |
---|
84 | * create |
---|
85 | * |
---|
86 | * @return void |
---|
87 | */ |
---|
88 | protected function create($params = NULL) { |
---|
89 | |
---|
90 | if (!$this->isOpened()) { |
---|
91 | return FALSE; |
---|
92 | } |
---|
93 | |
---|
94 | $data = $this->getSData(); |
---|
95 | |
---|
96 | require_once(LIB_PATH.'widgets/Panel.inc'); |
---|
97 | require_once(LIB_PATH.'forms/TextInput.inc'); |
---|
98 | require_once('./scripts/MyCustomTree.inc'); |
---|
99 | |
---|
100 | $this->setHeaderIcon('PageToolBar/settings.png'); |
---|
101 | $this->setHeaderTitle(Translator::translate('Wybierz z async drzewka :D.')); |
---|
102 | |
---|
103 | $top = 14; |
---|
104 | $int = 27; |
---|
105 | |
---|
106 | $leftPanel = new Panel($this->name.'leftPanel'); |
---|
107 | $leftPanel->top = ''; |
---|
108 | $leftPanel->left = ''; |
---|
109 | $leftPanel->width = '100%'; |
---|
110 | $leftPanel->height = '100%'; |
---|
111 | $leftPanel->overflow = 'hidden'; |
---|
112 | $leftPanel->class = 'b-s-b SPEX_'; |
---|
113 | $leftPanel->style = 'float:left;'; |
---|
114 | $leftPanel->position = 'relative'; |
---|
115 | $leftPanel->display = ''; |
---|
116 | |
---|
117 | //$tree__ = new MyCustomTree($this->name.'tree__', TRUE , $params); |
---|
118 | |
---|
119 | require_once(LIB_PATH.'widgets/FolderExplorer.inc'); |
---|
120 | $tree__ = new FolderExplorer($this->name.'tree__'); |
---|
121 | $tree__->setChroot('./var/img/'); |
---|
122 | |
---|
123 | $tree__->withoutUnnecessaryDIV = TRUE; |
---|
124 | $tree__->class = 'b-s-b sbg'; |
---|
125 | $tree__->mainCSS = 'height:calc(100% - 30px)'; |
---|
126 | $tree__->setStyle('overflow:auto; height:calc(100% - 32px); width:100%;'); |
---|
127 | $tree__->onSelect = '$(\''.$this->name.'trekey'.'\').value = this.clsnam;'; |
---|
128 | |
---|
129 | $trekey = new TextInput($this->name.'trekey'); |
---|
130 | $trekey->setCSSFormatting(NULL, 'display: none;'); |
---|
131 | |
---|
132 | $this->height = '400px'; |
---|
133 | |
---|
134 | parent::create(); |
---|
135 | |
---|
136 | $this->add($leftPanel); |
---|
137 | $leftPanel->add($tree__); |
---|
138 | $this->add($trekey, 'trekey'); |
---|
139 | |
---|
140 | $this->addButtonsPanel(array('bSave', 'bCancel')); |
---|
141 | |
---|
142 | } |
---|
143 | |
---|
144 | } |
---|
145 | |
---|
146 | ?> |
---|