1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
folder_edit.php
См. документацию.
1<?
2require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
3
5
7 GetMessage('FOLDER_EDIT_WINDOW_TITLE'),
8 ["SUFFIX" => (isset($_GET['subdialog']) && $_GET['subdialog'] === 'Y' ? 'subdialog' : '')]
9);
10
11if (IsModuleInstalled("fileman"))
12{
13 if (!$USER->CanDoOperation('fileman_edit_existent_folders') && !$USER->CanDoOperation('fileman_admin_folders'))
14 $popupWindow->ShowError(GetMessage("FOLDER_EDIT_ACCESS_DENIED"));
15}
16
17//Site ID
19if (isset($_REQUEST["site"]) && $_REQUEST["site"] <> '')
20{
21 $obSite = CSite::GetByID($_REQUEST["site"]);
22 if ($arSite = $obSite->Fetch())
23 $site = $_REQUEST["site"];
24}
25
27
28//Folder path
29$path = "";
30$documentRoot = CSite::GetSiteDocRoot($site);
31if (isset($_REQUEST["path"]) && $_REQUEST["path"] <> '')
32{
33 $path = $io->CombinePath("/", $_REQUEST["path"]);
34
35 //Find real folder
36 while($path != "/" && !$io->DirectoryExists($documentRoot.$path))
37 {
38 $position = mb_strrpos($path, "/");
39 if ($position === false)
40 break;
41
42 $path = mb_substr($path, 0, $position);
43 }
44
45 //Cut / from the end
46 $path = rtrim($path, "/");
47}
48
49if ($path == '' || !$io->DirectoryExists($documentRoot.$path))
50 $path = "/";
51
52//Absolute path
53$absolutePath = $documentRoot.($path != "/" ? $path : "");
54
55//Lang
56if (!isset($_REQUEST["lang"]) || $_REQUEST["lang"] == '')
57 $lang = LANGUAGE_ID;
58
59//BackUrl
60$back_url = ($_REQUEST["back_url"] ?? "");
61
62//Check permissions
63if(!$USER->CanDoFileOperation('fm_edit_existent_folder',Array($site, $path)))
64 $popupWindow->ShowError(GetMessage("FOLDER_EDIT_ACCESS_DENIED"));
65
67
68//Save folder settings
69if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid())
70{
71 $strWarning = GetMessage("MAIN_SESSION_EXPIRED");
72}
73elseif ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_REQUEST["save"]))
74{
75 $bNeedSectionFile = false;
76 $strSectionName = "";
77 if (isset($_POST["sSectionName"]) && $_POST["sSectionName"] <> '')
78 {
79 $strSectionName = "\$sSectionName = \"".EscapePHPString($_POST["sSectionName"])."\";\n";
80 $bNeedSectionFile = true;
81 }
82
83 $strDirProperties = "\$arDirProperties = Array(\n";
84
85 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"]))
86 {
87 $bNeedComma = false;
88 foreach ($_POST["PROPERTY"] as $arProperty)
89 {
90 $arProperty["CODE"] = (isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : "");
91 $arProperty["VALUE"] = (isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : "");
92
93 if ($arProperty["VALUE"] <> '' && preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"]) )
94 {
95 if($bNeedComma)
96 $strDirProperties .= ",\n";
97
98 $strDirProperties .= " \"".EscapePHPString($arProperty["CODE"])."\" => \"".EscapePHPString($arProperty["VALUE"])."\"";
99 $bNeedComma = true;
100 $bNeedSectionFile = true;
101 }
102 }
103 }
104
105 $strDirProperties .= "\n);\n";
106
107 $f = $io->GetFile($documentRoot.$path."/.section.php");
108 $arUndoParams = array(
109 'module' => 'fileman',
110 'undoType' => 'edit_section',
111 'undoHandler' => 'CFileman::UndoEditFile',
112 'arContent' => array(
113 'absPath' => $documentRoot.$path."/.section.php",
114 'content' => $f->GetContents()
115 )
116 );
117
118 //Save or delete data file
119 if($bNeedSectionFile)
120 {
121 $APPLICATION->SaveFileContent($absolutePath."/.section.php", "<"."?\n".$strSectionName.$strDirProperties."?".">");
122
123 if(COption::GetOptionString("fileman", "log_page", "Y")=="Y")
124 {
125 CEventLog::Log("content", "SECTION_EDIT", "fileman", $path);
126 }
127 }
128 else
129 $io->Delete($documentRoot.$path."/.section.php");
130
131 if ($e = $APPLICATION->GetException())
132 {
133 $strWarning = $e->msg;
134 }
135 else
136 {
137 CUndo::ShowUndoMessage(CUndo::Add($arUndoParams));
138
139 if (isset($_GET['subdialog']) && $_GET['subdialog'] == 'Y')
140 echo "<script>structReload('".urlencode($_REQUEST["path"])."');</script>";
141
142 $popupWindow->Close($bReload=($_GET['subdialog'] <> 'Y'), $back_url);
143 die();
144 }
145}
146
147//Properties from fileman settings
149if (CModule::IncludeModule("fileman") && is_callable(Array("CFileMan", "GetPropstypes")))
151
152//Properties from current .section.php
154
155if ($strWarning != "")
156{
157 //Restore post values if error occured
158 $sSectionName = (isset($_POST["sSectionName"]) && $_POST["sSectionName"] <> '' ? $_POST["sSectionName"] : "");
159
160 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"]))
161 {
162 foreach ($_POST["PROPERTY"] as $arProperty)
163 {
164 if (isset($arProperty["VALUE"]) && $arProperty["VALUE"] <> '')
165 $arDirProperties[$arProperty["CODE"]] = $arProperty["VALUE"];
166 }
167 }
168}
169else
170{
171 $sSectionName = "";
172 if($io->FileExists($absolutePath."/.section.php"))
173 include($io->GetPhysicalName($absolutePath."/.section.php"));
174}
175
176$arInheritProperties = $APPLICATION->GetDirPropertyList(Array($site, $path)); //All properties for folder. Includes properties from root folders
177if ($arInheritProperties === false)
178 $arInheritProperties = Array();
179
181foreach ($arFilemanProperties as $propertyCode => $propertyDesc)
182{
183 if (array_key_exists($propertyCode, $arDirProperties))
184 $arGlobalProperties[$propertyCode] = $arDirProperties[$propertyCode];
185 else
186 $arGlobalProperties[$propertyCode] = "";
187
188 unset($arDirProperties[$propertyCode]);
189 unset($arInheritProperties[mb_strtoupper($propertyCode)]);
190}
191
192foreach ($arDirProperties as $propertyCode => $propertyValue)
193 unset($arInheritProperties[mb_strtoupper($propertyCode)]);
194
195$popupWindow->ShowTitlebar(GetMessage('FOLDER_EDIT_WINDOW_TITLE'));
196$popupWindow->StartDescription("bx-property-folder");
197
198if($strWarning != "")
199 $popupWindow->ShowValidationError($strWarning);
200?>
201
202 <p><b><?=GetMessage("FOLDER_EDIT_WINDOW_TITLE");?> <?=htmlspecialcharsbx($path);?></b></p>
203
204 <?if (IsModuleInstalled("fileman")):?>
205 <p><a href="/bitrix/admin/fileman_folder.php?lang=<?=urlencode($lang)?>&site=<?=urlencode($site)?>&path=<?=urlencode($path)?>&back_url=<?=urlencode($back_url)?>"><?=GetMessage("FOLDER_EDIT_IN_ADMIN_SECTION")?></a></p>
206 <?endif?>
207
208<?
209$popupWindow->EndDescription();
210$popupWindow->StartContent();
211?>
212
213<table class="bx-width100" id="bx_folder_properties">
214
215 <tr class="section">
216 <td colspan="2">
217 <table cellspacing="0">
218 <tr>
219 <td><?=GetMessage("FOLDER_EDIT_FOLDER_NAME")?></td>
220 <td id="bx_folder_name">&nbsp;</td>
221 </tr>
222 </table>
223 </td>
224 </tr>
225
226 <tr>
227 <td class="bx-popup-label bx-width30"><?=GetMessage("FOLDER_EDIT_NAME")?>:</td>
228 <td><input type="text" style="width:90%;" name="sSectionName" value="<?=htmlspecialcharsEx($sSectionName)?>"></td>
229 </tr>
230
231 <tr class="empty">
232 <td colspan="2"><div class="empty"></div></td>
233 </tr>
234
235<?if (!empty($arGlobalProperties) || !empty($arDirProperties) || !empty($arInheritProperties)):?>
236
237 <tr class="section">
238 <td colspan="2">
239 <table cellspacing="0">
240 <tr>
241 <td><?=GetMessage("FOLDER_EDIT_WINDOW_TITLE");?></td>
242 <td id="bx_folder_prop_name">&nbsp;</td>
243 </tr>
244 </table>
245 </td>
246 </tr>
247
248<?endif?>
249
250
251<?
253$jsInheritPropIds = "var jsInheritProps = [";
254
255foreach ($arGlobalProperties as $propertyCode => $propertyValue):?>
256
257 <tr style="height:30px;">
258 <td class="bx-popup-label bx-width30"><?=(
259 $arFilemanProperties[$propertyCode] <> '' ?
261 htmlspecialcharsEx($propertyCode))
262 ?>:</td>
263 <td>
264
265 <?$inheritValue = $APPLICATION->GetDirProperty($propertyCode, Array($site, $path));?>
266
267 <?if ($inheritValue <> '' && $propertyValue == ''):
269 ?>
270
271 <input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
272
273 <div id="bx_view_property_<?=$propertyIndex?>" style="overflow:hidden;padding:2px 12px 2px 2px; border:1px solid white; width:90%; cursor:text; box-sizing:border-box; -moz-box-sizing:border-box;background-color:transparent; background-position:right; background-repeat:no-repeat;" onclick="BXEditProperty(<?=$propertyIndex?>)" onmouseover="this.style.borderColor = '#434B50 #ADC0CF #ADC0CF #434B50';" onmouseout="this.style.borderColor = 'white'" class="edit-field"><?=htmlspecialcharsEx($inheritValue)?></div>
274
275 <div id="bx_edit_property_<?=$propertyIndex?>" style="display:none;"></div>
276
277 <?else:?>
278
279 <input type="text" name="PROPERTY[<?=$propertyIndex?>][VALUE]" value="<?=htmlspecialcharsEx($propertyValue)?>" style="width:90%;"><input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
280
281 <?endif?>
282 </td>
283 </tr>
284
285<?
288?>
289
290<?
291 foreach ($arInheritProperties as $propertyCode => $propertyValue):
292 $jsInheritPropIds .= ",".$propertyIndex;
293?>
294
295 <tr style="height:30px;">
296 <td class="bx-popup-label bx-width30"><?=htmlspecialcharsEx($propertyCode)?>:</td>
297 <td>
298
299 <input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx($propertyCode)?>" />
300
301 <div id="bx_view_property_<?=$propertyIndex?>" style="overflow:hidden;padding:2px 12px 2px 2px; border:1px solid white; width:90%; cursor:text; box-sizing:border-box; -moz-box-sizing:border-box;background-color:transparent; background-position:right; background-repeat:no-repeat;" onclick="BXEditProperty(<?=$propertyIndex?>)" onmouseover="this.style.borderColor = '#434B50 #ADC0CF #ADC0CF #434B50'" onmouseout="this.style.borderColor = 'white'" class="edit-field"><?=htmlspecialcharsEx($propertyValue)?></div>
302
303 <div id="bx_edit_property_<?=$propertyIndex?>" style="display:none;"></div>
304
305 </td>
306 </tr>
307
308<?
311 $jsInheritPropIds .= "];";
312?>
313
314<?foreach ($arDirProperties as $propertyCode => $propertyValue):?>
315
316 <tr id="bx_user_property_<?=$propertyIndex?>">
317 <td class="bx-popup-label bx-width30"><?=htmlspecialcharsEx(mb_strtoupper($propertyCode))?><input type="hidden" name="PROPERTY[<?=$propertyIndex?>][CODE]" value="<?=htmlspecialcharsEx(mb_strtoupper($propertyCode))?>" />:</td>
318 <td><input type="text" name="PROPERTY[<?=$propertyIndex?>][VALUE]" value="<?=htmlspecialcharsEx($propertyValue)?>" style="width:90%;"></td>
319 </tr>
320
321<?
324?>
325</table>
326<input type="hidden" name="save" value="Y" />
327<?
328$popupWindow->EndContent();
329$popupWindow->ShowStandardButtons();
330?>
331
332<script>
333window.BXAddNewProperty = function(linkhref, propertyIndex)
334{
335 propertyIndex++;
336
337 linkhref.onclick = function () { return BXAddNewProperty(linkhref, propertyIndex)}
338
339 var propertyTable = document.getElementById("bx_folder_properties");
340 var tableRow = propertyTable.insertRow(document.getElementById("bx_user_property_end").rowIndex);
341 var codeTableCell = tableRow.insertCell(0);
342 var valueTableCell = tableRow.insertCell(1);
343
344 tableRow.id = "bx_user_property_" + propertyIndex;
345 codeTableCell.align = "right";
346 codeTableCell.innerHTML = '<input type="text" style="width:110px;" name="PROPERTY['+propertyIndex+'][CODE]" value="" />:'
347 valueTableCell.innerHTML = '<input type="text" name="PROPERTY['+propertyIndex+'][VALUE]" value="" style="width:90%;">' +
348 '&nbsp;<a href="" onclick="return BXDeleteProperty('+propertyIndex+');">x</a>';
349
350 return false;
351}
352
353window.BXDeleteProperty = function(propertyIndex)
354{
355 var propertyTable = document.getElementById("bx_folder_properties");
356 var propertyCaption = document.getElementById("bx_additional_properties");
357
358 if (!propertyTable || !propertyCaption)
359 return;
360
361 propertyTable.deleteRow(document.getElementById("bx_user_property_" + propertyIndex).rowIndex);
362
363 if (propertyCaption.rowIndex == propertyTable.rows.length - 1)
364 propertyTable.deleteRow(propertyCaption.rowIndex);
365
366 return false;
367}
368
369window.BXBlurProperty = function(element, propertyIndex)
370{
371 var viewProperty = document.getElementById("bx_view_property_" + propertyIndex);
372
373 if (element.value == "" || element.value == viewProperty.innerHTML)
374 {
375 var editProperty = document.getElementById("bx_edit_property_" + propertyIndex);
376
377 viewProperty.style.display = "block";
378 editProperty.style.display = "none";
379
380 while (editProperty.firstChild)
381 editProperty.removeChild(editProperty.firstChild);
382 }
383}
384
385window.BXEditProperty = function(propertyIndex)
386{
387 if (document.getElementById("bx_property_input_" + propertyIndex))
388 return;
389
390 var editProperty = document.getElementById("bx_edit_property_" + propertyIndex);
391 var viewProperty = document.getElementById("bx_view_property_" + propertyIndex);
392
393 viewProperty.style.display = "none";
394 editProperty.style.display = "block";
395
396 var input = document.createElement("INPUT");
397
398 input.type = "text";
399 input.name = "PROPERTY["+propertyIndex+"][VALUE]";
400 input.style.width = "90%";
401 input.style.padding = "2px";
402 input.id = "bx_property_input_" + propertyIndex;
403 input.onblur = function () {BXBlurProperty(input,propertyIndex)};
404 input.value = viewProperty.innerHTML;
405
406 editProperty.appendChild(input);
407 input.focus();
408 input.select();
409
410}
411
412window.BXFolderEditHint = function()
413{
414 var td = document.getElementById("bx_folder_name");
415 oBXHint = new BXHint("<?=GetMessage("FOLDER_NAME_TITLE")?>");
416 td.appendChild(oBXHint.oIcon);
417
418 var td = document.getElementById("bx_folder_prop_name");
419 if (td)
420 {
421 oBXHint = new BXHint("<?=GetMessage("FOLDER_PROP_TITLE")?>");
422 td.appendChild(oBXHint.oIcon);
423 }
424
426
427 for (var index = 0; index < jsInheritProps.length; index++)
428 oBXHint = new BXHint("<?=GetMessage("FOLDER_EDIT_PROP_TITLE")?>", document.getElementById("bx_view_property_"+ jsInheritProps[index]), {"width":200});
429}
430
431window.BXFolderEditHint();
432
433
434</script>
435
436<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");?>
$path
Определения access_edit.php:21
$popupWindow
Определения access_edit.php:10
$back_url
Определения access_edit.php:50
global $APPLICATION
Определения include.php:80
if($canUseYandexMarket) $strWarning
Определения options.php:74
static GetInstance()
Определения virtual_io.php:60
static Log($SEVERITY, $AUDIT_TYPE_ID, $MODULE_ID, $ITEM_ID, $DESCRIPTION=false, $SITE_ID=false)
Определения event_log.php:32
static GetPropstypes($site="")
Определения fileman.php:2077
Определения jspopup.php:10
static ShowUndoMessage($ID)
Определения undo.php:187
static Add($params=array())
Определения undo.php:9
$f
Определения component_props.php:52
& nbsp
Определения epilog_main_admin.php:38
window BXBlurProperty
Определения file_new.php:1067
endif $jsInheritPropIds
Определения file_new.php:811
</td ></tr ></table ></td ></tr ><?endif?><? $propertyIndex=0;foreach( $arGlobalProperties as $propertyCode=> $propertyValue
Определения file_new.php:729
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
BXEditProperty(<?=$propertyIndex?>)" onmouseover $propertyIndex
Определения file_new.php:769
if($_SERVER $arFilemanProperties["REQUEST_METHOD"]=="POST" &&isset($_REQUEST["save"]) && $strWarning=="")
Определения file_new.php:504
$arGlobalProperties
Определения file_new.php:542
$arInheritProperties
Определения file_new.php:526
$absolutePath
Определения folder_edit.php:53
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$arDirProperties
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$io
Определения csv_new_run.php:98
endif
Определения csv_new_setup.php:990
foreach(['Bitrix\\Main'=> '/lib', 'Psr\\Container'=> '/vendor/psr/container/src', 'Psr\\Log'=> '/vendor/psr/log/src', 'Psr\\Http\\Message'=> '/vendor/psr/http-message/src', 'Psr\\Http\\Client'=> '/vendor/psr/http-client/src', 'Http\\Promise'=> '/vendor/php-http/promise/src', 'PHPMailer\\PHPMailer'=> '/vendor/phpmailer/phpmailer/src', 'GeoIp2'=> '/vendor/geoip2/geoip2/src', 'MaxMind\\Db'=> '/vendor/maxmind-db/reader/src/MaxMind/Db', 'PhpParser'=> '/vendor/nikic/php-parser/lib/PhpParser', 'Recurr'=> '/vendor/simshaun/recurr/src/Recurr',] as $namespace=> $namespacePath) $documentRoot
Определения autoload.php:27
if(!defined('SITE_ID')) $lang
Определения include.php:91
EscapePHPString($str, $encloser='"')
Определения tools.php:4917
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
IsModuleInstalled($module_id)
Определения tools.php:5301
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
global_menu_<?echo $menu["menu_id"]?> adm main menu item icon adm main menu item text text adm main menu hover adm submenu menucontainer menu_id menu_id items_id items_id desktop menu_id block none adm global submenu<?=($subMenuDisplay=="block" ? " adm-global-submenu-active" :"")?> global_submenu_<?echo $menu["menu_id"]?> text MAIN_PR_ADMIN_FAV items adm submenu items wrap adm submenu items stretch wrap BX adminMenu itemsStretchScroll()"> <table class if (!empty( $menu["items"])) elseif ( $menu[ 'menu_id']=='desktop') if ( $menu[ 'menu_id']=='desktop') endforeach
Определения prolog_main_admin.php:255
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
die
Определения quickway.php:367
font style
Определения invoice.php:442
$sSectionName
Определения .section.php:2
const SITE_ID
Определения sonet_set_content_view.php:12
$site
Определения yandex_run.php:614