1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
structure.php
См. документацию.
1<?php
12
14
15require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
16require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php");
17
18IncludeModuleLangFile(__FILE__);
19
20$obJSPopup = new CJSPopup(GetMessage("pub_struct_title"));
21
22if(!$USER->CanDoOperation('fileman_view_file_structure') || !$USER->CanDoFileOperation('fm_edit_existent_folder', array(SITE_ID, "/")))
23 $obJSPopup->ShowError(GetMessage("ACCESS_DENIED"));
24
26{
27 if($a["type"] == "D" && $b["type"] == "F")
28 return -1;
29 elseif($a["type"] == "F" && $b["type"] == "D")
30 return 1;
31 else
32 {
33 $name1 = ($a["name"] <> ''? $a["name"] : $a["file"]);
34 $name2 = ($b["name"] <> ''? $b["name"] : $b["file"]);
35 return strcmp(mb_strtoupper($name1), mb_strtoupper($name2));
36 }
37}
38
40{
41 static $arTextExt = array("php", "htm", "html");
42
44
45 $arFile = array("file"=>$file, "name"=>"");
46 if($io->DirectoryExists($abs_path."/".$file))
47 {
48 $arFile["type"] = "D";
49 if($io->FileExists($abs_path."/".$file."/.section.php"))
50 {
51 $sSectionName = "";
53 include($io->GetPhysicalName($abs_path."/".$file."/.section.php"));
54 $arFile["name"] = $sSectionName;
55 $arFile["properties"] = $arDirProperties;
56 }
57 }
58 else
59 {
60 $arFile["type"] = "F";
61 if(in_array(GetFileExtension($file), $arTextExt))
62 {
63 $f = $io->GetFile($abs_path."/".$file);
64 $sContent = $f->GetContents();
65 $arContent = ParseFileContent($sContent);
66 $arFile["name"] = $arContent["TITLE"];
67 $arFile["properties"] = $arContent["PROPERTIES"];
68 }
69 }
70 if($GLOBALS['arOptions']['show_file_info'] == true)
71 {
72 if ($io->DirectoryExists($abs_path."/".$file))
73 {
74 $f = $io->GetDirectory($abs_path."/".$file);
75 $arFile["time"] = $f->GetModificationTime();
76 }
77 else
78 {
79 $f = $io->GetFile($abs_path."/".$file);
80 $arFile["time"] = $f->GetModificationTime();
81 $arFile["size"] = $f->GetFileSize();
82 }
83 }
84 return $arFile;
85}
86
87function __struct_show_files($arFiles, $doc_root, $path, $open_path, $dirsonly=false)
88{
89 global $USER;
90
91 static $tzOffset = false;
92 if($tzOffset === false)
93 $tzOffset = CTimeZone::GetOffset();
94
95 $res = '';
96 $hintScript = '';
97 $scrDest = '';
98 $scrSrc = '';
99 foreach($arFiles as $arFile)
100 {
101 if($arFile["name"] == '' && $arFile["file"] <> "/" && ($GLOBALS['arOptions']['show_all_files'] ?? null) != true)
102 continue;
103
104 $full_path = rtrim($path, "/")."/".trim($arFile["file"], "/");
105 $encPath = urlencode($full_path);
106 $name = ($arFile["name"] <> ''? htmlspecialcharsback($arFile["name"]):$arFile["file"]);
107
108 $md5 = md5($full_path);
109 if($dirsonly)
110 $md5 = "_dirs".$md5;
111 $itemID = 'item'.$md5;
112 $item = '';
113 if($arFile["type"] == 'D')
114 {
115 $arPath = array($_GET['site'], $full_path);
116 $arPerm = array(
117 "create_file" => $USER->CanDoFileOperation("fm_create_new_file", $arPath),
118 "create_folder" => $USER->CanDoFileOperation("fm_create_new_folder", $arPath),
119 "edit_folder" => $USER->CanDoFileOperation("fm_edit_existent_folder", $arPath),
120 "edit_perm" => $USER->CanDoFileOperation("fm_edit_permission", $arPath),
121 "del_folder" => $USER->CanDoFileOperation("fm_delete_folder", $arPath),
122 );
123
124 $bOpenSubdir = ($open_path <> "" && (mb_strpos($open_path."/", $full_path."/") === 0 || $arFile["file"] == "/"));
125 $dirID = 'dir'.$md5;
126 $item = '<div id="sign'.$md5.'" class="'.($bOpenSubdir? 'bx-struct-minus':'bx-struct-plus').'" onclick="structGetSubDir(this, \''.$dirID.'\', \''.$encPath.'\', '.($dirsonly? 'true':'false').')"></div>
127 <div class="bx-struct-dir" id="icon'.$md5.'"></div>
128 <div id="'.$itemID.'" __bx_path="'.$encPath.'" __bx_type="D" class="bx-struct-name"'.
129 ' onmouseover="structNameOver(this)" onmouseout="structNameOut(this)" onclick="structShowDirMenu(this, '.($dirsonly? 'true':'false').', ' . htmlspecialcharsbx(Json::encode($arPerm)) . ')"'.
130 ' ondblclick="structGetSubdirAction(\'sign'.$md5.'\')">'.htmlspecialcharsEx($name).'</div>
131 <div style="clear:both;"></div>
132 <div id="'.$dirID.'" class="bx-struct-sub" style="display:'.($bOpenSubdir? 'block':'none').'">'.
133 ($bOpenSubdir? __struct_get_files($doc_root, $full_path, $open_path, $dirsonly):'').'</div>';
134
135 $scrDest .= ($scrDest <>''? ', ':'')."'".$itemID."'";
136 if($arFile["file"] <> '/')
137 $scrSrc .= ($scrSrc <>''? ', ':'')."'".$itemID."', 'icon".$md5."'";
138 }
139 elseif($dirsonly == false)
140 {
141 $arPath = array($_GET['site'], $full_path);
142 $arPerm = array(
143 "edit_file" => $USER->CanDoFileOperation("fm_edit_existent_file", $arPath),
144 "edit_perm" => $USER->CanDoFileOperation("fm_edit_permission", $arPath),
145 "del_file" => $USER->CanDoFileOperation("fm_delete_file", $arPath),
146 );
147
148 if($GLOBALS['bFileman'] == true && ($GLOBALS['arOptions']['show_all_files'] ?? null) == true)
149 $type = CFileMan::GetFileTypeEx($arFile["file"]);
150 else
151 $type = "";
152
153 $item = '<div style="float:left"></div><div class="bx-struct-file'.($type <> ''? ' bx-struct-type-'.$type : '').'" id="icon'.$md5.'"></div>
154 <div id="'.$itemID.'" __bx_path="'.$encPath.'" __bx_type="F" class="bx-struct-name" onmouseover="structNameOver(this)" onmouseout="structNameOut(this)" onclick="structShowFileMenu(this, ' . htmlspecialcharsbx(Json::encode($arPerm)) . ')" ondblclick="structEditFileAction(this)">'.htmlspecialcharsEx($name).'</div>
155 <div style="clear:both;"></div>';
156
157 $scrSrc .= ($scrSrc <>''? ', ':'')."'".$itemID."', 'icon".$md5."'";
158 }
159 if($item <> '')
160 $res .= '<div class="bx-struct-item">'.$item.'</div>';
161
162 if($GLOBALS['arOptions']['show_file_info'] == true)
163 {
164 $sHint = '<table cellspacing="0" border="0">'.
165 '<tr><td colspan="2"><b>'.($arFile["type"] == 'D'? GetMessage("pub_struct_folder"):GetMessage("pub_struct_file")).'</b></td></tr>'.
166 '<tr><td class="bx-grey">'.GetMessage("pub_struct_name").'</td><td>'.htmlspecialcharsEx($arFile["file"]).'</td></tr>'.
167 ($arFile["type"] == 'F'? '<tr><td class="bx-grey">'.GetMessage("pub_struct_size")."</td><td>".number_format($arFile["size"], 0, ".", ",")." ".GetMessage("pub_struct_byte").'</td></tr>':'').
168 '<tr><td class="bx-grey">'.GetMessage("pub_struct_modified").'</td><td>'.htmlspecialcharsEx(ConvertTimeStamp($arFile["time"]+$tzOffset, 'FULL', $_GET['site'])).'</td></tr>';
169 if(is_array($arFile["properties"]))
170 foreach($arFile["properties"] as $prop_name => $prop_val)
171 $sHint .= '<tr valign="top"><td class="bx-grey">'.htmlspecialcharsEx($prop_name).':</td><td>'.htmlspecialcharsEx($prop_val).'</td></tr>';
172 $sHint .= '</table>';
173
174 $hintScript .= 'window.structHint'.$itemID.' = new BXHint(\''.CUtil::JSEscape($sHint).'\', document.getElementById(\''.$itemID.'\')); ';
175 }
176 }
177 if($hintScript <> '')
178 $res .= '<script>'.$hintScript.'</script>';
179
180 if($GLOBALS['bFileman'] == true)
181 $res .= '<script>structRegisterDD(['.$scrSrc.'], ['.$scrDest.']);</script>';
182
183 return $res;
184}
185
186function __struct_get_files($doc_root, $path="", $open_path="", $dirsonly=false)
187{
188 global $USER;
189
190 if(!$USER->CanDoFileOperation('fm_view_listing', array($_GET['site'], $path)))
191 return '';
192
193 $arFiles = array();
194 $abs_path = $doc_root."/".$path;
195
196 $io = CBXVirtualIo::GetInstance();
197 $directory = $io->GetDirectory($abs_path);
198 $arChildren = $directory->GetChildren();
199 foreach ($arChildren as $child)
200 {
201 $n = $child->GetName();
202 if (!$child->IsDirectory())
203 {
204 if($n == '.section.php' || $n == '.access.php')
205 continue;
206 if(preg_match('/^\.(.*)?\.menu\.(php|html|php3|php4|php5|php6|phtml)$/', $n))
207 continue;
208 }
209 $arFile = __struct_get_file_info($abs_path, $n);
210 $arFiles[] = $arFile;
211 }
212
213 usort($arFiles, "__struct_file_sort");
214
215 return __struct_show_files($arFiles, $doc_root, $path, $open_path, $dirsonly);
216}
217
218$bFileman = CModule::IncludeModule('fileman');
219
220$strWarning = "";
221$DOC_ROOT = CSite::GetSiteDocRoot($_GET["site"]);
222
223$arOptions = CUserOptions::GetOption("public_structure", "options", array());
224if(!isset($arOptions['show_file_info']))
225 $arOptions['show_file_info'] = true;
226
227$io = CBXVirtualIo::GetInstance();
228// **********************************************
229//ajax requests
230if (isset($_GET['ajax']) && $_GET['ajax'] == 'Y')
231{
232 if(!empty($_GET['action']) && $_GET['action'] == 'delfolder' && check_bitrix_sessid() && $bFileman)
233 {
234 $normPath = $io->CombinePath("/", $_GET["path"]);
235 if($normPath <> "")
236 $strWarning = CFileMan::DeleteEx(array($_GET["site"], $normPath));
237
238 if(COption::GetOptionString("fileman", "log_page", "Y")=="Y")
239 {
240 CEventLog::Log("content", "SECTION_DELETE", "fileman", $normPath);
241 }
242 }
243 elseif(!empty($_GET['action']) && ($_GET['action'] == 'copy' || $_GET['action'] == 'move') && check_bitrix_sessid() && $bFileman)
244 {
245 $normFrom = $io->CombinePath("/", $_GET["from"]);
246 $name = "";
247 if(($pos = mb_strrpos($normFrom, "/")) !== false)
248 $name = mb_substr($normFrom, $pos + 1);
249 $normTo = $io->CombinePath("/", $_GET["to"]."/".$name);
250 if($normFrom <> "" && $normTo <> "")
251 $strWarning = CFileMan::CopyEx(array($_GET["site"], $normFrom), array($_GET["site"], $normTo), ($_GET['action'] == "move"? true : false));
252 }
253
254 if(isset($_GET['show_all_files']))
255 $arOptions['show_all_files'] = ($_GET['show_all_files'] == 'Y');
256 if(isset($_GET['show_file_info']))
257 $arOptions['show_file_info'] = ($_GET['show_file_info'] == 'Y');
258 if(isset($_GET['show_all_files']) || isset($_GET['show_file_info']))
259 CUserOptions::SetOption("public_structure", "options", $arOptions);
260
261 if (!empty($_GET['load_path']))
262 {
263 echo __struct_get_files($DOC_ROOT, _normalizePath($_GET['load_path']), "", (!empty($_GET['dirsonly']) && $_GET['dirsonly']=='Y'));
264 }
265 elseif (isset($_GET['reload']) && $_GET['reload'] == 'Y')
266 {
267 //display first level tree
268 $arRoot = __struct_get_file_info($DOC_ROOT, "/");
269 echo __struct_show_files(array($arRoot), $DOC_ROOT, "", _normalizePath($_GET["path"]), (!empty($_GET['dirsonly']) && $_GET['dirsonly']=='Y'));
270 }
271
272 if($strWarning <> "")
273 {
274 $obJSPopup->ShowValidationError($strWarning);
275 echo '<script>jsPopup.AdjustShadow()</script>';
276 }
277}
278?>
279<script>window.structOptions = <?= Json::encode($arOptions) ?>;</script>
280<?
281if (isset($_GET['ajax']) && $_GET['ajax'] == 'Y')
282{
283 require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
284 die();
285}
286// **********************************************
287
288$encPath = urlencode($_GET["path"]);
289$encLang = urlencode($_GET["lang"]);
290$encSite = urlencode($_GET["site"]);
291$encTemplateID = urlencode($_GET["templateID"]);
292?>
293<script src="/bitrix/js/main/dd.js<?echo '?'.filemtime($_SERVER["DOCUMENT_ROOT"].'/bitrix/js/main/dd.js')?>"></script>
294<script>
295window.structRegisterDD = function(arSrc, arDest)
296{
297 for(var i=0, n=arSrc.length; i<n; i++)
298 {
299 var obEl = document.getElementById(arSrc[i]);
300 obEl.onbxdragstart = Struct_DragStart;
301 obEl.onbxdragstop = Struct_DragStop;
302 obEl.onbxdrag = Struct_Drag;
303 jsDD.registerObject(obEl);
304 }
305 for(i=0, n=arDest.length; i<n; i++)
306 {
307 obEl = document.getElementById(arDest[i]);
308 obEl.onbxdestdraghover = Struct_DragHover;
309 obEl.onbxdestdraghout = Struct_DragOut;
310 obEl.onbxdestdragfinish = Struct_DragFinish;
311 jsDD.registerDest(obEl);
312 }
313};
314
315window.structGetSubDir = function(el, div_id, path, dirsonly)
316{
317 var div = document.getElementById(div_id);
318 if(!div)
319 return;
320 if(div.innerHTML == '')
321 {
322 div.innerHTML = '<?=CUtil::JSEscape(GetMessage("pub_struct_loading"))?>';
323 CHttpRequest.Action = function(result)
324 {
325 result = jsUtils.trim(result);
326 div.innerHTML = result;
327 if(result == '')
328 {
329 el.onclick = null;
330 el.className = 'bx-struct-dot';
331 div.style.display = 'none';
332 }
333 };
334 CHttpRequest.Send('/bitrix/admin/public_structure.php?ajax=Y&<?="lang=".$encLang."&site=".$encSite?>&load_path='+path+(dirsonly? '&dirsonly=Y':''));
335 }
336 el.className = (el.className == 'bx-struct-plus'? 'bx-struct-minus':'bx-struct-plus');
337 div.style.display = (div.style.display == 'none'? 'block':'none');
338};
339
340window.structGetSubdirAction = function(id)
341{
342 var el = document.getElementById(id);
343 if(el)
344 {
345 setTimeout(function(){if(window.structMenu) window.structMenu.PopupHide();}, 50);
346 el.onclick();
347 }
348};
349
350window.structReload = function(path, params)
351{
352 CHttpRequest.Action = function(result)
353 {
354 jsDD.Reset();
355 var container = document.getElementById('structure_content');
356 if(container)
357 container.innerHTML = result;
358
359 CloseWaitWindow();
360 structReloadDirs(path);
361 };
362 setTimeout(ShowWaitWindow, 50);
363 CHttpRequest.Send('/bitrix/admin/public_structure.php?ajax=Y&reload=Y&<?="lang=".$encLang."&site=".$encSite?>&path='+path+(params? '&'+params:''));
364};
365
366window.structReloadDirs = function(path)
367{
368 var container = document.getElementById('bx_struct_dirs_container');
369 if(!container)
370 return;
371 CHttpRequest.Action = function(result)
372 {
373 container.innerHTML = result;
374 CloseWaitWindow();
375 };
376 setTimeout(ShowWaitWindow, 50);
377 CHttpRequest.Send('/bitrix/admin/public_structure.php?ajax=Y&reload=Y&<?="lang=".$encLang."&site=".$encSite?>&dirsonly=Y&path='+path);
378};
379
380window.structNameOver = function(el)
381{
382 el.className += ' bx-struct-name-over';
383};
384
385window.structNameOut = function(el)
386{
387 el.className = el.className.replace(/\s*bx-struct-name-over/ig, "");
388};
389
390window.structPopup = <?=$obJSPopup->jsPopup?>;
391
392window.jsPopup_subdialog = new JCPopup({'suffix':'subdialog', 'zIndex':parseInt(window.structPopup.zIndex)+20});
393
394window.structShowSubDialog = function()
395{
396 setTimeout(function(){window.structPopup.bDenyEscKey = true}, 200);
397 jsUtils.addCustomEvent('OnBeforeCloseDialog', function(){setTimeout(function(){window.structPopup.bDenyEscKey = false;}, 50);});
398};
399
400window.structAddFile = function(path, isFolder)
401{
402 structShowSubDialog();
403<?
404 $url = $APPLICATION->GetPopupLink(array(
405 "URL"=>"/bitrix/admin/public_file_new.php?subdialog=Y&lang=".$encLang."&site=".$encSite."&templateID=".$encTemplateID."&path=_PATH_",
406 "PARAMS"=> Array("min_width"=>450, "min_height" => 250)), "subdialog");
407 $url = str_replace("_PATH_", "'+path+(isFolder==true? '&newFolder=Y':'')+'", $url);
408 echo $url.";";
409?>
410};
411
412window.structAccessDialog = function(path)
413{
414 structShowSubDialog();
415<?
416 $url = $APPLICATION->GetPopupLink(Array(
417 "URL"=>"/bitrix/admin/public_access_edit.php?subdialog=Y&lang=".$encLang."&site=".$encSite."&path=_PATH_",
418 "PARAMS" => Array("min_width"=>450, "min_height" => 250)), "subdialog");
419 $url = str_replace("_PATH_", "'+path+'", $url);
420 echo $url.";";
421?>
422};
423
424window.structEditFolder = function(path)
425{
426 structShowSubDialog();
427<?
428 $url = $APPLICATION->GetPopupLink(array(
429 "URL"=>"/bitrix/admin/public_folder_edit.php?subdialog=Y&lang=".$encLang."&site=".$encSite."&path=_PATH_",
430 "PARAMS" => Array("min_width"=>450, "min_height" => 250)), "subdialog");
431 $url = str_replace("_PATH_", "'+path+'", $url);
432 echo $url.";";
433?>
434};
435
436window.structEditFile = function(path)
437{
438<?
439 $url = $APPLICATION->GetPopupLink(Array(
440 "URL"=>"/bitrix/admin/public_file_edit.php?bxpublic=Y&subdialog=Y&lang=".$encLang."&path=_PATH_&site=".$encSite,
441 "PARAMS"=>array("width"=>780, "height"=>570, "resize"=>true)), "editor");
442 $url = str_replace("_PATH_", "'+path+'", $url);
443 echo $url.";";
444?>
445};
446
447window.structEditFileHtml = function(path)
448{
449<?
450 $url = $APPLICATION->GetPopupLink(Array(
451 "URL"=>"/bitrix/admin/public_file_edit.php?bxpublic=Y&subdialog=Y&lang=".$encLang."&noeditor=Y&path=_PATH_&site=".$encSite,
452 "PARAMS"=>array("width"=>780, "height"=>570, "resize"=>true)), "editor");
453 $url = str_replace("_PATH_", "'+path+'", $url);
454 echo $url.";";
455?>
456};
457
458window.structFileProp = function(path)
459{
460 structShowSubDialog();
461<?
462 $url = $APPLICATION->GetPopupLink(Array(
463 "URL"=>"/bitrix/admin/public_file_property.php?subdialog=Y&lang=".$encLang."&site=".$encSite."&path=_PATH_",
464 "PARAMS" => Array("min_width"=>450, "min_height" => 250)), "subdialog");
465 $url = str_replace("_PATH_", "'+path+'", $url);
466 echo $url.";";
467?>
468};
469
470window.structDelFile = function(path)
471{
472 structShowSubDialog();
473<?
474 $url = $APPLICATION->GetPopupLink(array(
475 "URL" => "/bitrix/admin/public_file_delete.php?subdialog=Y&lang=".$encLang."&site=".$encSite."&path=_PATH_",
476 "PARAMS" => Array("min_width"=>250, "min_height" => 150, 'height' => 150, 'width' => 350)), "subdialog");
477 $url = str_replace("_PATH_", "'+path+'", $url);
478 echo $url.";";
479?>
480};
481
482window.structDelFolder = function(path)
483{
484 if(confirm('<?=CUtil::JSEscape(GetMessage("pub_struct_folder_del_confirm"))?>'))
485 structReload(path, 'action=delfolder&<?="lang=".$encLang."&site=".$encSite."&".bitrix_sessid_get()?>&path='+path);
486};
487
488window.structShowDirMenu = function(el, dirsonly, arPerm)
489{
490 var path = el.getAttribute('__bx_path');
491 var items = [
492 {'ICONCLASS': 'panel-new-file', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_add_page"))?>', 'ONCLICK': 'structAddFile(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_add_page_title"))?>', 'DISABLED':!arPerm.create_file},
493 {'ICONCLASS': 'panel-new-folder', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_add_sect"))?>', 'ONCLICK': 'structAddFile(\''+path+'\', true)', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_add_sect_title"))?>', 'DISABLED':!arPerm.create_folder},
494 {'SEPARATOR':true},
495 {'ICONCLASS': 'panel-folder-props', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_prop"))?>', 'ONCLICK': 'structEditFolder(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_prop_title"))?>', 'DISABLED':!arPerm.edit_folder},
496 {'ICONCLASS': 'panel-folder-access', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_access"))?>', 'ONCLICK': 'structAccessDialog(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_access_title"))?>', 'DISABLED':!arPerm.edit_perm}
497 ];
498<?if($bFileman):?>
499 if(unescape(path) != '/')
500 {
501 items[items.length] = {'SEPARATOR':true};
502 items[items.length] = {'ICONCLASS': 'panel-folder-delete', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_del"))?>', 'ONCLICK': 'structDelFolder(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_del_title"))?>', 'DISABLED':!arPerm.del_folder};
503 }
504 items[items.length] = {'SEPARATOR':true};
505 items[items.length] = {'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_cp"))?>', 'ONCLICK': 'jsUtils.Redirect(arguments, \'/bitrix/admin/fileman_admin.php?lang=<?=$encLang?>&site=<?=$encSite?>&path='+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_cp_title"))?>'};
506<?endif;?>
507
508 window.structShowMenu(el, items, dirsonly);
509};
510
511window.structShowFileMenu = function(el, arPerm)
512{
513 var path = el.getAttribute('__bx_path');
514 var ext = '';
515 var pos = path.lastIndexOf('.');
516 if(pos > -1)
517 ext = path.substr(pos+1);
518
519 var bText = false;
520 var items = [];
521 if(ext == 'php' || ext == 'htm' || ext == 'html')
522 {
523 items[items.length] = {'ICONCLASS': 'panel-edit-visual', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_edit"))?>', 'ONCLICK': 'structEditFile(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_edit_title"))?>', 'DEFAULT':true, 'DISABLED':!arPerm.edit_file};
524 items[items.length] = {'ICONCLASS': 'panel-edit-text', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_edit_html"))?>', 'ONCLICK': 'structEditFileHtml(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_edit_html_title"))?>', 'DISABLED':!arPerm.edit_file};
525 bText = true;
526 }
527 if(ext == 'php')
528 {
529 items[items.length] = {'SEPARATOR':true};
530 items[items.length] = {'ICONCLASS': 'panel-file-props', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_prop"))?>', 'ONCLICK': 'structFileProp(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_prop_title"))?>', 'DISABLED':!arPerm.edit_file};
531 items[items.length] = {'ICONCLASS': 'panel-file-access', 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_access"))?>', 'ONCLICK': 'structAccessDialog(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_access_title"))?>', 'DISABLED':!arPerm.edit_perm};
532 }
533 if(items.length > 0)
534 items[items.length] = {'SEPARATOR':true};
535 items[items.length] = {'ICONCLASS': 'panel-file-delete', 'TEXT': (bText? '<?=CUtil::JSEscape(GetMessage("pub_struct_file_del"))?>':'<?=CUtil::JSEscape(GetMessage("pub_struct_file_del_title"))?>'), 'ONCLICK': 'structDelFile(\''+path+'\')', 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_file_del_title1"))?>', 'DISABLED':!arPerm.del_file};
536
537 window.structShowMenu(el, items);
538};
539
540window.structEditFileAction = function(el)
541{
542 var path = el.getAttribute('__bx_path');
543 var pos = path.lastIndexOf('.');
544 if(pos > -1)
545 {
546 var ext = path.substr(pos+1);
547 if(ext == 'php' || ext == 'htm' || ext == 'html')
548 structEditFile(path);
549 }
550};
551
552window.structShowMenu = function(el, items, dirsonly)
553{
554 if(!window.structMenu)
555 {
556 window.structMenu = new PopupMenu('structure_menu');
557 window.structMenu.Create(parseInt(window.structPopup.zIndex)+15);
558 }
559
560 if(window['structHint'+el.id])
561 window['structHint'+el.id].Freeze();
562 window.structPopup.bDenyEscKey = true;
563 jsUtils.addCustomEvent('OnBeforeCloseDialog', window.structMenu.PopupHide, [], window.structMenu);
564
565 //var dY = document.getElementById((dirsonly? 'bx_struct_dirs_content':'bx_popup_content')).scrollTop;
566 var dY = 0; /*(
567 dirsonly
568 ? BX('bx_struct_dirs_content')
569 : BX.findParent(window.structPopup.GetContent(), {tag: 'DIV'}) // hack ;-(
570 ).scrollTop;*/
571
572 var dPos = {'left':0, 'right':0, 'top':-dY+1, 'bottom':-dY+1};
573
574 window.structMenu.ShowMenu(el, items, false, dPos, function(){
575 setTimeout(function(){window.structPopup.bDenyEscKey = false}, 50);
576 if(window['structHint'+el.id])
577 window['structHint'+el.id].UnFreeze();
578 });
579};
580
581window.structShowSettingsMenu = function(el)
582{
583 if(!window.structSettingsMenu)
584 window.structSettingsMenu = new PopupMenu('structure_menu', parseInt(window.structPopup.zIndex)+10);
585
586 var items = [
587 {'ICONCLASS': (window.structOptions['show_all_files'] == true? 'checked':''),
588 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_show_all"))?>',
589 'ONCLICK': 'structReload(\'<?=$encPath?>\', \'show_all_files='+(window.structOptions['show_all_files'] == true? 'N':'Y')+'\')',
590 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_show_all_title"))?>'},
591 {'ICONCLASS': (window.structOptions['show_file_info'] == true? 'checked':''),
592 'TEXT': '<?=CUtil::JSEscape(GetMessage("pub_struct_show_info"))?>',
593 'ONCLICK': 'structReload(\'<?=$encPath?>\', \'show_file_info='+(window.structOptions['show_file_info'] == true? 'N':'Y')+'\')',
594 'TITLE': '<?=CUtil::JSEscape(GetMessage("pub_struct_show_info_title"))?>'}
595 ];
596
597 window.structSettingsMenu.SetItems(items);
598 window.structSettingsMenu.BuildItems();
599
600 window.structPopup.bDenyEscKey = true;
601 jsUtils.addCustomEvent('OnBeforeCloseDialog', window.structSettingsMenu.PopupHide, [], window.structSettingsMenu);
602
603 window.structSettingsMenu.ShowMenu(el, false, false, false, function(){setTimeout(function(){window.structPopup.bDenyEscKey = false}, 50)});
604};
605
606window.structOpenDirs = function(el)
607{
608 if(document.getElementById('bx_struct_dirs'))
609 return;
610 var strDiv = window.structPopup.Get();
611 var div = jsFloatDiv.Create({
612 'id':'bx_struct_dirs',
613 'className':'bx-popup-form',
614 'zIndex':parseInt(window.structPopup.zIndex)+10,
615 'width':250, 'height':strDiv.offsetHeight
616 });
617
618 BX.showWait(strDiv);
619 BX.ajax.get(
620 '/bitrix/admin/public_structure.php?ajax=Y&reload=Y&<?="lang=".$encLang."&site=".$encSite."&path=".$encPath?>&dirsonly=Y',
621 function(result)
622 {
623 var container = document.getElementById('bx_struct_dirs');
624 if(container)
625 {
626 container.innerHTML =
627 '<div class="bx-popup-title" id="bx_popup_title_dirs"><table cellspacing="0" class="bx-width100">'+
628 '<tr>'+
629 ' <td class="bx-width100 bx-title-text" onmousedown="jsFloatDiv.StartDrag(arguments[0], document.getElementById(\'bx_struct_dirs\'));">'+'<?=CUtil::JSEscape(GetMessage("pub_struct_sections"))?>'+'</td>'+
630 ' <td class="bx-width0"><a class="bx-popup-close" href="javascript:void(0)" onclick="structCloseDirs()" title="'+'<?=CUtil::JSEscape(GetMessage("pub_struct_close"))?>'+'"></a></td>'+
631 '</tr>'+
632 '</table></div>'+
633 '<div class="bx-popup-content" id="bx_struct_dirs_content"><div class="bx-popup-content-container" id="bx_struct_dirs_container">'+result+'</div></div>';
634
635 var pos = jsUtils.GetRealPos(strDiv);
636 var cont = document.getElementById('bx_struct_dirs_content');
637 cont.style.height = pos["bottom"]-pos["top"]-31+'px';
638 cont.style.width = 250-12+'px';
639
640 jsDD.registerContainer(cont);
641
642 div.style.zIndex = parseInt(window.structPopup.zIndex)+2;
643 jsFloatDiv.Show(div, pos["left"]-250-1, pos["top"], 0, true);
644 BX.closeWait(strDiv);
645 }
646 }
647 );
648 window.structUpdateTop = function() {div.style.top = strDiv.style.top;};
649 BX.addCustomEvent(window.structPopup, 'onWindowClose', structCloseDirs);
650 BX.addCustomEvent(window.structPopup, 'onWindowExpand', window.structUpdateTop);
651 BX.addCustomEvent(window.structPopup, 'onWindowNarrow', window.structUpdateTop);
652};
653
654window.structCloseDirs = function()
655{
656 var div = document.getElementById('bx_struct_dirs');
657 if(div)
658 {
659 jsFloatDiv.Close(div);
660 div.parentNode.removeChild(div);
661 }
662 BX.removeCustomEvent(window.structPopup, 'onWindowClose', structCloseDirs);
663
664 if (window.structUpdateTop)
665 {
666 BX.removeCustomEvent(window.structPopup, 'onWindowExpand', window.structUpdateTop);
667 BX.removeCustomEvent(window.structPopup, 'onWindowNarrow', window.structUpdateTop);
668 window.structUpdateTop = null;
669 }
670};
671
672/* DD handlers */
673
674window.Struct_DragStart = function()
675{
676 var div = document.body.appendChild(document.createElement("DIV"));
677 div.style.position = 'absolute';
678 div.style.zIndex = parseInt(window.structPopup.zIndex)+30;
679 div.className = 'bx-struct-drag';
680 this.__dragCopyDiv = div;
681
682 var drag_div = this;
683 if(!drag_div.getAttribute('__bx_path'))
684 drag_div = jsUtils.FindNextSibling(drag_div, "div");
685
686 div.innerHTML = drag_div.innerHTML;
687 drag_div.className = 'bx-struct-name bx-struct-name-drag';
688
689 window.structContainers = [BX.findParent(window.structPopup.GetContent(), {tag: 'DIV'}), document.getElementById('bx_struct_dirs_content')];
690 window.structContainerPos = [];
691 for(var i=0; i<window.structContainers.length; i++)
692 if(window.structContainers[i])
693 window.structContainerPos[i] = jsUtils.GetRealPos(window.structContainers[i]);
694
695 var hint = window['structHint'+drag_div.id];
696 if(hint)
697 hint.Freeze();
698
699 return true;
700};
701
702window.Struct_Drag = function(x, y)
703{
704 var div = this.__dragCopyDiv;
705 div.style.left = x+'px';
706 div.style.top = y+'px';
707
708 for(var i=0; i<window.structContainers.length; i++)
709 {
710 if(window.structContainers[i] && x >= window.structContainerPos[i]["left"] && x <= window.structContainerPos[i]["right"])
711 {
712 if(y > window.structContainerPos[i]["bottom"])
713 window.structContainers[i].scrollTop += 20;
714 if(y < window.structContainerPos[i]["top"])
715 window.structContainers[i].scrollTop -= 20;
716 }
717 }
718
719 return true;
720};
721
722window.Struct_DragStop = function()
723{
724 this.__dragCopyDiv.parentNode.removeChild(this.__dragCopyDiv);
725 this.__dragCopyDiv = null;
726
727 var drag_div = this;
728 if(!drag_div.getAttribute('__bx_path'))
729 drag_div = jsUtils.FindNextSibling(drag_div, "div");
730
731 drag_div.className = 'bx-struct-name';
732
733 var hint = window['structHint'+drag_div.id];
734 if(hint)
735 hint.UnFreeze();
736
737 return true;
738};
739
740window.Struct_DragHover = function(obDrag, x, y)
741{
742 this.className += ' bx-struct-dragover';
743 return true;
744};
745
746window.Struct_DragOut = function(obDrag, x, y)
747{
748 this.className = this.className.replace(/\s*bx-struct-dragover/ig, "");
749 return true;
750};
751
752window.Struct_DragFinish = function(obDrag, x, y, e)
753{
754 this.className = this.className.replace(/\s*bx-struct-dragover/ig, "");
755
756 if(!obDrag.getAttribute('__bx_path'))
757 obDrag = jsUtils.FindNextSibling(obDrag, "div");
758
759 //can't move to itself
760 if(this == obDrag)
761 return true;
762 //can't move to parent folder
763 var enc_from = obDrag.getAttribute('__bx_path');
764 var enc_to = this.getAttribute('__bx_path');
765 var from = unescape(enc_from);
766 var to = unescape(enc_to);
767 if(to.charAt(to.length-1) != '/')
768 to += '/';
769 if(to == from.substring(0, from.lastIndexOf('/')+1))
770 return true;
771 //can't move folder to its subfolder
772 if(to.indexOf(from+'/') == 0)
773 return true;
774
775 var mess;
776 var bFolder = (obDrag.getAttribute('__bx_type') == 'D');
777 if(e.ctrlKey)
778 mess = (bFolder? '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_confirm_copy"))?>' : '<?=CUtil::JSEscape(GetMessage("pub_struct_file_confirm_copy"))?>');
779 else
780 mess = (bFolder? '<?=CUtil::JSEscape(GetMessage("pub_struct_folder_confirm_move"))?>' : '<?=CUtil::JSEscape(GetMessage("pub_struct_file_confirm_move"))?>');
781
782 mess = mess.replace(/#FROM#/g, from);
783 mess = mess.replace(/#TO#/g, unescape(enc_to));
784 if(confirm(mess))
785 structReload(enc_to, 'action='+(e.ctrlKey? 'copy':'move')+'&from='+enc_from+'&to='+enc_to+'&<?=bitrix_sessid_get()?>');
786
787 return true;
788};
789
790jsDD.Reset();
791//jsDD.registerContainer(BX.findParent(window.structPopup.GetContent(), {tag: 'DIV'}));
792jsDD.registerContainer(BX.WindowManager.Get().GetContent());
793
794</script>
795
796<?
797$obJSPopup->ShowTitlebar();
798$obJSPopup->StartDescription('bx-structure');
799?>
800<p><b><?echo GetMessage("pub_struct_desc_title")?></b></p>
801<div class="bx-struct-settings" onclick="structShowSettingsMenu(this)" onmouseover="this.className+=' bx-struct-settings-over'" onmouseout="this.className=this.className.replace(/\s*bx-struct-settings-over/ig, '')" title="<?echo GetMessage("pub_struct_settings_title")?>"><?echo GetMessage("pub_struct_settings")?></div>
802<div class="bx-struct-settings bx-struct-button" onclick="structOpenDirs(this)" onmouseover="this.className+=' bx-struct-settings-over'" onmouseout="this.className=this.className.replace(/\s*bx-struct-settings-over/ig, '')" title="<?echo GetMessage("pub_struct_folders_title")?>"><?echo GetMessage("pub_struct_folders_button")?></div>
803<br />
804<br style="clear:both;" />
805<?
806$obJSPopup->StartContent();
807?>
808<div id="structure_content">
809<?
810//display first level tree
811$arRoot = __struct_get_file_info($DOC_ROOT, "/");
812echo __struct_show_files(array($arRoot), $DOC_ROOT, "", _normalizePath($_GET["path"]));
813?>
814</div>
815<?
816$obJSPopup->ShowStandardButtons(array("close"));
817?>
818<?
819require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
820?>
$path
Определения access_edit.php:21
Определения json.php:9
static GetInstance()
Определения virtual_io.php:60
Определения jspopup.php:10
$abs_path
Определения component_props2.php:76
$f
Определения component_props.php:52
$DOC_ROOT
Определения file_edit.php:66
$arPath
Определения file_edit.php:72
hidden PROPERTY[<?=$propertyIndex?>][CODE]<?=htmlspecialcharsEx( $propertyCode)?> height
Определения file_new.php:759
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</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
hidden mSiteList<?=htmlspecialcharsbx(serialize( $siteList))?><?=htmlspecialcharsbx( $siteList[ $j]["ID"])?> _Propery<? if(((COption::GetOptionString( $module_id, "different_set", "N")=="Y") &&( $j !=0))||(COption::GetOptionString( $module_id, "different_set", "N")=="N")) echo "display: none;"?> top adm detail content cell l top adm detail content cell r heading center center ID left
Определения options.php:768
$res
Определения filter_act.php:7
$arDirProperties
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$io
Определения csv_new_run.php:98
URL bitrix admin public_access_edit php subdialog
Определения structure.php:417
if(isset( $_GET[ 'ajax']) &&$_GET[ 'ajax']=='Y') if(isset($_GET['ajax']) && $_GET['ajax']=='Y') $encPath
Определения structure.php:288
URL bitrix admin public_file_edit php bxpublic
Определения structure.php:440
__struct_file_sort($a, $b)
Определения structure.php:25
__struct_get_file_info($abs_path, $file)
Определения structure.php:39
__struct_show_files($arFiles, $doc_root, $path, $open_path, $dirsonly=false)
Определения structure.php:87
GetFileExtension($path)
Определения tools.php:2972
ParseFileContent($filesrc, $params=[])
Определения tools.php:4780
htmlspecialcharsback($str)
Определения tools.php:2693
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
_normalizePath($strPath)
Определения tools.php:3341
$name
Определения menu_edit.php:35
$arFiles
Определения options.php:60
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
lang
Определения options.php:182
$md5
Определения result_rec.php:12
font style
Определения invoice.php:442
font size
Определения invoice.php:442
else $a
Определения template.php:137
$sSectionName
Определения .section.php:2
$obJSPopup
Определения settings_admin_form.php:102
const SITE_ID
Определения sonet_set_content_view.php:12
path
Определения template_copy.php:201
$GLOBALS['_____370096793']
Определения update_client.php:1
adm detail iblock types adm detail iblock list tr_SITE_ID display
Определения yandex_setup.php:388