Merge remote-tracking branch 'mike/master' into dev
This commit is contained in:
commit
657ec75c3d
@ -26,6 +26,8 @@ class Impel extends \Zotlabs\Web\Controller {
|
|||||||
if(! $j)
|
if(! $j)
|
||||||
json_return_and_die($ret);
|
json_return_and_die($ret);
|
||||||
|
|
||||||
|
// logger('element: ' . print_r($j,true));
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = \App::get_channel();
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
@ -162,12 +162,12 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
'created' => $rr['created'],
|
'created' => $rr['created'],
|
||||||
'edited' => $rr['edited'],
|
'edited' => $rr['edited'],
|
||||||
'mimetype' => $rr['mimetype'],
|
'mimetype' => $rr['mimetype'],
|
||||||
'pagetitle' => $rr['sid'],
|
'pagetitle' => urldecode($rr['v']),
|
||||||
'mid' => $rr['mid']
|
'mid' => $rr['mid']
|
||||||
);
|
);
|
||||||
$pages[$rr['iid']][] = array(
|
$pages[$rr['iid']][] = array(
|
||||||
'url' => $rr['iid'],
|
'url' => $rr['iid'],
|
||||||
'title' => $rr['v'],
|
'title' => urldecode($rr['v']),
|
||||||
'descr' => $rr['title'],
|
'descr' => $rr['title'],
|
||||||
'mid' => $rr['mid'],
|
'mid' => $rr['mid'],
|
||||||
'created' => $rr['created'],
|
'created' => $rr['created'],
|
||||||
|
@ -465,6 +465,51 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||||||
$_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
|
$_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$matches = [];
|
||||||
|
$partial = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
|
||||||
|
$pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
||||||
|
if($pm) {
|
||||||
|
logger('Content-Range: ' . print_r($matches,true));
|
||||||
|
$partial = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial) {
|
||||||
|
$x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
|
||||||
|
|
||||||
|
if($x['partial']) {
|
||||||
|
header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
|
||||||
|
json_return_and_die($result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header('Range: bytes=0-' . (($x['size']) ? $x['size'] - 1 : 0));
|
||||||
|
|
||||||
|
$_FILES['userfile'] = [
|
||||||
|
'name' => $x['name'],
|
||||||
|
'type' => $x['type'],
|
||||||
|
'tmp_name' => $x['tmp_name'],
|
||||||
|
'error' => $x['error'],
|
||||||
|
'size' => $x['size']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(! array_key_exists('userfile',$_FILES)) {
|
||||||
|
$_FILES['userfile'] = [
|
||||||
|
'name' => $_FILES['files']['name'],
|
||||||
|
'type' => $_FILES['files']['type'],
|
||||||
|
'tmp_name' => $_FILES['files']['tmp_name'],
|
||||||
|
'error' => $_FILES['files']['error'],
|
||||||
|
'size' => $_FILES['files']['size']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$r = attach_store($channel,get_observer_hash(), '', $_REQUEST);
|
$r = attach_store($channel,get_observer_hash(), '', $_REQUEST);
|
||||||
|
|
||||||
if(! $r['success']) {
|
if(! $r['success']) {
|
||||||
@ -557,7 +602,10 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
nav_set_selected('Photos');
|
nav_set_selected('Photos');
|
||||||
|
|
||||||
$o = "";
|
$o = '<script src="library/blueimp_upload/js/vendor/jquery.ui.widget.js"></script>
|
||||||
|
<script src="library/blueimp_upload/js/jquery.iframe-transport.js"></script>
|
||||||
|
<script src="library/blueimp_upload/js/jquery.fileupload.js"></script>';
|
||||||
|
|
||||||
|
|
||||||
$o .= "<script> var profile_uid = " . \App::$profile['profile_uid']
|
$o .= "<script> var profile_uid = " . \App::$profile['profile_uid']
|
||||||
. "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; </script>\r\n";
|
. "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; </script>\r\n";
|
||||||
@ -656,7 +704,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||||||
'$uploader' => $ret['addon_text'],
|
'$uploader' => $ret['addon_text'],
|
||||||
'$default' => (($ret['default_upload']) ? true : false),
|
'$default' => (($ret['default_upload']) ? true : false),
|
||||||
'$uploadurl' => $ret['post_url'],
|
'$uploadurl' => $ret['post_url'],
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Upload')
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -373,8 +373,6 @@ class Browser extends DAV\Browser\Plugin {
|
|||||||
if(strpos($path,$special) === 0)
|
if(strpos($path,$special) === 0)
|
||||||
$path = trim(substr($path,$count),'/');
|
$path = trim(substr($path,$count),'/');
|
||||||
|
|
||||||
$info = t('Please use DAV to upload large (video, audio) files.<br>See <a class="zrl" href="help/member/member_guide#Cloud_Desktop_Clients">Cloud Desktop Clients</a>');
|
|
||||||
|
|
||||||
|
|
||||||
$output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array(
|
$output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array(
|
||||||
'$folder_header' => t('Create new folder'),
|
'$folder_header' => t('Create new folder'),
|
||||||
@ -382,7 +380,6 @@ class Browser extends DAV\Browser\Plugin {
|
|||||||
'$upload_header' => t('Upload file'),
|
'$upload_header' => t('Upload file'),
|
||||||
'$upload_submit' => t('Upload'),
|
'$upload_submit' => t('Upload'),
|
||||||
'$quota' => $quota,
|
'$quota' => $quota,
|
||||||
'$info' => $info,
|
|
||||||
'$channick' => $this->auth->owner_nick,
|
'$channick' => $this->auth->owner_nick,
|
||||||
'$aclselect' => $aclselect,
|
'$aclselect' => $aclselect,
|
||||||
'$allow_cid' => acl2json($channel_acl['allow_cid']),
|
'$allow_cid' => acl2json($channel_acl['allow_cid']),
|
||||||
|
@ -246,8 +246,8 @@ function bb_parse_element($match) {
|
|||||||
$j = json_decode(base64url_decode($match[1]),true);
|
$j = json_decode(base64url_decode($match[1]),true);
|
||||||
|
|
||||||
if ($j && local_channel()) {
|
if ($j && local_channel()) {
|
||||||
$text = sprintf( t('Install %s element: '), translate_design_element($j['type'])) . $j['pagetitle'];
|
$text = sprintf( t('Install %1$s element %2$s'), translate_design_element($j['type']), $j['pagetitle']);
|
||||||
$o = EOL . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</a>' . EOL;
|
$o = EOL . '<button class="btn btn-primary" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</button>' . EOL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle'];
|
$text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle'];
|
||||||
|
@ -27,29 +27,93 @@ function showHideBodyTextarea() {
|
|||||||
// initialize
|
// initialize
|
||||||
function UploadInit() {
|
function UploadInit() {
|
||||||
|
|
||||||
|
var nickname = $('#invisible-photos-file-upload').data('nickname');
|
||||||
var fileselect = $("#photos-upload-choose");
|
var fileselect = $("#photos-upload-choose");
|
||||||
var filedrag = $("#photos-upload-form");
|
var filedrag = $("#photos-upload-form");
|
||||||
var submit = $("#dbtn-submit");
|
var submit = $("#dbtn-submit");
|
||||||
|
var count = 1;
|
||||||
|
|
||||||
// is XHR2 available?
|
$('#invisible-photos-file-upload').fileupload({
|
||||||
var xhr = new XMLHttpRequest();
|
url: 'photos/' + nickname,
|
||||||
if (xhr.upload) {
|
dataType: 'json',
|
||||||
|
dropZone: filedrag,
|
||||||
|
maxChunkSize: 4 * 1024 * 1024,
|
||||||
|
|
||||||
// file select
|
add: function(e,data) {
|
||||||
fileselect.attr("multiple", 'multiple');
|
$(data.files).each( function() { this.count = ++ count; prepareHtml(this); });
|
||||||
fileselect.on("change", UploadFileSelectHandler);
|
|
||||||
|
|
||||||
// file submit
|
var allow_cid = ($('#photos-upload-form').data('allow_cid') || []);
|
||||||
submit.on("click", fileselect, UploadFileSelectHandler);
|
var allow_gid = ($('#photos-upload-form').data('allow_gid') || []);
|
||||||
|
var deny_cid = ($('#photos-upload-form').data('deny_cid') || []);
|
||||||
|
var deny_gid = ($('#photos-upload-form').data('deny_gid') || []);
|
||||||
|
|
||||||
// file drop
|
$('.acl-field').remove();
|
||||||
filedrag.on("dragover", DragDropUploadFileHover);
|
|
||||||
filedrag.on("dragleave", DragDropUploadFileHover);
|
$(allow_gid).each(function(i,v) {
|
||||||
filedrag.on("drop", DragDropUploadFileSelectHandler);
|
$('#photos-upload-form').append("<input class='acl-field' type='hidden' name='group_allow[]' value='"+v+"'>");
|
||||||
|
});
|
||||||
|
$(allow_cid).each(function(i,v) {
|
||||||
|
$('#photos-upload-form').append("<input class='acl-field' type='hidden' name='contact_allow[]' value='"+v+"'>");
|
||||||
|
});
|
||||||
|
$(deny_gid).each(function(i,v) {
|
||||||
|
$('#photos-upload-form').append("<input class='acl-field' type='hidden' name='group_deny[]' value='"+v+"'>");
|
||||||
|
});
|
||||||
|
$(deny_cid).each(function(i,v) {
|
||||||
|
$('#photos-upload-form').append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>");
|
||||||
|
});
|
||||||
|
|
||||||
|
data.formData = $('#photos-upload-form').serializeArray();
|
||||||
|
|
||||||
|
data.submit();
|
||||||
|
},
|
||||||
|
|
||||||
|
progress: function(e,data) {
|
||||||
|
|
||||||
|
// there will only be one file, the one we are looking for
|
||||||
|
|
||||||
|
$(data.files).each( function() {
|
||||||
|
var idx = this.count;
|
||||||
|
|
||||||
|
// Dynamically update the percentage complete displayed in the file upload list
|
||||||
|
$('#upload-progress-' + idx).html(Math.round(data.loaded / data.total * 100) + '%');
|
||||||
|
$('#upload-progress-bar-' + idx).css('background-size', Math.round(data.loaded / data.total * 100) + '%');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
stop: function(e,data) {
|
||||||
|
window.location.href = window.location.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.filesToUpload = 0;
|
});
|
||||||
window.fileUploadsCompleted = 0;
|
|
||||||
|
$('#dbtn-submit').click(function(event) { event.preventDefault(); $('#invisible-photos-file-upload').trigger('click'); return false;});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// is XHR2 available?
|
||||||
|
// var xhr = new XMLHttpRequest();
|
||||||
|
// if (xhr.upload) {
|
||||||
|
|
||||||
|
// file select
|
||||||
|
// fileselect.attr("multiple", 'multiple');
|
||||||
|
// fileselect.on("change", UploadFileSelectHandler);
|
||||||
|
|
||||||
|
// file submit
|
||||||
|
// submit.on("click", fileselect, UploadFileSelectHandler);
|
||||||
|
|
||||||
|
// file drop
|
||||||
|
// filedrag.on("dragover", DragDropUploadFileHover);
|
||||||
|
// filedrag.on("dragleave", DragDropUploadFileHover);
|
||||||
|
// filedrag.on("drop", DragDropUploadFileSelectHandler);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// window.filesToUpload = 0;
|
||||||
|
// window.fileUploadsCompleted = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// file drag hover
|
// file drag hover
|
||||||
@ -98,8 +162,11 @@ function UploadFileSelectHandler(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareHtml(f, i) {
|
function prepareHtml(f) {
|
||||||
var num = i - 1;
|
|
||||||
|
var num = f.count - 1;
|
||||||
|
var i = f.count;
|
||||||
|
|
||||||
$('#upload-index #new-upload-progress-bar-' + num.toString()).after(
|
$('#upload-index #new-upload-progress-bar-' + num.toString()).after(
|
||||||
'<tr id="new-upload-' + i + '" class="new-upload">' +
|
'<tr id="new-upload-' + i + '" class="new-upload">' +
|
||||||
'<td width="1%"><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' +
|
'<td width="1%"><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' +
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="files-upload-tools" class="section-content-tools-wrapper">
|
<div id="files-upload-tools" class="section-content-tools-wrapper">
|
||||||
{{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{if $quota.desc}}{{$quota.desc}}<br><br>{{/if}}{{$info}}</div>{{/if}}
|
{{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{if $quota.desc}}{{$quota.desc}}<br><br>{{/if}}</div>{{/if}}
|
||||||
<form id="ajax-upload-files" method="post" action="#" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
<form id="ajax-upload-files" method="post" action="#" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
||||||
<input type="hidden" name="directory" value="{{$path}}" />
|
<input type="hidden" name="directory" value="{{$path}}" />
|
||||||
<input type="hidden" name="channick" value="{{$channick}}" />
|
<input type="hidden" name="channick" value="{{$channick}}" />
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<i class="fa fa-pencil btn btn-outline-secondary btn-sm" title="{{$album_edit.0}}" onclick="openClose('photo-album-edit-wrapper'); closeMenu('photo-upload-form');"></i>
|
<i class="fa fa-pencil btn btn-outline-secondary btn-sm" title="{{$album_edit.0}}" onclick="openClose('photo-album-edit-wrapper'); closeMenu('photo-upload-form');"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $can_post}}
|
{{if $can_post}}
|
||||||
<button class="btn btn-sm btn-success btn-sm" title="{{$usage}}" onclick="openClose('photo-upload-form'); closeMenu('photo-album-edit-wrapper');"><i class="fa fa-arrow-circle-o-up"></i> {{$upload.0}}</button>
|
<button class="btn btn-sm btn-success btn-sm" title="{{$usage}}" onclick="openClose('photo-upload-form'); {{if $album_edit.1}}closeMenu('photo-album-edit-wrapper');{{/if}}"><i class="fa fa-arrow-circle-o-up"></i> {{$upload.0}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<div id="photo-upload-form">
|
<div id="photo-upload-form">
|
||||||
|
<input id="invisible-photos-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple data-nickname='{{$nickname}}' >
|
||||||
<div class="section-content-tools-wrapper">
|
<div class="section-content-tools-wrapper">
|
||||||
<form action="photos/{{$nickname}}" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form" class="acl-form" data-form_id="photos-upload-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
<form action="#" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form" class="acl-form" data-form_id="photos-upload-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
||||||
<input type="hidden" id="photos-upload-source" name="source" value="photos" />
|
<input type="hidden" id="photos-upload-source" name="source" value="photos" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -15,9 +16,9 @@
|
|||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
{{if $default}}
|
{{if $default}}
|
||||||
<div class="form-group">
|
<!-- div class="form-group">
|
||||||
<input id="photos-upload-choose" type="file" name="userfile" />
|
<input id="photos-upload-choose" type="file" name="userfile" />
|
||||||
</div>
|
</div -->
|
||||||
{{include file="field_input.tpl" field=$caption}}
|
{{include file="field_input.tpl" field=$caption}}
|
||||||
{{include file="field_checkbox.tpl" field=$visible}}
|
{{include file="field_checkbox.tpl" field=$visible}}
|
||||||
<div id="body-textarea">
|
<div id="body-textarea">
|
||||||
@ -30,7 +31,7 @@
|
|||||||
<i id="jot-perms-icon" class="fa fa-{{$lockstate}}"></i>
|
<i id="jot-perms-icon" class="fa fa-{{$lockstate}}"></i>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<button id="dbtn-submit" class="btn btn-primary btn-sm" type="submit" name="submit" >{{$submit}}</button>
|
<button id="dbtn-submit" class="btn btn-primary btn-sm">{{$submit}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -57,7 +58,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<table id="upload-index">
|
<table id="upload-index">
|
||||||
<tr id="new-upload-progress-bar--1"></tr> {{* this is needed to append the upload files in the right order *}}
|
<tr id="new-upload-progress-bar-1"></tr> {{* this is needed to append the upload files in the right order *}}
|
||||||
</table>
|
</table>
|
||||||
{{$aclselect}}
|
{{$aclselect}}
|
||||||
<div id="photos-upload-end" class="clear"></div>
|
<div id="photos-upload-end" class="clear"></div>
|
||||||
|
Reference in New Issue
Block a user