1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
jspopup.php
См. документацию.
1<?php
8
10{
11 var $__form_name = 'bx_popup_form';
13 var $title = '';
15 var $bContentStarted = false;
16 var $bButtonsStarted = false;
17 var $suffix = '';
18 var $jsPopup = 'BX.WindowManager.Get()';
21
22 var $bInited = false;
23
24 /*
25 $arConfig = array(
26 'TITLE' => 'Popup window title',
27 'ARGS' => 'param1=values1&param2=value2', // additional GET arguments for POST query
28 )
29 */
30 public function __construct($title = '', $arConfig = array())
31 {
32 if ($title != '') $this->SetTitle($title);
33 if (is_set($arConfig, 'TITLE')) $this->SetTitle($arConfig['TITLE']);
34 if (is_set($arConfig, 'ARGS')) $this->SetAdditionalArgs($arConfig['ARGS']);
35 if (is_set($arConfig, 'SUFFIX') && $arConfig['SUFFIX'] <> '') $this->SetSuffix($arConfig['SUFFIX']);
36 }
37
38 function InitSystem()
39 {
41 global $APPLICATION;
42
43 if (!$this->bInited && (!isset($_REQUEST['bxsender']) || $_REQUEST['bxsender'] != 'core_window_cauthdialog'))
44 {
45 $this->InitScripts();
46
47 $APPLICATION->AddBufferContent(array($this, "_InitSystem"));
48
49 $APPLICATION->ShowHeadStrings();
50 $APPLICATION->ShowHeadScripts();
51
52 $this->bInited = true;
53 }
54 }
55
56 function _InitSystem()
57 {
58 $adminPage = new CAdminPage();
59
60 return
61 $adminPage->ShowPopupCSS().
62 $adminPage->ShowScript();
63 }
64
65 function InitScripts()
66 {
67 CJSCore::Init(array('admin_interface'));
68 }
69
70 function SetAdditionalArgs($additional_args = '')
71 {
72 $this->post_args = $additional_args;
73 }
74
75 function SetTitle($title = '')
76 {
77 $this->title = trim($title);
78 }
79
80 function GetFormName()
81 {
82 return $this->__form_name;
83 }
84
86 {
87 $this->suffix = '_'.trim($suffix);
88 $this->__form_name .= $this->suffix;
89 }
90
91 function ShowTitlebar($title = '')
92 {
93 $this->InitSystem();
94
95 if ($title == '')
97 ?>
98 <script>
99 var currentWindow = top.window;
100 if (top.BX.SidePanel && top.BX.SidePanel.Instance && top.BX.SidePanel.Instance.getTopSlider())
101 {
102 currentWindow = top.BX.SidePanel.Instance.getTopSlider().getWindow();
103 }
104 var currentPopup = currentWindow.<?=$this->jsPopup; ?>;
105 if (currentPopup)
106 {
107 currentPopup.SetTitle('<?echo CUtil::JSEscape($title)?>');
108 }
109 </script>
110 <?
111 }
112
113 function StartDescription($icon = false)
114 {
115 $this->InitSystem();
116
117 $this->bDescriptionStarted = true;
118?>
119<script><?if ($icon):?>
120 <?if (!str_contains($icon, '/')):?>
121
122 <?=$this->jsPopup?>.SetIcon('<?echo CUtil::JSEscape($icon)?>');
123 <?else:?>
124
125 <?=$this->jsPopup?>.SetIconFile('<?echo CUtil::JSEscape($icon)?>');
126 <?endif;?>
127<?endif;?>
128<?
129 ob_start();
130 }
131
132 function EndDescription()
133 {
134 if ($this->bDescriptionStarted)
135 {
136 $descr = ob_get_contents();
137 ob_end_clean();
138?>
139
140<?=$this->jsPopup?>.SetHead('<?echo CUtil::JSEscape($descr)?>');</script>
141<?
142 //echo '</div></div>';
143 $this->bDescriptionStarted = false;
144 }
145 }
146
147 function StartContent($arAdditional = array())
148 {
149 $this->InitSystem();
150
151 $this->EndDescription();
152 $this->bContentStarted = true;
153
154 if (isset($arAdditional['buffer']) && $arAdditional['buffer'])
155 {
156 $this->bContentBuffered = true;
157 //ob_start();
158 $this->cont_id = RandString(10);
159 echo '<div id="'.$this->cont_id.'" style="display: none;">';
160 }
161
162 echo '<form name="'.$this->__form_name.'">'."\r\n";
163 echo bitrix_sessid_post()."\r\n";
164
165 if (is_set($_REQUEST, 'back_url'))
166 echo '<input type="hidden" name="back_url" value="'.htmlspecialcharsbx($_REQUEST['back_url']).'" />'."\r\n";
167 }
168
169 function EndContent()
170 {
171 if ($this->bContentStarted)
172 {
173 echo '</form>'."\r\n";
174
175 $hkInstance = CHotKeys::getInstance();
176 $Execs = $hkInstance->GetCodeByClassName("CDialog");
177 echo $hkInstance->PrintJSExecs($Execs, "", true, true);
178
179 if ($this->bContentBuffered)
180 {
181?></div><script>BX.ready(function() {<?=$this->jsPopup?>.SwapContent(BX('<?echo $this->cont_id?>'))});</script><?
182 }
183
184 if (!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE == false)
185 {
186?><script><?echo "BX.adminFormTools.modifyFormElements(".$this->jsPopup.".DIV);"?></script><?
187 }
188
189 $this->bContentStarted = false;
190 }
191 }
192
193 function StartButtons()
194 {
195 $this->InitSystem();
196
197 $this->EndDescription();
198 $this->EndContent();
199
200 $this->bButtonsStarted = true;
201
202 ob_start();
203 }
204
205 function EndButtons()
206 {
207 if ($this->bButtonsStarted)
208 {
209 $buttons = ob_get_contents();
210 ob_end_clean();
211?>
212 <script><?=$this->jsPopup?>.SetButtons('<?echo CUtil::JSEscape($buttons)?>');</script>
213<?
214 $this->bButtonsStarted = false;
215 }
216 }
217
218 function ShowStandardButtons($arButtons = array('save', 'cancel'))
219 {
220 $this->InitSystem();
221
222 if (!is_array($arButtons)) return;
223
224 if ($this->bButtonsStarted)
225 {
226 $this->EndButtons();
227 }
228
229 $arSB = array('save' => $this->jsPopup.'.btnSave', 'cancel' => $this->jsPopup.'.btnCancel', 'close' => $this->jsPopup.'.btnClose');
230
231 foreach ($arButtons as $key => $value)
232 if (!$arSB[$value]) unset($arButtons[$key]);
233 $arButtons = array_values($arButtons);
234
235?>
236<script><?=$this->jsPopup?>.SetButtons([<?
237 foreach ($arButtons as $key => $btn)
238 echo ($key ? ',' : '').$arSB[$btn];
239?>]);</script><?
240 }
241
242 function ShowValidationError($errortext)
243 {
244 $this->EndDescription();
245 echo '<script>top.'.$this->jsPopup.'.ShowError(\''.CUtil::JSEscape(str_replace(array('<br>', '<br />', '<BR>', '<BR />'), "\r\n", $errortext)).'\')</script>';
246 }
247
248 function ShowError($errortext, $title = '')
249 {
250 $this->ShowTitlebar($title != "" ? $title : $this->title);
251
252 if (!$this->bDescriptionStarted)
253 $this->StartDescription();
254
255 ShowError($errortext);
256
257 $this->ShowStandardButtons(array("close"));
258 echo '<script>'.$this->jsPopup.'.AdjustShadow();</script>';
259 require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
260
261 exit();
262 }
263
264 function Close($bReload = true, $back_url = false)
265 {
266 if (!$back_url && is_set($_REQUEST, 'back_url'))
267 $back_url = $_REQUEST['back_url'];
268
269 if(!str_starts_with($back_url, "/") || substr($back_url,1,1) == "/")
270 {
271 //only local /url is allowed
272 $back_url = '';
273 }
274
275 echo '<script>';
276 echo 'top.'.$this->jsPopup.'.Close(); ';
277
278 if ($bReload)
279 {
280 echo 'top.BX.showWait(); ';
281 echo "top.BX.reload('".CUtil::JSEscape($back_url)."', true);";
282 }
283 echo '</script>';
284 die();
285 }
286}
287
288class CJSPopupOnPage extends CJSPopup
289{
290 function InitSystem() {} // this SHOULD be empty!
291}
global $APPLICATION
Определения include.php:80
Определения admin_lib.php:22
static Init($arExt=array(), $bReturn=false)
Определения jscore.php:66
Определения jspopup.php:10
SetTitle($title='')
Определения jspopup.php:75
EndContent()
Определения jspopup.php:169
ShowStandardButtons($arButtons=array('save', 'cancel'))
Определения jspopup.php:218
StartContent($arAdditional=array())
Определения jspopup.php:147
$bDescriptionStarted
Определения jspopup.php:14
$bContentStarted
Определения jspopup.php:15
_InitSystem()
Определения jspopup.php:56
$__form_name
Определения jspopup.php:11
StartButtons()
Определения jspopup.php:193
EndButtons()
Определения jspopup.php:205
StartDescription($icon=false)
Определения jspopup.php:113
__construct($title='', $arConfig=array())
Определения jspopup.php:30
Close($bReload=true, $back_url=false)
Определения jspopup.php:264
EndDescription()
Определения jspopup.php:132
SetAdditionalArgs($additional_args='')
Определения jspopup.php:70
$suffix
Определения jspopup.php:17
SetSuffix($suffix)
Определения jspopup.php:85
ShowTitlebar($title='')
Определения jspopup.php:91
InitScripts()
Определения jspopup.php:65
GetFormName()
Определения jspopup.php:80
$post_args
Определения jspopup.php:12
$bButtonsStarted
Определения jspopup.php:16
$title
Определения jspopup.php:13
$jsPopup
Определения jspopup.php:18
$bContentBuffered
Определения jspopup.php:19
$bInited
Определения jspopup.php:22
ShowValidationError($errortext)
Определения jspopup.php:242
$cont_id
Определения jspopup.php:20
InitSystem()
Определения jspopup.php:38
const BX_PUBLIC_MODE
Определения file_edit.php:2
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
Определения file_new.php:657
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$hkInstance
Определения hot_keys_act.php:7
global $adminPage
Определения init_admin.php:7
endif
Определения csv_new_setup.php:990
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
is_set($a, $k=false)
Определения tools.php:2133
<? endif;?> window document title
Определения prolog_main_admin.php:76
if(empty($signedUserToken)) $key
Определения quickway.php:257