1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
jspopup.php
См. документацию.
1
<?php
8
9
class
CJSPopup
10
{
11
var
$__form_name
=
'bx_popup_form'
;
12
var
$post_args
;
13
var
$title
=
''
;
14
var
$bDescriptionStarted
=
false
;
15
var
$bContentStarted
=
false
;
16
var
$bButtonsStarted
=
false
;
17
var
$suffix
=
''
;
18
var
$jsPopup
=
'BX.WindowManager.Get()'
;
19
var
$bContentBuffered
;
20
var
$cont_id
;
21
22
var
$bInited
=
false
;
23
24
/*
25
$arConfig = array(
26
'TITLE' => 'Popup window title',
27
'ARGS' => 'param1=values1¶m2=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
85
function
SetSuffix
(
$suffix
)
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 ==
''
)
96
$title
=
$this->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
288
class CJSPopupOnPage extends CJSPopup
289
{
290
function InitSystem() {} // this SHOULD be empty!
291
}
$APPLICATION
global $APPLICATION
Определения
include.php:80
CAdminPage
Определения
admin_lib.php:22
CJSCore\Init
static Init($arExt=array(), $bReturn=false)
Определения
jscore.php:66
CJSPopup
Определения
jspopup.php:10
CJSPopup\SetTitle
SetTitle($title='')
Определения
jspopup.php:75
CJSPopup\EndContent
EndContent()
Определения
jspopup.php:169
CJSPopup\ShowStandardButtons
ShowStandardButtons($arButtons=array('save', 'cancel'))
Определения
jspopup.php:218
CJSPopup\StartContent
StartContent($arAdditional=array())
Определения
jspopup.php:147
CJSPopup\$bDescriptionStarted
$bDescriptionStarted
Определения
jspopup.php:14
CJSPopup\$bContentStarted
$bContentStarted
Определения
jspopup.php:15
CJSPopup\_InitSystem
_InitSystem()
Определения
jspopup.php:56
CJSPopup\$__form_name
$__form_name
Определения
jspopup.php:11
CJSPopup\StartButtons
StartButtons()
Определения
jspopup.php:193
CJSPopup\EndButtons
EndButtons()
Определения
jspopup.php:205
CJSPopup\StartDescription
StartDescription($icon=false)
Определения
jspopup.php:113
CJSPopup\__construct
__construct($title='', $arConfig=array())
Определения
jspopup.php:30
CJSPopup\Close
Close($bReload=true, $back_url=false)
Определения
jspopup.php:264
CJSPopup\EndDescription
EndDescription()
Определения
jspopup.php:132
CJSPopup\SetAdditionalArgs
SetAdditionalArgs($additional_args='')
Определения
jspopup.php:70
CJSPopup\$suffix
$suffix
Определения
jspopup.php:17
CJSPopup\SetSuffix
SetSuffix($suffix)
Определения
jspopup.php:85
CJSPopup\ShowTitlebar
ShowTitlebar($title='')
Определения
jspopup.php:91
CJSPopup\InitScripts
InitScripts()
Определения
jspopup.php:65
CJSPopup\GetFormName
GetFormName()
Определения
jspopup.php:80
CJSPopup\$post_args
$post_args
Определения
jspopup.php:12
CJSPopup\$bButtonsStarted
$bButtonsStarted
Определения
jspopup.php:16
CJSPopup\$title
$title
Определения
jspopup.php:13
CJSPopup\$jsPopup
$jsPopup
Определения
jspopup.php:18
CJSPopup\$bContentBuffered
$bContentBuffered
Определения
jspopup.php:19
CJSPopup\$bInited
$bInited
Определения
jspopup.php:22
CJSPopup\ShowValidationError
ShowValidationError($errortext)
Определения
jspopup.php:242
CJSPopup\$cont_id
$cont_id
Определения
jspopup.php:20
CJSPopup\InitSystem
InitSystem()
Определения
jspopup.php:38
BX_PUBLIC_MODE
const BX_PUBLIC_MODE
Определения
file_edit.php:2
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
top
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
Определения
file_new.php:657
$_REQUEST
$_REQUEST["admin_mnu_menu_id"]
Определения
get_menu.php:8
$hkInstance
$hkInstance
Определения
hot_keys_act.php:7
$adminPage
global $adminPage
Определения
init_admin.php:7
endif
endif
Определения
csv_new_setup.php:990
bitrix_sessid_post
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения
tools.php:4700
is_set
is_set($a, $k=false)
Определения
tools.php:2133
title
<? endif;?> window document title
Определения
prolog_main_admin.php:76
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
main
interface
jspopup.php
Создано системой
1.14.0