Merged development branch
* updated Plupload to 1.4.3.2 * Plupload tuned * upload controls set according to settings * added setting for max number of uploaded files at once * incremented version info git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@22 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
parent
069f1e91e2
commit
02c8da4011
70
README.txt
70
README.txt
@ -4,15 +4,21 @@ Redmine Document Management System "Features" plugin is distributed under GNU GP
|
||||
|
||||
License itself is here: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC1
|
||||
|
||||
2 Installation and Setup
|
||||
2 Installation
|
||||
|
||||
2.1. Required packages
|
||||
2.1. Prerequisities
|
||||
|
||||
For zipped content download you must have rubyzip gem installed.
|
||||
* Redmine 1.1.x
|
||||
* Ruby Zip library - rubyzip gem
|
||||
|
||||
To use file/document search capabilities you must install xapian (http://xapian.org) search engine.
|
||||
That means libxapian-ruby1.8 and xapian-omega packages. To index some files with omega you may have to install some other
|
||||
packages like xpdf, antiword, ...
|
||||
2.1.1 Fulltext search (optional)
|
||||
|
||||
If you want to use fulltext search abilities:
|
||||
* Xapian (http://xapian.org) search engine
|
||||
* Xapian Omega indexing tool
|
||||
* Xapian ruby bindings - xapian or xapian-full gem
|
||||
|
||||
To index some files with omega you may have to install some other packages like xpdf, antiword, ...
|
||||
|
||||
From Omega documentation:
|
||||
|
||||
@ -36,34 +42,45 @@ From Omega documentation:
|
||||
|
||||
On Debinan (Squeeze) use:
|
||||
apt-get install xapian-ruby1.8 xapian-omega libxapian-dev xpdf antiword unzip antiword\
|
||||
catdoc libwpd8c2a libwps-0.1-1 gzip unrtf catdvi djview djview3 libzip-ruby1.8
|
||||
catdoc libwpd8c2a libwps-0.1-1 gzip unrtf catdvi djview djview3
|
||||
|
||||
In case of package shortage it is possible to use:
|
||||
gem install xapian-full rubyzip
|
||||
2.2. Setup
|
||||
|
||||
2.2. Plugin installation
|
||||
|
||||
Install redmine_dmsf into vendor/plugins directory with:
|
||||
* Put redmine_dmsf plugin content into vendor/plugins
|
||||
* Put redmine_dmsf plugin directory into vendor/plugins
|
||||
* Initialize database:
|
||||
rake db:migrate:plugins RAILS_ENV="production"
|
||||
* The access rights must be set for web server
|
||||
Example:
|
||||
rake db:migrate:plugins RAILS_ENV="production"
|
||||
* The access rights must be set for web server, example:
|
||||
chown -R www-data:www-data /opt/redmine/vendor/plugins/redmine_dmsf
|
||||
* Restart web server
|
||||
* You should configure plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure
|
||||
* Assign DMSF permissions to appropriate roles
|
||||
|
||||
2.3. Setup
|
||||
2.2.1 Fulltext search (optional)
|
||||
|
||||
Then you must configure plugin in Administration -> Plugins -> DMSF -> Configure
|
||||
If you want to use fulltext search features, you must setup file content indexing.
|
||||
|
||||
It is also neccessary to assign DMSF permissions to appropriate roles.
|
||||
It is necessary to index DMSF files with omega before searching attemts to recieve some output:
|
||||
omindex -s english -l 1 --db {path to index database from configuration} {path to storage from configuration}
|
||||
|
||||
This command must be run on regular basis (e.g. from cron)
|
||||
|
||||
Example of cron job (once per hour at 8th minute):
|
||||
* 8 * * * root /usr/bin/omindex -s english -l 1 --db /opt/redmine/files/dmsf_index /opt/redmine/files/dmsf
|
||||
|
||||
Use omindex -h for help.
|
||||
|
||||
2.3 Usage
|
||||
|
||||
DMSF act as project module so you must check DMSF in project settings.
|
||||
|
||||
Search options will now contain "Dmsf files" check, that allows you to search DMSF content.
|
||||
|
||||
To include Wiki DMSF link help:
|
||||
* In file public/help/wiki_syntax_detailed.html include after document link description:
|
||||
There is possibility to link DMSF files from Wiki entries:
|
||||
{{dmsf(17)}} link to file with id 17
|
||||
DMSF file id can be found in link for file download.
|
||||
|
||||
You can also publish Wiki help description.
|
||||
In file <redmine_root>/public/help/wiki_syntax_detailed.html include after document link description:
|
||||
<ul>
|
||||
<li>
|
||||
DMSF:
|
||||
@ -73,14 +90,3 @@ To include Wiki DMSF link help:
|
||||
DMSF file id can be found in link for file download
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
It is necessary to index DMSF files with omega before searching attemts to recieve some output:
|
||||
|
||||
omindex -s english -l 1 --db {path to index database from plugin configuration} {path to storage from plugin configuration}
|
||||
|
||||
This command must be run on regular basis (e.g. from cron)
|
||||
|
||||
Example of cron job (once per hour at 8th minute):
|
||||
* 8 * * * root /usr/bin/omindex -s english -l 1 --db /opt/redmine/files/dmsf_index /opt/redmine/files/dmsf
|
||||
|
||||
Use omindex -h for help.
|
||||
|
||||
@ -163,12 +163,17 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
<h3>File Upload</h3>
|
||||
<% form_tag({:controller => "dmsf_detail", :action => "upload_files", :id => @project, :folder_id => @folder},
|
||||
:id => "uploadform", :method=>:post, :multipart => true) do %>
|
||||
<div style="padding-bottom: 6px; line-height: 1.4em; font-size: 0.9em;">
|
||||
<div class="upload_select">
|
||||
File size: <select id="uploader_select"><option value="1">< 100 MB</option><option value="2">> 100 MB</option></select>
|
||||
</div>
|
||||
<span>There can be uploaded maximum of 20 files at once. To upload files greater than 2GB you must have 64b browser.</span>
|
||||
<br style="clear: both" />
|
||||
<div style="padding-bottom: 6px; line-height: 1.4em; font-size: 0.9em;">
|
||||
<% if Setting.attachment_max_size.to_i >= 102400 %>
|
||||
<div class="upload_select">
|
||||
File size: <select id="uploader_select"><option value="1">< 100 MB</option><option value="2">> 100 MB</option></select>
|
||||
</div>
|
||||
<br style="clear: both" />
|
||||
<% end %>
|
||||
<span>
|
||||
<% if Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i > 0 %>There can be uploaded maximum of <%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i %> files at once.<% end %>
|
||||
<% if Setting.attachment_max_size.to_i >= 2097151 %>To upload files greater than 2GB you must have 64b browser.<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div id="uploader">
|
||||
<p>
|
||||
@ -188,14 +193,18 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
<%= render(:partial => 'user_pref') %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
<%= stylesheet_link_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/base/jquery-ui.css" %>
|
||||
<%= stylesheet_link_tag "plupload/jquery.ui.plupload.css", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" %>
|
||||
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js" %>
|
||||
<%= javascript_include_tag "plupload/gears_init.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.full.min.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/jquery.ui.plupload.js", :plugin => "redmine_dmsf" %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
|
||||
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" %>
|
||||
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" %>
|
||||
<%= javascript_include_tag "plupload/plupload.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.flash.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.gears.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.html5.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.html4.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/jquery.ui.plupload/jquery.ui.plupload.js", :plugin => "redmine_dmsf" %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
|
||||
@ -250,7 +259,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
runtimes : 'gears,html5,flash,html4',
|
||||
url : '<%= url_for({:controller => "dmsf_detail", :action => "upload_file", :id => @project, :folder_id => @folder}) %>',
|
||||
max_file_size : '100mb',
|
||||
max_file_count: 20, // user can add no more then 20 files at a time
|
||||
max_file_count: <%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i %>,
|
||||
multipart: true,
|
||||
multipart_params : {authenticity_token : jQuery("input[name=authenticity_token]").val()},
|
||||
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
<p>
|
||||
<%=content_tag(:label, "Maximum files upload:") %>
|
||||
<%=text_field_tag "settings[dmsf_max_file_upload]", @settings["dmsf_max_file_upload"], :size=>10 %><br/>
|
||||
(<%=l(:label_default)%>: 0)
|
||||
<br/>
|
||||
Limits maximum number of files uploaded at once. "0" means unlimited.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, "Maximum files download:") %>
|
||||
<%=text_field_tag "settings[dmsf_max_file_download]", @settings["dmsf_max_file_download"], :size=>10 %><br/>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
@ -1,86 +0,0 @@
|
||||
// Copyright 2007, Google Inc.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// 3. Neither the name of Google Inc. nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Sets up google.gears.*, which is *the only* supported way to access Gears.
|
||||
//
|
||||
// Circumvent this file at your own risk!
|
||||
//
|
||||
// In the future, Gears may automatically define google.gears.* without this
|
||||
// file. Gears may use these objects to transparently fix bugs and compatibility
|
||||
// issues. Applications that use the code below will continue to work seamlessly
|
||||
// when that happens.
|
||||
|
||||
(function() {
|
||||
// We are already defined. Hooray!
|
||||
if (window.google && google.gears) {
|
||||
return;
|
||||
}
|
||||
|
||||
var factory = null;
|
||||
|
||||
// Firefox
|
||||
if (typeof GearsFactory != 'undefined') {
|
||||
factory = new GearsFactory();
|
||||
} else {
|
||||
// IE
|
||||
try {
|
||||
factory = new ActiveXObject('Gears.Factory');
|
||||
// privateSetGlobalObject is only required and supported on WinCE.
|
||||
if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {
|
||||
factory.privateSetGlobalObject(this);
|
||||
}
|
||||
} catch (e) {
|
||||
// Safari
|
||||
if ((typeof navigator.mimeTypes != 'undefined')
|
||||
&& navigator.mimeTypes["application/x-googlegears"]) {
|
||||
factory = document.createElement("object");
|
||||
factory.style.display = "none";
|
||||
factory.width = 0;
|
||||
factory.height = 0;
|
||||
factory.type = "application/x-googlegears";
|
||||
document.documentElement.appendChild(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *Do not* define any objects if Gears is not installed. This mimics the
|
||||
// behavior of Gears defining the objects in the future.
|
||||
if (!factory) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now set up the objects, being careful not to overwrite anything.
|
||||
//
|
||||
// Note: In Internet Explorer for Windows Mobile, you can't add properties to
|
||||
// the window object. However, global objects are automatically added as
|
||||
// properties of the window object in all browsers.
|
||||
if (!window.google) {
|
||||
google = {};
|
||||
}
|
||||
|
||||
if (!google.gears) {
|
||||
google.gears = {factory: factory};
|
||||
}
|
||||
})();
|
||||
@ -1,12 +1,25 @@
|
||||
// .po file like language pack
|
||||
plupload.addI18n({
|
||||
'Select files' : 'Sélectionner les fichiers',
|
||||
'Add files to the upload queue and click the start button.' : 'Ajouter des fichiers à la file et appuyer sur le bouton démarrer.',
|
||||
'Select files' : 'Sélectionnez les fichiers',
|
||||
'Add files to the upload queue and click the start button.' : 'Ajoutez des fichiers à la file et appuyez sur le bouton démarrer.',
|
||||
'Filename' : 'Nom de fichier',
|
||||
'Status' : 'Status',
|
||||
'Size' : 'Taille',
|
||||
'Add Files' : 'Ajouter fichiers',
|
||||
'Stop current upload' : 'Arrêter téléversement',
|
||||
'Start Upload' : 'Démarrer téléversement',
|
||||
'Drag files here.' : 'Déposer les fichiers ici.'
|
||||
'Add files' : 'Ajouter Fichiers',
|
||||
'Stop current upload' : 'Arrêter l\'envoi en cours',
|
||||
'Start uploading queue' : 'Démarrer l\'envoi',
|
||||
'Uploaded %d/%d files': '%d/%d fichiers envoyés',
|
||||
'N/A' : 'Non applicable',
|
||||
'Drag files here.' : 'Déposer les fichiers ici.',
|
||||
'File extension error.': 'Erreur extension fichier',
|
||||
'File size error.': 'Erreur taille fichier.',
|
||||
'Init error.': 'Erreur d\'initialisation.',
|
||||
'HTTP Error.': 'Erreur HTTP.',
|
||||
'Security error.': 'Erreur de sécurité.',
|
||||
'Generic error.': 'Erreur générique.',
|
||||
'IO error.': 'Erreur E/S.',
|
||||
'Stop Upload': 'Arrêter les envois.',
|
||||
'Add Files': 'Ajouter des fichiers',
|
||||
'Start Upload': 'Démarrer les envois.',
|
||||
'%d files queued': '%d fichiers en attente.'
|
||||
});
|
||||
33
assets/javascripts/plupload/i18n/lv.js
Normal file
33
assets/javascripts/plupload/i18n/lv.js
Normal file
@ -0,0 +1,33 @@
|
||||
// .lv file like language pack
|
||||
plupload.addI18n({
|
||||
'Select files' : 'Izvēlieties failus',
|
||||
'Add files to the upload queue and click the start button.' : 'Pieveinojiet failus rindai un klikšķiniet uz "Sākt augšupielādi" pogas.',
|
||||
'Filename' : 'Faila nosaukums',
|
||||
'Status' : 'Statuss',
|
||||
'Size' : 'Izmērs',
|
||||
'Add files' : 'Pievienot failus',
|
||||
'Stop current upload' : 'Apturēt pašreizējo augšupielādi',
|
||||
'Start uploading queue' : 'Sākt augšupielādi',
|
||||
'Drag files here.' : 'Ievelciet failus šeit',
|
||||
'Start upload' : 'Sākt augšupielādi',
|
||||
'Uploaded %d/%d files': 'Augšupielādēti %d/%d faili',
|
||||
'Stop upload': 'Pārtraukt augšupielādi',
|
||||
'Start upload': 'Sākt augšupielādi',
|
||||
'%d files queued': '%d faili pievienoti rindai',
|
||||
'File: %s': 'Fails: %s',
|
||||
'Close': 'Aizvērt',
|
||||
'Using runtime: ': 'Lieto saskarni: ',
|
||||
'File: %f, size: %s, max file size: %m': 'Fails: %f, izmērs: %s, maksimālais faila izmērs: %m',
|
||||
'Upload element accepts only %d file(s) at a time. Extra files were stripped.': 'Iespējams ielādēt tikai %d failus vienā reizē. Atlikušie faili netika pievienoti',
|
||||
'Upload URL might be wrong or doesn\'t exist': 'Augšupielādes URL varētu būt nepareizs vai neeksistē',
|
||||
'Error: File to large: ': 'Kļūda: Fails pārāk liels: ',
|
||||
'Error: Invalid file extension: ': 'Kļūda: Nekorekts faila paplašinājums:',
|
||||
'File extension error.': 'Faila paplašinājuma kļūda.',
|
||||
'File size error.': 'Faila izmēra kļūda.',
|
||||
'File count error.': 'Failu skaita kļūda',
|
||||
'Init error.': 'Inicializācijas kļūda.',
|
||||
'HTTP Error.': 'HTTP kļūda.',
|
||||
'Security error.': 'Drošības kļūda.',
|
||||
'Generic error.': 'Vispārēja rakstura kļūda.',
|
||||
'IO error.': 'Ievades/Izvades kļūda.'
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@ -33,7 +33,6 @@ function renderUI(obj) {
|
||||
'<div class="plupload_wrapper">' +
|
||||
'<div class="ui-widget-content plupload_container">' +
|
||||
'<div class="plupload">' +
|
||||
|
||||
'<div class="plupload_content">' +
|
||||
'<table class="plupload_filelist">' +
|
||||
'<tr class="ui-widget-header plupload_filelist_header">' +
|
||||
@ -332,37 +331,39 @@ $.widget("ui.plupload", {
|
||||
}
|
||||
|
||||
self._notify('error', message);
|
||||
self._trigger('error', null, { up: up, file: file, error: message } );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_setOption: function(key, value) {
|
||||
|
||||
var self = this;
|
||||
|
||||
if (key == 'buttons' && typeof(value) == 'object') {
|
||||
value = $.extend(this.options.buttons, value);
|
||||
value = $.extend(self.options.buttons, value);
|
||||
|
||||
if (!value.browse) {
|
||||
this.browse_button.button('disable').hide();
|
||||
$('#' + this.id + self.runtime + '_container').hide();
|
||||
self.browse_button.button('disable').hide();
|
||||
$('#' + self.id + self.runtime + '_container').hide();
|
||||
} else {
|
||||
this.browse_button.button('enable').show();
|
||||
$('#' + this.id + self.runtime + '_container').show();
|
||||
self.browse_button.button('enable').show();
|
||||
$('#' + self.id + self.runtime + '_container').show();
|
||||
}
|
||||
|
||||
if (!value.start) {
|
||||
this.start_button.button('disable').hide();
|
||||
self.start_button.button('disable').hide();
|
||||
} else {
|
||||
this.start_button.button('enable').show();
|
||||
self.start_button.button('enable').show();
|
||||
}
|
||||
|
||||
if (!value.stop) {
|
||||
this.stop_button.button('disable').hide();
|
||||
self.stop_button.button('disable').hide();
|
||||
} else {
|
||||
this.start_button.button('enable').show();
|
||||
self.start_button.button('enable').show();
|
||||
}
|
||||
}
|
||||
|
||||
this.uploader.settings[key] = value;
|
||||
self.uploader.settings[key] = value;
|
||||
},
|
||||
|
||||
|
||||
@ -496,11 +497,6 @@ $.widget("ui.plupload", {
|
||||
$('.plupload_upload_status', this.element).text(
|
||||
_('Uploaded %d/%d files').replace('%d/%d', uploader.total.uploaded+'/'+uploader.files.length)
|
||||
);
|
||||
|
||||
// All files are uploaded
|
||||
if (uploader.total.uploaded === uploader.files.length) {
|
||||
uploader.stop();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
337
assets/javascripts/plupload/plupload.browserplus.js
Normal file
337
assets/javascripts/plupload/plupload.browserplus.js
Normal file
@ -0,0 +1,337 @@
|
||||
/**
|
||||
* plupload.browserplus.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under GPL License.
|
||||
*
|
||||
* License: http://www.plupload.com/license
|
||||
* Contributing: http://www.plupload.com/contributing
|
||||
*/
|
||||
|
||||
// JSLint defined globals
|
||||
/*global plupload:false, BrowserPlus:false, window:false */
|
||||
|
||||
(function(plupload) {
|
||||
/**
|
||||
* Yahoo BrowserPlus implementation. This runtime supports these features: dragdrop, jpgresize, pngresize.
|
||||
*
|
||||
* @static
|
||||
* @class plupload.runtimes.BrowserPlus
|
||||
* @extends plupload.Runtime
|
||||
*/
|
||||
plupload.runtimes.BrowserPlus = plupload.addRuntime("browserplus", {
|
||||
/**
|
||||
* Returns a list of supported features for the runtime.
|
||||
*
|
||||
* @return {Object} Name/value object with supported features.
|
||||
*/
|
||||
getFeatures : function() {
|
||||
return {
|
||||
dragdrop : true,
|
||||
jpgresize : true,
|
||||
pngresize : true,
|
||||
chunks : true,
|
||||
progress: true,
|
||||
multipart: true
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the browserplus runtime.
|
||||
*
|
||||
* @method init
|
||||
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
|
||||
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
|
||||
*/
|
||||
init : function(uploader, callback) {
|
||||
var browserPlus = window.BrowserPlus, browserPlusFiles = {}, settings = uploader.settings, resize = settings.resize;
|
||||
|
||||
function addSelectedFiles(native_files) {
|
||||
var files, i, selectedFiles = [], file, id;
|
||||
|
||||
// Add the native files and setup plupload files
|
||||
for (i = 0; i < native_files.length; i++) {
|
||||
file = native_files[i];
|
||||
id = plupload.guid();
|
||||
browserPlusFiles[id] = file;
|
||||
|
||||
selectedFiles.push(new plupload.File(id, file.name, file.size));
|
||||
}
|
||||
|
||||
// Any files selected fire event
|
||||
if (i) {
|
||||
uploader.trigger("FilesAdded", selectedFiles);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup event listeners if browserplus was initialized
|
||||
function setup() {
|
||||
// Add drop handler
|
||||
uploader.bind("PostInit", function() {
|
||||
var dropTargetElm, dropElmId = settings.drop_element,
|
||||
dropTargetId = uploader.id + '_droptarget',
|
||||
dropElm = document.getElementById(dropElmId),
|
||||
lastState;
|
||||
|
||||
// Enable/disable drop support for the drop target
|
||||
// this is needed to resolve IE bubbeling issues and make it possible to drag/drop
|
||||
// files into gears runtimes on the same page
|
||||
function addDropHandler(id, end_callback) {
|
||||
// Add drop target and listener
|
||||
browserPlus.DragAndDrop.AddDropTarget({id : id}, function(res) {
|
||||
browserPlus.DragAndDrop.AttachCallbacks({
|
||||
id : id,
|
||||
hover : function(res) {
|
||||
if (!res && end_callback) {
|
||||
end_callback();
|
||||
}
|
||||
},
|
||||
drop : function(res) {
|
||||
if (end_callback) {
|
||||
end_callback();
|
||||
}
|
||||
|
||||
addSelectedFiles(res);
|
||||
}
|
||||
}, function() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function hide() {
|
||||
document.getElementById(dropTargetId).style.top = '-1000px';
|
||||
}
|
||||
|
||||
if (dropElm) {
|
||||
// Since IE has issues with bubbeling when it comes to the drop of files
|
||||
// we need to do this hack where we show a drop target div element while dropping
|
||||
if (document.attachEvent && (/MSIE/gi).test(navigator.userAgent)) {
|
||||
// Create drop target
|
||||
dropTargetElm = document.createElement('div');
|
||||
dropTargetElm.setAttribute('id', dropTargetId);
|
||||
plupload.extend(dropTargetElm.style, {
|
||||
position : 'absolute',
|
||||
top : '-1000px',
|
||||
background : 'red',
|
||||
filter : 'alpha(opacity=0)',
|
||||
opacity : 0
|
||||
});
|
||||
|
||||
document.body.appendChild(dropTargetElm);
|
||||
|
||||
plupload.addEvent(dropElm, 'dragenter', function(e) {
|
||||
var dropElm, dropElmPos;
|
||||
|
||||
dropElm = document.getElementById(dropElmId);
|
||||
dropElmPos = plupload.getPos(dropElm);
|
||||
|
||||
plupload.extend(document.getElementById(dropTargetId).style, {
|
||||
top : dropElmPos.y + 'px',
|
||||
left : dropElmPos.x + 'px',
|
||||
width : dropElm.offsetWidth + 'px',
|
||||
height : dropElm.offsetHeight + 'px'
|
||||
});
|
||||
});
|
||||
|
||||
addDropHandler(dropTargetId, hide);
|
||||
} else {
|
||||
addDropHandler(dropElmId);
|
||||
}
|
||||
}
|
||||
|
||||
plupload.addEvent(document.getElementById(settings.browse_button), 'click', function(e) {
|
||||
var mimeTypes = [], i, a, filters = settings.filters, ext;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Convert extensions to mimetypes
|
||||
for (i = 0; i < filters.length; i++) {
|
||||
ext = filters[i].extensions.split(',');
|
||||
|
||||
for (a = 0; a < ext.length; a++) {
|
||||
mimeTypes.push(plupload.mimeTypes[ext[a]]);
|
||||
}
|
||||
}
|
||||
|
||||
browserPlus.FileBrowse.OpenBrowseDialog({
|
||||
mimeTypes : mimeTypes
|
||||
}, function(res) {
|
||||
if (res.success) {
|
||||
addSelectedFiles(res.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Prevent IE leaks
|
||||
dropElm = dropTargetElm = null;
|
||||
});
|
||||
|
||||
uploader.bind("UploadFile", function(up, file) {
|
||||
var nativeFile = browserPlusFiles[file.id], reqParams = {},
|
||||
chunkSize = up.settings.chunk_size, loadProgress, chunkStack = [];
|
||||
|
||||
function uploadFile(chunk, chunks) {
|
||||
var chunkFile;
|
||||
|
||||
// Stop upload if file is maked as failed
|
||||
if (file.status == plupload.FAILED) {
|
||||
return;
|
||||
}
|
||||
|
||||
reqParams.name = file.target_name || file.name;
|
||||
|
||||
// Only send chunk parameters if chunk size is defined
|
||||
if (chunkSize) {
|
||||
reqParams.chunk = "" + chunk;
|
||||
reqParams.chunks = "" + chunks;
|
||||
}
|
||||
|
||||
chunkFile = chunkStack.shift();
|
||||
|
||||
browserPlus.Uploader.upload({
|
||||
url : up.settings.url,
|
||||
files : {file : chunkFile},
|
||||
cookies : document.cookies,
|
||||
postvars : plupload.extend(reqParams, up.settings.multipart_params),
|
||||
progressCallback : function(res) {
|
||||
var i, loaded = 0;
|
||||
|
||||
// since more than 1 chunk can be sent at a time, keep track of how many bytes
|
||||
// of each chunk was sent
|
||||
loadProgress[chunk] = parseInt(res.filePercent * chunkFile.size / 100, 10);
|
||||
for (i = 0; i < loadProgress.length; i++) {
|
||||
loaded += loadProgress[i];
|
||||
}
|
||||
|
||||
file.loaded = loaded;
|
||||
up.trigger('UploadProgress', file);
|
||||
}
|
||||
}, function(res) {
|
||||
var httpStatus, chunkArgs;
|
||||
|
||||
if (res.success) {
|
||||
httpStatus = res.value.statusCode;
|
||||
|
||||
if (chunkSize) {
|
||||
up.trigger('ChunkUploaded', file, {
|
||||
chunk : chunk,
|
||||
chunks : chunks,
|
||||
response : res.value.body,
|
||||
status : httpStatus
|
||||
});
|
||||
}
|
||||
|
||||
if (chunkStack.length > 0) {
|
||||
// More chunks to be uploaded
|
||||
uploadFile(++chunk, chunks);
|
||||
} else {
|
||||
file.status = plupload.DONE;
|
||||
|
||||
up.trigger('FileUploaded', file, {
|
||||
response : res.value.body,
|
||||
status : httpStatus
|
||||
});
|
||||
|
||||
// Is error status
|
||||
if (httpStatus >= 400) {
|
||||
up.trigger('Error', {
|
||||
code : plupload.HTTP_ERROR,
|
||||
message : plupload.translate('HTTP Error.'),
|
||||
file : file,
|
||||
status : httpStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
up.trigger('Error', {
|
||||
code : plupload.GENERIC_ERROR,
|
||||
message : plupload.translate('Generic Error.'),
|
||||
file : file,
|
||||
details : res.error
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function chunkAndUploadFile(native_file) {
|
||||
file.size = native_file.size;
|
||||
if (chunkSize) {
|
||||
browserPlus.FileAccess.chunk({file : native_file, chunkSize : chunkSize}, function(cr) {
|
||||
if (cr.success) {
|
||||
var chunks = cr.value, len = chunks.length;
|
||||
|
||||
loadProgress = Array(len);
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
loadProgress[i] = 0;
|
||||
chunkStack.push(chunks[i]);
|
||||
}
|
||||
|
||||
uploadFile(0, len);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadProgress = Array(1);
|
||||
chunkStack.push(native_file);
|
||||
uploadFile(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Resize image if it's a supported format and resize is enabled
|
||||
if (resize && /\.(png|jpg|jpeg)$/i.test(file.name)) {
|
||||
BrowserPlus.ImageAlter.transform({
|
||||
file : nativeFile,
|
||||
quality : resize.quality || 90,
|
||||
actions : [{
|
||||
scale : {
|
||||
maxwidth : resize.width,
|
||||
maxheight : resize.height
|
||||
}
|
||||
}]
|
||||
}, function(res) {
|
||||
if (res.success) {
|
||||
chunkAndUploadFile(res.value.file);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
chunkAndUploadFile(nativeFile);
|
||||
}
|
||||
});
|
||||
|
||||
callback({success : true});
|
||||
}
|
||||
|
||||
// Check for browserplus object
|
||||
if (browserPlus) {
|
||||
browserPlus.init(function(res) {
|
||||
var services = [
|
||||
{service: "Uploader", version: "3"},
|
||||
{service: "DragAndDrop", version: "1"},
|
||||
{service: "FileBrowse", version: "1"},
|
||||
{service: "FileAccess", version: "2"}
|
||||
];
|
||||
|
||||
if (resize) {
|
||||
services.push({service : 'ImageAlter', version : "4"});
|
||||
}
|
||||
|
||||
if (res.success) {
|
||||
browserPlus.require({
|
||||
services : services
|
||||
}, function(sres) {
|
||||
if (sres.success) {
|
||||
setup();
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
})(plupload);
|
||||
@ -1 +0,0 @@
|
||||
(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l<n.length;l++){k=n[l];o=a.guid();h[o]=k;j.push(new a.File(o,k.name,k.size))}if(l){g.trigger("FilesAdded",j)}}function b(){g.bind("PostInit",function(){var m,k=d.drop_element,o=g.id+"_droptarget",j=document.getElementById(k),l;function p(r,q){e.DragAndDrop.AddDropTarget({id:r},function(s){e.DragAndDrop.AttachCallbacks({id:r,hover:function(t){if(!t&&q){q()}},drop:function(t){if(q){q()}f(t)}},function(){})})}function n(){document.getElementById(o).style.top="-1000px"}if(j){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){m=document.createElement("div");m.setAttribute("id",o);a.extend(m.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});document.body.appendChild(m);a.addEvent(j,"dragenter",function(r){var q,s;q=document.getElementById(k);s=a.getPos(q);a.extend(document.getElementById(o).style,{top:s.y+"px",left:s.x+"px",width:q.offsetWidth+"px",height:q.offsetHeight+"px"})});p(o,n)}else{p(k)}}a.addEvent(document.getElementById(d.browse_button),"click",function(v){var t=[],r,q,u=d.filters,s;v.preventDefault();for(r=0;r<u.length;r++){s=u[r].extensions.split(",");for(q=0;q<s.length;q++){t.push(a.mimeTypes[s[q]])}}e.FileBrowse.OpenBrowseDialog({mimeTypes:t},function(w){if(w.success){f(w.value)}})});j=m=null});g.bind("UploadFile",function(m,j){var l=h[j.id],r={},k=m.settings.chunk_size,n,o=[];function q(s,u){var t;if(j.status==a.FAILED){return}r.name=j.target_name||j.name;if(k){r.chunk=""+s;r.chunks=""+u}t=o.shift();e.Uploader.upload({url:m.settings.url,files:{file:t},cookies:document.cookies,postvars:a.extend(r,m.settings.multipart_params),progressCallback:function(x){var w,v=0;n[s]=parseInt(x.filePercent*t.size/100,10);for(w=0;w<n.length;w++){v+=n[w]}j.loaded=v;m.trigger("UploadProgress",j)}},function(w){var v,x;if(w.success){v=w.value.statusCode;if(k){m.trigger("ChunkUploaded",j,{chunk:s,chunks:u,response:w.value.body,status:v})}if(o.length>0){q(++s,u)}else{j.status=a.DONE;m.trigger("FileUploaded",j,{response:w.value.body,status:v});if(v>=400){m.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:j,status:v})}}}else{m.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:j,details:w.error})}})}function p(s){j.size=s.size;if(k){e.FileAccess.chunk({file:s,chunkSize:k},function(v){if(v.success){var w=v.value,t=w.length;n=Array(t);for(var u=0;u<t;u++){n[u]=0;o.push(w[u])}q(0,t)}})}else{n=Array(1);o.push(s);q(0,1)}}if(c&&/\.(png|jpg|jpeg)$/i.test(j.name)){BrowserPlus.ImageAlter.transform({file:l,quality:c.quality||90,actions:[{scale:{maxwidth:c.width,maxheight:c.height}}]},function(s){if(s.success){p(s.value.file)}})}else{p(l)}});i({success:true})}if(e){e.init(function(k){var j=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];if(c){j.push({service:"ImageAlter",version:"4"})}if(k.success){e.require({services:j},function(l){if(l.success){b()}else{i()}})}else{i()}})}else{i()}}})})(plupload);
|
||||
387
assets/javascripts/plupload/plupload.flash.js
Normal file
387
assets/javascripts/plupload/plupload.flash.js
Normal file
@ -0,0 +1,387 @@
|
||||
/**
|
||||
* plupload.flash.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under GPL License.
|
||||
*
|
||||
* License: http://www.plupload.com/license
|
||||
* Contributing: http://www.plupload.com/contributing
|
||||
*/
|
||||
|
||||
// JSLint defined globals
|
||||
/*global window:false, document:false, plupload:false, ActiveXObject:false, escape:false */
|
||||
|
||||
(function(window, document, plupload, undef) {
|
||||
var uploadInstances = {}, initialized = {};
|
||||
|
||||
function getFlashVersion() {
|
||||
var version;
|
||||
|
||||
try {
|
||||
version = navigator.plugins['Shockwave Flash'];
|
||||
version = version.description;
|
||||
} catch (e1) {
|
||||
try {
|
||||
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
|
||||
} catch (e2) {
|
||||
version = '0.0';
|
||||
}
|
||||
}
|
||||
|
||||
version = version.match(/\d+/g);
|
||||
|
||||
return parseFloat(version[0] + '.' + version[1]);
|
||||
}
|
||||
|
||||
plupload.flash = {
|
||||
/**
|
||||
* Will be executed by the Flash runtime when it sends out events.
|
||||
*
|
||||
* @param {String} id If for the upload instance.
|
||||
* @param {String} name Event name to trigger.
|
||||
* @param {Object} obj Parameters to be passed with event.
|
||||
*/
|
||||
trigger : function(id, name, obj) {
|
||||
|
||||
// Detach the call so that error handling in the browser is presented correctly
|
||||
setTimeout(function() {
|
||||
var uploader = uploadInstances[id], i, args;
|
||||
|
||||
if (uploader) {
|
||||
uploader.trigger('Flash:' + name, obj);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* FlashRuntime implementation. This runtime supports these features: jpgresize, pngresize, chunks.
|
||||
*
|
||||
* @static
|
||||
* @class plupload.runtimes.Flash
|
||||
* @extends plupload.Runtime
|
||||
*/
|
||||
plupload.runtimes.Flash = plupload.addRuntime("flash", {
|
||||
|
||||
/**
|
||||
* Returns a list of supported features for the runtime.
|
||||
*
|
||||
* @return {Object} Name/value object with supported features.
|
||||
*/
|
||||
getFeatures : function() {
|
||||
return {
|
||||
jpgresize: true,
|
||||
pngresize: true,
|
||||
maxWidth: 8091,
|
||||
maxHeight: 8091,
|
||||
chunks: true,
|
||||
progress: true,
|
||||
multipart: true
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the upload runtime. This method should add necessary items to the DOM and register events needed for operation.
|
||||
*
|
||||
* @method init
|
||||
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
|
||||
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
|
||||
*/
|
||||
init : function(uploader, callback) {
|
||||
var browseButton, flashContainer, flashVars, waitCount = 0, container = document.body;
|
||||
|
||||
if (getFlashVersion() < 10) {
|
||||
callback({success : false});
|
||||
return;
|
||||
}
|
||||
|
||||
initialized[uploader.id] = false;
|
||||
uploadInstances[uploader.id] = uploader;
|
||||
|
||||
// Find browse button and set to to be relative
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
|
||||
// Create flash container and insert it at an absolute position within the browse button
|
||||
flashContainer = document.createElement('div');
|
||||
flashContainer.id = uploader.id + '_flash_container';
|
||||
|
||||
plupload.extend(flashContainer.style, {
|
||||
position : 'absolute',
|
||||
top : '0px',
|
||||
background : uploader.settings.shim_bgcolor || 'transparent',
|
||||
zIndex : 99999,
|
||||
width : '100%',
|
||||
height : '100%'
|
||||
});
|
||||
|
||||
flashContainer.className = 'plupload flash';
|
||||
|
||||
if (uploader.settings.container) {
|
||||
container = document.getElementById(uploader.settings.container);
|
||||
if (plupload.getStyle(container, 'position') === 'static') {
|
||||
container.style.position = 'relative';
|
||||
}
|
||||
}
|
||||
|
||||
container.appendChild(flashContainer);
|
||||
|
||||
flashVars = 'id=' + escape(uploader.id);
|
||||
|
||||
// Insert the Flash inide the flash container
|
||||
flashContainer.innerHTML = '<object id="' + uploader.id + '_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="' + uploader.settings.flash_swf_url + '">' +
|
||||
'<param name="movie" value="' + uploader.settings.flash_swf_url + '" />' +
|
||||
'<param name="flashvars" value="' + flashVars + '" />' +
|
||||
'<param name="wmode" value="transparent" />' +
|
||||
'<param name="allowscriptaccess" value="always" /></object>';
|
||||
|
||||
function getFlashObj() {
|
||||
return document.getElementById(uploader.id + '_flash');
|
||||
}
|
||||
|
||||
function waitLoad() {
|
||||
|
||||
// Wait for 5 sec
|
||||
if (waitCount++ > 5000) {
|
||||
callback({success : false});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!initialized[uploader.id]) {
|
||||
setTimeout(waitLoad, 1);
|
||||
}
|
||||
}
|
||||
|
||||
waitLoad();
|
||||
|
||||
// Fix IE memory leaks
|
||||
browseButton = flashContainer = null;
|
||||
|
||||
// Wait for Flash to send init event
|
||||
uploader.bind("Flash:Init", function() {
|
||||
var lookup = {}, i;
|
||||
|
||||
getFlashObj().setFileFilters(uploader.settings.filters, uploader.settings.multi_selection);
|
||||
|
||||
// Prevent eventual reinitialization of the instance
|
||||
if (initialized[uploader.id]) {
|
||||
return;
|
||||
}
|
||||
initialized[uploader.id] = true;
|
||||
|
||||
uploader.bind("UploadFile", function(up, file) {
|
||||
var settings = up.settings, resize = uploader.settings.resize || {};
|
||||
|
||||
getFlashObj().uploadFile(lookup[file.id], settings.url, {
|
||||
name : file.target_name || file.name,
|
||||
mime : plupload.mimeTypes[file.name.replace(/^.+\.([^.]+)/, '$1').toLowerCase()] || 'application/octet-stream',
|
||||
chunk_size : settings.chunk_size,
|
||||
width : resize.width,
|
||||
height : resize.height,
|
||||
quality : resize.quality,
|
||||
multipart : settings.multipart,
|
||||
multipart_params : settings.multipart_params || {},
|
||||
file_data_name : settings.file_data_name,
|
||||
format : /\.(jpg|jpeg)$/i.test(file.name) ? 'jpg' : 'png',
|
||||
headers : settings.headers,
|
||||
urlstream_upload : settings.urlstream_upload
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
uploader.bind("Flash:UploadProcess", function(up, flash_file) {
|
||||
var file = up.getFile(lookup[flash_file.id]);
|
||||
|
||||
if (file.status != plupload.FAILED) {
|
||||
file.loaded = flash_file.loaded;
|
||||
file.size = flash_file.size;
|
||||
|
||||
up.trigger('UploadProgress', file);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Flash:UploadChunkComplete", function(up, info) {
|
||||
var chunkArgs, file = up.getFile(lookup[info.id]);
|
||||
|
||||
chunkArgs = {
|
||||
chunk : info.chunk,
|
||||
chunks : info.chunks,
|
||||
response : info.text
|
||||
};
|
||||
|
||||
up.trigger('ChunkUploaded', file, chunkArgs);
|
||||
|
||||
// Stop upload if file is maked as failed
|
||||
if (file.status != plupload.FAILED) {
|
||||
getFlashObj().uploadNextChunk();
|
||||
}
|
||||
|
||||
// Last chunk then dispatch FileUploaded event
|
||||
if (info.chunk == info.chunks - 1) {
|
||||
file.status = plupload.DONE;
|
||||
|
||||
up.trigger('FileUploaded', file, {
|
||||
response : info.text
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Flash:SelectFiles", function(up, selected_files) {
|
||||
var file, i, files = [], id;
|
||||
|
||||
// Add the selected files to the file queue
|
||||
for (i = 0; i < selected_files.length; i++) {
|
||||
file = selected_files[i];
|
||||
|
||||
// Store away flash ref internally
|
||||
id = plupload.guid();
|
||||
lookup[id] = file.id;
|
||||
lookup[file.id] = id;
|
||||
|
||||
files.push(new plupload.File(id, file.name, file.size));
|
||||
}
|
||||
|
||||
// Trigger FilesAdded event if we added any
|
||||
if (files.length) {
|
||||
uploader.trigger("FilesAdded", files);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Flash:SecurityError", function(up, err) {
|
||||
uploader.trigger('Error', {
|
||||
code : plupload.SECURITY_ERROR,
|
||||
message : plupload.translate('Security error.'),
|
||||
details : err.message,
|
||||
file : uploader.getFile(lookup[err.id])
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind("Flash:GenericError", function(up, err) {
|
||||
uploader.trigger('Error', {
|
||||
code : plupload.GENERIC_ERROR,
|
||||
message : plupload.translate('Generic error.'),
|
||||
details : err.message,
|
||||
file : uploader.getFile(lookup[err.id])
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind("Flash:IOError", function(up, err) {
|
||||
uploader.trigger('Error', {
|
||||
code : plupload.IO_ERROR,
|
||||
message : plupload.translate('IO error.'),
|
||||
details : err.message,
|
||||
file : uploader.getFile(lookup[err.id])
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind("Flash:ImageError", function(up, err) {
|
||||
uploader.trigger('Error', {
|
||||
code : parseInt(err.code, 10),
|
||||
message : plupload.translate('Image error.'),
|
||||
file : uploader.getFile(lookup[err.id])
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind('Flash:StageEvent:rollOver', function(up) {
|
||||
var browseButton, hoverClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
hoverClass = up.settings.browse_button_hover;
|
||||
|
||||
if (browseButton && hoverClass) {
|
||||
plupload.addClass(browseButton, hoverClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Flash:StageEvent:rollOut', function(up) {
|
||||
var browseButton, hoverClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
hoverClass = up.settings.browse_button_hover;
|
||||
|
||||
if (browseButton && hoverClass) {
|
||||
plupload.removeClass(browseButton, hoverClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Flash:StageEvent:mouseDown', function(up) {
|
||||
var browseButton, activeClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
activeClass = up.settings.browse_button_active;
|
||||
|
||||
if (browseButton && activeClass) {
|
||||
plupload.addClass(browseButton, activeClass);
|
||||
|
||||
// Make sure that browse_button has active state removed from it
|
||||
plupload.addEvent(document.body, 'mouseup', function() {
|
||||
plupload.removeClass(browseButton, activeClass);
|
||||
}, up.id);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Flash:StageEvent:mouseUp', function(up) {
|
||||
var browseButton, activeClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
activeClass = up.settings.browse_button_active;
|
||||
|
||||
if (browseButton && activeClass) {
|
||||
plupload.removeClass(browseButton, activeClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("QueueChanged", function(up) {
|
||||
uploader.refresh();
|
||||
});
|
||||
|
||||
uploader.bind("FilesRemoved", function(up, files) {
|
||||
var i;
|
||||
|
||||
for (i = 0; i < files.length; i++) {
|
||||
getFlashObj().removeFile(lookup[files[i].id]);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("StateChanged", function(up) {
|
||||
uploader.refresh();
|
||||
});
|
||||
|
||||
uploader.bind("Refresh", function(up) {
|
||||
var browseButton, browsePos, browseSize;
|
||||
|
||||
// Set file filters incase it has been changed dynamically
|
||||
getFlashObj().setFileFilters(uploader.settings.filters, uploader.settings.multi_selection);
|
||||
|
||||
browseButton = document.getElementById(up.settings.browse_button);
|
||||
if (browseButton) {
|
||||
browsePos = plupload.getPos(browseButton, document.getElementById(up.settings.container));
|
||||
browseSize = plupload.getSize(browseButton);
|
||||
|
||||
plupload.extend(document.getElementById(up.id + '_flash_container').style, {
|
||||
top : browsePos.y + 'px',
|
||||
left : browsePos.x + 'px',
|
||||
width : browseSize.w + 'px',
|
||||
height : browseSize.h + 'px'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Destroy", function(up) {
|
||||
var flashContainer;
|
||||
|
||||
plupload.removeAllEvents(document.body, up.id);
|
||||
|
||||
delete initialized[up.id];
|
||||
delete uploadInstances[up.id];
|
||||
|
||||
flashContainer = document.getElementById(up.id + '_flash_container');
|
||||
if (flashContainer) {
|
||||
container.removeChild(flashContainer);
|
||||
}
|
||||
});
|
||||
|
||||
callback({success : true});
|
||||
});
|
||||
}
|
||||
});
|
||||
})(window, document, plupload);
|
||||
@ -1 +0,0 @@
|
||||
(function(f,b,d,e){var a={},g={};function c(){var h;try{h=navigator.plugins["Shockwave Flash"];h=h.description}catch(j){try{h=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){h="0.0"}}h=h.match(/\d+/g);return parseFloat(h[0]+"."+h[1])}d.flash={trigger:function(j,h,i){setTimeout(function(){var m=a[j],l,k;if(m){m.trigger("Flash:"+h,i)}},0)}};d.runtimes.Flash=d.addRuntime("flash",{getFeatures:function(){return{jpgresize:true,pngresize:true,maxWidth:8091,maxHeight:8091,chunks:true,progress:true,multipart:true}},init:function(j,o){var n,i,k,p=0,h=b.body;if(c()<10){o({success:false});return}g[j.id]=false;a[j.id]=j;n=b.getElementById(j.settings.browse_button);i=b.createElement("div");i.id=j.id+"_flash_container";d.extend(i.style,{position:"absolute",top:"0px",background:j.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});i.className="plupload flash";if(j.settings.container){h=b.getElementById(j.settings.container);h.style.position="relative"}h.appendChild(i);k="id="+escape(j.id);i.innerHTML='<object id="'+j.id+'_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="'+j.settings.flash_swf_url+'"><param name="movie" value="'+j.settings.flash_swf_url+'" /><param name="flashvars" value="'+k+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';function m(){return b.getElementById(j.id+"_flash")}function l(){if(p++>5000){o({success:false});return}if(!g[j.id]){setTimeout(l,1)}}l();n=i=null;j.bind("Flash:Init",function(){var s={},r,q=j.settings.resize||{};m().setFileFilters(j.settings.filters,j.settings.multi_selection);if(g[j.id]){return}g[j.id]=true;j.bind("UploadFile",function(t,u){var v=t.settings;m().uploadFile(s[u.id],v.url,{name:u.target_name||u.name,mime:d.mimeTypes[u.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream",chunk_size:v.chunk_size,width:q.width,height:q.height,quality:q.quality||90,multipart:v.multipart,multipart_params:v.multipart_params||{},file_data_name:v.file_data_name,format:/\.(jpg|jpeg)$/i.test(u.name)?"jpg":"png",headers:v.headers,urlstream_upload:v.urlstream_upload})});j.bind("Flash:UploadProcess",function(u,t){var v=u.getFile(s[t.id]);if(v.status!=d.FAILED){v.loaded=t.loaded;v.size=t.size;u.trigger("UploadProgress",v)}});j.bind("Flash:UploadChunkComplete",function(t,v){var w,u=t.getFile(s[v.id]);w={chunk:v.chunk,chunks:v.chunks,response:v.text};t.trigger("ChunkUploaded",u,w);if(u.status!=d.FAILED){m().uploadNextChunk()}if(v.chunk==v.chunks-1){u.status=d.DONE;t.trigger("FileUploaded",u,{response:v.text})}});j.bind("Flash:SelectFiles",function(t,w){var v,u,x=[],y;for(u=0;u<w.length;u++){v=w[u];y=d.guid();s[y]=v.id;s[v.id]=y;x.push(new d.File(y,v.name,v.size))}if(x.length){j.trigger("FilesAdded",x)}});j.bind("Flash:SecurityError",function(t,u){j.trigger("Error",{code:d.SECURITY_ERROR,message:d.translate("Security error."),details:u.message,file:j.getFile(s[u.id])})});j.bind("Flash:GenericError",function(t,u){j.trigger("Error",{code:d.GENERIC_ERROR,message:d.translate("Generic error."),details:u.message,file:j.getFile(s[u.id])})});j.bind("Flash:IOError",function(t,u){j.trigger("Error",{code:d.IO_ERROR,message:d.translate("IO error."),details:u.message,file:j.getFile(s[u.id])})});j.bind("Flash:ImageError",function(t,u){j.trigger("Error",{code:parseInt(u.code),message:d.translate("Image error."),file:j.getFile(s[u.id])})});j.bind("Flash:StageEvent:rollOver",function(t){var u,v;u=b.getElementById(j.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.addClass(u,v)}});j.bind("Flash:StageEvent:rollOut",function(t){var u,v;u=b.getElementById(j.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.removeClass(u,v)}});j.bind("Flash:StageEvent:mouseDown",function(t){var u,v;u=b.getElementById(j.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.addClass(u,v);d.addEvent(b.body,"mouseup",function(){d.removeClass(u,v)},t.id)}});j.bind("Flash:StageEvent:mouseUp",function(t){var u,v;u=b.getElementById(j.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.removeClass(u,v)}});j.bind("QueueChanged",function(t){j.refresh()});j.bind("FilesRemoved",function(t,v){var u;for(u=0;u<v.length;u++){m().removeFile(s[v[u].id])}});j.bind("StateChanged",function(t){j.refresh()});j.bind("Refresh",function(t){var u,v,w;m().setFileFilters(j.settings.filters,j.settings.multi_selection);u=b.getElementById(t.settings.browse_button);if(u){v=d.getPos(u,b.getElementById(t.settings.container));w=d.getSize(u);d.extend(b.getElementById(t.id+"_flash_container").style,{top:v.y+"px",left:v.x+"px",width:w.w+"px",height:w.h+"px"})}});j.bind("Destroy",function(t){var u;d.removeAllEvents(b.body,t.id);delete g[t.id];delete a[t.id];u=b.getElementById(t.id+"_flash_container");if(u){h.removeChild(u)}});o({success:true})})}})})(window,document,plupload);
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
420
assets/javascripts/plupload/plupload.gears.js
Normal file
420
assets/javascripts/plupload/plupload.gears.js
Normal file
@ -0,0 +1,420 @@
|
||||
/**
|
||||
* plupload.gears.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under GPL License.
|
||||
*
|
||||
* License: http://www.plupload.com/license
|
||||
* Contributing: http://www.plupload.com/contributing
|
||||
*/
|
||||
|
||||
// JSLint defined globals
|
||||
/*global window:false, document:false, plupload:false, google:false, GearsFactory:false, ActiveXObject:false */
|
||||
|
||||
// Copyright 2007, Google Inc.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// 3. Neither the name of Google Inc. nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Sets up google.gears.*, which is *the only* supported way to access Gears.
|
||||
//
|
||||
// Circumvent this file at your own risk!
|
||||
//
|
||||
// In the future, Gears may automatically define google.gears.* without this
|
||||
// file. Gears may use these objects to transparently fix bugs and compatibility
|
||||
// issues. Applications that use the code below will continue to work seamlessly
|
||||
// when that happens.
|
||||
|
||||
(function() {
|
||||
// We are already defined. Hooray!
|
||||
if (window.google && google.gears) {
|
||||
return;
|
||||
}
|
||||
|
||||
var factory = null;
|
||||
|
||||
// Firefox
|
||||
if (typeof GearsFactory != 'undefined') {
|
||||
factory = new GearsFactory();
|
||||
} else {
|
||||
// IE
|
||||
try {
|
||||
factory = new ActiveXObject('Gears.Factory');
|
||||
// privateSetGlobalObject is only required and supported on WinCE.
|
||||
if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {
|
||||
factory.privateSetGlobalObject(this);
|
||||
}
|
||||
} catch (e) {
|
||||
// Safari
|
||||
if ((typeof navigator.mimeTypes != 'undefined') && navigator.mimeTypes["application/x-googlegears"]) {
|
||||
factory = document.createElement("object");
|
||||
factory.style.display = "none";
|
||||
factory.width = 0;
|
||||
factory.height = 0;
|
||||
factory.type = "application/x-googlegears";
|
||||
document.documentElement.appendChild(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *Do not* define any objects if Gears is not installed. This mimics the
|
||||
// behavior of Gears defining the objects in the future.
|
||||
if (!factory) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now set up the objects, being careful not to overwrite anything.
|
||||
//
|
||||
// Note: In Internet Explorer for Windows Mobile, you can't add properties to
|
||||
// the window object. However, global objects are automatically added as
|
||||
// properties of the window object in all browsers.
|
||||
if (!window.google) {
|
||||
window.google = {};
|
||||
}
|
||||
|
||||
if (!google.gears) {
|
||||
google.gears = {factory: factory};
|
||||
}
|
||||
})();
|
||||
|
||||
(function(window, document, plupload, undef) {
|
||||
var blobs = {};
|
||||
|
||||
function scaleImage(image_blob, resize, mime) {
|
||||
var percentage, canvas, context, scale;
|
||||
|
||||
// Setup canvas and scale
|
||||
canvas = google.gears.factory.create('beta.canvas');
|
||||
try {
|
||||
canvas.decode(image_blob);
|
||||
|
||||
if (!resize['width']) {
|
||||
resize['width'] = canvas.width;
|
||||
}
|
||||
|
||||
if (!resize['height']) {
|
||||
resize['height'] = canvas.height;
|
||||
}
|
||||
|
||||
scale = Math.min(width / canvas.width, height / canvas.height);
|
||||
|
||||
if (scale < 1 || (scale === 1 && mime === 'image/jpeg')) {
|
||||
canvas.resize(Math.round(canvas.width * scale), Math.round(canvas.height * scale));
|
||||
|
||||
if (resize['quality']) {
|
||||
return canvas.encode(mime, {quality : resize.quality / 100});
|
||||
}
|
||||
|
||||
return canvas.encode(mime);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore for example when a user uploads a file that can't be decoded
|
||||
}
|
||||
|
||||
return image_blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gears implementation. This runtime supports these features: dragdrop, jpgresize, pngresize, chunks.
|
||||
*
|
||||
* @static
|
||||
* @class plupload.runtimes.Gears
|
||||
* @extends plupload.Runtime
|
||||
*/
|
||||
plupload.runtimes.Gears = plupload.addRuntime("gears", {
|
||||
/**
|
||||
* Returns a list of supported features for the runtime.
|
||||
*
|
||||
* @return {Object} Name/value object with supported features.
|
||||
*/
|
||||
getFeatures : function() {
|
||||
return {
|
||||
dragdrop: true,
|
||||
jpgresize: true,
|
||||
pngresize: true,
|
||||
chunks: true,
|
||||
progress: true,
|
||||
multipart: true
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the upload runtime.
|
||||
*
|
||||
* @method init
|
||||
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
|
||||
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
|
||||
*/
|
||||
init : function(uploader, callback) {
|
||||
var desktop;
|
||||
|
||||
// Check for gears support
|
||||
if (!window.google || !google.gears) {
|
||||
return callback({success : false});
|
||||
}
|
||||
|
||||
try {
|
||||
desktop = google.gears.factory.create('beta.desktop');
|
||||
} catch (e) {
|
||||
// Might fail on the latest Gecko build for some odd reason
|
||||
return callback({success : false});
|
||||
}
|
||||
|
||||
function addSelectedFiles(selected_files) {
|
||||
var file, i, files = [], id;
|
||||
|
||||
// Add the selected files to the file queue
|
||||
for (i = 0; i < selected_files.length; i++) {
|
||||
file = selected_files[i];
|
||||
|
||||
// Store away gears blob internally
|
||||
id = plupload.guid();
|
||||
blobs[id] = file.blob;
|
||||
|
||||
files.push(new plupload.File(id, file.name, file.blob.length));
|
||||
}
|
||||
|
||||
// Fire FilesAdded event
|
||||
uploader.trigger("FilesAdded", files);
|
||||
}
|
||||
|
||||
// Add drop handler
|
||||
uploader.bind("PostInit", function() {
|
||||
var settings = uploader.settings, dropElm = document.getElementById(settings.drop_element);
|
||||
|
||||
if (dropElm) {
|
||||
// Block browser default drag over
|
||||
plupload.addEvent(dropElm, 'dragover', function(e) {
|
||||
desktop.setDropEffect(e, 'copy');
|
||||
e.preventDefault();
|
||||
}, uploader.id);
|
||||
|
||||
// Attach drop handler and grab files from Gears
|
||||
plupload.addEvent(dropElm, 'drop', function(e) {
|
||||
var dragData = desktop.getDragData(e, 'application/x-gears-files');
|
||||
|
||||
if (dragData) {
|
||||
addSelectedFiles(dragData.files);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}, uploader.id);
|
||||
|
||||
// Prevent IE leak
|
||||
dropElm = 0;
|
||||
}
|
||||
|
||||
// Add browse button
|
||||
plupload.addEvent(document.getElementById(settings.browse_button), 'click', function(e) {
|
||||
var filters = [], i, a, ext;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
for (i = 0; i < settings.filters.length; i++) {
|
||||
ext = settings.filters[i].extensions.split(',');
|
||||
|
||||
for (a = 0; a < ext.length; a++) {
|
||||
filters.push('.' + ext[a]);
|
||||
}
|
||||
}
|
||||
|
||||
desktop.openFiles(addSelectedFiles, {singleFile : !settings.multi_selection, filter : filters});
|
||||
}, uploader.id);
|
||||
});
|
||||
|
||||
uploader.bind("UploadFile", function(up, file) {
|
||||
var chunk = 0, chunks, chunkSize, loaded = 0, resize = up.settings.resize, chunking;
|
||||
|
||||
// If file is png or jpeg and resize is configured then resize it
|
||||
if (resize && /\.(png|jpg|jpeg)$/i.test(file.name)) {
|
||||
blobs[file.id] = scaleImage(blobs[file.id], resize, /\.png$/i.test(file.name) ? 'image/png' : 'image/jpeg');
|
||||
}
|
||||
|
||||
file.size = blobs[file.id].length;
|
||||
|
||||
chunkSize = up.settings.chunk_size;
|
||||
chunking = chunkSize > 0;
|
||||
chunks = Math.ceil(file.size / chunkSize);
|
||||
|
||||
// If chunking is disabled then upload the whole file in one huge chunk
|
||||
if (!chunking) {
|
||||
chunkSize = file.size;
|
||||
chunks = 1;
|
||||
}
|
||||
|
||||
function uploadNextChunk() {
|
||||
var req, curChunkSize, multipart = up.settings.multipart, multipartLength = 0, reqArgs = {name : file.target_name || file.name}, url = up.settings.url;
|
||||
|
||||
// Sends the binary blob multipart encoded or raw depending on config
|
||||
function sendBinaryBlob(blob) {
|
||||
var builder, boundary = '----pluploadboundary' + plupload.guid(), dashdash = '--', crlf = '\r\n', multipartBlob, mimeType;
|
||||
|
||||
// Build multipart request
|
||||
if (multipart) {
|
||||
req.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
|
||||
builder = google.gears.factory.create('beta.blobbuilder');
|
||||
|
||||
// Append mutlipart parameters
|
||||
plupload.each(plupload.extend(reqArgs, up.settings.multipart_params), function(value, name) {
|
||||
builder.append(
|
||||
dashdash + boundary + crlf +
|
||||
'Content-Disposition: form-data; name="' + name + '"' + crlf + crlf
|
||||
);
|
||||
|
||||
builder.append(value + crlf);
|
||||
});
|
||||
|
||||
mimeType = plupload.mimeTypes[file.name.replace(/^.+\.([^.]+)/, '$1').toLowerCase()] || 'application/octet-stream';
|
||||
|
||||
// Add file header
|
||||
builder.append(
|
||||
dashdash + boundary + crlf +
|
||||
'Content-Disposition: form-data; name="' + up.settings.file_data_name + '"; filename="' + file.name + '"' + crlf +
|
||||
'Content-Type: ' + mimeType + crlf + crlf
|
||||
);
|
||||
|
||||
// Add file data
|
||||
builder.append(blob);
|
||||
|
||||
// Add footer
|
||||
builder.append(crlf + dashdash + boundary + dashdash + crlf);
|
||||
multipartBlob = builder.getAsBlob();
|
||||
multipartLength = multipartBlob.length - blob.length;
|
||||
blob = multipartBlob;
|
||||
}
|
||||
|
||||
// Send blob or multipart blob depending on config
|
||||
req.send(blob);
|
||||
}
|
||||
|
||||
// File upload finished
|
||||
if (file.status == plupload.DONE || file.status == plupload.FAILED || up.state == plupload.STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only add chunking args if needed
|
||||
if (chunking) {
|
||||
reqArgs.chunk = chunk;
|
||||
reqArgs.chunks = chunks;
|
||||
}
|
||||
|
||||
// Setup current chunk size
|
||||
curChunkSize = Math.min(chunkSize, file.size - (chunk * chunkSize));
|
||||
|
||||
if (!multipart) {
|
||||
url = plupload.buildUrl(up.settings.url, reqArgs);
|
||||
}
|
||||
|
||||
req = google.gears.factory.create('beta.httprequest');
|
||||
req.open('POST', url);
|
||||
|
||||
// Add disposition and type if multipart is disabled
|
||||
if (!multipart) {
|
||||
req.setRequestHeader('Content-Disposition', 'attachment; filename="' + file.name + '"');
|
||||
req.setRequestHeader('Content-Type', 'application/octet-stream');
|
||||
}
|
||||
|
||||
// Set custom headers
|
||||
plupload.each(up.settings.headers, function(value, name) {
|
||||
req.setRequestHeader(name, value);
|
||||
});
|
||||
|
||||
req.upload.onprogress = function(progress) {
|
||||
file.loaded = loaded + progress.loaded - multipartLength;
|
||||
up.trigger('UploadProgress', file);
|
||||
};
|
||||
|
||||
req.onreadystatechange = function() {
|
||||
var chunkArgs;
|
||||
|
||||
if (req.readyState == 4) {
|
||||
if (req.status == 200) {
|
||||
chunkArgs = {
|
||||
chunk : chunk,
|
||||
chunks : chunks,
|
||||
response : req.responseText,
|
||||
status : req.status
|
||||
};
|
||||
|
||||
up.trigger('ChunkUploaded', file, chunkArgs);
|
||||
|
||||
// Stop upload
|
||||
if (chunkArgs.cancelled) {
|
||||
file.status = plupload.FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
loaded += curChunkSize;
|
||||
|
||||
if (++chunk >= chunks) {
|
||||
file.status = plupload.DONE;
|
||||
up.trigger('FileUploaded', file, {
|
||||
response : req.responseText,
|
||||
status : req.status
|
||||
});
|
||||
} else {
|
||||
uploadNextChunk();
|
||||
}
|
||||
} else {
|
||||
up.trigger('Error', {
|
||||
code : plupload.HTTP_ERROR,
|
||||
message : plupload.translate('HTTP Error.'),
|
||||
file : file,
|
||||
chunk : chunk,
|
||||
chunks : chunks,
|
||||
status : req.status
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (chunk < chunks) {
|
||||
sendBinaryBlob(blobs[file.id].slice(chunk * chunkSize, curChunkSize));
|
||||
}
|
||||
}
|
||||
|
||||
// Start uploading chunks
|
||||
uploadNextChunk();
|
||||
});
|
||||
|
||||
uploader.bind("Destroy", function(up) {
|
||||
var name, element,
|
||||
elements = {
|
||||
browseButton: up.settings.browse_button,
|
||||
dropElm: up.settings.drop_element
|
||||
};
|
||||
|
||||
// Unbind event handlers
|
||||
for (name in elements) {
|
||||
element = document.getElementById(elements[name]);
|
||||
if (element) {
|
||||
plupload.removeAllEvents(element, up.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
callback({success : true});
|
||||
}
|
||||
});
|
||||
})(window, document, plupload);
|
||||
@ -1 +0,0 @@
|
||||
(function(e,b,c,d){var f={};function a(l,h,o,n,g){var p,j,i,k;j=google.gears.factory.create("beta.canvas");try{j.decode(l);k=Math.min(h/j.width,o/j.height);if(k<1){j.resize(Math.round(j.width*k),Math.round(j.height*k));return j.encode(g,{quality:n/100})}}catch(m){}return l}c.runtimes.Gears=c.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(i,k){var j;if(!e.google||!google.gears){return k({success:false})}try{j=google.gears.factory.create("beta.desktop")}catch(h){return k({success:false})}function g(n){var m,l,o=[],p;for(l=0;l<n.length;l++){m=n[l];p=c.guid();f[p]=m.blob;o.push(new c.File(p,m.name,m.blob.length))}i.trigger("FilesAdded",o)}i.bind("PostInit",function(){var m=i.settings,l=b.getElementById(m.drop_element);if(l){c.addEvent(l,"dragover",function(n){j.setDropEffect(n,"copy");n.preventDefault()},i.id);c.addEvent(l,"drop",function(o){var n=j.getDragData(o,"application/x-gears-files");if(n){g(n.files)}o.preventDefault()},i.id);l=0}c.addEvent(b.getElementById(m.browse_button),"click",function(r){var q=[],o,n,p;r.preventDefault();for(o=0;o<m.filters.length;o++){p=m.filters[o].extensions.split(",");for(n=0;n<p.length;n++){q.push("."+p[n])}}j.openFiles(g,{singleFile:!m.multi_selection,filter:q})},i.id)});i.bind("UploadFile",function(r,o){var t=0,s,p,q=0,n=r.settings.resize,l;if(n&&/\.(png|jpg|jpeg)$/i.test(o.name)){f[o.id]=a(f[o.id],n.width,n.height,n.quality||90,/\.png$/i.test(o.name)?"image/png":"image/jpeg")}o.size=f[o.id].length;p=r.settings.chunk_size;l=p>0;s=Math.ceil(o.size/p);if(!l){p=o.size;s=1}function m(){var y,A,v=r.settings.multipart,u=0,z={name:o.target_name||o.name},w=r.settings.url;function x(C){var B,H="----pluploadboundary"+c.guid(),E="--",G="\r\n",D,F;if(v){y.setRequestHeader("Content-Type","multipart/form-data; boundary="+H);B=google.gears.factory.create("beta.blobbuilder");c.each(c.extend(z,r.settings.multipart_params),function(J,I){B.append(E+H+G+'Content-Disposition: form-data; name="'+I+'"'+G+G);B.append(J+G)});F=c.mimeTypes[o.name.replace(/^.+\.([^.]+)/,"$1")]||"application/octet-stream";B.append(E+H+G+'Content-Disposition: form-data; name="'+r.settings.file_data_name+'"; filename="'+o.name+'"'+G+"Content-Type: "+F+G+G);B.append(C);B.append(G+E+H+E+G);D=B.getAsBlob();u=D.length-C.length;C=D}y.send(C)}if(o.status==c.DONE||o.status==c.FAILED||r.state==c.STOPPED){return}if(l){z.chunk=t;z.chunks=s}A=Math.min(p,o.size-(t*p));if(!v){w=c.buildUrl(r.settings.url,z)}y=google.gears.factory.create("beta.httprequest");y.open("POST",w);if(!v){y.setRequestHeader("Content-Disposition",'attachment; filename="'+o.name+'"');y.setRequestHeader("Content-Type","application/octet-stream")}c.each(r.settings.headers,function(C,B){y.setRequestHeader(B,C)});y.upload.onprogress=function(B){o.loaded=q+B.loaded-u;r.trigger("UploadProgress",o)};y.onreadystatechange=function(){var B;if(y.readyState==4){if(y.status==200){B={chunk:t,chunks:s,response:y.responseText,status:y.status};r.trigger("ChunkUploaded",o,B);if(B.cancelled){o.status=c.FAILED;return}q+=A;if(++t>=s){o.status=c.DONE;r.trigger("FileUploaded",o,{response:y.responseText,status:y.status})}else{m()}}else{r.trigger("Error",{code:c.HTTP_ERROR,message:c.translate("HTTP Error."),file:o,chunk:t,chunks:s,status:y.status})}}};if(t<s){x(f[o.id].slice(t*p,A))}}m()});i.bind("Destroy",function(l){var m,n,o={browseButton:l.settings.browse_button,dropElm:l.settings.drop_element};for(m in o){n=b.getElementById(o[m]);if(n){c.removeAllEvents(n,l.id)}}});k({success:true})}})})(window,document,plupload);
|
||||
413
assets/javascripts/plupload/plupload.html4.js
Normal file
413
assets/javascripts/plupload/plupload.html4.js
Normal file
@ -0,0 +1,413 @@
|
||||
/**
|
||||
* plupload.html4.js
|
||||
*
|
||||
* Copyright 2010, Ryan Demmer
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under GPL License.
|
||||
*
|
||||
* License: http://www.plupload.com/license
|
||||
* Contributing: http://www.plupload.com/contributing
|
||||
*/
|
||||
|
||||
// JSLint defined globals
|
||||
/*global plupload:false, window:false */
|
||||
|
||||
(function(window, document, plupload, undef) {
|
||||
function getById(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* HTML4 implementation. This runtime has no special features it uses an form that posts files into an hidden iframe.
|
||||
*
|
||||
* @static
|
||||
* @class plupload.runtimes.Html4
|
||||
* @extends plupload.Runtime
|
||||
*/
|
||||
plupload.runtimes.Html4 = plupload.addRuntime("html4", {
|
||||
/**
|
||||
* Returns a list of supported features for the runtime.
|
||||
*
|
||||
* @return {Object} Name/value object with supported features.
|
||||
*/
|
||||
getFeatures : function() {
|
||||
// Only multipart feature
|
||||
return {
|
||||
multipart: true,
|
||||
|
||||
/* WebKit let you trigger file dialog programmatically while FF and Opera - do not, so we
|
||||
sniff for it here... probably not that good idea, but impossibillity of controlling cursor style
|
||||
on top of add files button obviously feels even worse */
|
||||
canOpenDialog: navigator.userAgent.indexOf('WebKit') !== -1
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the upload runtime.
|
||||
*
|
||||
* @method init
|
||||
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
|
||||
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
|
||||
*/
|
||||
init : function(uploader, callback) {
|
||||
uploader.bind("Init", function(up) {
|
||||
var container = document.body, iframe, url = "javascript", currentFile,
|
||||
input, currentFileId, fileIds = [], IE = /MSIE/.test(navigator.userAgent), mimes = [],
|
||||
filters = up.settings.filters, i, ext, type, y;
|
||||
|
||||
// Convert extensions to mime types list
|
||||
no_type_restriction:
|
||||
for (i = 0; i < filters.length; i++) {
|
||||
ext = filters[i].extensions.split(/,/);
|
||||
|
||||
for (y = 0; y < ext.length; y++) {
|
||||
|
||||
// If there's an asterisk in the list, then accept attribute is not required
|
||||
if (ext[y] === '*') {
|
||||
mimes = [];
|
||||
break no_type_restriction;
|
||||
}
|
||||
|
||||
type = plupload.mimeTypes[ext[y]];
|
||||
|
||||
if (type) {
|
||||
mimes.push(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mimes = mimes.join(',');
|
||||
|
||||
function createForm() {
|
||||
var form, input, bgcolor, browseButton;
|
||||
|
||||
// Setup unique id for form
|
||||
currentFileId = plupload.guid();
|
||||
|
||||
// Save id for Destroy handler
|
||||
fileIds.push(currentFileId);
|
||||
|
||||
// Create form
|
||||
form = document.createElement('form');
|
||||
form.setAttribute('id', 'form_' + currentFileId);
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('enctype', 'multipart/form-data');
|
||||
form.setAttribute('encoding', 'multipart/form-data');
|
||||
form.setAttribute("target", up.id + '_iframe');
|
||||
form.style.position = 'absolute';
|
||||
|
||||
// Create input and set attributes
|
||||
input = document.createElement('input');
|
||||
input.setAttribute('id', 'input_' + currentFileId);
|
||||
input.setAttribute('type', 'file');
|
||||
input.setAttribute('accept', mimes);
|
||||
input.setAttribute('size', 1);
|
||||
|
||||
browseButton = getById(up.settings.browse_button);
|
||||
|
||||
// Route click event to input element programmatically, if possible
|
||||
if (up.features.canOpenDialog && browseButton) {
|
||||
plupload.addEvent(getById(up.settings.browse_button), 'click', function(e) {
|
||||
input.click();
|
||||
e.preventDefault();
|
||||
}, up.id);
|
||||
}
|
||||
|
||||
// Set input styles
|
||||
plupload.extend(input.style, {
|
||||
width : '100%',
|
||||
height : '100%',
|
||||
opacity : 0,
|
||||
fontSize: '99px' // force input element to be bigger then needed to occupy whole space
|
||||
});
|
||||
|
||||
plupload.extend(form.style, {
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
// Show the container if shim_bgcolor is specified
|
||||
bgcolor = up.settings.shim_bgcolor;
|
||||
if (bgcolor) {
|
||||
form.style.background = bgcolor;
|
||||
}
|
||||
|
||||
// no opacity in IE
|
||||
if (IE) {
|
||||
plupload.extend(input.style, {
|
||||
filter : "alpha(opacity=0)"
|
||||
});
|
||||
}
|
||||
|
||||
// add change event
|
||||
plupload.addEvent(input, 'change', function(e) {
|
||||
var element = e.target, name, files = [], topElement;
|
||||
|
||||
if (element.value) {
|
||||
getById('form_' + currentFileId).style.top = -0xFFFFF + "px";
|
||||
|
||||
// Get file name
|
||||
name = element.value.replace(/\\/g, '/');
|
||||
name = name.substring(name.length, name.lastIndexOf('/') + 1);
|
||||
|
||||
// Push files
|
||||
files.push(new plupload.File(currentFileId, name));
|
||||
|
||||
// Clean-up events - they won't be needed anymore
|
||||
if (!up.features.canOpenDialog) {
|
||||
plupload.removeAllEvents(form, up.id);
|
||||
} else {
|
||||
plupload.removeEvent(browseButton, 'click', up.id);
|
||||
}
|
||||
plupload.removeEvent(input, 'change', up.id);
|
||||
|
||||
// Create and position next form
|
||||
createForm();
|
||||
|
||||
// Fire FilesAdded event
|
||||
if (files.length) {
|
||||
uploader.trigger("FilesAdded", files);
|
||||
}
|
||||
}
|
||||
}, up.id);
|
||||
|
||||
// append to container
|
||||
form.appendChild(input);
|
||||
container.appendChild(form);
|
||||
|
||||
up.refresh();
|
||||
}
|
||||
|
||||
|
||||
function createIframe() {
|
||||
var temp = document.createElement('div');
|
||||
|
||||
// Create iframe using a temp div since IE 6 won't be able to set the name using setAttribute or iframe.name
|
||||
temp.innerHTML = '<iframe id="' + up.id + '_iframe" name="' + up.id + '_iframe" src="' + url + ':""" style="display:none"></iframe>';
|
||||
iframe = temp.firstChild;
|
||||
container.appendChild(iframe);
|
||||
|
||||
// Add IFrame onload event
|
||||
plupload.addEvent(iframe, 'load', function(e) {
|
||||
var n = e.target, el, result;
|
||||
|
||||
// Ignore load event if there is no file
|
||||
if (!currentFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
el = n.contentWindow.document || n.contentDocument || window.frames[n.id].document;
|
||||
} catch (ex) {
|
||||
// Probably a permission denied error
|
||||
up.trigger('Error', {
|
||||
code : plupload.SECURITY_ERROR,
|
||||
message : plupload.translate('Security error.'),
|
||||
file : currentFile
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get result
|
||||
result = el.documentElement.innerText || el.documentElement.textContent;
|
||||
|
||||
// Assume no error
|
||||
if (result) {
|
||||
currentFile.status = plupload.DONE;
|
||||
currentFile.loaded = 1025;
|
||||
currentFile.percent = 100;
|
||||
|
||||
up.trigger('UploadProgress', currentFile);
|
||||
up.trigger('FileUploaded', currentFile, {
|
||||
response : result
|
||||
});
|
||||
}
|
||||
}, up.id);
|
||||
} // end createIframe
|
||||
|
||||
if (up.settings.container) {
|
||||
container = getById(up.settings.container);
|
||||
if (plupload.getStyle(container, 'position') === 'static') {
|
||||
container.style.position = 'relative';
|
||||
}
|
||||
}
|
||||
|
||||
// Upload file
|
||||
up.bind("UploadFile", function(up, file) {
|
||||
var form, input;
|
||||
|
||||
// File upload finished
|
||||
if (file.status == plupload.DONE || file.status == plupload.FAILED || up.state == plupload.STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the form and input elements
|
||||
form = getById('form_' + file.id);
|
||||
input = getById('input_' + file.id);
|
||||
|
||||
// Set input element name attribute which allows it to be submitted
|
||||
input.setAttribute('name', up.settings.file_data_name);
|
||||
|
||||
// Store action
|
||||
form.setAttribute("action", up.settings.url);
|
||||
|
||||
// Append multipart parameters
|
||||
plupload.each(plupload.extend({name : file.target_name || file.name}, up.settings.multipart_params), function(value, name) {
|
||||
var hidden = document.createElement('input');
|
||||
|
||||
plupload.extend(hidden, {
|
||||
type : 'hidden',
|
||||
name : name,
|
||||
value : value
|
||||
});
|
||||
|
||||
form.insertBefore(hidden, form.firstChild);
|
||||
});
|
||||
|
||||
currentFile = file;
|
||||
|
||||
// Hide the current form
|
||||
getById('form_' + currentFileId).style.top = -0xFFFFF + "px";
|
||||
|
||||
form.submit();
|
||||
form.parentNode.removeChild(form);
|
||||
});
|
||||
|
||||
|
||||
|
||||
up.bind('FileUploaded', function(up) {
|
||||
up.refresh(); // just to get the form back on top of browse_button
|
||||
});
|
||||
|
||||
up.bind('StateChanged', function(up) {
|
||||
if (up.state == plupload.STARTED) {
|
||||
createIframe();
|
||||
}
|
||||
|
||||
if (up.state == plupload.STOPPED) {
|
||||
window.setTimeout(function() {
|
||||
plupload.removeEvent(iframe, 'load', up.id);
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
// Refresh button, will reposition the input form
|
||||
up.bind("Refresh", function(up) {
|
||||
var browseButton, topElement, hoverClass, activeClass, browsePos, browseSize, inputContainer, inputFile, pzIndex;
|
||||
|
||||
browseButton = getById(up.settings.browse_button);
|
||||
if (browseButton) {
|
||||
browsePos = plupload.getPos(browseButton, getById(up.settings.container));
|
||||
browseSize = plupload.getSize(browseButton);
|
||||
inputContainer = getById('form_' + currentFileId);
|
||||
inputFile = getById('input_' + currentFileId);
|
||||
|
||||
plupload.extend(inputContainer.style, {
|
||||
top : browsePos.y + 'px',
|
||||
left : browsePos.x + 'px',
|
||||
width : browseSize.w + 'px',
|
||||
height : browseSize.h + 'px'
|
||||
});
|
||||
|
||||
// for IE and WebKit place input element underneath the browse button and route onclick event
|
||||
// TODO: revise when browser support for this feature will change
|
||||
if (up.features.canOpenDialog) {
|
||||
pzIndex = parseInt(browseButton.parentNode.style.zIndex, 10);
|
||||
|
||||
if (isNaN(pzIndex)) {
|
||||
pzIndex = 0;
|
||||
}
|
||||
|
||||
plupload.extend(browseButton.style, {
|
||||
zIndex : pzIndex
|
||||
});
|
||||
|
||||
if (plupload.getStyle(browseButton, 'position') === 'static') {
|
||||
plupload.extend(browseButton.style, {
|
||||
position : 'relative'
|
||||
});
|
||||
}
|
||||
|
||||
plupload.extend(inputContainer.style, {
|
||||
zIndex : pzIndex - 1
|
||||
});
|
||||
}
|
||||
|
||||
/* Since we have to place input[type=file] on top of the browse_button for some browsers (FF, Opera),
|
||||
browse_button loses interactivity, here we try to neutralize this issue highlighting browse_button
|
||||
with a special class
|
||||
TODO: needs to be revised as things will change */
|
||||
hoverClass = up.settings.browse_button_hover;
|
||||
activeClass = up.settings.browse_button_active;
|
||||
topElement = up.features.canOpenDialog ? browseButton : inputContainer;
|
||||
|
||||
if (hoverClass) {
|
||||
plupload.addEvent(topElement, 'mouseover', function() {
|
||||
plupload.addClass(browseButton, hoverClass);
|
||||
}, up.id);
|
||||
plupload.addEvent(topElement, 'mouseout', function() {
|
||||
plupload.removeClass(browseButton, hoverClass);
|
||||
}, up.id);
|
||||
}
|
||||
|
||||
if (activeClass) {
|
||||
plupload.addEvent(topElement, 'mousedown', function() {
|
||||
plupload.addClass(browseButton, activeClass);
|
||||
}, up.id);
|
||||
plupload.addEvent(document.body, 'mouseup', function() {
|
||||
plupload.removeClass(browseButton, activeClass);
|
||||
}, up.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Remove files
|
||||
uploader.bind("FilesRemoved", function(up, files) {
|
||||
var i, n;
|
||||
|
||||
for (i = 0; i < files.length; i++) {
|
||||
n = getById('form_' + files[i].id);
|
||||
if (n) {
|
||||
n.parentNode.removeChild(n);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Completely destroy the runtime
|
||||
uploader.bind("Destroy", function(up) {
|
||||
var name, element, form,
|
||||
elements = {
|
||||
inputContainer: 'form_' + currentFileId,
|
||||
inputFile: 'input_' + currentFileId,
|
||||
browseButton: up.settings.browse_button
|
||||
};
|
||||
|
||||
// Unbind event handlers
|
||||
for (name in elements) {
|
||||
element = getById(elements[name]);
|
||||
if (element) {
|
||||
plupload.removeAllEvents(element, up.id);
|
||||
}
|
||||
}
|
||||
plupload.removeAllEvents(document.body, up.id);
|
||||
|
||||
// Remove mark-up
|
||||
plupload.each(fileIds, function(id, i) {
|
||||
form = getById('form_' + id);
|
||||
if (form) {
|
||||
container.removeChild(form);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Create initial form
|
||||
createForm();
|
||||
});
|
||||
|
||||
callback({success : true});
|
||||
}
|
||||
});
|
||||
})(window, document, plupload);
|
||||
@ -1 +0,0 @@
|
||||
(function(d,a,b,c){function e(f){return a.getElementById(f)}b.runtimes.Html4=b.addRuntime("html4",{getFeatures:function(){return{multipart:true,canOpenDialog:navigator.userAgent.indexOf("WebKit")!==-1}},init:function(f,g){f.bind("Init",function(p){var j=a.body,n,h="javascript",k,x,q,z=[],r=/MSIE/.test(navigator.userAgent),t=[],m=p.settings.filters,o,l,s,w;for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(w=0;w<l.length;w++){s=b.mimeTypes[l[w]];if(s){t.push(s)}}}t=t.join(",");function v(){var B,y,i,A;q=b.guid();z.push(q);B=a.createElement("form");B.setAttribute("id","form_"+q);B.setAttribute("method","post");B.setAttribute("enctype","multipart/form-data");B.setAttribute("encoding","multipart/form-data");B.setAttribute("target",p.id+"_iframe");B.style.position="absolute";y=a.createElement("input");y.setAttribute("id","input_"+q);y.setAttribute("type","file");y.setAttribute("accept",t);y.setAttribute("size",1);A=e(p.settings.browse_button);if(p.features.canOpenDialog&&A){b.addEvent(e(p.settings.browse_button),"click",function(C){y.click();C.preventDefault()},p.id)}b.extend(y.style,{width:"100%",height:"100%",opacity:0,fontSize:"2em"});b.extend(B.style,{overflow:"hidden"});i=p.settings.shim_bgcolor;if(i){B.style.background=i}if(r){b.extend(y.style,{filter:"alpha(opacity=0)"})}b.addEvent(y,"change",function(F){var D=F.target,C,E=[],G;if(D.value){e("form_"+q).style.top=-1048575+"px";C=D.value.replace(/\\/g,"/");C=C.substring(C.length,C.lastIndexOf("/")+1);E.push(new b.File(q,C));if(!p.features.canOpenDialog){b.removeAllEvents(B,p.id)}else{b.removeEvent(A,"click",p.id)}b.removeEvent(y,"change",p.id);v();if(E.length){f.trigger("FilesAdded",E)}}},p.id);B.appendChild(y);j.appendChild(B);p.refresh()}function u(){var i=a.createElement("div");i.innerHTML='<iframe id="'+p.id+'_iframe" name="'+p.id+'_iframe" src="'+h+':""" style="display:none"></iframe>';n=i.firstChild;j.appendChild(n);b.addEvent(n,"load",function(C){var D=C.target,B,y;if(!k){return}try{B=D.contentWindow.document||D.contentDocument||d.frames[D.id].document}catch(A){p.trigger("Error",{code:b.SECURITY_ERROR,message:b.translate("Security error."),file:k});return}y=B.documentElement.innerText||B.documentElement.textContent;if(y){k.status=b.DONE;k.loaded=1025;k.percent=100;p.trigger("UploadProgress",k);p.trigger("FileUploaded",k,{response:y})}},p.id)}if(p.settings.container){j=e(p.settings.container);j.style.position="relative"}p.bind("UploadFile",function(i,A){var B,y;if(A.status==b.DONE||A.status==b.FAILED||i.state==b.STOPPED){return}B=e("form_"+A.id);y=e("input_"+A.id);y.setAttribute("name",i.settings.file_data_name);B.setAttribute("action",i.settings.url);b.each(b.extend({name:A.target_name||A.name},i.settings.multipart_params),function(E,C){var D=a.createElement("input");b.extend(D,{type:"hidden",name:C,value:E});B.insertBefore(D,B.firstChild)});k=A;e("form_"+q).style.top=-1048575+"px";B.submit();B.parentNode.removeChild(B)});p.bind("FileUploaded",function(i){i.refresh()});p.bind("StateChanged",function(i){if(i.state==b.STARTED){u()}if(i.state==b.STOPPED){d.setTimeout(function(){b.removeEvent(n,"load",i.id);n.parentNode.removeChild(n)},0)}});p.bind("Refresh",function(A){var F,B,C,D,i,G,H,E,y;F=e(A.settings.browse_button);if(F){i=b.getPos(F,e(A.settings.container));G=b.getSize(F);H=e("form_"+q);E=e("input_"+q);b.extend(H.style,{top:i.y+"px",left:i.x+"px",width:G.w+"px",height:G.h+"px"});if(A.features.canOpenDialog){y=parseInt(F.parentNode.style.zIndex,10);if(isNaN(y)){y=0}b.extend(F.style,{position:"relative",zIndex:y});b.extend(H.style,{zIndex:y-1})}C=A.settings.browse_button_hover;D=A.settings.browse_button_active;B=A.features.canOpenDialog?F:H;if(C){b.addEvent(B,"mouseover",function(){b.addClass(F,C)},A.id);b.addEvent(B,"mouseout",function(){b.removeClass(F,C)},A.id)}if(D){b.addEvent(B,"mousedown",function(){b.addClass(F,D)},A.id);b.addEvent(a.body,"mouseup",function(){b.removeClass(F,D)},A.id)}}});f.bind("FilesRemoved",function(y,B){var A,C;for(A=0;A<B.length;A++){C=e("form_"+B[A].id);if(C){C.parentNode.removeChild(C)}}});f.bind("Destroy",function(i){var y,A,B,C={inputContainer:"form_"+q,inputFile:"input_"+q,browseButton:i.settings.browse_button};for(y in C){A=e(C[y]);if(A){b.removeAllEvents(A,i.id)}}b.removeAllEvents(a.body,i.id);b.each(z,function(E,D){B=e("form_"+E);if(B){j.removeChild(B)}})});v()});g({success:true})}})})(window,document,plupload);
|
||||
1315
assets/javascripts/plupload/plupload.html5.js
Normal file
1315
assets/javascripts/plupload/plupload.html5.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
1680
assets/javascripts/plupload/plupload.js
Normal file
1680
assets/javascripts/plupload/plupload.js
Normal file
File diff suppressed because it is too large
Load Diff
2
assets/javascripts/plupload/plupload.min.js
vendored
2
assets/javascripts/plupload/plupload.min.js
vendored
File diff suppressed because one or more lines are too long
439
assets/javascripts/plupload/plupload.silverlight.js
Normal file
439
assets/javascripts/plupload/plupload.silverlight.js
Normal file
@ -0,0 +1,439 @@
|
||||
/**
|
||||
* plupload.silverlight.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under GPL License.
|
||||
*
|
||||
* License: http://www.plupload.com/license
|
||||
* Contributing: http://www.plupload.com/contributing
|
||||
*/
|
||||
|
||||
// JSLint defined globals
|
||||
/*global window:false, document:false, plupload:false, ActiveXObject:false */
|
||||
|
||||
(function(window, document, plupload, undef) {
|
||||
var uploadInstances = {}, initialized = {};
|
||||
|
||||
function jsonSerialize(obj) {
|
||||
var value, type = typeof obj, isArray, i, key;
|
||||
|
||||
// Encode strings
|
||||
if (type === 'string') {
|
||||
value = '\bb\tt\nn\ff\rr\""\'\'\\\\';
|
||||
|
||||
return '"' + obj.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {
|
||||
var idx = value.indexOf(b);
|
||||
|
||||
if (idx + 1) {
|
||||
return '\\' + value.charAt(idx + 1);
|
||||
}
|
||||
|
||||
a = b.charCodeAt().toString(16);
|
||||
|
||||
return '\\u' + '0000'.substring(a.length) + a;
|
||||
}) + '"';
|
||||
}
|
||||
|
||||
// Loop objects/arrays
|
||||
if (type == 'object') {
|
||||
isArray = obj.length !== undef;
|
||||
value = '';
|
||||
|
||||
if (isArray) {
|
||||
for (i = 0; i < obj.length; i++) {
|
||||
if (value) {
|
||||
value += ',';
|
||||
}
|
||||
|
||||
value += jsonSerialize(obj[i]);
|
||||
}
|
||||
|
||||
value = '[' + value + ']';
|
||||
} else {
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (value) {
|
||||
value += ',';
|
||||
}
|
||||
|
||||
value += jsonSerialize(key) + ':' + jsonSerialize(obj[key]);
|
||||
}
|
||||
}
|
||||
|
||||
value = '{' + value + '}';
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Treat undefined as null
|
||||
if (obj === undef) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Convert all other types to string
|
||||
return '' + obj;
|
||||
}
|
||||
|
||||
function isInstalled(version) {
|
||||
var isVersionSupported = false, container = null, control = null, actualVer,
|
||||
actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
control = new ActiveXObject('AgControl.AgControl');
|
||||
|
||||
if (control.IsVersionSupported(version)) {
|
||||
isVersionSupported = true;
|
||||
}
|
||||
|
||||
control = null;
|
||||
} catch (e) {
|
||||
var plugin = navigator.plugins["Silverlight Plug-In"];
|
||||
|
||||
if (plugin) {
|
||||
actualVer = plugin.description;
|
||||
|
||||
if (actualVer === "1.0.30226.2") {
|
||||
actualVer = "2.0.30226.2";
|
||||
}
|
||||
|
||||
actualVerArray = actualVer.split(".");
|
||||
|
||||
while (actualVerArray.length > 3) {
|
||||
actualVerArray.pop();
|
||||
}
|
||||
|
||||
while ( actualVerArray.length < 4) {
|
||||
actualVerArray.push(0);
|
||||
}
|
||||
|
||||
reqVerArray = version.split(".");
|
||||
|
||||
while (reqVerArray.length > 4) {
|
||||
reqVerArray.pop();
|
||||
}
|
||||
|
||||
do {
|
||||
requiredVersionPart = parseInt(reqVerArray[index], 10);
|
||||
actualVersionPart = parseInt(actualVerArray[index], 10);
|
||||
index++;
|
||||
} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
|
||||
|
||||
if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {
|
||||
isVersionSupported = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e2) {
|
||||
isVersionSupported = false;
|
||||
}
|
||||
|
||||
return isVersionSupported;
|
||||
}
|
||||
|
||||
plupload.silverlight = {
|
||||
trigger : function(id, name) {
|
||||
var uploader = uploadInstances[id], i, args;
|
||||
|
||||
if (uploader) {
|
||||
args = plupload.toArray(arguments).slice(1);
|
||||
args[0] = 'Silverlight:' + name;
|
||||
|
||||
// Detach the call so that error handling in the browser is presented correctly
|
||||
setTimeout(function() {
|
||||
uploader.trigger.apply(uploader, args);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Silverlight implementation. This runtime supports these features: jpgresize, pngresize, chunks.
|
||||
*
|
||||
* @static
|
||||
* @class plupload.runtimes.Silverlight
|
||||
* @extends plupload.Runtime
|
||||
*/
|
||||
plupload.runtimes.Silverlight = plupload.addRuntime("silverlight", {
|
||||
/**
|
||||
* Returns a list of supported features for the runtime.
|
||||
*
|
||||
* @return {Object} Name/value object with supported features.
|
||||
*/
|
||||
getFeatures : function() {
|
||||
return {
|
||||
jpgresize: true,
|
||||
pngresize: true,
|
||||
chunks: true,
|
||||
progress: true,
|
||||
multipart: true
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the upload runtime. This runtime supports these features: jpgresize, pngresize, chunks.
|
||||
*
|
||||
* @method init
|
||||
* @param {plupload.Uploader} uploader Uploader instance that needs to be initialized.
|
||||
* @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true.
|
||||
*/
|
||||
init : function(uploader, callback) {
|
||||
var silverlightContainer, filter = '', filters = uploader.settings.filters, i, container = document.body;
|
||||
|
||||
// Check if Silverlight is installed, Silverlight windowless parameter doesn't work correctly on Opera so we disable it for now
|
||||
if (!isInstalled('2.0.31005.0') || (window.opera && window.opera.buildNumber)) {
|
||||
callback({success : false});
|
||||
return;
|
||||
}
|
||||
|
||||
initialized[uploader.id] = false;
|
||||
uploadInstances[uploader.id] = uploader;
|
||||
|
||||
// Create silverlight container and insert it at an absolute position within the browse button
|
||||
silverlightContainer = document.createElement('div');
|
||||
silverlightContainer.id = uploader.id + '_silverlight_container';
|
||||
|
||||
plupload.extend(silverlightContainer.style, {
|
||||
position : 'absolute',
|
||||
top : '0px',
|
||||
background : uploader.settings.shim_bgcolor || 'transparent',
|
||||
zIndex : 99999,
|
||||
width : '100px',
|
||||
height : '100px',
|
||||
overflow : 'hidden',
|
||||
opacity : uploader.settings.shim_bgcolor || document.documentMode > 8 ? '' : 0.01 // Force transparent if bgcolor is undefined
|
||||
});
|
||||
|
||||
silverlightContainer.className = 'plupload silverlight';
|
||||
|
||||
if (uploader.settings.container) {
|
||||
container = document.getElementById(uploader.settings.container);
|
||||
if (plupload.getStyle(container, 'position') === 'static') {
|
||||
container.style.position = 'relative';
|
||||
}
|
||||
}
|
||||
|
||||
container.appendChild(silverlightContainer);
|
||||
|
||||
for (i = 0; i < filters.length; i++) {
|
||||
filter += (filter != '' ? '|' : '') + filters[i].title + " | *." + filters[i].extensions.replace(/,/g, ';*.');
|
||||
}
|
||||
|
||||
// Insert the Silverlight object inide the Silverlight container
|
||||
silverlightContainer.innerHTML = '<object id="' + uploader.id + '_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024">' +
|
||||
'<param name="source" value="' + uploader.settings.silverlight_xap_url + '"/>' +
|
||||
'<param name="background" value="Transparent"/>' +
|
||||
'<param name="windowless" value="true"/>' +
|
||||
'<param name="enablehtmlaccess" value="true"/>' +
|
||||
'<param name="initParams" value="id=' + uploader.id + ',filter=' + filter + ',multiselect=' + uploader.settings.multi_selection + '"/>' +
|
||||
'</object>';
|
||||
|
||||
function getSilverlightObj() {
|
||||
return document.getElementById(uploader.id + '_silverlight').content.Upload;
|
||||
}
|
||||
|
||||
uploader.bind("Silverlight:Init", function() {
|
||||
var selectedFiles, lookup = {};
|
||||
|
||||
// Prevent eventual reinitialization of the instance
|
||||
if (initialized[uploader.id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
initialized[uploader.id] = true;
|
||||
|
||||
uploader.bind("Silverlight:StartSelectFiles", function(up) {
|
||||
selectedFiles = [];
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:SelectFile", function(up, sl_id, name, size) {
|
||||
var id;
|
||||
|
||||
// Store away silverlight ids
|
||||
id = plupload.guid();
|
||||
lookup[id] = sl_id;
|
||||
lookup[sl_id] = id;
|
||||
|
||||
// Expose id, name and size
|
||||
selectedFiles.push(new plupload.File(id, name, size));
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:SelectSuccessful", function() {
|
||||
// Trigger FilesAdded event if we added any
|
||||
if (selectedFiles.length) {
|
||||
uploader.trigger("FilesAdded", selectedFiles);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:UploadChunkError", function(up, file_id, chunk, chunks, message) {
|
||||
uploader.trigger("Error", {
|
||||
code : plupload.IO_ERROR,
|
||||
message : 'IO Error.',
|
||||
details : message,
|
||||
file : up.getFile(lookup[file_id])
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:UploadFileProgress", function(up, sl_id, loaded, total) {
|
||||
var file = up.getFile(lookup[sl_id]);
|
||||
|
||||
if (file.status != plupload.FAILED) {
|
||||
file.size = total;
|
||||
file.loaded = loaded;
|
||||
|
||||
up.trigger('UploadProgress', file);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Refresh", function(up) {
|
||||
var browseButton, browsePos, browseSize;
|
||||
|
||||
browseButton = document.getElementById(up.settings.browse_button);
|
||||
if (browseButton) {
|
||||
browsePos = plupload.getPos(browseButton, document.getElementById(up.settings.container));
|
||||
browseSize = plupload.getSize(browseButton);
|
||||
|
||||
plupload.extend(document.getElementById(up.id + '_silverlight_container').style, {
|
||||
top : browsePos.y + 'px',
|
||||
left : browsePos.x + 'px',
|
||||
width : browseSize.w + 'px',
|
||||
height : browseSize.h + 'px'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:UploadChunkSuccessful", function(up, sl_id, chunk, chunks, text) {
|
||||
var chunkArgs, file = up.getFile(lookup[sl_id]);
|
||||
|
||||
chunkArgs = {
|
||||
chunk : chunk,
|
||||
chunks : chunks,
|
||||
response : text
|
||||
};
|
||||
|
||||
up.trigger('ChunkUploaded', file, chunkArgs);
|
||||
|
||||
// Stop upload if file is maked as failed
|
||||
if (file.status != plupload.FAILED) {
|
||||
getSilverlightObj().UploadNextChunk();
|
||||
}
|
||||
|
||||
// Last chunk then dispatch FileUploaded event
|
||||
if (chunk == chunks - 1) {
|
||||
file.status = plupload.DONE;
|
||||
|
||||
up.trigger('FileUploaded', file, {
|
||||
response : text
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Silverlight:UploadSuccessful", function(up, sl_id, response) {
|
||||
var file = up.getFile(lookup[sl_id]);
|
||||
|
||||
file.status = plupload.DONE;
|
||||
|
||||
up.trigger('FileUploaded', file, {
|
||||
response : response
|
||||
});
|
||||
});
|
||||
|
||||
uploader.bind("FilesRemoved", function(up, files) {
|
||||
var i;
|
||||
|
||||
for (i = 0; i < files.length; i++) {
|
||||
getSilverlightObj().RemoveFile(lookup[files[i].id]);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("UploadFile", function(up, file) {
|
||||
var settings = up.settings, resize = settings.resize || {};
|
||||
|
||||
getSilverlightObj().UploadFile(
|
||||
lookup[file.id],
|
||||
up.settings.url,
|
||||
jsonSerialize({
|
||||
name : file.target_name || file.name,
|
||||
mime : plupload.mimeTypes[file.name.replace(/^.+\.([^.]+)/, '$1').toLowerCase()] || 'application/octet-stream',
|
||||
chunk_size : settings.chunk_size,
|
||||
image_width : resize.width,
|
||||
image_height : resize.height,
|
||||
image_quality : resize.quality || 90,
|
||||
multipart : !!settings.multipart,
|
||||
multipart_params : settings.multipart_params || {},
|
||||
file_data_name : settings.file_data_name,
|
||||
headers : settings.headers
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
uploader.bind('Silverlight:MouseEnter', function(up) {
|
||||
var browseButton, hoverClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
hoverClass = up.settings.browse_button_hover;
|
||||
|
||||
if (browseButton && hoverClass) {
|
||||
plupload.addClass(browseButton, hoverClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Silverlight:MouseLeave', function(up) {
|
||||
var browseButton, hoverClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
hoverClass = up.settings.browse_button_hover;
|
||||
|
||||
if (browseButton && hoverClass) {
|
||||
plupload.removeClass(browseButton, hoverClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Silverlight:MouseLeftButtonDown', function(up) {
|
||||
var browseButton, activeClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
activeClass = up.settings.browse_button_active;
|
||||
|
||||
if (browseButton && activeClass) {
|
||||
plupload.addClass(browseButton, activeClass);
|
||||
|
||||
// Make sure that browse_button has active state removed from it
|
||||
plupload.addEvent(document.body, 'mouseup', function() {
|
||||
plupload.removeClass(browseButton, activeClass);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind('Sliverlight:StartSelectFiles', function(up) {
|
||||
var browseButton, activeClass;
|
||||
|
||||
browseButton = document.getElementById(uploader.settings.browse_button);
|
||||
activeClass = up.settings.browse_button_active;
|
||||
|
||||
if (browseButton && activeClass) {
|
||||
plupload.removeClass(browseButton, activeClass);
|
||||
}
|
||||
});
|
||||
|
||||
uploader.bind("Destroy", function(up) {
|
||||
var silverlightContainer;
|
||||
|
||||
plupload.removeAllEvents(document.body, up.id);
|
||||
|
||||
delete initialized[up.id];
|
||||
delete uploadInstances[up.id];
|
||||
|
||||
silverlightContainer = document.getElementById(up.id + '_silverlight_container');
|
||||
if (silverlightContainer) {
|
||||
container.removeChild(silverlightContainer);
|
||||
}
|
||||
});
|
||||
|
||||
callback({success : true});
|
||||
});
|
||||
}
|
||||
});
|
||||
})(window, document, plupload);
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -116,4 +116,13 @@ div.upload_select input, div.upload_select select {
|
||||
|
||||
input[type="checkbox"] {
|
||||
margin: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.plupload_scroll {
|
||||
max-height: 1000px;
|
||||
min-height: 175px;
|
||||
}
|
||||
|
||||
.ui-resizable-s {
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
@ -20,14 +20,14 @@ div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;}
|
||||
}
|
||||
|
||||
.plupload_header_content {
|
||||
background-image: url('../../images/plupload/plupload-bw.png');
|
||||
background-image: url('../img/plupload.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 8px center;
|
||||
min-height: 56px;
|
||||
padding-left: 60px;
|
||||
position:relative;
|
||||
}
|
||||
.plupload_header_content_bw {background-image: url('../../images/plupload/plupload-bw.png');}
|
||||
.plupload_header_content_bw {background-image: url('../img/plupload-bw.png');}
|
||||
.plupload_header_title {
|
||||
font: normal 18px sans-serif;
|
||||
padding: 6px 0 3px;
|
||||
@ -50,6 +50,7 @@ div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;}
|
||||
}
|
||||
|
||||
.plupload_scroll {
|
||||
max-height: 180px;
|
||||
min-height: 168px;
|
||||
_height: 168px;
|
||||
overflow-y: auto;
|
||||
|
||||
@ -1,177 +0,0 @@
|
||||
/*
|
||||
Plupload
|
||||
------------------------------------------------------------------- */
|
||||
|
||||
.plupload_button {
|
||||
display: -moz-inline-box; /* FF < 3*/
|
||||
display: inline-block;
|
||||
font: normal 12px sans-serif;
|
||||
text-decoration: none;
|
||||
color: #42454a;
|
||||
border: 1px solid #bababa;
|
||||
padding: 2px 8px 3px 20px;
|
||||
margin-right: 4px;
|
||||
background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center;
|
||||
outline: 0;
|
||||
|
||||
/* Optional rounded corners for browsers that support it */
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.plupload_button:hover {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.plupload_disabled, a.plupload_disabled:hover {
|
||||
color: #737373;
|
||||
border-color: #c5c5c5;
|
||||
background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.plupload_add {
|
||||
background-position: -181px center;
|
||||
}
|
||||
|
||||
.plupload_wrapper {
|
||||
font: normal 11px Verdana,sans-serif;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.plupload_container {
|
||||
padding: 8px;
|
||||
background: url('../img/transp50.png');
|
||||
/*-moz-border-radius: 5px;*/
|
||||
}
|
||||
|
||||
.plupload_container input {
|
||||
border: 1px solid #DDD;
|
||||
font: normal 11px Verdana,sans-serif;
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;}
|
||||
.plupload_header_content {
|
||||
background: url('../img/backgrounds.gif') no-repeat 0 -317px;
|
||||
min-height: 56px;
|
||||
padding-left: 60px;
|
||||
color: #FFF;
|
||||
}
|
||||
.plupload_header_title {
|
||||
font: normal 18px sans-serif;
|
||||
padding: 6px 0 3px;
|
||||
}
|
||||
.plupload_header_text {
|
||||
font: normal 12px sans-serif;
|
||||
}
|
||||
|
||||
.plupload_filelist {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.plupload_scroll .plupload_filelist {
|
||||
height: 185px;
|
||||
background: #F5F5F5;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.plupload_filelist li {
|
||||
padding: 10px 8px;
|
||||
background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px;
|
||||
border-bottom: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.plupload_filelist_header, .plupload_filelist_footer {
|
||||
background: #DFDFDF;
|
||||
padding: 8px 8px;
|
||||
color: #42454A;
|
||||
}
|
||||
.plupload_filelist_header {
|
||||
border-top: 1px solid #EEE;
|
||||
border-bottom: 1px solid #CDCDCD;
|
||||
}
|
||||
|
||||
.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
|
||||
.plupload_file_name {float: left; overflow: hidden}
|
||||
.plupload_file_status {color: #777;}
|
||||
.plupload_file_status span {color: #42454A;}
|
||||
.plupload_file_size, .plupload_file_status, .plupload_progress {
|
||||
float: right;
|
||||
width: 80px;
|
||||
}
|
||||
.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
|
||||
|
||||
.plupload_filelist .plupload_file_name {width: 205px}
|
||||
|
||||
.plupload_file_action {
|
||||
float: right;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.plupload_file_action * {
|
||||
display: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;}
|
||||
li.plupload_done {color:#AAA}
|
||||
|
||||
li.plupload_delete a {
|
||||
background: url('../img/delete.gif');
|
||||
}
|
||||
|
||||
li.plupload_failed a {
|
||||
background: url('../img/error.gif');
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
li.plupload_done a {
|
||||
background: url('../img/done.gif');
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.plupload_progress, .plupload_upload_status {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.plupload_progress_container {
|
||||
margin-top: 3px;
|
||||
border: 1px solid #CCC;
|
||||
background: #FFF;
|
||||
padding: 1px;
|
||||
}
|
||||
.plupload_progress_bar {
|
||||
width: 0px;
|
||||
height: 7px;
|
||||
background: #CDEB8B;
|
||||
}
|
||||
|
||||
.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
|
||||
margin-right: 17px;
|
||||
}
|
||||
|
||||
/* Floats */
|
||||
|
||||
.plupload_clear,.plupload_clearer {clear: both;}
|
||||
.plupload_clearer, .plupload_progress_bar {
|
||||
display: block;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
li.plupload_droptext {
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
border: 0;
|
||||
line-height: 165px;
|
||||
}
|
||||
3
init.rb
3
init.rb
@ -22,12 +22,13 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
name "DMSF"
|
||||
author "Vít Jonáš"
|
||||
description "Document Management System Features for Redmine"
|
||||
version "0.5.1"
|
||||
version "0.6.0"
|
||||
url "https://code.google.com/p/redmine-dmsf/"
|
||||
author_url "mailto:vit.jonas@kontron-czech.com"
|
||||
|
||||
settings :partial => 'settings/dmsf_settings',
|
||||
:default => {
|
||||
"dmsf_max_file_upload" => "0",
|
||||
"dmsf_max_file_download" => "0",
|
||||
"dmsf_storage_directory" => "#{RAILS_ROOT}/files/dmsf",
|
||||
"dmsf_index_database" => "#{RAILS_ROOT}/files/dmsf_index",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user