225 lines
No EOL
6.4 KiB
HTML
225 lines
No EOL
6.4 KiB
HTML
{if $smarty.const.THIS_PAGE == 'upload'}
|
|
|
|
<link href="{$js}/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
|
|
<script type="text/javascript" src="{$js}/uploadify/swfobject.js"></script>
|
|
<script type="text/javascript" src="{$js}/uploadify/jquery.uploadify.v2.1.4.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
var jsURL = '{$js}';
|
|
var uploadError = false;
|
|
var file_name = '{$file_name}';
|
|
var lang = new Array();
|
|
lang['saveData'] = '{lang code='save_data'}';
|
|
lang['savingData'] = '{lang code='saving'}';
|
|
lang['remoteUploadFile'] = '{lang code="remote_upload_file"}';
|
|
lang['upload_video_button'] = '{lang code="upload_video_button"}';
|
|
var fileExt = '{$Cbucket->list_extensions()|replace:",":";"}';
|
|
|
|
var uploadSwfPath = '{$uploaderDetails.uploadSwfPath}';
|
|
var uploadScriptPath = '{$uploaderDetails.uploadScriptPath}';
|
|
|
|
{literal}
|
|
|
|
function show_error(msg,ID,fade)
|
|
{ $('#file_uploads'+ID+' .percentage')
|
|
.after('<div class=\"uploadErrorDiv\"><div class=\"uploadErrorMsg\">'+msg+'<\/div><\/div>');
|
|
if(fade){$('.uploadSuccessDiv').delay(3000).fadeOut('slow');}
|
|
}
|
|
|
|
function show_message(msg,ID,fade)
|
|
{ $('#uploadForm'+ID)
|
|
.prepend('<div class=\"uploadSuccessDiv\"><div class=\"uploadSuccessMsg\">'+msg+'<\/div><\/div>');
|
|
if(fade){$('.uploadSuccessDiv').delay(3000).fadeOut('slow');}
|
|
}
|
|
|
|
|
|
function doUpdateVideo(formId,ID)
|
|
{
|
|
var formObjectData = $(formId).serialize();
|
|
//alert(serializedData);
|
|
|
|
$('#updateVideoDataLoading').html('<img src="'+imageurl+'/ajax-loader.gif" />');
|
|
$('#cbSubmitUpload'+ID)
|
|
.attr('disabled','disabled')
|
|
.attr("value",lang.savingData)
|
|
.attr("onClick","return false;");
|
|
|
|
$.post(
|
|
baseurl+'/actions/file_uploader.php',formObjectData,function(data)
|
|
{
|
|
show_message(data,ID,true);
|
|
$('#updateVideoDataLoading').empty();
|
|
$('#cbSubmitUpload'+ID)
|
|
.attr("disabled","")
|
|
.attr("value",lang.saveData)
|
|
.attr("onClick","doUpdateVideo('#uploadForm"+ID+"','"+ID+"')")
|
|
},"text"
|
|
)
|
|
}
|
|
|
|
$(document).ready(function()
|
|
{
|
|
|
|
|
|
var instanceNumber = 0;
|
|
function showUploadify(object)
|
|
{
|
|
$(object).uploadify({
|
|
'uploader' : uploadSwfPath,
|
|
'script' : uploadScriptPath,
|
|
'cancelImg' : imageurl+'/cancel_upload.png',
|
|
'auto' : true,
|
|
'removeCompleted' : false,
|
|
'displayData' : 'both',
|
|
'fileExt' : fileExt,
|
|
'multi' : true,
|
|
'fileDesc' : 'Video Files',
|
|
'buttonText' : lang.upload_video_button,
|
|
'queueID' : 'fileUploadQueue',
|
|
'queueLimit' : 2,
|
|
'onOpen' : function(event,ID,fileObj) {
|
|
|
|
uploadError = false;
|
|
filename = new Date().getTime() + Math.round((99977 - 10016) * Math.random() + 1) ;
|
|
$.ajax({
|
|
url: baseurl+'/actions/file_uploader.php',
|
|
type: "POST",
|
|
data:({"getForm":"get_form","title":fileObj.name,"objId":ID}),
|
|
dataType: "text",
|
|
success: function(data)
|
|
{
|
|
if(!uploadError)
|
|
{
|
|
$('#file_uploads'+ID).append(data);
|
|
}
|
|
}
|
|
});
|
|
|
|
return true;
|
|
},
|
|
'onComplete' : function(event, ID, fileObj, response, data)
|
|
{
|
|
var resObj = eval('(' + response + ')');
|
|
var vid = "";
|
|
if(resObj.success=='yes')
|
|
{
|
|
var file_name = resObj.file_name;
|
|
$.ajax({
|
|
url: baseurl+'/actions/file_uploader.php',
|
|
type: "POST",
|
|
data:({"insertVideo":"yes","title":fileObj.name,"file_name":file_name}),
|
|
dataType: "text",
|
|
success: function(data)
|
|
{
|
|
vid = data;
|
|
$("#uploadForm"+ID+" #title").after('<input type="hidden" name="videoid" value="'+vid+'" id="videoid" />')
|
|
.after('<input type="hidden" name="updateVideo" value="yes" id="updateVideo" />');
|
|
$('#cbSubmitUpload'+ID)
|
|
.before('<span id="updateVideoDataLoading" style="margin-right:5px"></span>')
|
|
.attr("disabled","")
|
|
.attr("value",lang.saveData)
|
|
.attr("onClick","doUpdateVideo('#uploadForm"+ID+"','"+ID+"')");
|
|
|
|
doUpdateVideo('#uploadForm'+ID,ID);
|
|
}
|
|
});
|
|
}else
|
|
{
|
|
$("#upload_form"+ID).empty().remove();
|
|
show_error(resObj.error,ID,false);
|
|
uploadError = true;
|
|
return false;
|
|
}
|
|
},
|
|
});
|
|
}
|
|
|
|
|
|
showUploadify('#file_uploads');
|
|
});
|
|
|
|
{/literal}
|
|
</script>
|
|
|
|
|
|
{else}
|
|
<script type="text/javascript">
|
|
{literal}
|
|
window.onload = function() {
|
|
load_quicklist_box();
|
|
ini_cookies();
|
|
}
|
|
{/literal}
|
|
</script>
|
|
{/if}
|
|
|
|
|
|
|
|
{if $smarty.const.THIS_PAGE == 'photo_upload'}
|
|
<script src="{$js}/swfupload/swfupload.js" type="text/javascript"></script>
|
|
<script src="{$js}/swfupload/plugins/all_in_one.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
var swfu;
|
|
window.onload = function ()
|
|
{ldelim}
|
|
var settings =
|
|
{ldelim}
|
|
flash_url : "{$js}/swfupload/swfupload.swf",
|
|
file_post_name: 'photoUpload',
|
|
upload_url: "{$baseurl}/actions/photo_uploader.php",
|
|
button_image_url: "{$imageurl}/cb_button.png",
|
|
file_size_limit : "{$Cbucket->configs.max_photo_size} MB",
|
|
file_types : "{$cbphoto->extensions()}",
|
|
file_types_description : "Image Files",
|
|
file_upload_limit : {$Cbucket->configs.photo_multi_upload},
|
|
post_params :
|
|
{ldelim}
|
|
{if $smarty.get.collection}
|
|
{assign var=collectionID value=$cbphoto->decode_key($smarty.get.collection)}
|
|
{if $cbphoto->is_addable($collectionID)}
|
|
collection : {$collectionID},
|
|
{/if}
|
|
{/if}
|
|
userid : {$userquery->userid}
|
|
{rdelim},
|
|
file_queue_limit : 0,
|
|
custom_settings : {ldelim}
|
|
progressTarget : "fsUploadProgress",
|
|
cancelButtonId : "btnCancel"
|
|
{rdelim},
|
|
debug: false,
|
|
|
|
// Button settings
|
|
|
|
button_placeholder_id: "spanButtonPlaceHolder",
|
|
button_width: 77,
|
|
button_height: 22,
|
|
button_text_left_padding: 18,
|
|
button_text_top_padding: 2,
|
|
|
|
button_text: '<span class="cb_button_font">Upload</span>',
|
|
|
|
// The event handler functions are defined in handlers.js
|
|
file_queued_handler : fileQueued,
|
|
file_queue_error_handler : fileQueueError,
|
|
file_dialog_complete_handler : fileDialogComplete,
|
|
upload_start_handler : uploadStart,
|
|
upload_progress_handler : uploadProgress,
|
|
upload_error_handler : uploadError,
|
|
upload_success_handler : PictureUploadSuccess,
|
|
upload_complete_handler : uploadComplete,
|
|
queue_complete_handler : queueComplete // Queue plugin event
|
|
|
|
{rdelim}
|
|
swfu = new SWFUpload(settings);
|
|
{rdelim}
|
|
</script>
|
|
{/if}
|
|
|
|
{if $smarty.const.THIS_PAGE == 'view_item'}
|
|
<script type="text/javascript">
|
|
var Seo = '{$Cbucket->configs.seo}';
|
|
onReload_item();
|
|
</script>
|
|
{/if} |