);
//add to new toolbar (need to use api)
- //$j('[rel=insert] .tool-file').addMediaWiz(
- // mwAddMediaConfig
- //);
+ /*$j('[rel=insert] tool-file').addMediaWiz(
+ mwAddMediaConfig
+ );*/
}
}
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title>Javascript Api Proxy</title>
+ <style type="text/css">
+ body{
+ font-size:80%;
+ }
+ img {
+ border:medium none;
+ }
+ </style>
+ <script type="text/javascript">
+ var domainList = [
+ '127.0.0.1'
+ ];
+ </script>
+</head>
+<body>
+<h3> This file proxies api and html output for source domains: </h3>
+<div id="domainList"></div>
+ <script type="text/javascript">
+ var o='';
+ for( var i in domainList){
+ o+='<br><i>'+ domainList[i] + '</i>';
+ }
+ </script>
+</body>
+</html>
+
"ignorewarning" : "Ignore warning and save file anyway",
"file-thumbnail-no" : "The filename begins with <b><tt>$1</tt></b>",
"go-to-resource" : "Go to Resource Page",
+ "upload-misc-error" : "Unknown upload error",
"wgfogg_waring_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types\">more information</a>).",
};
return cancelBtn;
},
- cancel_action:function(dlElm){
+ cancel_action : function( dlElm ){
//confirm:
if( confirm( gM('mv-cancel-confim') )){
//@@todo (cancel the encode / upload)
var default_firefogg_options = {
//what to do when finished uploading
- 'upload_done_action':'redirect',
+ 'done_upload_cb':false,
//if firefoog is enabled
'fogg_enabled':false,
//the api url to upload to
get_mw_token(
'File:'+ _this.formData['wpDestFile'],
_this.api_url,
- function( eToken ){
+ function( eToken ){
+ if(eToken==)
_this.etoken = eToken;
_this.doChunkWithFormData();
}
buttons[gM('go-to-resource')] = function(){
window.location = _this.fogg.resultUrl;
}
- var go_to_url_txt = gM('go-to-resource');
- //should have an json result:
- _this.updateProgressWin( gM('successfulupload'), gM( 'mv_upload_done', _this.fogg.resultUrl),buttons);
+ var go_to_url_txt = gM('go-to-resource');
+ if( typeof _this.done_upload_cb == 'function' ){
+ //if done action return 'true'
+ if( _this.done_upload_cb() ){
+ //update status
+ _this.updateProgressWin( gM('successfulupload'), gM( 'mv_upload_done', _this.fogg.resultUrl),buttons);
+ }else{
+ //if done action returns 'false' //close progress window
+ this.action_done = true;
+ $j('#upProgressDialog').dialog('close');
+ }
+ }
}else{
//done state with error? ..not really possible given how firefogg works
js_log(" upload done, in chunks mode, but no resultUrl!");
_this.updateProgressWin( gM('mv_upload_completed'), result_txt );
if( result_page && result_page.toLowerCase().indexOf( sstring.toLowerCase() ) != -1){
- js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.upload_done_action );
- if( _this.upload_done_action == 'redirect' ){
+ js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.done_upload_cb );
+ if( _this.done_upload_cb == 'redirect' ){
$j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + result_txt + '<br>' + form_txt);
window.location = wgArticlePath.replace( /\$1/, 'File:' + _this.formData['wpDestFile'] );
}else{
//check if the add_done_action is a callback:
- if( typeof _this.upload_done_action == 'function' )
- _this.upload_done_action();
+ if( typeof _this.done_upload_cb == 'function' )
+ _this.done_upload_cb();
}
}else{
//js_log( 'upload page error: did not find: ' +sstring + ' in ' + "\n" + result_page );
$j('#tab-upload').html( gM('rsd_config_error', 'bad_api_url') );
return false;
}
- //output the form
- mvJsLoader.doLoad(['$j.fn.simpleUploadForm'],function(){
- //set the form action based on domain:
- if( parseUri( document.URL ).host == parseUri( _this.upload_api_target ).host ){
+ //output the form
+ //set the form action based on domain:
+ if( parseUri( document.URL ).host == parseUri( _this.upload_api_target ).host ){
+ mvJsLoader.doLoad(['$j.fn.simpleUploadForm'],function(){
//deal with the api form upload form directly:
$j('#tab-upload').simpleUploadForm({
- "api_target" : _this.upload_api_target
+ "api_target" : _this.upload_api_target ,
+ "ondone_cb" : function( resultData ){
+ var cat = resultData;
+ debugger;
+ return false;
+ }
})
- }else{
- //setup the proxy
- }
- });
+ });
+ }else{
+ //setup the proxy
+ js_log('do proxy:: ' + parseUri( _this.upload_api_target ).host);
+ $j('#tab-upload').html('proxy upload not yet ready');
+ }
},
runSearch: function(){
js_log("f:runSearch::" + this.disp_item);
mvJsLoader.doLoad([
'mvBaseUploadInterface',
'$j.ui.progressbar'
- ],function(){
-
+ ],function(){
//initicate a download similar to url copy:
myUp = new mvBaseUploadInterface({
'api_url' : _this.local_wiki_api_url,
//close up the rsd_resource_import
$j('#rsd_resource_import').remove();
//run the parent callback:
- cir_callback();
+ cir_callback();
+ //return false to avoid BaseUploadInterface done actions
+ return false;
}
});
//set the edit token if we have it handy
"licence_cc-by-sa" : "Creative Commons Share Alike (3.0)",
"upload" : "Upload File",
"destfilename" : "Destination filename:",
- "summary" : "Summary"
+ "summary" : "Summary",
+ "error_not_loggedin" : "You don't appear to be logged in or don't have upload privlages."
});
var default_form_options = {
'enable_fogg' : true,
'licence_options':['cc-by-sa'],
- 'api_target' : false
+ 'api_target' : false,
+ 'ondone_cb' : null
};
(function($) {
if(!opt.api_target){
$(this.selector).html('Error: Missing api target');
return false;
- }
-
+ }
//@@todo this is just a proof of concept
//much todo to improved this web form
- var o = '<div style="margin: 0 auto;">'+
- '<form id="suf-upload" enctype="multipart/form-data" action="" method="post">' +
- '<label for="wpUploadFile">' + gM('select_file') + '</label><br>'+
- '<input type="file" style="display: inline;" name="wpUploadFile" id="wpUploadFile" size="10"/><br>' +
- '<label for="wpDestFile">' +gM('destfilename') + '</label><br>'+
- '<input type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+
- '<label for="wpUploadDescription">' + gM('summary') + ':</label><br>' +
- '<textarea cols="30" rows="3" id="wpUploadDescription" name="wpUploadDescription" tabindex="3"/><br>'+
- gM('select_ownwork') + '<br>' +
- '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM('licence_cc-by-sa') + '<br>' +
-
- '<input type="submit" accesskey="s" value="' + gM('upload') + '" name="wpUploadBtn" id="wpUploadBtn" tabindex="9"/>' +
- //close the form and div
- '</form></div>';
+ get_mw_token('File:MyRandomFileTokenCheck', opt.api_target, function(eToken){
+ debugger;
+ if( !eToken || eToken == '+\\' ){
+ $(this.selector).html( gM('error_not_loggedin') );
+ return false;
+ }
- //set the target with the form output:
- $(this.selector).html( o );
- //by default dissable:
- $j('#wpUploadBtn').attr('disabled', 'disabled');
-
- //set up basic binding:
- $j('#wpLicence').click(function(){
- if( $j(this).is(':checked') ){
- $j('#wpUploadBtn').removeAttr('disabled');
- }else{
- $j('#wpUploadBtn').attr('disabled', 'disabled');
- }
- });
+ var o = '<div style="margin: 0 auto;width:450px;">'+
+ '<form id="suf-upload" enctype="multipart/form-data" action="" method="post">' +
+ '<label for="wpUploadFile">' + gM('select_file') + '</label><br>'+
+ '<input type="file" style="display: inline;" name="wpUploadFile" id="wpUploadFile" size="10"/><br>' +
+ '<label for="wpDestFile">' +gM('destfilename') + '</label><br>'+
+ '<input type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+
+ '<label for="wpUploadDescription">' + gM('summary') + ':</label><br>' +
+ '<textarea cols="30" rows="3" id="wpUploadDescription" name="wpUploadDescription" tabindex="3"/><br>'+
+ gM('select_ownwork') + '<br>' +
+ '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM('licence_cc-by-sa') + '<br>' +
+
+ '<input type="submit" accesskey="s" value="' + gM('upload') + '" name="wpUploadBtn" id="wpUploadBtn" tabindex="9"/>' +
+ //close the form and div
+ '</form></div>';
+
+ //set the target with the form output:
+ $( this.selector ).html( o );
+ //by default dissable:
+ $j('#wpUploadBtn').attr('disabled', 'disabled');
- //set up the binding per the config
- if( opt.enable_fogg ){
- $j('#wpUploadFile').firefogg({
- //an api url (we won't submit directly to action of the form)
- 'api_url' : opt.api_target,
- 'form_rewrite': true,
- 'target_edit_from' : '#suf-upload',
- 'new_source_cb' : function( orgFilename, oggName ){
- $j('#wpDestFile').val( oggName );
- //@@TODO:
- //mwUploadHelper.doDestCheck();
- }
- });
- }else{
- //simple web form rewrite
- }
+ //set up basic binding:
+ $j('#wpLicence').click(function(){
+ if( $j(this).is(':checked') ){
+ $j('#wpUploadBtn').removeAttr('disabled');
+ }else{
+ $j('#wpUploadBtn').attr('disabled', 'disabled');
+ }
+ });
+
+ if(typeof opt.ondone_cb == 'undefined')
+ opt.ondone_cb = false;
+
+ //set up the binding per the config
+ if( opt.enable_fogg ){
+ $j('#wpUploadFile').firefogg({
+ //an api url (we won't submit directly to action of the form)
+ 'api_url' : opt.api_target,
+ 'form_rewrite': true,
+ 'target_edit_from' : '#suf-upload',
+ 'new_source_cb' : function( orgFilename, oggName ){
+ $j('#wpDestFile').val( oggName );
+ //@@TODO:
+ //mwUploadHelper.doDestCheck();
+ },
+ 'done_upload_cb' : opt.ondone_cb
+ });
+ }else{
+ //simple web form rewrite
+ }
+ });
}
})(jQuery);
\ No newline at end of file
* Dual licensed under the MIT and GPL licenses
*
*/
-
(function ($) {
var ColorPicker = function () {
var
* the mvPlayList object code
* only included if playlist object found
*
- * part of mv_embed:
- * http://metavid.org/wiki/index.php/Mv_embed
+ * part of mwEmbed media projects see:
+ * http://www.mediawiki.org/wiki/Media_Projects_Overview
+ *
+ * @author: Michael Dale mdale@wikimedia.org
+ * @license GPL2
*/
-var mv_default_playlist_attributes = {
+var mv_default_playlist_attributes = {
//playlist attributes :
"id":null,
"title":null,
//globals:
//10 possible colors for clips: (can be in hexadecimal)
var mv_clip_colors = new Array('aqua', 'blue', 'fuchsia', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red');
+
//the base url for requesting stream metadata
if(typeof wgServer=='undefined'){
var defaultMetaDataProvider = 'http://metavid.org/overlay/archive_browser/export_cmml?stream_name=';
'fill',
'dur',
'title',
-
+ //some custom attributes:
'uri',
+ 'durationHint',
'poster'
);
/* extension to mvClip to support smil properties */
}
//parse duration / begin times:
if( this.dur )
- this.dur = smilParseTime( this.dur );
+ this.dur = smilParseTime( this.dur );
+ //parse the media duration hint ( the source media length)
+ if( this.durationHint )
+ this.durationHint = smilParseTime( this.durationHint );
//conform type to vido/ogg:
if( this.type == 'application/ogg' )
if( this.dur )
return this.dur;
return this.embed.getDuration();
- },
+ },
//gets the duration of the clip subracting transitions
getSoloDuration:function(){
var fulldur = this.getDuration();
//js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
return fulldur;
+ },
+ //gets the duration of the original media asset (usefull for bounding setting of in-out-points)
+ getSourceDuration:function(){
+ if( this.durationHint )
+ return this.durationHint;
+ //if we have no source duration just return the media dur:
+ return this.getDuration();
}
}
/*
//depencency mapping for css files for self contained included plugins:
lcCssPath({
- '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
- '$j.fn.ColorPicker': 'libClipEdit/colorpicker/css/colorpicker.css'
+ '$j.ui' : 'jquery/' + jQueryUiVN + '.custom.css',
+ '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
+ '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css'
})
/**
//prepend json_ to feed_format if not already requesting json format
if( req_url.indexOf("feed_format=")!=-1 && req_url.indexOf("feed_format=json")==-1)
req_url = req_url.replace(/feed_format=/, 'feed_format=json_');
- loadExternalJs(req_url+'&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1));
+ loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length-1));
}
}
global_req_cb[response['cb_inx']]( response['pay_load'] );
}
//load external js via dom injection
-function loadExternalJs( url ){
+function loadExternalJs( url, callback ){
js_log('load js: '+ url);
//if(window['$j']) //use jquery call:
/*$j.ajax({
var e = document.createElement("script");
e.setAttribute('src', url);
e.setAttribute('type',"text/javascript");
+ /*if(callback)
+ e.onload = callback;
+ */
//e.setAttribute('defer', true);
- document.getElementsByTagName("head")[0].appendChild(e);
+ document.getElementsByTagName("head")[0].appendChild(e);
// }
}
-
function styleSheetPresent(url){
style_elements = document.getElementsByTagName('link');
if( style_elements.length > 0) {
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title></title>
+ <script type="text/javascript">
+ /*
+ XDCommsChild - Cross Domain Communication, Child Object.
+
+ Create this in the child window with the address of the xdomaincomms.html file on the same domain as the parent window
+ */
+ var XDCommsChild = function(xdomaincommsAddress) {
+ this.xdomaincommsAddress = xdomaincommsAddress;
+
+ this.isIe = isInternetExplorer();
+
+ if (isIe) {
+ // need hidden frame for communication. IE8 is supposed to support postMessage, but I can't get it to work properly
+ document.writeln("")
+ }
+
+ this.postBack = function(data) {
+ if (isIe) {
+ // this method tested against IE6,7 & 8
+ window.open(this.xdomaincommsAddress + '#data=' + data, 'xdcomms'); // MUST use window.open. frame.src or frame.location both fail
+ } else {
+ // for everything else - tested against Firefox 3, Chrome, Safari
+ window.opener.postMessage(data, '*'); // should really restrict the domain data can come from here
+ }
+ }
+
+ this.postBackAndCloseWindow = function(data){
+ this.postBack(data);
+ setTimeout("window.close()", 200); // need to use a timeout to make sure the javascript in the frame has executed if we are using that communication model
+ }
+ }
+ </script>
+</head>
+<body>
+<h3> This file should be inclued by external sites that want to be proxied: </h3>
+</body>
+</html>
+
'ignorewarning' => 'Ignore warning and save file anyway',
'file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>',
'go-to-resource' => 'Go to Resource Page',
+ 'upload-misc-error' => 'Unknown upload error',
'wgfogg_waring_bad_extension' => 'You have selected a file with an unsuported extension (<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">more information</a>).',
'cancel-button' => 'Cancel',
'ok-button' => 'OK',