Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122334269
AphrontFormDragAndDropUploadControl.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 17, 06:30
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jul 19, 06:30 (2 d)
Engine
blob
Format
Raw Data
Handle
27467652
Attached To
rPH Phabricator
AphrontFormDragAndDropUploadControl.php
View Options
<?php
final
class
AphrontFormDragAndDropUploadControl
extends
AphrontFormControl
{
private
$activatedClass
;
public
function
__construct
()
{
$this
->
setControlID
(
celerity_generate_unique_node_id
());
$this
->
setControlStyle
(
'display: none;'
);
}
protected
function
getCustomControlClass
()
{
return
'aphront-form-drag-and-drop-upload'
;
}
public
function
setActivatedClass
(
$class
)
{
$this
->
activatedClass
=
$class
;
return
$this
;
}
protected
function
renderInput
()
{
require_celerity_resource
(
'aphront-attached-file-view-css'
);
$list_id
=
celerity_generate_unique_node_id
();
$files
=
$this
->
getValue
();
$value
=
array
();
if
(
$files
)
{
foreach
(
$files
as
$file
)
{
$view
=
new
AphrontAttachedFileView
();
$view
->
setFile
(
$file
);
$value
[
$file
->
getPHID
()]
=
array
(
'phid'
=>
$file
->
getPHID
(),
'html'
=>
$view
->
render
(),
);
}
}
Javelin
::
initBehavior
(
'aphront-drag-and-drop'
,
array
(
'control'
=>
$this
->
getControlID
(),
'name'
=>
$this
->
getName
(),
'value'
=>
nonempty
(
$value
,
null
),
'list'
=>
$list_id
,
'uri'
=>
'/file/dropupload/'
,
'activatedClass'
=>
$this
->
activatedClass
,
));
return
phutil_tag
(
'div'
,
array
(
'id'
=>
$list_id
,
'class'
=>
'aphront-form-drag-and-drop-file-list'
,
),
''
);
}
}
Event Timeline
Log In to Comment