Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
file.php
1
<?php
2
3
namespace
Bitrix\Sale\Cashbox\Inputs
;
4
5
use
Bitrix\Main\Localization
;
6
use
Bitrix\Sale\Internals\Input
;
7
8
Localization\Loc::loadMessages(__FILE__);
9
10
require_once __DIR__.
'/../../internals/input.php'
;
11
16
class
File
extends
Input\Base
17
{
23
public
static
function
getViewHtmlSingle
(array $input, $value)
24
{
25
$result =
'<span>'
;
26
if
($value)
27
{
28
$result .= Localization\Loc::getMessage(
'SALE_CASHBOX_INPUT_SECURITY_FILE_CONTROL_LOADED'
);
29
}
30
$result .=
'</span> '
;
31
32
return
$result;
33
}
34
41
public
static
function
getEditHtmlSingle
($name, array $input, $value)
42
{
43
$input[
'ONCHANGE'
] =
44
"var anchor = this.previousElementSibling.previousElementSibling;"
.
45
"if (anchor.firstChild) anchor.removeChild(anchor.firstChild);"
.
46
"anchor.appendChild(document.createTextNode(this.value.split(/(\\\\|\\/)/g).pop()));"
.
47
($input[
'ONCHANGE'
] ??
''
);
48
49
$fileAttributes = static::extractAttributes($input,
50
array(
'DISABLED'
=>
''
,
'AUTOFOCUS'
=>
''
,
'REQUIRED'
=>
''
),
51
array(
'FORM'
=>1,
'ACCEPT'
=>1));
52
53
$otherAttributes = static::extractAttributes($input, array(
'DISABLED'
=>
''
), array(
'FORM'
=>1),
false
);
54
55
return
static::getViewHtmlSingle($input, $value)
56
.
'<input type="hidden" name="'
.$name.
'" value="'
.htmlspecialcharsbx($value).
'"'
.$otherAttributes.
'>'
57
.
'<input type="file" name="'
.$name.
'" style="position:absolute; visibility:hidden"'
.$fileAttributes.
'>'
58
.
'<input type="button" value="'
.Localization\Loc::getMessage(
'SALE_CASHBOX_INPUT_SECURITY_FILE_CONTROL_BROWSE'
).
'" onclick="this.previousSibling.click()">'
59
.(
60
$input[
'NO_DELETE'
]
61
?
''
62
:
'<label>'
.Localization\Loc::getMessage(
'SALE_CASHBOX_INPUT_SECURITY_FILE_CONTROL_DELETE'
).
' <input type="checkbox" name="'
.$name.
'[DELETE]" onclick="'
63
.
"var button = this.parentNode.previousSibling, file = button.previousSibling;"
64
.
"button.disabled = file.disabled = this.checked;"
65
.
'"'
.$otherAttributes.
'></label>'
66
);
67
}
68
74
public
static
function
getErrorSingle
(array $input, $value)
75
{
76
$errors = [];
77
return
$errors;
78
}
79
}
80
85
Input\Manager::register(
'SECURITY_FILE_CONTROL'
, array(
86
'CLASS'
=> __NAMESPACE__.
'\\File'
,
87
'NAME'
=> Localization\
Loc::getMessage
(
'SALE_CASHBOX_INPUT_SECURITY_FILE_CONTROL'
)
88
));
89
90
Input\Manager::register(
'DATABASE_FILE'
, array(
91
'CLASS'
=> __NAMESPACE__.
'\\File'
,
92
'NAME'
=> Localization\
Loc::getMessage
(
'SALE_CASHBOX_INPUT_SECURITY_FILE_CONTROL'
)
93
));
Bitrix\Main\IO\File
Definition
file.php:7
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\Cashbox\Inputs\File\getViewHtmlSingle
static getViewHtmlSingle(array $input, $value)
Definition
file.php:23
Bitrix\Sale\Cashbox\Inputs\File\getEditHtmlSingle
static getEditHtmlSingle($name, array $input, $value)
Definition
file.php:41
Bitrix\Sale\Cashbox\Inputs\File\getErrorSingle
static getErrorSingle(array $input, $value)
Definition
file.php:74
Bitrix\Main\Localization
Definition
culture.php:8
Bitrix\Sale\Cashbox\Inputs
Definition
file.php:3
Bitrix\Sale\Internals\Input
Definition
input.php:3
modules
sale
lib
cashbox
inputs
file.php
Создано системой
1.10.0