Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F429490
PhabricatorGlobalUploadTargetView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorGlobalUploadTargetView.php
View Options
<?php
/**
* IMPORTANT: If you use this, make sure to implement
*
* public function isGlobalDragAndDropUploadEnabled() {
* return true;
* }
*
* on the controller(s) that render this class...! This is necessary
* to make sure Quicksand works properly with the javascript in this
* UI.
*/
final
class
PhabricatorGlobalUploadTargetView
extends
AphrontView
{
private
$showIfSupportedID
;
public
function
setShowIfSupportedID
(
$show_if_supported_id
)
{
$this
->
showIfSupportedID
=
$show_if_supported_id
;
return
$this
;
}
public
function
getShowIfSupportedID
()
{
return
$this
->
showIfSupportedID
;
}
public
function
render
()
{
$viewer
=
$this
->
getUser
();
if
(!
$viewer
->
isLoggedIn
())
{
return
null
;
}
$instructions_id
=
'phabricator-global-drag-and-drop-upload-instructions'
;
require_celerity_resource
(
'global-drag-and-drop-css'
);
// Use the configured default view policy. Drag and drop uploads use
// a more restrictive view policy if we don't specify a policy explicitly,
// as the more restrictive policy is correct for most drop targets (like
// Pholio uploads and Remarkup text areas).
$view_policy
=
PhabricatorFile
::
initializeNewFile
()->
getViewPolicy
();
Javelin
::
initBehavior
(
'global-drag-and-drop'
,
array
(
'ifSupported'
=>
$this
->
showIfSupportedID
,
'instructions'
=>
$instructions_id
,
'uploadURI'
=>
'/file/dropupload/'
,
'browseURI'
=>
'/file/query/authored/'
,
'viewPolicy'
=>
$view_policy
,
'chunkThreshold'
=>
PhabricatorFileStorageEngine
::
getChunkThreshold
(),
));
return
phutil_tag
(
'div'
,
array
(
'id'
=>
$instructions_id
,
'class'
=>
'phabricator-global-upload-instructions'
,
'style'
=>
'display: none;'
,
),
"
\x
E2
\x
87
\x
AA "
.
pht
(
'Drop Files to Upload'
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 8:35 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
59377
Default Alt Text
PhabricatorGlobalUploadTargetView.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment