Attached Files |
new_uploader_interface.patch [^] (66,206 bytes) 2010-05-27 15:28
[Show Content]
Index: admin_templates/incs/footer.tpl
===================================================================
--- admin_templates/incs/footer.tpl (revision 13557)
+++ admin_templates/incs/footer.tpl (working copy)
@@ -12,9 +12,6 @@
addLoadEvent(
function() {
Form.Init('scroll_container');
-
- // moving uploaders after form resize (needed only, when transparency is used)!
- IterateUploaders('moveOutside');
}
);
}
@@ -28,11 +25,7 @@
<inp2:m_else/>
addLoadEvent(
function() {
- IterateUploaders('moveOutside');
-
- if (typeof UploadsManager != 'undefined') {
- UploadsManager.setScrollEvents();
- }
+ IterateUploaders('renderBrowseButton');
}
);
Index: admin_templates/incs/form_blocks.tpl
===================================================================
--- admin_templates/incs/form_blocks.tpl (revision 13606)
+++ admin_templates/incs/form_blocks.tpl (working copy)
@@ -260,45 +260,13 @@
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>" id="<inp2:$prefix_InputName field='$field'/>_row">
<inp2:m_RenderElement name="inp_edit_field_caption" caption_render_as="$caption_render_as" prefix="$prefix" field="$field" title="$title" hint_label="$hint_label" is_last="$is_last"/>
<td class="control-cell">
- <div class="uploader-main" id="<inp2:{$prefix}_InputName field='$field'/>_progress">
- <div class="uploader-percent" id="<inp2:{$prefix}_InputName field='$field'/>_percent">0%</div>
- <div class="uploader-left">
- <div class="uploader-done" id="<inp2:{$prefix}_InputName field='$field'/>_done"></div>
- </div>
- <table style="border-collapse: collapse; width: 100%;">
- <tr>
- <td style="width: 120px">Uploading:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_filename"></td>
- </tr>
- <tr>
- <td>Progress:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_progress"></td>
- </tr>
- <tr>
- <td>Time elapsed:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_elapsed"></td>
- </tr>
- <tr>
- <td>Time remaining:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_remaining"></td>
- </tr>
- <tr>
- <td colspan="2" style="text-align: center"><a href="javascript:UploadsManager.CancelUpload('<inp2:{$prefix}_InputName field='$field'/>')">Cancel</a></td>
- </tr>
- </table>
+ <div style="width: 63px; height: 21px;" id="<inp2:{$prefix}_InputName field='$field'/>_place_holder">
+
</div>
- <table cellpadding="0" cellspacing="3">
- <tr>
- <td style="width: 63px; height: 21px;" id="<inp2:{$prefix}_InputName field='$field'/>_place_holder">
-
- </td>
- <td>
- <input class="button" type="button" onclick="UploadsManager.StartUpload('<inp2:{$prefix}_InputName field='$field'/>')" value="Upload"/>
- </td>
- </tr>
- </table>
+ <div id="<inp2:{$prefix}_InputName field='$field'/>_queueinfo" class="uploader-queue"></div>
- <div id="<inp2:{$prefix}_InputName field='$field'/>_queueinfo"></div>
- <div id="<inp2:{$prefix}_InputName field='$field'/>_holder"></div>
-
- <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[upload]" id="<inp2:{$prefix}_InputName field='$field'/>[upload]" value="<inp2:{$prefix}_Field field='$field' format='file_names'/>"><br/>
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[upload]" id="<inp2:{$prefix}_InputName field='$field'/>[upload]" value="<inp2:{$prefix}_Field field='$field' format='file_names'/>">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" value="">
@@ -313,6 +281,7 @@
multiple : '<inp2:{$prefix}_FieldOption field="$field" option="multiple"/>',
prefix : '<inp2:m_Param name="prefix"/>',
field : '<inp2:m_Param name="field"/>',
+ thumb_format: '<inp2:{$prefix}_FieldOption field="$field" option="thumb_format"/>',
urls : '<inp2:{$prefix}_Field field="$field" format="file_urls" js_escape="1"/>',
names : '<inp2:{$prefix}_Field field="$field" format="file_names" js_escape="1"/>',
sizes : '<inp2:{$prefix}_Field field="$field" format="file_sizes" js_escape="1"/>',
Index: admin_templates/incs/style_template.css
===================================================================
--- admin_templates/incs/style_template.css (revision 13635)
+++ admin_templates/incs/style_template.css (working copy)
@@ -512,45 +512,30 @@
border-collapse: separate
}
-
/* Uploader */
-
-.uploader-main {
- position: absolute;
- display: none;
- z-index: 10;
- border: 1px solid #777;
- padding: 10px;
- width: 350px;
- height: 120px;
- overflow: hidden;
- background-color: #fff;
-}
-
-.uploader-percent {
- width: 100%;
- padding-top: 3px;
- text-align: center;
- position: relative;
- z-index: 20;
+.uploader-queue .progress-container {
+ margin-right: 5px;
+ margin-top: 2px;
float: left;
- font-weight: bold;
}
-.uploader-left {
- width: 100%;
+.uploader-queue .progress-empty {
+ width: 150px;
+ height: 9px;
border: 1px solid black;
- height: 20px;
- background: #fff url('@@base_url@@/core/admin_templates/img/progress_left.gif');
+ background: url('@@base_url@@/core/admin_templates/img/progress_left.gif') repeat-x;
}
-.uploader-done {
- width: 0%;
- background-color: green;
- height: 20px;
- background: #4A92CE url('@@base_url@@/core/admin_templates/img/progress_done.gif');
+.uploader-queue .progress-full {
+ height: 9px;
+ background: url('@@base_url@@/core/admin_templates/img/progress_done.gif');
}
+.uploader-queue .thumbnail {
+ margin-bottom: 2px;
+ border: 1px solid black;
+ background-color: grey;
+}
/* To be sorted */
span#category_path, span#category_path a {
Index: admin_templates/js/forms.js
===================================================================
--- admin_templates/js/forms.js (revision 13557)
+++ admin_templates/js/forms.js (working copy)
@@ -291,8 +291,6 @@
// alert('h is: '+h+' min height is '+this.MinHeight+' MinControlsHeight is '+this.MinControlsHeight+' -> '+split+' to split between '+count);
// print_pre(this.Controls)
-
- IterateUploaders('syncBrowseButton');
}
Form.ResetHeights = function()
Index: admin_templates/js/script.js
===================================================================
--- admin_templates/js/script.js (revision 13557)
+++ admin_templates/js/script.js (working copy)
@@ -161,11 +161,11 @@
var $form = document.getElementById($form_name);
- if (typeof $form.onsubmit == 'function') {
+ if ($.isFunction($form.onsubmit)) {
$form.onsubmit();
}
- $form.submit();
+ $($form).submit();
$form.target = '';
set_hidden_field('t', t);
Index: admin_templates/js/uploader/upload_manager.js
===================================================================
--- admin_templates/js/uploader/upload_manager.js (revision 13557)
+++ admin_templates/js/uploader/upload_manager.js (working copy)
@@ -1,5 +1,6 @@
function UploadsManager() {
- addLoadEvent(
+
+ $(document).ready(
function() {
UploadsManager._initAll();
}
@@ -14,49 +15,13 @@
UploadsManager._debugMode = false;
UploadsManager._Uploaders = {};
-UploadsManager._singleUpload = true;
-/* ==== Public Attributes ==== */
-UploadsManager.useToolbar = true;
-UploadsManager.formContainerId = '';
-UploadsManager.useTransparency = true;
-UploadsManager.uploadCancelled = false;
-
/* ==== Private methods ==== */
-UploadsManager.setScrollEvents = function() {
- var $scroll_container = this._getScrollContainer();
-
- addEvent(
- $scroll_container,
- 'scroll',
- function(ev) {
- UploadsManager.iterate('syncBrowseButton');
- }
- )
-}
-
UploadsManager._nextFlashId = function() {
this._nextId++;
return 'uploaderflash' + this._nextId;
}
-UploadsManager._getFormContainer = function() {
- if (UploadsManager.formContainerId) {
- return document.getElementById(UploadsManager.formContainerId);
- }
-
- return Form.Div;
-}
-
-
-UploadsManager._getScrollContainer = function() {
- if (UploadsManager.formContainerId) {
- return document.body;
- }
-
- return document.getElementById(Form.Div.id + '_container');
-}
-
UploadsManager._initAll = function() {
this._createHooks();
@@ -120,36 +85,19 @@
}
UploadsManager._createHooks = function () {
- if (typeof Application != 'undefined') {
- Application.setHook(
- 'm:OnAfterFormInit',
- function () {
- UploadsManager.setScrollEvents();
- }
- );
- }
+ var $me = this;
- // hooking to standard toolbar select button to peform auto-upload when Save is clicked
- if (!UploadsManager.useToolbar || !isset(a_toolbar)) {
- return ;
- }
+ $('#' + $form_name).submit(
+ function ($e) {
+ if ($me._hasQueue()) {
+ submitted = false;
+ alert('File upload is in progress. Please cancel the upload or wait until it\'s completed.');
- if (a_toolbar.ButtonExists('select')) {
- var old_onclick = a_toolbar.Buttons['select'].onClick;
- a_toolbar.Buttons['select'].onClick = function() {
- UploadsManager.UploadAll(
- function() {
- if (UploadsManager._debugMode) {
- if (!confirm('Proceed with form submitting?')) {
- return ;
- }
- }
-
- old_onclick();
- }
- );
+ return false;
+ }
}
- }
+
+ );
}
/* ==== Public methods ==== */
@@ -160,12 +108,11 @@
UploadsManager.RemoveUploader = function(id) {
this._Uploaders[id].remove();
delete this._Uploaders[id];
- this.iterate('syncBrowseButton');
}
UploadsManager.DeleteFile = function(uploader_id, fname, confirmed) {
- if (!confirmed && !confirm('Are you sure you want to delete this file?')) {
- return;
+ if (!confirmed && !confirm('Are you sure you want to delete "' + fname + '" file?')) {
+ return false;
}
var $uploader = this._Uploaders[uploader_id];
@@ -184,10 +131,11 @@
},
fname, $uploader
);
+
+ return true;
}
UploadsManager.StartUpload = function(id) {
- UploadsManager._singleUpload = true;
this._Uploaders[id].startUpload();
}
@@ -195,55 +143,8 @@
this._Uploaders[id].callFlash('CancelUpload', [file_id]);
}
-UploadsManager.UploadAll = function(onAllUploaded) {
- if (!this._hasQueue()) {
- onAllUploaded();
- return ;
- }
-
- UploadsManager._singleUpload = false;
- for (var i in this._Uploaders) {
- // could raise problems, when simultanious uploads from diffrent uploaders are made
- this._Uploaders[i].startUpload();
- }
-
- this.OnAllUploaded = onAllUploaded;
-}
-
UploadsManager.UploadQueueComplete = function($uploader) {
- var $all_uploaded = true; // all queued files were uploaded
- var $all_processed = true; // all queued files were processed (uploaded OR cancelled)
- for (var i in this._Uploaders) {
- var $queue_owner = this._Uploaders[i].id == $uploader.id;
- if (UploadsManager._singleUpload && !$queue_owner) {
- // count only current uploader when single upload is made
- continue;
- }
-
- if ($queue_owner) {
- this._Uploaders[i].finalizeUpload();
- }
-
- var $empty_queue = !this._Uploaders[i].hasQueue();
-
- $all_uploaded = $all_uploaded && $empty_queue;
- $all_processed = $all_processed && ($empty_queue || this._Uploaders[i].uploadCancelled);
- }
-
- if ($all_processed) {
- // enable all browse button, when upload is totally completed or cancelled
- UploadsManager.iterate('disableBrowse', false);
- }
-
- if (UploadsManager.useTransparency && $all_processed) {
- // remove transparency, when all uploaders are done
- Request.setOpacity(100, UploadsManager._getFormContainer());
- }
-
- if ($all_uploaded && isset(this.OnAllUploaded) && !this.uploadCancelled) {
- this.OnAllUploaded();
- }
}
UploadsManager.CancelUpload = function(id) {
@@ -313,21 +214,25 @@
// delete file added
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
if (this.files[0].uploaded) {
UploadsManager.DeleteFile(UploadsManager._getUploader(file).id, this.files[0].name, true);
}
else {
this.callFlash('CancelUpload', [this.files[0].id]);
}
+
+ this.startUpload();
}
}
else {
// new file will not exceed allowed file number
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
+ this.startUpload();
}
+
this.updateInfo();
}
)
Index: admin_templates/js/uploader/uploader.js
===================================================================
--- admin_templates/js/uploader/uploader.js (revision 13557)
+++ admin_templates/js/uploader/uploader.js (working copy)
@@ -4,7 +4,6 @@
function Uploader(id, params) {
this.id = id;
- this._moved = false; // flash was moved outside scroll container
// normalize params
if (isNaN(parseInt(params.multiple))) {
@@ -23,12 +22,10 @@
this.files_count = 0;
this.files = new Array();
- this.deleted = new Array()
+ this.deleted = new Array();
this.uploadURL = params.uploadURL;
this.deleteURL = params.deleteURL;
-
- this._resetCounters();
}
/* ==== Private methods ==== */
@@ -45,6 +42,7 @@
allowedFiletypesDescription : 'All Files',
allowedFilesize : 0, // Default zero means "unlimited"
multiple : 0,
+ thumb_format: '',
fileQueueLimit : 0,
buttonImageURL : '',
buttonWidth : 1,
@@ -81,6 +79,7 @@
Uploader.prototype._prepareFiles = function() {
var ids = '';
var names = '';
+
for (var f = 0; f < this.files.length; f++) {
if (isset(this.files[f].uploaded) && !isset(this.files[f].temp)) {
continue;
@@ -92,38 +91,24 @@
ids = ids.replace(/\|$/, '', ids);
names = names.replace(/\|$/, '', names);
+
document.getElementById(this.id+'[tmp_ids]').value = ids;
document.getElementById(this.id+'[tmp_names]').value = names;
document.getElementById(this.id+'[tmp_deleted]').value = this.deleted.join('|');
}
-Uploader.prototype._getMicroTime = function() {
- var $now = new Date();
- return Math.round($now.getTime() / 1000); // because miliseconds are returned too
-}
+Uploader.prototype._formatSize = function (bytes) {
+ var kb = Math.round(bytes / 1024);
-Uploader.prototype._getEstimatedTime = function() {
- return Math.ceil((100 - this.ProgressPercent) * this.ProgressTime / this.ProgressPercent);
-}
+ if (kb < 1024) {
+ return kb + ' KB';
+ }
-Uploader.prototype._formatTime = function ($seconds) {
- $seconds = parseInt($seconds);
+ var mb = Math.round(kb / 1024 * 100) / 100;
- var $minutes = Math.floor($seconds / 60);
- if ($minutes < 10) $minutes = '0' + $minutes;
- $seconds = $seconds % 60;
- if ($seconds < 10) $seconds = '0' + $seconds;
-
- return $minutes + ':' + $seconds;
+ return mb + ' MB';
}
-Uploader.prototype._formatSize = function (bytes) {
- var kb = Math.round(bytes / 1024);
- if (kb < 1024) return kb+'Kb';
- var mb = Math.round(kb / 1024 * 100)/100;
- return mb+'Mb';
-}
-
Uploader.prototype._executeNextEvent = function () {
var f = this._eventQueue ? this._eventQueue.shift() : null;
if (typeof(f) === 'function') {
@@ -133,34 +118,8 @@
/* ==== Public methods ==== */
Uploader.prototype.init = function() {
- if (this.params.buttonPlaceholderId !== false) {
- // use given container
- var holder = document.getElementById(this.params.buttonPlaceholderId);
- }
- else {
- // create container on the fly
- var holder = document.createElement('DIV');
- document.body.appendChild(holder);
- }
-
- if (UploadsManager.useTransparency) {
- document.getElementById($form_name).style.display = 'block';
- }
-
- // moving out progress div to overcome loosing of flash object after setting opacity
- this.div = document.getElementById(this.id+'_progress');
- var clone = this.div.cloneNode(true);
- this.div.parentNode.removeChild(this.div)
- this.div = document.body.appendChild(clone);
this.IconPath = this.params.IconPath ? this.params.IconPath : '../admin_templates/img/browser/icons';
- this.filename = document.getElementById(this.id+'_progress_filename');
- this.progress = document.getElementById(this.id+'_progress_progress');
- this.elapsed = document.getElementById(this.id+'_progress_elapsed');
- this.remaining = document.getElementById(this.id+'_progress_remaining');
- this.percent = document.getElementById(this.id+'_percent');
- this.done = document.getElementById(this.id+'_done');
-
// initialize flash object
this.flash_id = UploadsManager._nextFlashId();
@@ -184,7 +143,7 @@
this.swf.addParam('wmode', escape(this.params.wmode));
this.swf.addVariable('movieName', escape(this.flash_id));
- this.swf.addVariable('fileUploadLimit', escape(this.params.multiple));
+ this.swf.addVariable('fileUploadLimit', 0);
this.swf.addVariable('fileQueueLimit', escape(this.params.fileQueueLimit));
this.swf.addVariable('fileSizeLimit', escape(this.params.allowedFilesize)); // in kilobytes
this.swf.addVariable('fileTypes', escape(this.params.allowedFiletypes));
@@ -207,62 +166,50 @@
this.swf.addVariable('debugEnabled', escape('true')); // flash var
}
- if (this.params.buttonPlaceholderId === false || !UploadsManager.useTransparency) {
- // only write flash, when button placeholder is not used
- this.swf.write(holder);
- this.flash = document.getElementById(this.flash_id);
- }
+ var $me = this;
+ Application.setHook(
+ 'm:OnAfterFormInit',
+ function () {
+ $me.renderBrowseButton();
+ }
+ )
+
if (this.params.urls != '') {
var urls = this.params.urls.split('|');
var names = this.params.names.split('|');
var sizes = this.params.sizes.split('|');
+
for (var i = 0; i < urls.length; i++) {
var a_file = {
id : names[i],
name : names[i],
url : urls[i],
size: sizes[i],
- uploaded : 1
- }
- this.files.push(a_file)
+ uploaded : 1,
+ progress: 100
+ };
+
+ this.files.push(a_file);
this.files_count++;
}
+
this.updateInfo();
}
}
-Uploader.prototype.moveOutside = function() {
- // move flash outside scroll_container, but keeps it's position on screen
- if (!UploadsManager.useTransparency || this._moved) {
- // moving only needed when transparency us used (e.g. in admin)
- return ;
- }
+Uploader.prototype.renderBrowseButton = function() {
+ var holder = document.getElementById(this.params.buttonPlaceholderId);
+ this.swf.write(holder);
- var $new_container = document.createElement('DIV');
- $new_container.id = this.params.buttonPlaceholderId + '_outside';
- $new_container.style.position = 'absolute';
-
- var $old_container = document.getElementById(this.params.buttonPlaceholderId);
- $new_container.style.top = getRealTop($old_container) + 'px';
- $new_container.style.left = getRealLeft($old_container) + 'px';
-
- var $holder_dimensions = getDimensions($old_container);
- $new_container.style.width = $holder_dimensions.innerWidth + 'px';
- $new_container.style.height = $holder_dimensions.innerHeight + 'px';
-
- document.body.appendChild($new_container);
-
- this.swf.write($new_container); // write flash outside scroll_container
- this.flash = document.getElementById(this.flash_id); // fix reference to flash object
-
- this._moved = true;
+ this.flash = document.getElementById(this.flash_id);
}
Uploader.prototype.remove = function() {
- var id = this._moved ? this.params.buttonPlaceholderId + '_outside' : this.params.buttonPlaceholderId;
+ var id = this.params.buttonPlaceholderId;
var obj = document.getElementById(id);
+
if (obj/* && obj.nodeName == "OBJECT"*/) {
var u = navigator.userAgent.toLowerCase();
var p = navigator.platform.toLowerCase();
@@ -298,95 +245,90 @@
}
}
-Uploader.prototype.syncBrowseButton = function() {
- // when flash is moved outside scroll_container, keeps it's position on screen during scroll operations
- if (!this._moved) {
- return ;
- }
-
- var $scroll_container = UploadsManager._getScrollContainer();
- var $scroll_container_top = getRealTop($scroll_container);
- var $scroll_container_left = getRealLeft($scroll_container);
-
- var $scroll_top = $scroll_container.scrollTop;
- var $scroll_left = $scroll_container.scrollLeft;
-
- var $old_container = document.getElementById(this.params.buttonPlaceholderId);
- var $new_container = document.getElementById(this.params.buttonPlaceholderId + '_outside');
-
- var $old_container_top = getRealTop($old_container);
- var $old_container_left = getRealLeft($old_container);
-
- if ($scroll_container_top <= $old_container_top - $scroll_top) {
- // prevents moving outside $scroll_container
- $new_container.style.top = ($old_container_top - $scroll_top) + 'px';
- }
- else {
- // move browse button outside visible area
- $new_container.style.top = -this.params.buttonHeight + 'px';
- }
-
- if ($scroll_container_left <= $old_container_left - $scroll_left) {
- // prevents moving outside $scroll_container
- $new_container.style.left = ($old_container_left - $scroll_left) + 'px';
- }
- else {
- // move browse button outside visible area
- $new_container.style.left = -this.params.buttonWidth + 'px';
- }
+Uploader.prototype.isImage = function($file_extension) {
+ return $file_extension.match(/^(bmp|gif|jpg|jpeg|png)$/)
}
Uploader.prototype.updateInfo = function() {
var $o = '';
var $icon = '';
var $filename = '';
+ var $file_label = '';
var $delete_code = '';
+ var $checkbox_code = '';
+ var $cancel_code = '';
+ var $empty_progress_bar = '';
for (var f = 0; f < this.files.length; f++) {
this.files[f].name.match(/\.([^.]*)$/);
var ext = RegExp.$1.toLowerCase();
+
$icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
- $icon = '<img src="' + this.IconPath + '/' + $icon + '.gif"/> ';
+ var $icon_html = '<img src="' + this.IconPath + '/' + $icon + '.gif"/> ';
if (isset(this.files[f].uploaded)) {
- $filename = '<a href="' + this.files[f].url + '" target="_new">' + this.files[f].name + '</a> (' + this._formatSize(this.files[f].size) + ')';
$delete_code = 'UploadsManager.DeleteFile(\'' + this.id + '\', \'' + this.files[f].name + '\')';
+ $checkbox_code = '<input type="checkbox" checked onclick="this.checked = !' + $delete_code + '"/>';
+ $file_label = this.files[f].name + ' (' + this._formatSize(this.files[f].size) + ')';
+
+ if ((this.params.thumb_format.length > 0) && this.isImage(ext)) {
+ $icon_html = '<a href="' + this.files[f].url + '" target="_new"><img class="thumbnail-image" large_src="' + this.files[f].url + '&thumb=1" src="' + this.IconPath + '/' + $icon + '.gif" alt=""/></a> ';
+ }
+
+ $filename = '<a href="' + this.files[f].url + '" target="_new">' + $file_label + '</a>';
+ $cancel_code = $empty_progress_bar = '';
}
else {
$filename = this.files[f].name + ' (' + this._formatSize(this.files[f].size) + ')';
$delete_code = 'UploadsManager.CancelFile(\'' + UploadsManager._getUploader(this.files[f]).id + '\', \'' + this.files[f].id + '\')';
+ $checkbox_code = '';
+ $cancel_code = '<a href="javascript:' + $delete_code + '">Cancel</a>';
+ $empty_progress_bar = '<div class="progress-empty"><div class="progress-full" style="width: 0%;"></div></div>';
}
- $o += '<tr><td>' + $icon + '</td><td style="font: 11px arial, sans-serif;">' + $filename + ' [<a href="javascript:' + $delete_code + '">Delete</a>]</td></tr>';
+ $o += '<tr><td>' + $checkbox_code + '</td><td>' + $icon_html + '</td><td style="font: 11px arial, sans-serif;">' + $filename + ' </td><td><div id="' + this.files[f].id + '_progress" class="progress-container">' + $empty_progress_bar + '</div>' + $cancel_code + '</td></tr>';
}
- document.getElementById(this.id+'_queueinfo').innerHTML = '<table cellpadding="0" cellspacing="0">' + $o + '</table>';
+ var $queue_container = document.getElementById(this.id + '_queueinfo');
+
+ $queue_container.innerHTML = '<table cellpadding="0" cellspacing="0">' + $o + '</table>';
+ $queue_container.style.marginTop = this.files.length > 0 ? '8px' : '';
+
+ $('img.thumbnail-image').each(
+ function () {
+ var $me = $(this);
+
+ var $thumb_image = new Image();
+ $thumb_image.src = $me.attr('large_src');
+
+ $($thumb_image).load (
+ function ($e) {
+ $me.attr('src', $thumb_image.src).addClass('thumbnail');
+ }
+ );
+ }
+ );
+
this._prepareFiles();
+}
- // sync position of all uploaders below current, because file queue height change will not affect their positions
- UploadsManager.iterate('syncBrowseButton', 'timeout:0');
+Uploader.prototype.updateProgressOnly = function ($file_index) {
+ var $progress_code = '<div class="progress-empty" title="' + this.files[$file_index].progress + '%"><div class="progress-full" style="width: ' + this.files[$file_index].progress + '%;"></div></div>';
+
+ $('#' + this.files[$file_index].id + '_progress').html($progress_code);
}
Uploader.prototype.removeFile = function (file) {
var n_files = new Array();
var count = 0;
- var $new_total = 0;
for (var f = 0; f < this.files.length; f++) {
if (this.files[f].id != file.id && this.files[f].name != file.id) {
n_files.push(this.files[f]);
- if (!isset(this.files[f].uploaded)) {
- $new_total += file.size;
- }
count++;
}
}
- if (this.StartTime == 0) {
- // don't update total during upload, because that breaks progress bar
- this.total = $new_total;
- }
-
this.files = n_files;
this.files_count = count;
this.updateInfo();
@@ -405,123 +347,80 @@
}
Uploader.prototype.startUpload = function() {
- UploadsManager.uploadCancelled = this.uploadCancelled = false;
+ this.uploadCancelled = false;
if (!this.hasQueue()) {
return;
}
- if (UploadsManager.useTransparency) {
- Request.setOpacity(30, UploadsManager._getFormContainer());
- }
-
- if (!document.all) {
- var $winW = window.innerWidth;
- var $winH = window.innerHeight;
- }
- else {
- var $winW = window.document.body.offsetWidth;
- var $winH = window.document.body.offsetHeight;
- }
-
- var left = Math.round(($winW - 350)/2)+'px';
- var top = Math.round(($winH - 110)/2)+'px';
-
- this.div.style.top = top;
- this.div.style.left = left;
- this.div.style.display = 'block';
-
- if (UploadsManager.useTransparency) {
- Request.setOpacity(100, this.div);
- }
-
- this.StartTime = this._getMicroTime();
- this.ProgressPercent = 0; // progress percent
- this.ProgressTime = new Array();
-
- this.uploaded = 0;
- this.total = 0;
- for (var f = 0; f < this.files.length; f++) {
- if (isset(this.files[f].uploaded)) {
- // get total bytes of non-uploaded files
- continue;
- }
- this.total += this.files[f].size;
- }
-
this.callFlash('StartUpload');
}
Uploader.prototype.cancelUpload = function() {
this.callFlash('StopUpload');
-
var $stats = this.callFlash('GetStats');
+
while ($stats.files_queued > 0) {
this.callFlash('CancelUpload');
-
$stats = this.callFlash('GetStats');
}
- UploadsManager.uploadCancelled = this.uploadCancelled = true;
+ this.uploadCancelled = true;
}
Uploader.prototype.UploadFileStart = function(file) {
- this.filename.innerHTML = file.name;
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = 0;
+ this.updateProgressOnly($file_index);
this.callFlash('AddFileParam', [file.id, 'field', this.params.field]);
this.callFlash('AddFileParam', [file.id, 'id', file.id]);
this.callFlash('AddFileParam', [file.id, 'flashsid', this.params.flashsid]);
- UploadsManager.iterate('disableBrowse', true); // disable all "Browse" buttons (not just for current uploader)!
-
// we can prevent user from adding any files here :)
this.callFlash('ReturnUploadStart', [true]);
}
Uploader.prototype.UploadProgress = function(file, bytesLoaded, bytesTotal) {
- this.cur_file_uploaded = bytesLoaded;
- var uploaded = this.uploaded + this.cur_file_uploaded;
- this.ProgressTime = this._getMicroTime() - this.StartTime;
-
- var speed = 0;
- if (this.ProgressTime > 0) {
- speed = Math.round(uploaded / this.ProgressTime * 100) / 100;
- }
-
- this.progress.innerHTML = this._formatSize(uploaded) + ' / ' + this._formatSize(this.total) + ' (' + this._formatSize(speed) + '/s)';
- this.ProgressPercent = Math.round(uploaded / this.total * 100);
- this.done.style.width = this.ProgressPercent + '%';
- this.percent.innerHTML = this.ProgressPercent + '%';
-
- this.elapsed.innerHTML = this._formatTime(this.ProgressTime );
- this.remaining.innerHTML = this._formatTime( this._getEstimatedTime() );
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = Math.round(bytesLoaded / bytesTotal * 100);
+ this.updateProgressOnly($file_index);
}
Uploader.prototype.UploadFileComplete = function(file) {
- this.uploaded += this.cur_file_uploaded;
- for (var f = 0; f < this.files.length; f++) {
- if (this.files[f].id == file.id) {
- this.files[f].uploaded = 1;
- this.files[f].temp = 1;
- this.files[f].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', file.name).replace('#FIELD#', this.params.field);
- }
+ var $file_index = this.getFileIndex(file);
+
+ if ($file_index !== false) {
+ // in case if file upload was cancelled, then no info here
+ this.files[$file_index].uploaded = 1;
+ this.files[$file_index].progress = 100;
+ this.files[$file_index].temp = 1;
+ this.files[$file_index].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', file.name).replace('#FIELD#', this.params.field);
}
+
this.updateInfo();
// upload next file in queue
var $stats = this.callFlash('GetStats');
- if ($stats.files_queued > 0 && !UploadsManager.uploadCancelled) {
+
+ if ($stats.files_queued > 0) {
this.callFlash('StartUpload');
- } else {
- // all files in queue are uploaded OR upload was cancelled globally
- if (UploadsManager.uploadCancelled) {
- // when upload was cancelled globally -> cancel it for any other uploader
- this.cancelUpload();
- }
+ }
+ else {
UploadsManager.UploadQueueComplete(this);
}
}
+Uploader.prototype.getFileIndex = function(file) {
+ for (var f = 0; f < this.files.length; f++) {
+ if (this.files[f].id == file.id) {
+ return f;
+ }
+ }
+
+ return false;
+}
+
Uploader.prototype.queueEvent = function (function_body) {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
var self = this;
@@ -598,32 +497,17 @@
};
Uploader.prototype.onFlashReady = function() {
- this.disableBrowse(false);
- UploadsManager.iterate('syncBrowseButton');
-}
+ var $me = this;
-Uploader.prototype.disableBrowse = function($disabled) {
- if ($disabled === undefined) {
- $disabled = true;
- }
-
this.queueEvent(
function() {
- this.callFlash('SetButtonDisabled', [$disabled]);
+ setTimeout(
+ function () {
+ // enable upload button, when flash is fully loaded
+ $me.callFlash('SetButtonDisabled', [false]);
+ }, 0
+ )
+
}
);
}
-
-Uploader.prototype._resetCounters = function() {
- this.StartTime = 0; // time, when upload was started
- this.ProgressPercent = 0; // upload progress in percents
- this.ProgressTime = 0; // flash upload process callback times
- this.total = 0; // total bytes to upload (from all queued files)
- this.uploaded = 0; // total uploaded bytes (from all queued files)
-}
-
-Uploader.prototype.finalizeUpload = function() {
- // hide progress bar only of uploader, that completed it's queue
- this.div.style.display = 'none';
- this._resetCounters();
-}
\ No newline at end of file
Index: admin_templates/swfupload.swf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 13635)
+++ install/install_data.sql (working copy)
@@ -673,7 +673,7 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.delete', 11, 1, 1, 0);
-INSERT INTO Skins VALUES(DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\nbody, td {\r\n /* fix for Firefox, when font-size was not inherited in table cells */\r\n font-size: 9pt;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\ntable.head-table {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/right_background.png'') top right @@HeadBgColor@@ no-repeat;\r\n}\r\n\r\n.head-table tr td, .head-table tr td a {\r\n color: @@HeadColor@@\r\n}\r\n\r\ndiv#extra_toolbar td.button-active {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif'') bottom left repeat-x;\r\n height: 22px;\r\n}\r\n\r\ndiv#extra_toolbar td.button-active a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif'') repeat-x top left;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n font-weight: bold;\r\n color: #0080C8;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: #FFFFFF;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back_disabled.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n margin-left: 3px !important;\r\n white-space: nowrap;\r\n}\r\n\r\n.tab-active {\r\n background-color: #4487D9;\r\n}\r\n\r\n.tab a {\r\n color: #4487D9;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #FFFFFF;\r\n font-weight: bold;\r\n}\r\n\r\na.scroll-left, a.scroll-right {\r\n cursor: pointer;\r\n display: block;\r\n float: left;\r\n height: 18px;\r\n margin: 0px 1px;\r\n width: 18px;\r\n}\r\n\r\na.scroll-left {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/left.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.scroll-right {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/right.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.disabled {\r\n visibility: hidden !important;\r\n}\r\n\r\na.scroll-left:hover, a.scroll-right:hover {\r\n background-position: 0 -18px;\r\n}\r\n\r\ntd.scroll-right-container {\r\n width: 20px;\r\n}\r\n\r\ntd.scroll-right-container.disabled, td.scroll-right-container.disabled * {\r\n width: 0px;\r\n margin: 0px;\r\n}\r\n\r\ntd.scroll-right-container.disabled br {\r\n display: none;\r\n}\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2 {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2 {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-1 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-0 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\ntr.grid-header-row-0 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-0 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: 1px solid #C9C9C9;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n /*padding: 3px 5px 3px 5px;*/\r\n padding: 1px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(''@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif'') no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 160px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_mid.gif'') repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_input_line.gif'') no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.warning-table {\r\n background-color: #F0F1EB;\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n border-top-width: 0px;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n font-size: 11px;\r\n}\r\n\r\n.priority {\r\n color: red;\r\n padding-left: 1px;\r\n padding-right: 1px;\r\n font-size: 11px;\r\n}\r\n\r\n.small-statistics {\r\n font-size: 11px;\r\n color: #707070;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n\r\n/* Uploader */\r\n\r\n.uploader-main {\r\n position: absolute;\r\n display: none;\r\n z-index: 10;\r\n border: 1px solid #777;\r\n padding: 10px;\r\n width: 350px;\r\n height: 120px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n}\r\n\r\n.uploader-percent {\r\n width: 100%;\r\n padding-top: 3px;\r\n text-align: center;\r\n position: relative;\r\n z-index: 20;\r\n float: left;\r\n font-weight: bold;\r\n}\r\n\r\n.uploader-left {\r\n width: 100%;\r\n border: 1px solid black;\r\n height: 20px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/progress_left.gif'');\r\n}\r\n\r\n.uploader-done {\r\n width: 0%;\r\n background-color: green;\r\n height: 20px;\r\n background: #4A92CE url(''@@base_url@@/core/admin_templates/img/progress_done.gif'');\r\n}\r\n\r\n\r\n/* To be sorted */\r\nspan#category_path, span#category_path a {\r\n color: #FFFFFF;\r\n}\r\n\r\nspan#category_path a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Left side of bluebar */\r\n.header_left_bg {\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n padding-left: 5px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px;\r\n}\r\n\r\n.tree tr td a:hover, .tree tr td a.debug-only-item:hover {\r\n color: @@TreeHoverColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item {\r\n color: @@TreeHighColor@@;\r\n background-color: @@TreeHighBgColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: @@TreeHighHoverColor@@;\r\n}\r\n\r\n.tree tr td a.debug-only-item {\r\n color: grey;\r\n}\r\n\r\n/* Ajax Dropdown */\r\n.suggest-box {\r\n border: 1px solid #999;\r\n background-color: #fff;\r\n}\r\n\r\n.suggest-item, .suggest-item-over {\r\n padding: 1px 2px 0px 2px;\r\n font-family: arial,verdana;\r\n font-size: 12px;\r\n}\r\n\r\n.suggest-item-over {\r\n background-color: #3366CC;\r\n color: #fff;\r\n}', 'in-portal_logo_img.jpg', 'in-portal_logo_img2.jpg', 'in-portal_logo_login.gif', 'a:22:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#007BF4";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#FFFFFF";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"TreeHoverColor";a:1:{s:5:"Value";s:7:"#009FF0";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:18:"TreeHighHoverColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#DCECF6";}}', 1273946818, 1);
+INSERT INTO Skins VALUES(DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\nbody, td {\r\n /* fix for Firefox, when font-size was not inherited in table cells */\r\n font-size: 9pt;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\ntable.head-table {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/right_background.png'') top right @@HeadBgColor@@ no-repeat;\r\n}\r\n\r\n.head-table tr td, .head-table tr td a {\r\n color: @@HeadColor@@\r\n}\r\n\r\ndiv#extra_toolbar td.button-active {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif'') bottom left repeat-x;\r\n height: 22px;\r\n}\r\n\r\ndiv#extra_toolbar td.button-active a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif'') repeat-x top left;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n font-weight: bold;\r\n color: #0080C8;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: #FFFFFF;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back_disabled.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n margin-left: 3px !important;\r\n white-space: nowrap;\r\n}\r\n\r\n.tab-active {\r\n background-color: #4487D9;\r\n}\r\n\r\n.tab a {\r\n color: #4487D9;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #FFFFFF;\r\n font-weight: bold;\r\n}\r\n\r\na.scroll-left, a.scroll-right {\r\n cursor: pointer;\r\n display: block;\r\n float: left;\r\n height: 18px;\r\n margin: 0px 1px;\r\n width: 18px;\r\n}\r\n\r\na.scroll-left {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/left.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.scroll-right {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/right.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.disabled {\r\n visibility: hidden !important;\r\n}\r\n\r\na.scroll-left:hover, a.scroll-right:hover {\r\n background-position: 0 -18px;\r\n}\r\n\r\ntd.scroll-right-container {\r\n width: 20px;\r\n}\r\n\r\ntd.scroll-right-container.disabled, td.scroll-right-container.disabled * {\r\n width: 0px;\r\n margin: 0px;\r\n}\r\n\r\ntd.scroll-right-container.disabled br {\r\n display: none;\r\n}\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2 {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2 {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-1 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-0 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\ntr.grid-header-row-0 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-0 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: 1px solid #C9C9C9;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n /*padding: 3px 5px 3px 5px;*/\r\n padding: 1px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(''@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif'') no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 160px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_mid.gif'') repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_input_line.gif'') no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.warning-table {\r\n background-color: #F0F1EB;\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n border-top-width: 0px;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n font-size: 11px;\r\n}\r\n\r\n.priority {\r\n color: red;\r\n padding-left: 1px;\r\n padding-right: 1px;\r\n font-size: 11px;\r\n}\r\n\r\n.small-statistics {\r\n font-size: 11px;\r\n color: #707070;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n/* Uploader */\r\n.uploader-queue .progress-container {\r\n margin-right: 5px;\r\n margin-top: 2px;\r\n float: left;\r\n}\r\n\r\n.uploader-queue .progress-empty {\r\n width: 150px;\r\n height: 9px;\r\n border: 1px solid black;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_left.gif'') repeat-x;\r\n}\r\n\r\n.uploader-queue .progress-full {\r\n height: 9px;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_done.gif'');\r\n}\r\n\r\n.uploader-queue .thumbnail {\r\n margin-bottom: 2px;\r\n border: 1px solid black;\r\n background-color: grey;\r\n}\r\n\r\n/* To be sorted */\r\nspan#category_path, span#category_path a {\r\n color: #FFFFFF;\r\n}\r\n\r\nspan#category_path a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Left side of bluebar */\r\n.header_left_bg {\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n padding-left: 5px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px;\r\n}\r\n\r\n.tree tr td a:hover, .tree tr td a.debug-only-item:hover {\r\n color: @@TreeHoverColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item {\r\n color: @@TreeHighColor@@;\r\n background-color: @@TreeHighBgColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: @@TreeHighHoverColor@@;\r\n}\r\n\r\n.tree tr td a.debug-only-item {\r\n color: grey;\r\n}\r\n\r\n/* Ajax Dropdown */\r\n.suggest-box {\r\n border: 1px solid #999;\r\n background-color: #fff;\r\n}\r\n\r\n.suggest-item, .suggest-item-over {\r\n padding: 1px 2px 0px 2px;\r\n font-family: arial,verdana;\r\n font-size: 12px;\r\n}\r\n\r\n.suggest-item-over {\r\n background-color: #3366CC;\r\n color: #fff;\r\n}', 'in-portal_logo_img.jpg', 'in-portal_logo_img2.jpg', 'in-portal_logo_login.gif', 'a:22:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#007BF4";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#FFFFFF";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"TreeHoverColor";a:1:{s:5:"Value";s:7:"#009FF0";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:18:"TreeHighHoverColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#DCECF6";}}', 1274990718, 1);
INSERT INTO LocalesList VALUES
(1, '0x0436', 'Afrikaans (South Africa)', 'af-ZA', 'Latn', '1252'),
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 13581)
+++ kernel/db/db_event_handler.php (working copy)
@@ -2700,14 +2700,24 @@
return ;
}
+ $object =& $event->getObject( Array ('skip_autoload' => true));
+ /* @var $object kDBItem */
+
+ $field = $this->Application->GetVar('field');
+ $options = $object->GetFieldOptions($field);
+
if ($this->Application->GetVar('tmp')) {
- $path = WRITEABLE . '/tmp/' . $this->Application->GetVar('id') . '_' . $this->Application->GetVar('file');
+ $path = WRITEABLE . '/tmp/' . $this->Application->GetVar('id') . '_' . $file;
}
else {
- $object =& $event->getObject(array('skip_autoload'=>true));
- $options = $object->GetFieldOptions($this->Application->GetVar('field'));
+ $upload_dir = $options['upload_dir'];
- $path = FULL_PATH.$options['upload_dir'].$file;
+ if (array_key_exists('include_path', $options) && $options['include_path']) {
+ // relative path is already included in field
+ $upload_dir = '';
+ }
+
+ $path = FULL_PATH . $upload_dir . $file;
}
$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
@@ -2716,10 +2726,21 @@
exit;
}
+ if ($this->Application->GetVar('thumb')) {
+ $image_helper =& $this->Application->recallObject('ImageHelper');
+ /* @var $image_helper ImageHelper */
+
+ $path = $image_helper->ResizeImage($path, $options['thumb_format']);
+
+ $base_url = rtrim($this->Application->BaseURL(), '/');
+ $path = preg_replace('/^' . preg_quote($base_url, '/') . '(.*)/', FULL_PATH . '\\1', $path);
+ $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
+ }
+
$type = mime_content_type($path);
- header('Content-Length: '.filesize($path));
- header('Content-Type: '.$type);
+ header('Content-Length: ' . filesize($path));
+ header('Content-Type: ' . $type);
safeDefine('DBG_SKIP_REPORTING',1);
swfupload.swf [^] (12,787 bytes) 2010-05-27 15:28
new_uploader_interface_core_v2.patch [^] (71,347 bytes) 2010-05-29 16:46
[Show Content]
Index: admin_templates/incs/footer.tpl
===================================================================
--- admin_templates/incs/footer.tpl (revision 13557)
+++ admin_templates/incs/footer.tpl (working copy)
@@ -12,9 +12,6 @@
addLoadEvent(
function() {
Form.Init('scroll_container');
-
- // moving uploaders after form resize (needed only, when transparency is used)!
- IterateUploaders('moveOutside');
}
);
}
@@ -28,11 +25,7 @@
<inp2:m_else/>
addLoadEvent(
function() {
- IterateUploaders('moveOutside');
-
- if (typeof UploadsManager != 'undefined') {
- UploadsManager.setScrollEvents();
- }
+ IterateUploaders('renderBrowseButton');
}
);
Index: admin_templates/incs/form_blocks.tpl
===================================================================
--- admin_templates/incs/form_blocks.tpl (revision 13606)
+++ admin_templates/incs/form_blocks.tpl (working copy)
@@ -260,45 +260,13 @@
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>" id="<inp2:$prefix_InputName field='$field'/>_row">
<inp2:m_RenderElement name="inp_edit_field_caption" caption_render_as="$caption_render_as" prefix="$prefix" field="$field" title="$title" hint_label="$hint_label" is_last="$is_last"/>
<td class="control-cell">
- <div class="uploader-main" id="<inp2:{$prefix}_InputName field='$field'/>_progress">
- <div class="uploader-percent" id="<inp2:{$prefix}_InputName field='$field'/>_percent">0%</div>
- <div class="uploader-left">
- <div class="uploader-done" id="<inp2:{$prefix}_InputName field='$field'/>_done"></div>
- </div>
- <table style="border-collapse: collapse; width: 100%;">
- <tr>
- <td style="width: 120px">Uploading:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_filename"></td>
- </tr>
- <tr>
- <td>Progress:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_progress"></td>
- </tr>
- <tr>
- <td>Time elapsed:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_elapsed"></td>
- </tr>
- <tr>
- <td>Time remaining:</td><td id="<inp2:{$prefix}_InputName field='$field'/>_progress_remaining"></td>
- </tr>
- <tr>
- <td colspan="2" style="text-align: center"><a href="javascript:UploadsManager.CancelUpload('<inp2:{$prefix}_InputName field='$field'/>')">Cancel</a></td>
- </tr>
- </table>
+ <div style="width: 63px; height: 21px;" id="<inp2:{$prefix}_InputName field='$field'/>_place_holder">
+
</div>
- <table cellpadding="0" cellspacing="3">
- <tr>
- <td style="width: 63px; height: 21px;" id="<inp2:{$prefix}_InputName field='$field'/>_place_holder">
-
- </td>
- <td>
- <input class="button" type="button" onclick="UploadsManager.StartUpload('<inp2:{$prefix}_InputName field='$field'/>')" value="Upload"/>
- </td>
- </tr>
- </table>
+ <div id="<inp2:{$prefix}_InputName field='$field'/>_queueinfo" class="uploader-queue"></div>
- <div id="<inp2:{$prefix}_InputName field='$field'/>_queueinfo"></div>
- <div id="<inp2:{$prefix}_InputName field='$field'/>_holder"></div>
-
- <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[upload]" id="<inp2:{$prefix}_InputName field='$field'/>[upload]" value="<inp2:{$prefix}_Field field='$field' format='file_names'/>"><br/>
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[upload]" id="<inp2:{$prefix}_InputName field='$field'/>[upload]" value="<inp2:{$prefix}_Field field='$field' format='file_names'/>">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" value="">
@@ -313,6 +281,7 @@
multiple : '<inp2:{$prefix}_FieldOption field="$field" option="multiple"/>',
prefix : '<inp2:m_Param name="prefix"/>',
field : '<inp2:m_Param name="field"/>',
+ thumb_format: '<inp2:{$prefix}_FieldOption field="$field" option="thumb_format"/>',
urls : '<inp2:{$prefix}_Field field="$field" format="file_urls" js_escape="1"/>',
names : '<inp2:{$prefix}_Field field="$field" format="file_names" js_escape="1"/>',
sizes : '<inp2:{$prefix}_Field field="$field" format="file_sizes" js_escape="1"/>',
Index: admin_templates/incs/style_template.css
===================================================================
--- admin_templates/incs/style_template.css (revision 13635)
+++ admin_templates/incs/style_template.css (working copy)
@@ -512,45 +512,49 @@
border-collapse: separate
}
-
/* Uploader */
-
-.uploader-main {
- position: absolute;
- display: none;
- z-index: 10;
- border: 1px solid #777;
- padding: 10px;
- width: 350px;
- height: 120px;
- overflow: hidden;
- background-color: #fff;
+.uploader-queue div.file {
+ font-size: 11px;
+ border: 1px solid #7F99C5;
+ padding: 3px;
+ background-color: #DEE7F6;
+ margin-bottom: 2px;
}
-.uploader-percent {
- width: 100%;
- padding-top: 3px;
- text-align: center;
- position: relative;
- z-index: 20;
+.uploader-queue .left {
float: left;
- font-weight: bold;
+ vertical-align: top;
}
-.uploader-left {
- width: 100%;
+.uploader-queue .file-label {
+ margin-left: 5px;
+}
+
+.uploader-queue .preview .delete-checkbox {
+ margin-top: -3px;
+}
+
+.uploader-queue .progress-container {
+ margin: 2px 5px 0px 5px;
+}
+
+.uploader-queue .progress-empty {
+ width: 150px;
+ height: 9px;
border: 1px solid black;
- height: 20px;
- background: #fff url('@@base_url@@/core/admin_templates/img/progress_left.gif');
+ background: url('@@base_url@@/core/admin_templates/img/progress_left.gif') repeat-x;
}
-.uploader-done {
- width: 0%;
- background-color: green;
- height: 20px;
- background: #4A92CE url('@@base_url@@/core/admin_templates/img/progress_done.gif');
+.uploader-queue .progress-full {
+ height: 9px;
+ background: url('@@base_url@@/core/admin_templates/img/progress_done.gif');
}
+.uploader-queue .thumbnail {
+ /*margin-bottom: 2px;*/
+ border: 1px solid black;
+ background-color: grey;
+}
/* To be sorted */
span#category_path, span#category_path a {
Index: admin_templates/js/forms.js
===================================================================
--- admin_templates/js/forms.js (revision 13557)
+++ admin_templates/js/forms.js (working copy)
@@ -291,8 +291,6 @@
// alert('h is: '+h+' min height is '+this.MinHeight+' MinControlsHeight is '+this.MinControlsHeight+' -> '+split+' to split between '+count);
// print_pre(this.Controls)
-
- IterateUploaders('syncBrowseButton');
}
Form.ResetHeights = function()
Index: admin_templates/js/script.js
===================================================================
--- admin_templates/js/script.js (revision 13557)
+++ admin_templates/js/script.js (working copy)
@@ -161,11 +161,11 @@
var $form = document.getElementById($form_name);
- if (typeof $form.onsubmit == 'function') {
+ if ($.isFunction($form.onsubmit)) {
$form.onsubmit();
}
- $form.submit();
+ $($form).submit();
$form.target = '';
set_hidden_field('t', t);
Index: admin_templates/js/uploader/upload_manager.js
===================================================================
--- admin_templates/js/uploader/upload_manager.js (revision 13557)
+++ admin_templates/js/uploader/upload_manager.js (working copy)
@@ -1,5 +1,6 @@
function UploadsManager() {
- addLoadEvent(
+
+ $(document).ready(
function() {
UploadsManager._initAll();
}
@@ -14,49 +15,13 @@
UploadsManager._debugMode = false;
UploadsManager._Uploaders = {};
-UploadsManager._singleUpload = true;
-/* ==== Public Attributes ==== */
-UploadsManager.useToolbar = true;
-UploadsManager.formContainerId = '';
-UploadsManager.useTransparency = true;
-UploadsManager.uploadCancelled = false;
-
/* ==== Private methods ==== */
-UploadsManager.setScrollEvents = function() {
- var $scroll_container = this._getScrollContainer();
-
- addEvent(
- $scroll_container,
- 'scroll',
- function(ev) {
- UploadsManager.iterate('syncBrowseButton');
- }
- )
-}
-
UploadsManager._nextFlashId = function() {
this._nextId++;
return 'uploaderflash' + this._nextId;
}
-UploadsManager._getFormContainer = function() {
- if (UploadsManager.formContainerId) {
- return document.getElementById(UploadsManager.formContainerId);
- }
-
- return Form.Div;
-}
-
-
-UploadsManager._getScrollContainer = function() {
- if (UploadsManager.formContainerId) {
- return document.body;
- }
-
- return document.getElementById(Form.Div.id + '_container');
-}
-
UploadsManager._initAll = function() {
this._createHooks();
@@ -120,36 +85,19 @@
}
UploadsManager._createHooks = function () {
- if (typeof Application != 'undefined') {
- Application.setHook(
- 'm:OnAfterFormInit',
- function () {
- UploadsManager.setScrollEvents();
- }
- );
- }
+ var $me = this;
- // hooking to standard toolbar select button to peform auto-upload when Save is clicked
- if (!UploadsManager.useToolbar || !isset(a_toolbar)) {
- return ;
- }
+ $('#' + $form_name).submit(
+ function ($e) {
+ if ($me._hasQueue()) {
+ submitted = false;
+ alert('File upload is in progress. Please cancel the upload or wait until it\'s completed.');
- if (a_toolbar.ButtonExists('select')) {
- var old_onclick = a_toolbar.Buttons['select'].onClick;
- a_toolbar.Buttons['select'].onClick = function() {
- UploadsManager.UploadAll(
- function() {
- if (UploadsManager._debugMode) {
- if (!confirm('Proceed with form submitting?')) {
- return ;
- }
- }
-
- old_onclick();
- }
- );
+ return false;
+ }
}
- }
+
+ );
}
/* ==== Public methods ==== */
@@ -160,12 +108,11 @@
UploadsManager.RemoveUploader = function(id) {
this._Uploaders[id].remove();
delete this._Uploaders[id];
- this.iterate('syncBrowseButton');
}
UploadsManager.DeleteFile = function(uploader_id, fname, confirmed) {
- if (!confirmed && !confirm('Are you sure you want to delete this file?')) {
- return;
+ if (!confirmed && !confirm('Are you sure you want to delete "' + fname + '" file?')) {
+ return false;
}
var $uploader = this._Uploaders[uploader_id];
@@ -176,7 +123,7 @@
function(req, fname, $uploader) {
$uploader.removeFile({id:fname})
$uploader.deleted.push(fname);
- $uploader.updateInfo();
+ $uploader.updateInfo(undefined, true);
},
function(req, fname, $uploader) {
@@ -184,10 +131,11 @@
},
fname, $uploader
);
+
+ return true;
}
UploadsManager.StartUpload = function(id) {
- UploadsManager._singleUpload = true;
this._Uploaders[id].startUpload();
}
@@ -195,55 +143,8 @@
this._Uploaders[id].callFlash('CancelUpload', [file_id]);
}
-UploadsManager.UploadAll = function(onAllUploaded) {
- if (!this._hasQueue()) {
- onAllUploaded();
- return ;
- }
-
- UploadsManager._singleUpload = false;
- for (var i in this._Uploaders) {
- // could raise problems, when simultanious uploads from diffrent uploaders are made
- this._Uploaders[i].startUpload();
- }
-
- this.OnAllUploaded = onAllUploaded;
-}
-
UploadsManager.UploadQueueComplete = function($uploader) {
- var $all_uploaded = true; // all queued files were uploaded
- var $all_processed = true; // all queued files were processed (uploaded OR cancelled)
- for (var i in this._Uploaders) {
- var $queue_owner = this._Uploaders[i].id == $uploader.id;
- if (UploadsManager._singleUpload && !$queue_owner) {
- // count only current uploader when single upload is made
- continue;
- }
-
- if ($queue_owner) {
- this._Uploaders[i].finalizeUpload();
- }
-
- var $empty_queue = !this._Uploaders[i].hasQueue();
-
- $all_uploaded = $all_uploaded && $empty_queue;
- $all_processed = $all_processed && ($empty_queue || this._Uploaders[i].uploadCancelled);
- }
-
- if ($all_processed) {
- // enable all browse button, when upload is totally completed or cancelled
- UploadsManager.iterate('disableBrowse', false);
- }
-
- if (UploadsManager.useTransparency && $all_processed) {
- // remove transparency, when all uploaders are done
- Request.setOpacity(100, UploadsManager._getFormContainer());
- }
-
- if ($all_uploaded && isset(this.OnAllUploaded) && !this.uploadCancelled) {
- this.OnAllUploaded();
- }
}
UploadsManager.CancelUpload = function(id) {
@@ -313,22 +214,26 @@
// delete file added
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
if (this.files[0].uploaded) {
UploadsManager.DeleteFile(UploadsManager._getUploader(file).id, this.files[0].name, true);
}
else {
this.callFlash('CancelUpload', [this.files[0].id]);
}
+
+ this.startUpload();
}
}
else {
// new file will not exceed allowed file number
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
+ this.startUpload();
}
- this.updateInfo();
+
+ this.updateInfo(this.files.length - 1);
}
)
}
Index: admin_templates/js/uploader/uploader.js
===================================================================
--- admin_templates/js/uploader/uploader.js (revision 13557)
+++ admin_templates/js/uploader/uploader.js (working copy)
@@ -4,7 +4,6 @@
function Uploader(id, params) {
this.id = id;
- this._moved = false; // flash was moved outside scroll container
// normalize params
if (isNaN(parseInt(params.multiple))) {
@@ -23,12 +22,10 @@
this.files_count = 0;
this.files = new Array();
- this.deleted = new Array()
+ this.deleted = new Array();
this.uploadURL = params.uploadURL;
this.deleteURL = params.deleteURL;
-
- this._resetCounters();
}
/* ==== Private methods ==== */
@@ -45,6 +42,7 @@
allowedFiletypesDescription : 'All Files',
allowedFilesize : 0, // Default zero means "unlimited"
multiple : 0,
+ thumb_format: '',
fileQueueLimit : 0,
buttonImageURL : '',
buttonWidth : 1,
@@ -81,6 +79,7 @@
Uploader.prototype._prepareFiles = function() {
var ids = '';
var names = '';
+
for (var f = 0; f < this.files.length; f++) {
if (isset(this.files[f].uploaded) && !isset(this.files[f].temp)) {
continue;
@@ -92,38 +91,24 @@
ids = ids.replace(/\|$/, '', ids);
names = names.replace(/\|$/, '', names);
+
document.getElementById(this.id+'[tmp_ids]').value = ids;
document.getElementById(this.id+'[tmp_names]').value = names;
document.getElementById(this.id+'[tmp_deleted]').value = this.deleted.join('|');
}
-Uploader.prototype._getMicroTime = function() {
- var $now = new Date();
- return Math.round($now.getTime() / 1000); // because miliseconds are returned too
-}
+Uploader.prototype._formatSize = function (bytes) {
+ var kb = Math.round(bytes / 1024);
-Uploader.prototype._getEstimatedTime = function() {
- return Math.ceil((100 - this.ProgressPercent) * this.ProgressTime / this.ProgressPercent);
-}
+ if (kb < 1024) {
+ return kb + ' KB';
+ }
-Uploader.prototype._formatTime = function ($seconds) {
- $seconds = parseInt($seconds);
+ var mb = Math.round(kb / 1024 * 100) / 100;
- var $minutes = Math.floor($seconds / 60);
- if ($minutes < 10) $minutes = '0' + $minutes;
- $seconds = $seconds % 60;
- if ($seconds < 10) $seconds = '0' + $seconds;
-
- return $minutes + ':' + $seconds;
+ return mb + ' MB';
}
-Uploader.prototype._formatSize = function (bytes) {
- var kb = Math.round(bytes / 1024);
- if (kb < 1024) return kb+'Kb';
- var mb = Math.round(kb / 1024 * 100)/100;
- return mb+'Mb';
-}
-
Uploader.prototype._executeNextEvent = function () {
var f = this._eventQueue ? this._eventQueue.shift() : null;
if (typeof(f) === 'function') {
@@ -133,34 +118,8 @@
/* ==== Public methods ==== */
Uploader.prototype.init = function() {
- if (this.params.buttonPlaceholderId !== false) {
- // use given container
- var holder = document.getElementById(this.params.buttonPlaceholderId);
- }
- else {
- // create container on the fly
- var holder = document.createElement('DIV');
- document.body.appendChild(holder);
- }
-
- if (UploadsManager.useTransparency) {
- document.getElementById($form_name).style.display = 'block';
- }
-
- // moving out progress div to overcome loosing of flash object after setting opacity
- this.div = document.getElementById(this.id+'_progress');
- var clone = this.div.cloneNode(true);
- this.div.parentNode.removeChild(this.div)
- this.div = document.body.appendChild(clone);
this.IconPath = this.params.IconPath ? this.params.IconPath : '../admin_templates/img/browser/icons';
- this.filename = document.getElementById(this.id+'_progress_filename');
- this.progress = document.getElementById(this.id+'_progress_progress');
- this.elapsed = document.getElementById(this.id+'_progress_elapsed');
- this.remaining = document.getElementById(this.id+'_progress_remaining');
- this.percent = document.getElementById(this.id+'_percent');
- this.done = document.getElementById(this.id+'_done');
-
// initialize flash object
this.flash_id = UploadsManager._nextFlashId();
@@ -184,7 +143,7 @@
this.swf.addParam('wmode', escape(this.params.wmode));
this.swf.addVariable('movieName', escape(this.flash_id));
- this.swf.addVariable('fileUploadLimit', escape(this.params.multiple));
+ this.swf.addVariable('fileUploadLimit', 0);
this.swf.addVariable('fileQueueLimit', escape(this.params.fileQueueLimit));
this.swf.addVariable('fileSizeLimit', escape(this.params.allowedFilesize)); // in kilobytes
this.swf.addVariable('fileTypes', escape(this.params.allowedFiletypes));
@@ -207,62 +166,50 @@
this.swf.addVariable('debugEnabled', escape('true')); // flash var
}
- if (this.params.buttonPlaceholderId === false || !UploadsManager.useTransparency) {
- // only write flash, when button placeholder is not used
- this.swf.write(holder);
- this.flash = document.getElementById(this.flash_id);
- }
+ var $me = this;
+ Application.setHook(
+ 'm:OnAfterFormInit',
+ function () {
+ $me.renderBrowseButton();
+ }
+ )
+
if (this.params.urls != '') {
var urls = this.params.urls.split('|');
var names = this.params.names.split('|');
var sizes = this.params.sizes.split('|');
+
for (var i = 0; i < urls.length; i++) {
var a_file = {
id : names[i],
name : names[i],
url : urls[i],
size: sizes[i],
- uploaded : 1
- }
- this.files.push(a_file)
+ uploaded : 1,
+ progress: 100
+ };
+
+ this.files.push(a_file);
this.files_count++;
}
+
this.updateInfo();
}
}
-Uploader.prototype.moveOutside = function() {
- // move flash outside scroll_container, but keeps it's position on screen
- if (!UploadsManager.useTransparency || this._moved) {
- // moving only needed when transparency us used (e.g. in admin)
- return ;
- }
+Uploader.prototype.renderBrowseButton = function() {
+ var holder = document.getElementById(this.params.buttonPlaceholderId);
+ this.swf.write(holder);
- var $new_container = document.createElement('DIV');
- $new_container.id = this.params.buttonPlaceholderId + '_outside';
- $new_container.style.position = 'absolute';
-
- var $old_container = document.getElementById(this.params.buttonPlaceholderId);
- $new_container.style.top = getRealTop($old_container) + 'px';
- $new_container.style.left = getRealLeft($old_container) + 'px';
-
- var $holder_dimensions = getDimensions($old_container);
- $new_container.style.width = $holder_dimensions.innerWidth + 'px';
- $new_container.style.height = $holder_dimensions.innerHeight + 'px';
-
- document.body.appendChild($new_container);
-
- this.swf.write($new_container); // write flash outside scroll_container
- this.flash = document.getElementById(this.flash_id); // fix reference to flash object
-
- this._moved = true;
+ this.flash = document.getElementById(this.flash_id);
}
Uploader.prototype.remove = function() {
- var id = this._moved ? this.params.buttonPlaceholderId + '_outside' : this.params.buttonPlaceholderId;
+ var id = this.params.buttonPlaceholderId;
var obj = document.getElementById(id);
+
if (obj/* && obj.nodeName == "OBJECT"*/) {
var u = navigator.userAgent.toLowerCase();
var p = navigator.platform.toLowerCase();
@@ -298,98 +245,167 @@
}
}
-Uploader.prototype.syncBrowseButton = function() {
- // when flash is moved outside scroll_container, keeps it's position on screen during scroll operations
- if (!this._moved) {
- return ;
- }
+Uploader.prototype.isImage = function($filename) {
+ $filename.match(/\.([^.]*)$/);
+ var $ext = RegExp.$1.toLowerCase();
- var $scroll_container = UploadsManager._getScrollContainer();
- var $scroll_container_top = getRealTop($scroll_container);
- var $scroll_container_left = getRealLeft($scroll_container);
+ return $ext.match(/^(bmp|gif|jpg|jpeg|png)$/);
+}
- var $scroll_top = $scroll_container.scrollTop;
- var $scroll_left = $scroll_container.scrollLeft;
+Uploader.prototype.getFileIcon = function($filename) {
+ $filename.match(/\.([^.]*)$/);
+ var ext = RegExp.$1.toLowerCase();
- var $old_container = document.getElementById(this.params.buttonPlaceholderId);
- var $new_container = document.getElementById(this.params.buttonPlaceholderId + '_outside');
+ $icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
+ return this.IconPath + '/' + $icon + '.gif';
+}
- var $old_container_top = getRealTop($old_container);
- var $old_container_left = getRealLeft($old_container);
+Uploader.prototype.getQueueElement = function($file) {
+ var $ret = '';
+ var $icon_image = this.getFileIcon($file.name);
+ var $file_label = $file.name + ' (' + this._formatSize($file.size) + ')';
+ var $need_preview = false;
- if ($scroll_container_top <= $old_container_top - $scroll_top) {
- // prevents moving outside $scroll_container
- $new_container.style.top = ($old_container_top - $scroll_top) + 'px';
+ if (isset($file.uploaded)) {
+ // add deletion checkbox
+ $need_preview = (this.params.thumb_format.length > 0) && this.isImage($file.name);
+ $ret += '<div class="left delete-checkbox"><input type="checkbox" class="delete-file-btn" checked/></div>';
+
+ // add icon based on file type
+ $ret += '<div class="left">';
+
+ if ($need_preview) {
+ $ret += '<a href="' + $file.url + '" target="_new"><img class="thumbnail-image" large_src="' + $file.url + '&thumb=1" src="' + $icon_image + '" alt=""/></a>';
+ }
+ else {
+ $ret += '<img src="' + $icon_image + '"/>';
+ }
+
+ $ret += '</div>'
+
+ // add filename + preview link
+ $ret += '<div class="left file-label"><a href="' + $file.url + '" target="_new">' + $file_label + '</a></div>';
}
else {
- // move browse button outside visible area
- $new_container.style.top = -this.params.buttonHeight + 'px';
+ // add icon based on file type
+ $ret += '<div class="left"><img src="' + $icon_image + '"/></div>';
+
+ // add filename
+ $ret += '<div class="left file-label">' + $file_label + '</div>';
+
+ // add empty progress bar
+ $ret += '<div id="' + $file.id + '_progress" class="progress-container left"><div class="progress-empty"><div class="progress-full" style="width: 0%;"></div></div></div>';
+
+ // add cancel upload link
+ $ret += '<div class="left"><a href="#" class="cancel-upload-btn">Cancel</a></div>';
}
- if ($scroll_container_left <= $old_container_left - $scroll_left) {
- // prevents moving outside $scroll_container
- $new_container.style.left = ($old_container_left - $scroll_left) + 'px';
+ $ret += '<div style="clear: both;"/>';
+ $ret = $('<div id="' + $file.id + '_queue_row" class="file' + ($need_preview ? ' preview' : '') + '">' + $ret + '</div>');
+
+ // set click events
+ var $me = this;
+
+ $('.delete-file-btn', $ret).click(
+ function ($e) {
+ $(this).attr('checked', UploadsManager.DeleteFile($me.id, $file.name) ? '' : 'checked');
+ }
+ );
+
+ $('.cancel-upload-btn', $ret).click(
+ function ($e) {
+ UploadsManager.CancelFile(UploadsManager._getUploader($file).id, $file.id);
+ return false;
+ }
+ );
+
+ // prepare auto-loading preview
+ var $image = $('img.thumbnail-image', $ret);
+
+ if ($image.length > 0) {
+ var $tmp_image = new Image();
+ $tmp_image.src = $image.attr('large_src');
+
+ $($tmp_image).load (
+ function ($e) {
+ $image.attr('src', $tmp_image.src).addClass('thumbnail');
+ }
+ );
}
- else {
- // move browse button outside visible area
- $new_container.style.left = -this.params.buttonWidth + 'px';
- }
+
+ return $ret;
}
-Uploader.prototype.updateInfo = function() {
- var $o = '';
- var $icon = '';
- var $filename = '';
- var $delete_code = '';
+Uploader.prototype.updateQueueFile = function($file_index, $delete_file) {
+ $queue_container = $( jq('#' + this.id + '_queueinfo') );
- for (var f = 0; f < this.files.length; f++) {
- this.files[f].name.match(/\.([^.]*)$/);
- var ext = RegExp.$1.toLowerCase();
- $icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
- $icon = '<img src="' + this.IconPath + '/' + $icon + '.gif"/> ';
+ if ($delete_file !== undefined && $delete_file) {
+ $( jq('#' + this.files[$file_index].id + '_queue_row') ).remove();
- if (isset(this.files[f].uploaded)) {
- $filename = '<a href="' + this.files[f].url + '" target="_new">' + this.files[f].name + '</a> (' + this._formatSize(this.files[f].size) + ')';
- $delete_code = 'UploadsManager.DeleteFile(\'' + this.id + '\', \'' + this.files[f].name + '\')';
+ if (this.files.length == 1) {
+ $queue_container.css('margin-top', '0px');
}
+ return ;
+ }
+
+ $ret = this.getQueueElement( this.files[$file_index] );
+ var $row = $( jq('#' + this.files[$file_index].id + '_queue_row') );
+
+ if ($row.length > 0) {
+ // file round -> replace
+ $row.replaceWith($ret);
+ }
+ else {
+ // file not found - add
+ $( jq('#' + this.id + '_queueinfo') ).append($ret);
+ $queue_container.css('margin-top', '8px');
+ }
+}
+
+Uploader.prototype.updateInfo = function($file_index, $prepare_only) {
+ if ($prepare_only === undefined || !$prepare_only) {
+ if ($file_index === undefined) {
+ for (var f = 0; f < this.files.length; f++) {
+ this.updateQueueFile(f);
+ }
+ }
else {
- $filename = this.files[f].name + ' (' + this._formatSize(this.files[f].size) + ')';
- $delete_code = 'UploadsManager.CancelFile(\'' + UploadsManager._getUploader(this.files[f]).id + '\', \'' + this.files[f].id + '\')';
+ this.updateQueueFile($file_index);
}
-
- $o += '<tr><td>' + $icon + '</td><td style="font: 11px arial, sans-serif;">' + $filename + ' [<a href="javascript:' + $delete_code + '">Delete</a>]</td></tr>';
}
- document.getElementById(this.id+'_queueinfo').innerHTML = '<table cellpadding="0" cellspacing="0">' + $o + '</table>';
this._prepareFiles();
+}
- // sync position of all uploaders below current, because file queue height change will not affect their positions
- UploadsManager.iterate('syncBrowseButton', 'timeout:0');
+Uploader.prototype.updateProgressOnly = function ($file_index) {
+ var $progress_code = '<div class="progress-empty" title="' + this.files[$file_index].progress + '%"><div class="progress-full" style="width: ' + this.files[$file_index].progress + '%;"></div></div>';
+
+ $('#' + this.files[$file_index].id + '_progress').html($progress_code);
}
Uploader.prototype.removeFile = function (file) {
- var n_files = new Array();
var count = 0;
- var $new_total = 0;
+ var n_files = new Array();
+ var $to_delete = [];
+
for (var f = 0; f < this.files.length; f++) {
if (this.files[f].id != file.id && this.files[f].name != file.id) {
n_files.push(this.files[f]);
- if (!isset(this.files[f].uploaded)) {
- $new_total += file.size;
- }
count++;
}
+ else {
+ $to_delete.push(f);
+ }
}
- if (this.StartTime == 0) {
- // don't update total during upload, because that breaks progress bar
- this.total = $new_total;
+ for (var $i = 0; $i < $to_delete.length; $i++) {
+ this.updateQueueFile($to_delete[$i], true);
}
this.files = n_files;
this.files_count = count;
- this.updateInfo();
+ this.updateInfo(undefined, true);
}
Uploader.prototype.hasQueue = function() {
@@ -405,121 +421,78 @@
}
Uploader.prototype.startUpload = function() {
- UploadsManager.uploadCancelled = this.uploadCancelled = false;
+ this.uploadCancelled = false;
if (!this.hasQueue()) {
return;
}
- if (UploadsManager.useTransparency) {
- Request.setOpacity(30, UploadsManager._getFormContainer());
- }
-
- if (!document.all) {
- var $winW = window.innerWidth;
- var $winH = window.innerHeight;
- }
- else {
- var $winW = window.document.body.offsetWidth;
- var $winH = window.document.body.offsetHeight;
- }
-
- var left = Math.round(($winW - 350)/2)+'px';
- var top = Math.round(($winH - 110)/2)+'px';
-
- this.div.style.top = top;
- this.div.style.left = left;
- this.div.style.display = 'block';
-
- if (UploadsManager.useTransparency) {
- Request.setOpacity(100, this.div);
- }
-
- this.StartTime = this._getMicroTime();
- this.ProgressPercent = 0; // progress percent
- this.ProgressTime = new Array();
-
- this.uploaded = 0;
- this.total = 0;
- for (var f = 0; f < this.files.length; f++) {
- if (isset(this.files[f].uploaded)) {
- // get total bytes of non-uploaded files
- continue;
- }
- this.total += this.files[f].size;
- }
-
this.callFlash('StartUpload');
}
Uploader.prototype.cancelUpload = function() {
this.callFlash('StopUpload');
-
var $stats = this.callFlash('GetStats');
+
while ($stats.files_queued > 0) {
this.callFlash('CancelUpload');
-
$stats = this.callFlash('GetStats');
}
- UploadsManager.uploadCancelled = this.uploadCancelled = true;
+ this.uploadCancelled = true;
}
Uploader.prototype.UploadFileStart = function(file) {
- this.filename.innerHTML = file.name;
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = 0;
+ this.updateProgressOnly($file_index);
this.callFlash('AddFileParam', [file.id, 'field', this.params.field]);
this.callFlash('AddFileParam', [file.id, 'id', file.id]);
this.callFlash('AddFileParam', [file.id, 'flashsid', this.params.flashsid]);
- UploadsManager.iterate('disableBrowse', true); // disable all "Browse" buttons (not just for current uploader)!
-
// we can prevent user from adding any files here :)
this.callFlash('ReturnUploadStart', [true]);
}
Uploader.prototype.UploadProgress = function(file, bytesLoaded, bytesTotal) {
- this.cur_file_uploaded = bytesLoaded;
- var uploaded = this.uploaded + this.cur_file_uploaded;
- this.ProgressTime = this._getMicroTime() - this.StartTime;
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = Math.round(bytesLoaded / bytesTotal * 100);
+ this.updateProgressOnly($file_index);
+}
- var speed = 0;
- if (this.ProgressTime > 0) {
- speed = Math.round(uploaded / this.ProgressTime * 100) / 100;
+Uploader.prototype.UploadFileComplete = function(file) {
+ var $file_index = this.getFileIndex(file);
+
+ if ($file_index !== false) {
+ // in case if file upload was cancelled, then no info here
+ this.files[$file_index].uploaded = 1;
+ this.files[$file_index].progress = 100;
+ this.files[$file_index].temp = 1;
+ this.files[$file_index].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', file.name).replace('#FIELD#', this.params.field);
}
- this.progress.innerHTML = this._formatSize(uploaded) + ' / ' + this._formatSize(this.total) + ' (' + this._formatSize(speed) + '/s)';
- this.ProgressPercent = Math.round(uploaded / this.total * 100);
- this.done.style.width = this.ProgressPercent + '%';
- this.percent.innerHTML = this.ProgressPercent + '%';
+ this.updateInfo($file_index);
- this.elapsed.innerHTML = this._formatTime(this.ProgressTime );
- this.remaining.innerHTML = this._formatTime( this._getEstimatedTime() );
+ // upload next file in queue
+ var $stats = this.callFlash('GetStats');
+
+ if ($stats.files_queued > 0) {
+ this.callFlash('StartUpload');
+ }
+ else {
+ UploadsManager.UploadQueueComplete(this);
+ }
}
-Uploader.prototype.UploadFileComplete = function(file) {
- this.uploaded += this.cur_file_uploaded;
+Uploader.prototype.getFileIndex = function(file) {
for (var f = 0; f < this.files.length; f++) {
if (this.files[f].id == file.id) {
- this.files[f].uploaded = 1;
- this.files[f].temp = 1;
- this.files[f].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', file.name).replace('#FIELD#', this.params.field);
+ return f;
}
}
- this.updateInfo();
- // upload next file in queue
- var $stats = this.callFlash('GetStats');
- if ($stats.files_queued > 0 && !UploadsManager.uploadCancelled) {
- this.callFlash('StartUpload');
- } else {
- // all files in queue are uploaded OR upload was cancelled globally
- if (UploadsManager.uploadCancelled) {
- // when upload was cancelled globally -> cancel it for any other uploader
- this.cancelUpload();
- }
- UploadsManager.UploadQueueComplete(this);
- }
+ return false;
}
Uploader.prototype.queueEvent = function (function_body) {
@@ -598,32 +571,17 @@
};
Uploader.prototype.onFlashReady = function() {
- this.disableBrowse(false);
- UploadsManager.iterate('syncBrowseButton');
-}
+ var $me = this;
-Uploader.prototype.disableBrowse = function($disabled) {
- if ($disabled === undefined) {
- $disabled = true;
- }
-
this.queueEvent(
function() {
- this.callFlash('SetButtonDisabled', [$disabled]);
+ setTimeout(
+ function () {
+ // enable upload button, when flash is fully loaded
+ $me.callFlash('SetButtonDisabled', [false]);
+ }, 0
+ )
+
}
);
}
-
-Uploader.prototype._resetCounters = function() {
- this.StartTime = 0; // time, when upload was started
- this.ProgressPercent = 0; // upload progress in percents
- this.ProgressTime = 0; // flash upload process callback times
- this.total = 0; // total bytes to upload (from all queued files)
- this.uploaded = 0; // total uploaded bytes (from all queued files)
-}
-
-Uploader.prototype.finalizeUpload = function() {
- // hide progress bar only of uploader, that completed it's queue
- this.div.style.display = 'none';
- this._resetCounters();
-}
\ No newline at end of file
Index: admin_templates/swfupload.swf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 13635)
+++ install/install_data.sql (working copy)
@@ -673,7 +673,7 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:skins.delete', 11, 1, 1, 0);
-INSERT INTO Skins VALUES(DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\nbody, td {\r\n /* fix for Firefox, when font-size was not inherited in table cells */\r\n font-size: 9pt;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\ntable.head-table {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/right_background.png'') top right @@HeadBgColor@@ no-repeat;\r\n}\r\n\r\n.head-table tr td, .head-table tr td a {\r\n color: @@HeadColor@@\r\n}\r\n\r\ndiv#extra_toolbar td.button-active {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif'') bottom left repeat-x;\r\n height: 22px;\r\n}\r\n\r\ndiv#extra_toolbar td.button-active a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif'') repeat-x top left;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n font-weight: bold;\r\n color: #0080C8;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: #FFFFFF;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back_disabled.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n margin-left: 3px !important;\r\n white-space: nowrap;\r\n}\r\n\r\n.tab-active {\r\n background-color: #4487D9;\r\n}\r\n\r\n.tab a {\r\n color: #4487D9;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #FFFFFF;\r\n font-weight: bold;\r\n}\r\n\r\na.scroll-left, a.scroll-right {\r\n cursor: pointer;\r\n display: block;\r\n float: left;\r\n height: 18px;\r\n margin: 0px 1px;\r\n width: 18px;\r\n}\r\n\r\na.scroll-left {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/left.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.scroll-right {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/right.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.disabled {\r\n visibility: hidden !important;\r\n}\r\n\r\na.scroll-left:hover, a.scroll-right:hover {\r\n background-position: 0 -18px;\r\n}\r\n\r\ntd.scroll-right-container {\r\n width: 20px;\r\n}\r\n\r\ntd.scroll-right-container.disabled, td.scroll-right-container.disabled * {\r\n width: 0px;\r\n margin: 0px;\r\n}\r\n\r\ntd.scroll-right-container.disabled br {\r\n display: none;\r\n}\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2 {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2 {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-1 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-0 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\ntr.grid-header-row-0 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-0 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: 1px solid #C9C9C9;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n /*padding: 3px 5px 3px 5px;*/\r\n padding: 1px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(''@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif'') no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 160px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_mid.gif'') repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_input_line.gif'') no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.warning-table {\r\n background-color: #F0F1EB;\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n border-top-width: 0px;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n font-size: 11px;\r\n}\r\n\r\n.priority {\r\n color: red;\r\n padding-left: 1px;\r\n padding-right: 1px;\r\n font-size: 11px;\r\n}\r\n\r\n.small-statistics {\r\n font-size: 11px;\r\n color: #707070;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n\r\n/* Uploader */\r\n\r\n.uploader-main {\r\n position: absolute;\r\n display: none;\r\n z-index: 10;\r\n border: 1px solid #777;\r\n padding: 10px;\r\n width: 350px;\r\n height: 120px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n}\r\n\r\n.uploader-percent {\r\n width: 100%;\r\n padding-top: 3px;\r\n text-align: center;\r\n position: relative;\r\n z-index: 20;\r\n float: left;\r\n font-weight: bold;\r\n}\r\n\r\n.uploader-left {\r\n width: 100%;\r\n border: 1px solid black;\r\n height: 20px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/progress_left.gif'');\r\n}\r\n\r\n.uploader-done {\r\n width: 0%;\r\n background-color: green;\r\n height: 20px;\r\n background: #4A92CE url(''@@base_url@@/core/admin_templates/img/progress_done.gif'');\r\n}\r\n\r\n\r\n/* To be sorted */\r\nspan#category_path, span#category_path a {\r\n color: #FFFFFF;\r\n}\r\n\r\nspan#category_path a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Left side of bluebar */\r\n.header_left_bg {\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n padding-left: 5px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px;\r\n}\r\n\r\n.tree tr td a:hover, .tree tr td a.debug-only-item:hover {\r\n color: @@TreeHoverColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item {\r\n color: @@TreeHighColor@@;\r\n background-color: @@TreeHighBgColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: @@TreeHighHoverColor@@;\r\n}\r\n\r\n.tree tr td a.debug-only-item {\r\n color: grey;\r\n}\r\n\r\n/* Ajax Dropdown */\r\n.suggest-box {\r\n border: 1px solid #999;\r\n background-color: #fff;\r\n}\r\n\r\n.suggest-item, .suggest-item-over {\r\n padding: 1px 2px 0px 2px;\r\n font-family: arial,verdana;\r\n font-size: 12px;\r\n}\r\n\r\n.suggest-item-over {\r\n background-color: #3366CC;\r\n color: #fff;\r\n}', 'in-portal_logo_img.jpg', 'in-portal_logo_img2.jpg', 'in-portal_logo_login.gif', 'a:22:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#007BF4";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#FFFFFF";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"TreeHoverColor";a:1:{s:5:"Value";s:7:"#009FF0";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:18:"TreeHighHoverColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#DCECF6";}}', 1273946818, 1);
+INSERT INTO Skins VALUES(DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\nbody, td {\r\n /* fix for Firefox, when font-size was not inherited in table cells */\r\n font-size: 9pt;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\ntable.head-table {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/right_background.png'') top right @@HeadBgColor@@ no-repeat;\r\n}\r\n\r\n.head-table tr td, .head-table tr td a {\r\n color: @@HeadColor@@\r\n}\r\n\r\ndiv#extra_toolbar td.button-active {\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_button_background.gif'') bottom left repeat-x;\r\n height: 22px;\r\n}\r\n\r\ndiv#extra_toolbar td.button-active a {\r\n color: black;\r\n text-decoration: none;\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background: url(''@@base_url@@/core/admin_templates/img/top_frame/toolbar_background.gif'') repeat-x top left;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n font-weight: bold;\r\n color: #0080C8;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: #FFFFFF;\r\n /*background-color: @@HeadBarBgColor@@;*/\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(''@@base_url@@/core/admin_templates/img/button_back_disabled.gif'') #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n margin-left: 3px !important;\r\n white-space: nowrap;\r\n}\r\n\r\n.tab-active {\r\n background-color: #4487D9;\r\n}\r\n\r\n.tab a {\r\n color: #4487D9;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #FFFFFF;\r\n font-weight: bold;\r\n}\r\n\r\na.scroll-left, a.scroll-right {\r\n cursor: pointer;\r\n display: block;\r\n float: left;\r\n height: 18px;\r\n margin: 0px 1px;\r\n width: 18px;\r\n}\r\n\r\na.scroll-left {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/left.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.scroll-right {\r\n background: transparent url(''@@base_url@@/core/admin_templates/img/tabs/right.png'') no-repeat scroll 0 0;\r\n}\r\n\r\na.disabled {\r\n visibility: hidden !important;\r\n}\r\n\r\na.scroll-left:hover, a.scroll-right:hover {\r\n background-position: 0 -18px;\r\n}\r\n\r\ntd.scroll-right-container {\r\n width: 20px;\r\n}\r\n\r\ntd.scroll-right-container.disabled, td.scroll-right-container.disabled * {\r\n width: 0px;\r\n margin: 0px;\r\n}\r\n\r\ntd.scroll-right-container.disabled br {\r\n display: none;\r\n}\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2 {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2 {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-1 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-0 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\ntr.grid-header-row-0 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-0 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: 1px solid #C9C9C9;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-1 td.grid-header-col-1 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n /*padding: 3px 5px 3px 5px;*/\r\n padding: 1px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(''@@base_url@@/core/admin_templates/img/bgr_input_name_line.gif'') no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 160px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_mid.gif'') repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(''@@base_url@@/core/admin_templates/img/bgr_input_line.gif'') no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.warning-table {\r\n background-color: #F0F1EB;\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n border-top-width: 0px;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n font-size: 11px;\r\n}\r\n\r\n.priority {\r\n color: red;\r\n padding-left: 1px;\r\n padding-right: 1px;\r\n font-size: 11px;\r\n}\r\n\r\n.small-statistics {\r\n font-size: 11px;\r\n color: #707070;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n/* Uploader */\r\n.uploader-queue div.file {\r\n font-size: 11px;\r\n border: 1px solid #7F99C5;\r\n padding: 3px;\r\n background-color: #DEE7F6;\r\n margin-bottom: 2px;\r\n}\r\n\r\n.uploader-queue .left {\r\n float: left;\r\n vertical-align: top;\r\n}\r\n\r\n.uploader-queue .file-label {\r\n margin-left: 5px;\r\n}\r\n\r\n.uploader-queue .preview .delete-checkbox {\r\n margin-top: -3px;\r\n}\r\n\r\n.uploader-queue .progress-container {\r\n margin: 2px 5px 0px 5px;\r\n}\r\n\r\n.uploader-queue .progress-empty {\r\n width: 150px;\r\n height: 9px;\r\n border: 1px solid black;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_left.gif'') repeat-x;\r\n}\r\n\r\n.uploader-queue .progress-full {\r\n height: 9px;\r\n background: url(''@@base_url@@/core/admin_templates/img/progress_done.gif'');\r\n}\r\n\r\n.uploader-queue .thumbnail {\r\n /*margin-bottom: 2px;*/\r\n border: 1px solid black;\r\n background-color: grey;\r\n}\r\n\r\n/* To be sorted */\r\nspan#category_path, span#category_path a {\r\n color: #FFFFFF;\r\n}\r\n\r\nspan#category_path a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Left side of bluebar */\r\n.header_left_bg {\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n padding-left: 5px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px;\r\n}\r\n\r\n.tree tr td a:hover, .tree tr td a.debug-only-item:hover {\r\n color: @@TreeHoverColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a, .tree tr.highlighted td a.debug-only-item {\r\n color: @@TreeHighColor@@;\r\n background-color: @@TreeHighBgColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: @@TreeHighHoverColor@@;\r\n}\r\n\r\n.tree tr td a.debug-only-item {\r\n color: grey;\r\n}\r\n\r\n/* Ajax Dropdown */\r\n.suggest-box {\r\n border: 1px solid #999;\r\n background-color: #fff;\r\n}\r\n\r\n.suggest-item, .suggest-item-over {\r\n padding: 1px 2px 0px 2px;\r\n font-family: arial,verdana;\r\n font-size: 12px;\r\n}\r\n\r\n.suggest-item-over {\r\n background-color: #3366CC;\r\n color: #fff;\r\n}', 'in-portal_logo_img.jpg', 'in-portal_logo_img2.jpg', 'in-portal_logo_login.gif', 'a:22:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#007BF4";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#FFFFFF";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#000000";}s:14:"TreeHoverColor";a:1:{s:5:"Value";s:7:"#009FF0";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:18:"TreeHighHoverColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#DCECF6";}}', 1275134539, 1);
INSERT INTO LocalesList VALUES
(1, '0x0436', 'Afrikaans (South Africa)', 'af-ZA', 'Latn', '1252'),
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 13581)
+++ kernel/db/db_event_handler.php (working copy)
@@ -2700,14 +2700,24 @@
return ;
}
+ $object =& $event->getObject( Array ('skip_autoload' => true));
+ /* @var $object kDBItem */
+
+ $field = $this->Application->GetVar('field');
+ $options = $object->GetFieldOptions($field);
+
if ($this->Application->GetVar('tmp')) {
- $path = WRITEABLE . '/tmp/' . $this->Application->GetVar('id') . '_' . $this->Application->GetVar('file');
+ $path = WRITEABLE . '/tmp/' . $this->Application->GetVar('id') . '_' . $file;
}
else {
- $object =& $event->getObject(array('skip_autoload'=>true));
- $options = $object->GetFieldOptions($this->Application->GetVar('field'));
+ $upload_dir = $options['upload_dir'];
- $path = FULL_PATH.$options['upload_dir'].$file;
+ if (array_key_exists('include_path', $options) && $options['include_path']) {
+ // relative path is already included in field
+ $upload_dir = '';
+ }
+
+ $path = FULL_PATH . $upload_dir . $file;
}
$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
@@ -2716,10 +2726,21 @@
exit;
}
+ if ($this->Application->GetVar('thumb')) {
+ $image_helper =& $this->Application->recallObject('ImageHelper');
+ /* @var $image_helper ImageHelper */
+
+ $path = $image_helper->ResizeImage($path, $options['thumb_format']);
+
+ $base_url = rtrim($this->Application->BaseURL(), '/');
+ $path = preg_replace('/^' . preg_quote($base_url, '/') . '(.*)/', FULL_PATH . '\\1', $path);
+ $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
+ }
+
$type = mime_content_type($path);
- header('Content-Length: '.filesize($path));
- header('Content-Type: '.$type);
+ header('Content-Length: ' . filesize($path));
+ header('Content-Type: ' . $type);
safeDefine('DBG_SKIP_REPORTING',1);
Index: units/skins/skins_config.php
===================================================================
--- units/skins/skins_config.php (revision 13557)
+++ units/skins/skins_config.php (working copy)
@@ -117,7 +117,7 @@
'max_size'=>MAX_UPLOAD_SIZE, // in Bytes !
'file_types'=>'*.jpg;*.gif;*.png', 'files_description'=>'!la_hint_ImageFiles!',
'upload_dir' => WRITEBALE_BASE . '/user_files/', // relative to project's home
- 'as_image'=>true, 'thumb_width'=>100, 'thumb_height'=>100,
+ 'thumb_format' => 'resize:100x100',
'multiple'=>false, // false or max number of files - will be stored as serialized array of paths
'direct_links'=>false, // use direct file urls or send files through wrapper (requires mod_mime_magic)
'default' => null,
@@ -127,7 +127,7 @@
'max_size'=>MAX_UPLOAD_SIZE, // in Bytes !
'file_types'=>'*.jpg;*.gif;*.png', 'files_description'=>'!la_hint_ImageFiles!',
'upload_dir' => WRITEBALE_BASE . '/user_files/', // relative to project's home
- 'as_image'=>true, 'thumb_width'=>100, 'thumb_height'=>100,
+ 'thumb_format' => 'resize:100x100',
'multiple'=>false, // false or max number of files - will be stored as serialized array of paths
'direct_links'=>false, // use direct file urls or send files through wrapper (requires mod_mime_magic)
'not_null' => 1, 'default' => '',
@@ -137,7 +137,7 @@
'max_size'=>MAX_UPLOAD_SIZE, // in Bytes !
'file_types'=>'*.jpg;*.gif;*.png', 'files_description'=>'!la_hint_ImageFiles!',
'upload_dir' => WRITEBALE_BASE . '/user_files/', // relative to project's home
- 'as_image'=>true, 'thumb_width'=>100, 'thumb_height'=>100,
+ 'thumb_format' => 'resize:100x100',
'multiple'=>false, // false or max number of files - will be stored as serialized array of paths
'direct_links'=>false, // use direct file urls or send files through wrapper (requires mod_mime_magic)
'not_null' => 1, 'default' => '',
new_uploader_interface_modules.patch [^] (2,705 bytes) 2010-05-29 16:46
[Show Content]
Index: custom/units/widgets/widgets_config.php
===================================================================
--- custom/units/widgets/widgets_config.php (revision 13557)
+++ custom/units/widgets/widgets_config.php (working copy)
@@ -108,7 +108,7 @@
'VirtualFields' => Array (
'VirtualActionField' => Array ('type' => 'string', 'default' => ''),
),
-
+
'Fields' => Array (
'WidgetId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Title' => Array (
@@ -172,7 +172,7 @@
'max_size' => MAX_UPLOAD_SIZE, // in Bytes !
'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!',
'upload_dir' => '/system/user_files/', // relative to project's home
- 'as_image' => true, 'thumb_width' => 100, 'thumb_height' => 100,
+ 'as_image' => true, 'thumb_format' => 'resize:100x100',
'multiple' => false, // false or max number of files - will be stored as serialized array of paths
'direct_links' => false, // use direct file urls or send files through wrapper (requires mod_mime_magic)
'required' => 1, 'default' => null
Index: in-bulletin/units/polls/polls_config.php
===================================================================
--- in-bulletin/units/polls/polls_config.php (revision 13577)
+++ in-bulletin/units/polls/polls_config.php (working copy)
@@ -116,7 +116,7 @@
'formatter' => 'kPictureFormatter',
'max_size' => MAX_UPLOAD_SIZE, 'upload_dir' => IMAGES_PATH . 'polls/',
'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!',
- 'multiple' => false,
+ 'multiple' => false, 'thumb_format' => 'resize:200x200',
'max_len' => 255, 'not_null' => 1, 'default' => ''
),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
Index: in-commerce/units/manufacturers/manufacturers_config.php
===================================================================
--- in-commerce/units/manufacturers/manufacturers_config.php (revision 13557)
+++ in-commerce/units/manufacturers/manufacturers_config.php (working copy)
@@ -85,7 +85,7 @@
'formatter' => 'kPictureFormatter',
'max_size' => MAX_UPLOAD_SIZE, 'upload_dir' => IMAGES_PATH.'manufacturers/',
'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!',
- 'multiple' => false,
+ 'multiple' => false, 'thumb_format' => 'resize:100x100',
'max_len' => 255, 'not_null' => 1, 'default' => ''
),
'IsPopular' => Array (
new_uploader_queue.png [^] (64,692 bytes) 2010-06-01 04:18
combined_flash_uploader_fix_439.patch [^] (62,685 bytes) 2012-03-20 09:58
[Show Content]
Index: admin_templates/img/upload.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: admin_templates\img\upload.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: admin_templates/incs/form_blocks.tpl
===================================================================
--- admin_templates/incs/form_blocks.tpl (revision 3249)
+++ admin_templates/incs/form_blocks.tpl (working copy)
@@ -236,68 +236,53 @@
</tr>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="inp_edit_swf_upload" class="" is_last="" style="">
+<inp2:m_DefineElement name="inp_edit_swf_upload" class="" style="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
- <td class="uploader-text">
- <div class="uploader-main" id="<inp2:{$prefix}_InputName field="$field"/>_progress">
- <div class="uploader-percent" id="<inp2:{$prefix}_InputName field="$field"/>_percent">0%</div>
- <div class="uploader-left">
- <div class="uploader-done" id="<inp2:{$prefix}_InputName field="$field"/>_done"></div>
- </div>
- <table style="border-collapse: collapse; width: 100%;">
- <tr>
- <td style="width: 120px">Uploading:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_filename"></td>
- </tr>
- <tr>
- <td>Progress:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_progress"></td>
- </tr>
- <tr>
- <td>Time elapsed:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_elapsed"></td>
- </tr>
- <tr>
- <td>Time remaining:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_remaining"></td>
- </tr>
- <tr>
- <td colspan="2" style="text-align: center"><a href="javascript:UploadsManager.CancelUpload('<inp2:{$prefix}_InputName field="$field"/>')">Cancel</a></td>
- </tr>
- </table>
- </div>
- <div>
- <input class="button" type="button" onclick="UploadsManager.Browse('<inp2:{$prefix}_InputName field="$field"/>')" value="Browse"/>
- <input class="button" type="button" onclick="UploadsManager.StartUpload('<inp2:{$prefix}_InputName field="$field"/>')" value="Upload"/>
+ <td>
+ <div style="width: 63px; height: 21px;" id="<inp2:{$prefix}_InputName field='$field'/>_place_holder">
+
</div>
- <div id="<inp2:{$prefix}_InputName field="$field"/>_queueinfo"></div>
- <div id="<inp2:{$prefix}_InputName field="$field"/>_holder"></div>
+ <div id="<inp2:{$prefix}_InputName field='$field'/>_queueinfo" class="uploader-queue"></div>
- <input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[upload]" id="<inp2:{$prefix}_InputName field="$field"/>[upload]" value="<inp2:{$prefix}_Field field="$field"/>"><br/>
- <input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_ids]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_ids]" value="">
- <input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_names]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_names]" value="">
- <input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_deleted]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_deleted]" value="">
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[upload]" id="<inp2:{$prefix}_InputName field='$field'/>[upload]" value="<inp2:{$prefix}_Field field='$field' format='file_names'/>">
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_ids]" value="">
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_names]" value="">
+ <input type="hidden" name="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" id="<inp2:{$prefix}_InputName field='$field'/>[tmp_deleted]" value="">
<script type="text/javascript">
UploadsManager.AddUploader('<inp2:{$prefix}_InputName field="$field"/>',
{
- allowedFiletypesDescription : '<inp2:{$prefix}_FieldOption field="$field" option="files_description" js_escape="1"/>',
+ baseUrl: '<inp2:m_TemplatesBase />',
+ allowedFiletypesDescription : '<inp2:{$prefix}_FieldOption field="$field" option="files_description" result_to_var="files_description"/><inp2:m_Phrase name="$files_description" js_escape="1"/>',
allowedFiletypes : '<inp2:{$prefix}_FieldOption field="$field" option="file_types"/>',
allowedFilesize : '<inp2:{$prefix}_FieldOption field="$field" option="max_size"/>',
multiple : '<inp2:{$prefix}_FieldOption field="$field" option="multiple"/>',
prefix : '<inp2:m_Param name="prefix"/>',
field : '<inp2:m_Param name="field"/>',
+ thumb_format: '<inp2:{$prefix}_FieldOption field="$field" option="thumb_format"/>',
urls : '<inp2:{$prefix}_Field field="$field" format="file_urls" js_escape="1"/>',
names : '<inp2:{$prefix}_Field field="$field" format="file_names" js_escape="1"/>',
sizes : '<inp2:{$prefix}_Field field="$field" format="file_sizes" js_escape="1"/>',
flashsid : '<inp2:m_SID/>',
- uploadURL : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnUploadFile" js_escape="1" no_amp="1" />',
- deleteURL : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnDeleteFile" field="#FIELD#" file="#FILE#" js_escape="1" no_amp="1"/>',
- tmp_url : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnViewFile" tmp="1" field="#FIELD#" file="#FILE#" id="#ID#" js_escape="1" no_amp="1" />'
+ uploadURL : '<inp2:m_t pass="all,$prefix" {$prefix}_event="OnUploadFile" js_escape="1" no_amp="1" />',
+ deleteURL : '<inp2:m_t pass="all,$prefix" {$prefix}_event="OnDeleteFile" field="#FIELD#" file="#FILE#" js_escape="1" no_amp="1"/>',
+ tmp_url : '<inp2:m_t pass="all,$prefix" {$prefix}_event="OnViewFile" tmp="1" field="#FIELD#" file="#FILE#" id="#ID#" js_escape="1" no_amp="1" />',
+
+ // Button settings
+ buttonImageURL: 'img/upload.png', // Relative to the Flash file
+ buttonWidth: 63,
+ buttonHeight: 21,
+ buttonText: '<span class="theFont">Browse</span>',
+ buttonTextStyle: ".theFont { font-size: 12; font-family: arial, sans}",
+ buttonTextTopPadding: 2,
+ buttonTextLeftPadding: 9,
+ buttonPlaceholderId: '<inp2:{$prefix}_InputName field="$field"/>_place_holder'
}
)
- UploadsManager.formContainerId = 'scroll_container';
</script>
-
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/> </td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
Index: admin_templates/incs/header.tpl
===================================================================
--- admin_templates/incs/header.tpl (revision 3249)
+++ admin_templates/incs/header.tpl (working copy)
@@ -19,6 +19,8 @@
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" rev="stylesheet" href="incs/style.css" type="text/css" />
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+
<script type="text/javascript" src="js/is.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script language="javascript" src="js/application.js"></script>
Index: admin_templates/incs/style.css
===================================================================
--- admin_templates/incs/style.css (revision 3249)
+++ admin_templates/incs/style.css (working copy)
@@ -674,43 +674,45 @@
}
/* Uploader */
-
-.uploader-main {
- position: absolute;
- display: none;
- z-index: 10;
- border: 1px solid #777;
- padding: 10px;
- width: 350px;
- height: 120px;
- overflow: hidden;
- background-color: #fff;
+.uploader-queue div.file {
+ font-size: 11px;
+ border: 1px solid #7F99C5;
+ padding: 3px;
+ background-color: #DEE7F6;
+ margin-bottom: 2px;
}
-.uploader-percent {
- width: 100%;
- padding-top: 3px;
- text-align: center;
- position: relative;
- z-index: 20;
+.uploader-queue .left {
float: left;
- font-weight: bold;
+ vertical-align: top;
}
-.uploader-left {
- width: 100%;
+.uploader-queue .file-label {
+ margin-left: 5px;
+}
+
+.uploader-queue .preview .delete-checkbox {
+ margin-top: -3px;
+}
+
+.uploader-queue .progress-container {
+ margin: 2px 5px 0px 5px;
+}
+
+.uploader-queue .progress-empty {
+ width: 150px;
+ height: 9px;
border: 1px solid black;
- height: 20px;
- background: #fff url(../img/progress_left.gif);
+ background: url('../img/progress_left.gif') repeat-x;
}
-.uploader-done {
- width: 0%;
- background-color: green;
- height: 20px;
- background: #4A92CE url(../img/progress_done.gif);
+.uploader-queue .progress-full {
+ height: 9px;
+ background: url('../img/progress_done.gif');
}
-.uploader-text {
- font-size: 11px;
+.uploader-queue .thumbnail {
+ /*margin-bottom: 2px;*/
+ border: 1px solid black;
+ background-color: grey;
}
\ No newline at end of file
Index: admin_templates/js/script.js
===================================================================
--- admin_templates/js/script.js (revision 3249)
+++ admin_templates/js/script.js (working copy)
@@ -1473,4 +1473,26 @@
},
2000
)
+}
+
+function jq($selector) {
+ return $selector.replace(/(\[|\]|\.)/g, '\\$1');
+}
+
+function crc32(str) {
+ var table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';
+
+ var crc = 0;
+ var x = 0;
+ var y = 0;
+
+ crc = crc ^ (-1);
+
+ for (var i = 0, iTop = str.length; i < iTop; i++) {
+ y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
+ x = "0x" + table.substr( y * 9, 8 );
+ crc = ( crc >>> 8 ) ^ x;
+ }
+
+ return crc ^ (-1);
}
\ No newline at end of file
Index: admin_templates/js/uploader/upload_manager.js
===================================================================
--- admin_templates/js/uploader/upload_manager.js (revision 3249)
+++ admin_templates/js/uploader/upload_manager.js (working copy)
@@ -1,5 +1,6 @@
function UploadsManager() {
- addLoadEvent(
+
+ $(document).ready(
function() {
UploadsManager._initAll();
}
@@ -10,30 +11,17 @@
/* ==== Private Attributes ==== */
UploadsManager._nextId = 0;
+UploadsManager._uploadersReady = 0;
+
UploadsManager._debugMode = false;
-UploadsManager._Uploaders = new Object();
-UploadsManager._singleUpload = true;
+UploadsManager._Uploaders = {};
-/* ==== Public Attributes ==== */
-UploadsManager.useToolbar = true;
-UploadsManager.formContainerId = '';
-UploadsManager.useTransparency = true;
-UploadsManager.uploadCancelled = false;
-
/* ==== Private methods ==== */
UploadsManager._nextFlashId = function() {
this._nextId++;
return 'uploaderflash' + this._nextId;
}
-UploadsManager._getFromContainer = function() {
- if (UploadsManager.formContainerId) {
- return document.getElementById(UploadsManager.formContainerId);
- }
-
- return Form.Div;
-}
-
UploadsManager._initAll = function() {
this._createHooks();
@@ -42,6 +30,37 @@
}
}
+UploadsManager.iterate = function($method, $timeout) {
+ var $me = this;
+ var args = Array.prototype.slice.call(arguments); // convert to array
+
+ if ($timeout !== undefined) {
+ // 2nd parameter is given
+ if ((Object.prototype.toString.call($timeout) === '[object String]') && $timeout.match(/^timeout:([\d]+)$/)) {
+ // it's string in format "timeout:<number>"
+ $timeout = parseInt(RegExp.$1);
+ }
+ else {
+ // this is not the timeout, but 1st parameter of iteratable method
+ $timeout = undefined;
+ }
+ }
+
+ if ($timeout !== undefined) {
+ // make delayed iteration (helps with direct innerHTML assignments in IE)
+ args.splice(args.length - 1, 1); // remove timeout
+
+ setTimeout(function() { $me.iterate.apply($me, args); }, $timeout);
+ return ;
+ }
+
+ args.splice(0, 1); // remove method name
+
+ for (var i in this._Uploaders) {
+ this._Uploaders[i][$method].apply(this._Uploaders[i], args);
+ }
+}
+
UploadsManager._hasQueue = function() {
var has_queue = false;
@@ -66,27 +85,19 @@
}
UploadsManager._createHooks = function () {
- // hooking to standard toolbar select button to peform auto-upload when Save is clicked
- if (!UploadsManager.useToolbar || !isset(a_toolbar)) {
- return ;
- }
+ var $me = this;
- if (a_toolbar.ButtonExists('select')) {
- var old_onclick = a_toolbar.Buttons['select'].onClick;
- a_toolbar.Buttons['select'].onClick = function() {
- UploadsManager.UploadAll(
- function() {
- if (UploadsManager._debugMode) {
- if (!confirm('Proceed with form submitting?')) {
- return ;
- }
- }
+ $('#' + $form_name).submit(
+ function ($e) {
+ if ($me._hasQueue()) {
+ submitted = false;
+ alert('File upload is in progress. Please cancel the upload or wait until it\'s completed.');
- old_onclick();
- }
- );
+ return false;
+ }
}
- }
+
+ );
}
/* ==== Public methods ==== */
@@ -94,20 +105,25 @@
this._Uploaders[id] = new Uploader(id, params);
}
+UploadsManager.RemoveUploader = function(id) {
+ this._Uploaders[id].remove();
+ delete this._Uploaders[id];
+}
+
UploadsManager.DeleteFile = function(uploader_id, fname, confirmed) {
- if (!confirmed && !confirm('Are you sure you want to delete this file?')) {
- return;
+ if (!confirmed && !confirm('Are you sure you want to delete "' + fname + '" file?')) {
+ return false;
}
var $uploader = this._Uploaders[uploader_id];
Request.makeRequest(
- $uploader.deleteURL.replace('#FILE#', fname).replace('#FIELD#', $uploader.params.field),
+ $uploader.deleteURL.replace('#FILE#', encodeURIComponent(fname)).replace('#FIELD#', $uploader.params.field),
false, '',
function(req, fname, $uploader) {
$uploader.removeFile({id:fname})
$uploader.deleted.push(fname);
- $uploader.updateInfo();
+ $uploader.updateInfo(undefined, true);
},
function(req, fname, $uploader) {
@@ -115,70 +131,20 @@
},
fname, $uploader
);
-}
-UploadsManager.Browse = function(id) {
- this._Uploaders[id].queueEvent(
- function() {
- this.browse();
- }
- );
+ return true;
}
UploadsManager.StartUpload = function(id) {
- UploadsManager._singleUpload = true;
this._Uploaders[id].startUpload();
}
UploadsManager.CancelFile = function(id, file_id) {
- this._Uploaders[id].flash.CancelUpload(file_id);
+ this._Uploaders[id].callFlash('CancelUpload', [file_id]);
}
-UploadsManager.UploadAll = function(onAllUploaded) {
- if (!this._hasQueue()) {
- onAllUploaded();
- return ;
- }
-
- UploadsManager._singleUpload = false;
- for (var i in this._Uploaders) {
- // could raise problems, when simultanious uploads from diffrent uploaders are made
- this._Uploaders[i].startUpload();
- }
-
- this.OnAllUploaded = onAllUploaded;
-}
-
UploadsManager.UploadQueueComplete = function($uploader) {
- var $all_uploaded = true; // all queued files were uploaded
- var $all_processed = true; // all queued files were processed (uploaded OR cancelled)
- for (var i in this._Uploaders) {
- var $queue_owner = this._Uploaders[i].id == $uploader.id;
- if (UploadsManager._singleUpload && !$queue_owner) {
- // count only current uploader when single upload is made
- continue;
- }
-
- if ($queue_owner) {
- // hide progress bar only of uploader, that completed it's queue
- this._Uploaders[i].div.style.display = 'none';
- }
-
- var $empty_queue = !this._Uploaders[i].hasQueue();
-
- $all_uploaded = $all_uploaded && $empty_queue;
- $all_processed = $all_processed && ($empty_queue || this._Uploaders[i].uploadCancelled);
- }
-
- if (UploadsManager.useTransparency && $all_processed) {
- // remove transparency, when all uploaders are done
- Request.setOpacity(100, UploadsManager._getFromContainer());
- }
-
- if ($all_uploaded && isset(this.OnAllUploaded) && !this.uploadCancelled) {
- this.OnAllUploaded();
- }
}
UploadsManager.CancelUpload = function(id) {
@@ -187,7 +153,7 @@
UploadsManager.setDebugMode = function ($enabled) {
/*for (var $uploader_index in this._Uploaders) {
- this._Uploaders[$uploader_index].flash.SetDebugEnabled($enabled);
+ this._Uploaders[$uploader_index].clallFlash('SetDebugEnabled', [$enabled]);
}*/
this._debugMode = $enabled;
@@ -233,44 +199,55 @@
UploadsManager.onFileQueued = function(file) {
var $uploader = UploadsManager._getUploader(file);
+// file = this.unescapeFilePostParams(file);
$uploader.queueEvent(
function() {
- this.flash.AddFileParam(file.id, 'field', this.params.field);
- this.flash.AddFileParam(file.id, 'id', file.id);
- this.flash.AddFileParam(file.id, 'flashsid', this.params.flashsid);
-
if (this.files_count >= this.params.multiple) {
// new file can exceed allowed file number
if (this.params.multiple > 1) {
// it definetly exceed it
UploadsManager.onFileQueueError(file, -100, this.params.multiple);
- this.flash.CancelUpload(file.id);
+ this.callFlash('CancelUpload', [file.id]);
}
else {
// delete file added
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
if (this.files[0].uploaded) {
UploadsManager.DeleteFile(UploadsManager._getUploader(file).id, this.files[0].name, true);
}
else {
- this.flash.CancelUpload(this.files[0].id);
+ this.callFlash('CancelUpload', [this.files[0].id]);
}
+
+ this.startUpload();
}
}
else {
// new file will not exceed allowed file number
this.files_count++;
this.files.push(file);
- this.total += file.size;
+
+ this.startUpload();
}
- this.updateInfo();
+
+ this.updateInfo(this.files.length - 1);
}
)
}
+UploadsManager.onUploadSuccess = function(file, serverData, receivedResponse) {
+ var $uploader = UploadsManager._getUploader(file);
+
+ $uploader.queueEvent(
+ function() {
+ this.UploadSuccess(file, serverData, receivedResponse);
+ }
+ );
+}
+
UploadsManager.onUploadError = function(file, errorCode, message) {
var $uploader = UploadsManager._getUploader(file);
@@ -346,6 +323,16 @@
alert('Error [' + errorCode + ']: ' + message + "\n" + 'Occured on file ' + file.name);
}
+UploadsManager.onFlashReady = function ($uploader_id) {
+ this._Uploaders[$uploader_id].onFlashReady();
+ this._uploadersReady++;
+
+ if (this._uploadersReady == this._nextId) {
+ // all uploaders are ready
+ Application.processHooks('m:OnUploadersReady');
+ }
+}
+
UploadsManager.onDebug = function (message) {
if (!UploadsManager._debugMode) {
return ;
Index: admin_templates/js/uploader/uploader.js
===================================================================
--- admin_templates/js/uploader/uploader.js (revision 3249)
+++ admin_templates/js/uploader/uploader.js (working copy)
@@ -16,17 +16,59 @@
// set params to uploader
this._eventQueue = [];
this.uploadCancelled = false;
+ this.flashReady = false;
this.params = params;
+ this._ensureDefaultValues();
+
this.files_count = 0;
this.files = new Array();
- this.deleted = new Array()
+ this.deleted = new Array();
this.uploadURL = params.uploadURL;
this.deleteURL = params.deleteURL;
+
+ this.enableUploadButton();
}
/* ==== Private methods ==== */
+Uploader.prototype._ensureDefaultValues = function() {
+ // Upload backend settings
+ var $defaults = {
+ baseUrl: '',
+ uploadURL : '',
+ useQueryString : false,
+ requeueOnError : false,
+ httpSuccess : '',
+ filePostName : 'Filedata',
+ allowedFiletypes : '*.*',
+ allowedFiletypesDescription : 'All Files',
+ allowedFilesize : 0, // Default zero means "unlimited"
+ multiple : 0,
+ thumb_format: '',
+ fileQueueLimit : 0,
+ buttonImageURL : '',
+ buttonWidth : 1,
+ buttonHeight : 1,
+ buttonText : '',
+ buttonTextTopPadding : 0,
+ buttonTextLeftPadding : 0,
+ buttonTextStyle : 'color: #000000; font-size: 16pt;',
+ buttonAction : parseInt(this.params.multiple) == 1 ? -100 : -110, // SELECT_FILE : -100, SELECT_FILES : -110
+ buttonDisabled : true, //false,
+ buttonCursor : -1, // ARROW : -1, HAND : -2
+ wmode : 'transparent', // "window", "transparent", "opaque"
+ buttonPlaceholderId: false
+ }
+
+ for (var $param_name in $defaults) {
+ if (this.params[$param_name] == null) {
+// console.log('setting default value [', $defaults[$param_name], '] for missing parameter [', $param_name, '] instead of [', this.params[$param_name], ']');
+ this.params[$param_name] = $defaults[$param_name];
+ }
+ }
+}
+
Uploader.prototype._normalizeFilesize = function($file_size) {
var $normalize_size = parseInt($file_size);
if (isNaN($normalize_size)) {
@@ -40,7 +82,8 @@
Uploader.prototype._prepareFiles = function() {
var ids = '';
var names = '';
- for (var f in this.files) {
+
+ for (var f = 0; f < this.files.length; f++) {
if (isset(this.files[f].uploaded) && !isset(this.files[f].temp)) {
continue;
}
@@ -51,38 +94,24 @@
ids = ids.replace(/\|$/, '', ids);
names = names.replace(/\|$/, '', names);
+
document.getElementById(this.id+'[tmp_ids]').value = ids;
document.getElementById(this.id+'[tmp_names]').value = names;
document.getElementById(this.id+'[tmp_deleted]').value = this.deleted.join('|');
}
-Uploader.prototype._getMicroTime = function() {
- var $now = new Date();
- return Math.round($now.getTime() / 1000); // because miliseconds are returned too
-}
+Uploader.prototype._formatSize = function (bytes) {
+ var kb = Math.round(bytes / 1024);
-Uploader.prototype._getEstimatedTime = function() {
- return Math.ceil((100 - this.ProgressPercent) * this.ProgressTime / this.ProgressPercent);
-}
+ if (kb < 1024) {
+ return kb + ' KB';
+ }
-Uploader.prototype._formatTime = function ($seconds) {
- $seconds = parseInt($seconds);
+ var mb = Math.round(kb / 1024 * 100) / 100;
- var $minutes = Math.floor($seconds / 60);
- if ($minutes < 10) $minutes = '0' + $minutes;
- $seconds = $seconds % 60;
- if ($seconds < 10) $seconds = '0' + $seconds;
-
- return $minutes + ':' + $seconds;
+ return mb + ' MB';
}
-Uploader.prototype._formatSize = function (bytes) {
- var kb = Math.round(bytes / 1024);
- if (kb < 1024) return kb+'Kb';
- var mb = Math.round(kb / 1024 * 100)/100;
- return mb+'Mb';
-}
-
Uploader.prototype._executeNextEvent = function () {
var f = this._eventQueue ? this._eventQueue.shift() : null;
if (typeof(f) === 'function') {
@@ -92,35 +121,14 @@
/* ==== Public methods ==== */
Uploader.prototype.init = function() {
- var holder = document.createElement('DIV');
- document.body.appendChild(holder);
-
- if (UploadsManager.useTransparency) {
- document.getElementById($form_name).style.display = 'block';
- }
-
- // moving out progress div to overcome loosing of flash object after setting opacity
- this.div = document.getElementById(this.id+'_progress');
- var clone = this.div.cloneNode(true);
- this.div.parentNode.removeChild(this.div)
- this.div = document.body.appendChild(clone);
this.IconPath = this.params.IconPath ? this.params.IconPath : '../admin_templates/img/browser/icons';
- this.filename = document.getElementById(this.id+'_progress_filename');
- this.progress = document.getElementById(this.id+'_progress_progress');
- this.elapsed = document.getElementById(this.id+'_progress_elapsed');
- this.remaining = document.getElementById(this.id+'_progress_remaining');
- this.percent = document.getElementById(this.id+'_percent');
- this.done = document.getElementById(this.id+'_done');
- this.total = 0;
- this.uploaded = 0;
-
// initialize flash object
this.flash_id = UploadsManager._nextFlashId();
// add callbacks for every event, because none of callbacks will work in other case (see swfupload documentation)
SWFUpload.instances[this.flash_id] = this;
- SWFUpload.instances[this.flash_id].flashReady = UploadsManager.onHandleEverything;
+ SWFUpload.instances[this.flash_id].flashReady = function () { UploadsManager.onFlashReady(this.id); };
SWFUpload.instances[this.flash_id].fileDialogStart = UploadsManager.onHandleEverything;
SWFUpload.instances[this.flash_id].fileQueued = UploadsManager.onFileQueued;
SWFUpload.instances[this.flash_id].fileQueueError = UploadsManager.onFileQueueError;
@@ -129,97 +137,290 @@
SWFUpload.instances[this.flash_id].uploadStart = UploadsManager.onUploadStart;
SWFUpload.instances[this.flash_id].uploadProgress = UploadsManager.onUploadProgress;
SWFUpload.instances[this.flash_id].uploadError = UploadsManager.onUploadError;
- SWFUpload.instances[this.flash_id].uploadSuccess = UploadsManager.onHandleEverything;
+ SWFUpload.instances[this.flash_id].uploadSuccess = UploadsManager.onUploadSuccess;
SWFUpload.instances[this.flash_id].uploadComplete = UploadsManager.onUploadComplete;
SWFUpload.instances[this.flash_id].debug = UploadsManager.onDebug;
- this.swf = new SWFObject('swfupload.swf', this.flash_id, '0', '0', '8', '#FFFFFF');
-// this.swf = new SWFObject('swfupload_f9.swf', this.flash_id, '0', '0', '9', '#FFFFFF');
+ this.swf = new SWFObject(this.params.baseUrl + '/swfupload.swf', this.flash_id, this.params.buttonWidth, this.params.buttonHeight, '9', '#FFFFFF');
this.swf.setAttribute('style', '');
+ this.swf.addParam('wmode', encodeURIComponent(this.params.wmode));
- this.swf.addVariable('movieName', escape(this.flash_id));
- this.swf.addVariable('fileUploadLimit', escape(this.params.multiple));
- this.swf.addVariable('fileSizeLimit', escape(this.params.allowedFilesize)); // in kilobytes
- this.swf.addVariable('fileTypes', escape(this.params.allowedFiletypes));
- this.swf.addVariable('fileTypesDescription', escape(this.params.allowedFiletypesDescription));
- this.swf.addVariable('uploadURL', escape(this.params.uploadURL));
+ this.swf.addVariable('movieName', encodeURIComponent(this.flash_id));
+ this.swf.addVariable('fileUploadLimit', 0);
+ this.swf.addVariable('fileQueueLimit', encodeURIComponent(this.params.fileQueueLimit));
+ this.swf.addVariable('fileSizeLimit', encodeURIComponent(this.params.allowedFilesize)); // in kilobytes
+ this.swf.addVariable('fileTypes', encodeURIComponent(this.params.allowedFiletypes));
+ this.swf.addVariable('fileTypesDescription', encodeURIComponent(this.params.allowedFiletypesDescription));
+ this.swf.addVariable('uploadURL', encodeURIComponent(this.params.uploadURL));
+ // upload button appearance
+ this.swf.addVariable('buttonImageURL', encodeURIComponent(this.params.buttonImageURL));
+ this.swf.addVariable('buttonWidth', encodeURIComponent(this.params.buttonWidth));
+ this.swf.addVariable('buttonHeight', encodeURIComponent(this.params.buttonHeight));
+ this.swf.addVariable('buttonText', encodeURIComponent(this.params.buttonText));
+ this.swf.addVariable('buttonTextTopPadding', encodeURIComponent(this.params.buttonTextTopPadding));
+ this.swf.addVariable('buttonTextLeftPadding', encodeURIComponent(this.params.buttonTextLeftPadding));
+ this.swf.addVariable('buttonTextStyle', encodeURIComponent(this.params.buttonTextStyle));
+ this.swf.addVariable('buttonAction', encodeURIComponent(this.params.buttonAction));
+ this.swf.addVariable('buttonDisabled', encodeURIComponent(this.params.buttonDisabled));
+ this.swf.addVariable('buttonCursor', encodeURIComponent(this.params.buttonCursor));
+
if (UploadsManager._debugMode) {
- this.swf.addVariable('debugEnabled', escape('true')); // flash var
+ this.swf.addVariable('debugEnabled', encodeURIComponent('true')); // flash var
}
- this.swf.write(holder);
+ this.renderBrowseButton();
- this.flash = document.getElementById(this.flash_id);
- /*if (this.flash != null) {
- if(this.flash.PercentLoaded() == 100) {
- alert('done movie: '+this.flash.PercentLoaded());
- }
- }
- else {
- alert('this.flash is null')
- }*/
-
if (this.params.urls != '') {
var urls = this.params.urls.split('|');
var names = this.params.names.split('|');
var sizes = this.params.sizes.split('|');
- for (var i in urls) {
+
+ for (var i = 0; i < urls.length; i++) {
var a_file = {
- id : names[i],
+ id : 'uploaded_' + crc32(names[i]),
name : names[i],
url : urls[i],
size: sizes[i],
- uploaded : 1
- }
- this.files.push(a_file)
+ uploaded : 1,
+ progress: 100
+ };
+
+ this.files.push(a_file);
this.files_count++;
}
+
this.updateInfo();
}
}
-Uploader.prototype.updateInfo = function() {
- var o = '';
- for (var f in this.files) {
- this.files[f].name.match(/\.([^.]*)$/);
- var ext = RegExp.$1.toLowerCase();
+Uploader.prototype.enableUploadButton = function() {
+ var $me = this;
- var icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
- o += '<img src="' + this.IconPath + '/' + icon+'.gif" style="position: relative; top: 2px;"> ';
- if (isset(this.files[f].uploaded)) {
- o += '<a href="'+this.files[f].url+'" target="_new">'+this.files[f].name + '</a> ('+this._formatSize(this.files[f].size)+') [<a href="javascript:UploadsManager.DeleteFile(\''+this.id+'\', \''+this.files[f].name+'\')">Delete</a>]<br/>';
+ // enable upload button, when flash is fully loaded
+ this.queueEvent(
+ function() {
+ setTimeout(
+ function () {
+ $me.callFlash('SetButtonDisabled', [false]);
+ }, 0
+ )
}
+ );
+}
+
+Uploader.prototype.renderBrowseButton = function() {
+ var holder = document.getElementById(this.params.buttonPlaceholderId);
+ this.swf.write(holder);
+
+ this.flash = document.getElementById(this.flash_id);
+}
+
+Uploader.prototype.remove = function() {
+ var id = this.params.buttonPlaceholderId;
+
+ var obj = document.getElementById(id);
+
+ if (obj/* && obj.nodeName == "OBJECT"*/) {
+ var u = navigator.userAgent.toLowerCase();
+ var p = navigator.platform.toLowerCase();
+ var windows = p ? /win/.test(p) : /win/.test(u);
+ var $me = this;
+
+ if (document.all && windows) {
+ obj.style.display = "none";
+ (function(){
+ if (obj.readyState == 4) {
+ $me.removeObjectInIE(id);
+ }
+ else {
+ setTimeout(arguments.callee, 10);
+ }
+ })();
+ }
else {
- o += this.files[f].name + ' ('+this._formatSize(this.files[f].size)+') [<a href="javascript:UploadsManager.CancelFile(\'' + UploadsManager._getUploader(this.files[f]).id + '\', \''+this.files[f].id+'\')">Delete</a>]<br/>';
+ obj.parentNode.removeChild(obj);
}
}
- document.getElementById(this.id+'_queueinfo').innerHTML = o;
- this._prepareFiles()
}
+Uploader.prototype.removeObjectInIE = function(id) {
+ var obj = document.getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == 'function') {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+}
+
+Uploader.prototype.isImage = function($filename) {
+ $filename.match(/\.([^.]*)$/);
+ var $ext = RegExp.$1.toLowerCase();
+
+ return $ext.match(/^(bmp|gif|jpg|jpeg|png)$/);
+}
+
+Uploader.prototype.getFileIcon = function($filename) {
+ $filename.match(/\.([^.]*)$/);
+ var ext = RegExp.$1.toLowerCase();
+
+ $icon = ext.match(/^(ai|avi|bmp|cs|dll|doc|dot|exe|fla|gif|htm|html|jpg|js|mdb|mp3|pdf|ppt|rdp|swf|swt|txt|vsd|xls|xml|zip)$/) ? ext : 'default.icon';
+ return this.IconPath + '/' + $icon + '.gif';
+}
+
+Uploader.prototype.getQueueElement = function($file) {
+ var $ret = '';
+ var $icon_image = this.getFileIcon($file.name);
+ var $file_label = $file.name + ' (' + this._formatSize($file.size) + ')';
+ var $need_preview = false;
+
+ if (isset($file.uploaded)) {
+ // add deletion checkbox
+ $need_preview = (this.params.thumb_format.length > 0) && this.isImage($file.name);
+ $ret += '<div class="left delete-checkbox"><input type="checkbox" class="delete-file-btn" checked/></div>';
+
+ // add icon based on file type
+ $ret += '<div class="left">';
+
+ if ($need_preview) {
+ $ret += '<a href="' + $file.url + '" target="_new"><img class="thumbnail-image" large_src="' + $file.url + '&thumb=1" src="' + $icon_image + '" alt=""/></a>';
+ }
+ else {
+ $ret += '<img src="' + $icon_image + '"/>';
+ }
+
+ $ret += '</div>'
+
+ // add filename + preview link
+ $ret += '<div class="left file-label"><a href="' + $file.url + '" target="_new">' + $file_label + '</a></div>';
+ }
+ else {
+ // add icon based on file type
+ $ret += '<div class="left"><img src="' + $icon_image + '"/></div>';
+
+ // add filename
+ $ret += '<div class="left file-label">' + $file_label + '</div>';
+
+ // add empty progress bar
+ $ret += '<div id="' + $file.id + '_progress" class="progress-container left"><div class="progress-empty"><div class="progress-full" style="width: 0%;"></div></div></div>';
+
+ // add cancel upload link
+ $ret += '<div class="left"><a href="#" class="cancel-upload-btn">Cancel</a></div>';
+ }
+
+ $ret += '<div style="clear: both;"/>';
+ $ret = $('<div id="' + $file.id + '_queue_row" class="file' + ($need_preview ? ' preview' : '') + '">' + $ret + '</div>');
+
+ // set click events
+ var $me = this;
+
+ $('.delete-file-btn', $ret).click(
+ function ($e) {
+ $(this).attr('checked', UploadsManager.DeleteFile($me.id, $file.name) ? '' : 'checked');
+ }
+ );
+
+ $('.cancel-upload-btn', $ret).click(
+ function ($e) {
+ UploadsManager.CancelFile(UploadsManager._getUploader($file).id, $file.id);
+ return false;
+ }
+ );
+
+ // prepare auto-loading preview
+ var $image = $('img.thumbnail-image', $ret);
+
+ if ($image.length > 0) {
+ var $tmp_image = new Image();
+ $tmp_image.src = $image.attr('large_src');
+
+ $($tmp_image).load (
+ function ($e) {
+ $image.attr('src', $tmp_image.src).addClass('thumbnail');
+ }
+ );
+ }
+
+ return $ret;
+}
+
+Uploader.prototype.updateQueueFile = function($file_index, $delete_file) {
+ $queue_container = $( jq('#' + this.id + '_queueinfo') );
+
+ if ($delete_file !== undefined && $delete_file) {
+ $( jq('#' + this.files[$file_index].id + '_queue_row') ).remove();
+
+ if (this.files.length == 1) {
+ $queue_container.css('margin-top', '0px');
+ }
+ return ;
+ }
+
+ $ret = this.getQueueElement( this.files[$file_index] );
+ var $row = $( jq('#' + this.files[$file_index].id + '_queue_row') );
+
+ if ($row.length > 0) {
+ // file round -> replace
+ $row.replaceWith($ret);
+ }
+ else {
+ // file not found - add
+ $( jq('#' + this.id + '_queueinfo') ).append($ret);
+ $queue_container.css('margin-top', '8px');
+ }
+}
+
+Uploader.prototype.updateInfo = function($file_index, $prepare_only) {
+ if ($prepare_only === undefined || !$prepare_only) {
+ if ($file_index === undefined) {
+ for (var f = 0; f < this.files.length; f++) {
+ this.updateQueueFile(f);
+ }
+ }
+ else {
+ this.updateQueueFile($file_index);
+ }
+ }
+
+ this._prepareFiles();
+}
+
+Uploader.prototype.updateProgressOnly = function ($file_index) {
+ var $progress_code = '<div class="progress-empty" title="' + this.files[$file_index].progress + '%"><div class="progress-full" style="width: ' + this.files[$file_index].progress + '%;"></div></div>';
+
+ $('#' + this.files[$file_index].id + '_progress').html($progress_code);
+}
+
Uploader.prototype.removeFile = function (file) {
+ var count = 0;
var n_files = new Array();
- var count = 0;
- this.total = 0;
- for (var f in this.files) {
+ var $to_delete = [];
+
+ for (var f = 0; f < this.files.length; f++) {
if (this.files[f].id != file.id && this.files[f].name != file.id) {
n_files.push(this.files[f]);
- if (!isset(this.files[f].uploaded)) {
- this.total += file.size;
- }
count++;
}
+ else {
+ $to_delete.push(f);
+ }
}
+ for (var $i = 0; $i < $to_delete.length; $i++) {
+ this.updateQueueFile($to_delete[$i], true);
+ }
+
this.files = n_files;
this.files_count = count;
- this.updateInfo();
+ this.updateInfo(undefined, true);
}
Uploader.prototype.hasQueue = function() {
- for (var f in this.files) {
+ for (var f = 0; f < this.files.length; f++) {
if (isset(this.files[f].uploaded)) {
continue;
}
@@ -231,121 +432,93 @@
}
Uploader.prototype.startUpload = function() {
- UploadsManager.uploadCancelled = this.uploadCancelled = false;
+ this.uploadCancelled = false;
if (!this.hasQueue()) {
return;
}
- if (UploadsManager.useTransparency) {
- Request.setOpacity(30, UploadsManager._getFromContainer());
- }
-
- if (!document.all) {
- var $winW = window.innerWidth;
- var $winH = window.innerHeight;
- }
- else {
- var $winW = window.document.body.offsetWidth;
- var $winH = window.document.body.offsetHeight;
- }
-
- var left = Math.round(($winW - 350)/2)+'px';
- var top = Math.round(($winH - 110)/2)+'px';
-
- this.div.style.top = top;
- this.div.style.left = left;
- this.div.style.display = 'block';
-
- if (UploadsManager.useTransparency) {
- Request.setOpacity(100, this.div);
- }
-
- this.StartTime = this._getMicroTime();
- this.ProgressPercent = 0; // progress percent
- this.ProgressTime = new Array();
-
- this.uploaded = 0;
- this.total = 0;
- for (var f in this.files) {
- if (isset(this.files[f].uploaded)) continue;
- this.total += this.files[f].size;
- }
-
- this.flash.StartUpload();
+ this.callFlash('StartUpload');
}
Uploader.prototype.cancelUpload = function() {
- this.flash.StopUpload();
+ this.callFlash('StopUpload');
+ var $stats = this.callFlash('GetStats');
- var $stats = this.flash.GetStats();
while ($stats.files_queued > 0) {
- this.flash.CancelUpload();
- $stats = this.flash.GetStats();
+ this.callFlash('CancelUpload');
+ $stats = this.callFlash('GetStats');
}
- UploadsManager.uploadCancelled = this.uploadCancelled = true;
+ this.uploadCancelled = true;
}
-Uploader.prototype.browse = function() {
- if (parseInt(this.params.multiple) > 1) {
- this.flash.SelectFiles();
- } else {
- this.flash.SelectFile();
- }
-}
-
Uploader.prototype.UploadFileStart = function(file) {
- this.filename.innerHTML = file.name;
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = 0;
+ this.updateProgressOnly($file_index);
+ this.callFlash('AddFileParam', [file.id, 'field', this.params.field]);
+ this.callFlash('AddFileParam', [file.id, 'id', file.id]);
+ this.callFlash('AddFileParam', [file.id, 'flashsid', this.params.flashsid]);
+
// we can prevent user from adding any files here :)
- this.flash.ReturnUploadStart(true);
+ this.callFlash('ReturnUploadStart', [true]);
}
Uploader.prototype.UploadProgress = function(file, bytesLoaded, bytesTotal) {
- this.cur_file_uploaded = bytesLoaded;
- var uploaded = this.uploaded+this.cur_file_uploaded;
- this.ProgressTime = this._getMicroTime() - this.StartTime;
+ var $file_index = this.getFileIndex(file);
+ this.files[$file_index].progress = Math.round(bytesLoaded / bytesTotal * 100);
+ this.updateProgressOnly($file_index);
+}
- var speed = 0;
- if (this.ProgressTime > 0) {
- speed = Math.round(uploaded/this.ProgressTime*100)/100;
+Uploader.prototype.UploadSuccess = function(file, serverData, receivedResponse) {
+ if (!receivedResponse) {
+ return ;
}
- this.progress.innerHTML = this._formatSize(uploaded)+' / '+this._formatSize(this.total) + ' ('+this._formatSize(speed)+'/s)';
- this.ProgressPercent = Math.round(uploaded/this.total*100);
- this.done.style.width = this.ProgressPercent+'%';
- this.percent.innerHTML = this.ProgressPercent+'%';
-
- this.elapsed.innerHTML = this._formatTime(this.ProgressTime );
- this.remaining.innerHTML = this._formatTime( this._getEstimatedTime() );
+ for (var f = 0; f < this.files.length; f++) {
+ if (this.files[f].id == file.id) {
+ // new uploaded file name returned by OnUploadFile event
+ this.files[f].name = serverData;
+ }
+ }
}
Uploader.prototype.UploadFileComplete = function(file) {
- this.uploaded += this.cur_file_uploaded;
- for (var f in this.files) {
- if (this.files[f].id == file.id) {
- this.files[f].uploaded = 1;
- this.files[f].temp = 1;
- this.files[f].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', file.name).replace('#FIELD#', this.params.field);
- }
+ // file was uploaded OR file upload was cancelled
+ var $file_index = this.getFileIndex(file);
+
+ if ($file_index !== false) {
+ // in case if file upload was cancelled, then no info here
+ this.files[$file_index].uploaded = 1;
+ this.files[$file_index].progress = 100;
+ this.files[$file_index].temp = 1;
+ this.files[$file_index].url = this.params.tmp_url.replace('#ID#', file.id).replace('#FILE#', encodeURIComponent(file.name)).replace('#FIELD#', this.params.field);
+ this.updateInfo($file_index);
}
- this.updateInfo();
// upload next file in queue
- var $stats = this.flash.GetStats();
- if ($stats.files_queued > 0 && !UploadsManager.uploadCancelled) {
- this.flash.StartUpload();
- } else {
- // all files in queue are uploaded OR upload was cancelled globally
- if (UploadsManager.uploadCancelled) {
- // when upload was cancelled globally -> cancel it for any other uploader
- this.cancelUpload();
- }
+ var $stats = this.callFlash('GetStats');
+
+ if ($stats.files_queued > 0) {
+ this.callFlash('StartUpload');
+ }
+ else {
UploadsManager.UploadQueueComplete(this);
}
}
+Uploader.prototype.getFileIndex = function(file) {
+ for (var f = 0; f < this.files.length; f++) {
+ if (this.files[f].id == file.id) {
+ return f;
+ }
+ }
+
+ return false;
+}
+
Uploader.prototype.queueEvent = function (function_body) {
// Warning: Don't call this.debug inside here or you'll create an infinite loop
var self = this;
@@ -353,10 +526,98 @@
// Queue the event
this._eventQueue.push(function_body);
+ if (!this.flashReady) {
+ // don't execute any flash-related events, while it's not completely loaded
+ return ;
+ }
+
// Execute the next queued event
setTimeout(
function () {
self._executeNextEvent();
}, 0
);
-};
\ No newline at end of file
+};
+
+Uploader.prototype._executeQueuedEvents = function() {
+ var $me = this;
+
+ setTimeout(
+ function () {
+ $me._executeNextEvent();
+
+ if ($me._eventQueue.length > 0) {
+ $me._executeQueuedEvents();
+ }
+
+ }, 0
+ );
+}
+
+// Private: callFlash handles function calls made to the Flash element.
+// Calls are made with a setTimeout for some functions to work around
+// bugs in the ExternalInterface library.
+Uploader.prototype.callFlash = function (functionName, argumentArray) {
+ argumentArray = argumentArray || [];
+
+ var returnValue;
+
+ if (typeof this.flash[functionName] === 'function') {
+ // We have to go through all this if/else stuff because the Flash functions don't have apply() and only accept the exact number of arguments.
+ if (argumentArray.length === 0) {
+ returnValue = this.flash[functionName]();
+ } else if (argumentArray.length === 1) {
+ returnValue = this.flash[functionName](argumentArray[0]);
+ } else if (argumentArray.length === 2) {
+ returnValue = this.flash[functionName](argumentArray[0], argumentArray[1]);
+ } else if (argumentArray.length === 3) {
+ returnValue = this.flash[functionName](argumentArray[0], argumentArray[1], argumentArray[2]);
+ } else {
+ throw 'Too many arguments';
+ }
+
+ // Unescape file post param values
+ if (returnValue != undefined && typeof returnValue.post === 'object') {
+ returnValue = this.unescapeFilePostParams(returnValue);
+ }
+
+ return returnValue;
+ } else {
+// alert('invalid function name: ' + functionName);
+ throw "Invalid function name: " + functionName;
+ }
+};
+
+// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
+// properties that contain characters that are not valid for JavaScript identifiers. To work around this
+// the Flash Component escapes the parameter names and we must unescape again before passing them along.
+Uploader.prototype.unescapeFilePostParams = function (file) {
+ var reg = /[$]([0-9a-f]{4})/i;
+ var unescapedPost = {};
+ var uk;
+
+ if (file != undefined) {
+ for (var k in file.post) {
+ if (file.post.hasOwnProperty(k)) {
+ uk = k;
+ var match;
+ while ((match = reg.exec(uk)) !== null) {
+ uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
+ }
+ unescapedPost[uk] = file.post[k];
+ }
+ }
+
+ file.post = unescapedPost;
+ }
+
+ return file;
+};
+
+Uploader.prototype.onFlashReady = function() {
+ var $me = this;
+ this.flashReady = true;
+
+ // process events, queued before flash load
+ this._executeQueuedEvents();
+}
\ No newline at end of file
Index: admin_templates/swfupload.swf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 3249)
+++ kernel/db/db_event_handler.php (working copy)
@@ -2239,115 +2239,231 @@
* Used to save files uploaded via swfuploader
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnUploadFile(&$event)
+ protected function OnUploadFile(kEvent $event)
{
$event->status = erSTOP;
- echo "Flash requires that we output something or it won't fire the uploadSuccess event";
+// define('DBG_SKIP_REPORTING', 0);
+ $default_msg = "Flash requires that we output something or it won't fire the uploadSuccess event";
- // Flash uploader does NOT send correct cookies, so we need to make our own check
- $cookie_name = 'adm_'.$this->Application->ConfigValue('SessionCookieName');
- $this->Application->HttpQuery->Cookie['cookies_on'] = 1;
- $this->Application->HttpQuery->Cookie[$cookie_name] = $this->Application->GetVar('flashsid');
+ if ( !$this->Application->HttpQuery->Post ) {
+ // Variables {field, id, flashsid} are always submitted through POST!
+ // When file size is larger, then "upload_max_filesize" (in php.ini),
+ // then these variables also are not submitted -> handle such case.
+ header('HTTP/1.0 413 File size exceeds allowed limit');
+ echo $default_msg;
+ return;
+ }
- // this prevents session from auto-expiring when KeepSessionOnBrowserClose & FireFox is used
- $this->Application->HttpQuery->Cookie[$cookie_name.'_live'] = $this->Application->GetVar('flashsid');
-
- $admin_ses =& $this->Application->recallObject('Session.admin');
- /* @var $admin_ses Session */
-
- $perm_helper =& $this->Application->recallObject('PermissionsHelper');
- /* @var $perm_helper kPermissionsHelper */
-
- $section = $event->getSection();
- $user_id = $admin_ses->RecallVar('user_id');
-
- if (!$perm_helper->CheckUserPermission($user_id, $section.'.add') && !$perm_helper->CheckUserPermission($user_id, $section.'.edit')) {
+ if ( !$this->_checkFlashUploaderPermission($event) ) {
// 403 Forbidden
header('HTTP/1.0 403 You don\'t have permissions to upload');
- return ;
+ echo $default_msg;
+ return;
}
- if (!$cookie_name) {
- $cookie_name = 'sid';
- }
-
$value = $this->Application->GetVar('Filedata');
- if (!$value || ($value['error'] != UPLOAD_ERR_OK)) {
+ if ( !$value || ($value['error'] != UPLOAD_ERR_OK) ) {
// 413 Request Entity Too Large (file uploads disabled OR uploaded file was
// to large for web server to accept, see "upload_max_filesize" in php.ini)
header('HTTP/1.0 413 File size exceeds allowed limit');
- return ;
+ echo $default_msg;
+ return;
}
- $tmp_path = defined('WRITEABLE') ? WRITEABLE.'/tmp/' : FULL_PATH.'/kernel/cache/';
+ $tmp_path = WRITEABLE . '/tmp/';
$fname = $value['name'];
$id = $this->Application->GetVar('id');
- if ($id) {
- $fname = $id.'_'.$fname;
+
+ if ( $id ) {
+ $fname = $id . '_' . $fname;
}
- if (!is_writable($tmp_path)) {
+ $field_name = $this->Application->GetVar('field');
+ $fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
+ $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
+ $field_options = array_key_exists($field_name, $fields) ? $fields[$field_name] : $virtual_fields[$field_name];
+
+ $upload_dir = $field_options['upload_dir'];
+ $storage_format = array_key_exists('storage_format', $field_options) ? $field_options['storage_format'] : false;
+
+ if ( !is_writable($tmp_path) ) {
// 500 Internal Server Error
+ // check both temp and live upload directory
header('HTTP/1.0 500 Write permissions not set on the server');
- return ;
+ echo $default_msg;
+ return;
}
- move_uploaded_file($value['tmp_name'], $tmp_path.$fname);
+ $file_helper =& $this->Application->recallObject('FileHelper');
+ /* @var $file_helper FileHelper */
+
+ $fname = $file_helper->ensureUniqueFilename($tmp_path, $fname);
+
+ if ( $storage_format ) {
+ $image_helper =& $this->Application->recallObject('ImageHelper');
+ /* @var $image_helper ImageHelper */
+
+ move_uploaded_file($value['tmp_name'], $value['tmp_name'] . '.jpg'); // add extension, so ResizeImage can work
+ $url = $image_helper->ResizeImage($value['tmp_name'] . '.jpg', $storage_format);
+ $tmp_name = preg_replace('/^' . preg_quote($this->Application->BaseURL(), '/') . '/', '/', $url);
+ rename($tmp_name, $tmp_path . $fname);
+ }
+ else {
+ move_uploaded_file($value['tmp_name'], $tmp_path . $fname);
+ }
+
+ echo preg_replace('/^' . preg_quote($id, '/') . '_/', '', $fname);
+
+ $this->deleteTempFiles($tmp_path);
}
/**
- * Enter description here...
+ * Delete temporary files, that won't be used for sure
*
+ * @param string $path
+ * @return void
+ * @access protected
+ */
+ protected function deleteTempFiles($path)
+ {
+ $files = glob($path . '*.*');
+ $max_file_date = strtotime('-1 day');
+
+ foreach ($files as $file) {
+ if (filemtime($file) < $max_file_date) {
+ unlink($file);
+ }
+ }
+ }
+
+ /**
+ * Checks, that flash uploader is allowed to perform upload
+ *
* @param kEvent $event
+ * @return bool
*/
- function OnDeleteFile(&$event)
+ protected function _checkFlashUploaderPermission(kEvent $event)
{
+ // Flash uploader does NOT send correct cookies, so we need to make our own check
+ $cookie_name = 'adm_' . $this->Application->ConfigValue('SessionCookieName');
+ $this->Application->HttpQuery->Cookie['cookies_on'] = 1;
+ $this->Application->HttpQuery->Cookie[$cookie_name] = $this->Application->GetVar('flashsid');
+
+ // this prevents session from auto-expiring when KeepSessionOnBrowserClose & FireFox is used
+ $this->Application->HttpQuery->Cookie[$cookie_name . '_live'] = $this->Application->GetVar('flashsid');
+
+ $admin_ses =& $this->Application->recallObject('Session.admin');
+ /* @var $admin_ses Session */
+
+ if ( $admin_ses->RecallVar('user_id') == -1 ) {
+ return true;
+ }
+
+ // copy some data from given session to current session
+ $backup_user_id = $this->Application->RecallVar('user_id');
+ $this->Application->StoreVar('user_id', $admin_ses->RecallVar('user_id'));
+
+ $backup_user_groups = $this->Application->RecallVar('UserGroups');
+ $this->Application->StoreVar('UserGroups', $admin_ses->RecallVar('UserGroups'));
+
+ // check permissions using event, that have "add|edit" rule
+ $check_event = new kEvent($event->getPrefixSpecial() . ':OnProcessSelected');
+ $check_event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true));
+ $allowed_to_upload = $this->CheckPermission($check_event);
+
+ // restore changed data, so nothing gets saved to database
+ $this->Application->StoreVar('user_id', $backup_user_id);
+ $this->Application->StoreVar('UserGroups', $backup_user_groups);
+
+ return $allowed_to_upload;
+ }
+
+ /**
+ * Remembers, that file should be deleted on item's save from temp table
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnDeleteFile(kEvent $event)
+ {
$event->status = erSTOP;
- if (strpos($this->Application->GetVar('file'), '../') !== false) {
- return ;
+ if ( strpos($this->Application->GetVar('file'), '../') !== false ) {
+ return;
}
- $object =& $event->getObject( Array ('skip_autoload' => true) );
- $options = $object->GetFieldOptions( $this->Application->GetVar('field') );
+ $object =& $event->getObject(Array ('skip_autoload' => true));
+ $options = $object->GetFieldOptions($this->Application->GetVar('field'));
$var_name = $event->getPrefixSpecial() . '_file_pending_actions' . $this->Application->GetVar('m_wid');
$schedule = $this->Application->RecallVar($var_name);
$schedule = $schedule ? unserialize($schedule) : Array ();
- $schedule[] = Array ('action' => 'delete', 'file' => $path = FULL_PATH . $options['upload_dir'] . $this->Application->GetVar('file'));
+ $schedule[] = Array ('action' => 'delete', 'file' => FULL_PATH . $options['upload_dir'] . $this->Application->GetVar('file'));
$this->Application->StoreVar($var_name, serialize($schedule));
- $this->Application->Session->SaveData();
}
/**
- * Enter description here...
+ * Returns url for viewing uploaded file
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnViewFile(&$event)
+ protected function OnViewFile(kEvent $event)
{
- if (strpos($this->Application->GetVar('file'), '../') !== false) return ;
- if ($this->Application->GetVar('tmp')) {
- $path = (defined('WRITEABLE') ? WRITEABLE.'/tmp/' : FULL_PATH.'/kernel/cache/').$this->Application->GetVar('id').'_'.$this->Application->GetVar('file');
+ $event->status = erSTOP;
+
+ $file = $this->Application->GetVar('file');
+ if ( (strpos($file, '../') !== false) || (trim($file) !== $file) ) {
+ // when relative paths or special chars are found template names from url, then it's hacking attempt
+ return;
}
+
+ $object =& $event->getObject(Array ('skip_autoload' => true));
+ /* @var $object kDBItem */
+
+ $field = $this->Application->GetVar('field');
+ $options = $object->GetFieldOptions($field);
+
+ // set current uploaded file
+ if ( $this->Application->GetVar('tmp') ) {
+ $options['upload_dir'] = WRITEBALE_BASE . '/tmp/';
+ unset($options['include_path']);
+ $object->SetFieldOptions($field, $options);
+
+ $object->SetDBField($field, $this->Application->GetVar('id') . '_' . $file);
+ }
else {
- $object =& $event->getObject(array('skip_autoload'=>true));
- $options = $object->GetFieldOptions($this->Application->GetVar('field'));
+ $object->SetDBField($field, $file);
+ }
- $path = FULL_PATH.$options['upload_dir'].$this->Application->GetVar('file');
+ // get url to uploaded file
+ if ( $this->Application->GetVar('thumb') ) {
+ $url = $object->GetField($field, $options['thumb_format']);
}
+ else {
+ $url = $object->GetField($field, 'full_url'); // don't use "file_urls" format to prevent recursion
+ }
- $type = mime_content_type($path);
+ $file_helper =& $this->Application->recallObject('FileHelper');
+ /* @var $file_helper FileHelper */
- header('Content-Length: '.filesize($path));
- header('Content-Type: '.$type);
+ $path = $file_helper->urlToPath($url);
- safeDefine('DBG_SKIP_REPORTING',1);
+ if ( !file_exists($path) ) {
+ exit;
+ }
+ header('Content-Length: ' . filesize($path));
+ header('Content-Type: ' . mime_content_type($path));
+ header('Content-Disposition: inline; filename="' . $file . '"');
+
readfile($path);
- exit();
}
/**
Index: kernel/session/session.php
===================================================================
--- kernel/session/session.php (revision 3249)
+++ kernel/session/session.php (working copy)
@@ -578,12 +578,12 @@
$cookies_on = isset($http_query->Cookie['cookies_on']); // not good here
$get_sid = getArrayValue($http_query->Get, $this->GETName);
- if ($this->IsHTTPSRedirect() && $get_sid) { //Redirect from http to https on different domain
+ if ( ($this->IsHTTPSRedirect() && $get_sid) || $this->getFlashSID() ) { //Redirect from http to https on different domain
$this->OriginalMode = $this->Mode;
$this->SetMode(smGET_ONLY);
}
- if (!$cookies_on || $this->IsHTTPSRedirect()) {
+ if ( !$cookies_on || $this->IsHTTPSRedirect() || $this->getFlashSID() ) {
//If referer is our server, but we don't have our cookies_on, it's definetly off
$is_install = defined('IS_INSTALL') && IS_INSTALL;
if (!$is_install && $this->CheckReferer(1) && !$this->Application->GetVar('admin') && !$this->IsHTTPSRedirect()) {
@@ -654,12 +654,30 @@
return false;
}
+ function getFlashSID()
+ {
+ $http_query = $this->Application->recallObject('HTTPQuery');
+ /* @var $http_query kHTTPQuery */
+
+ return getArrayValue($http_query->Post, 'flashsid');
+ }
+
function GetPassedSIDValue($use_cache = 1)
{
- if (!empty($this->CachedSID) && $use_cache) return $this->CachedSID;
- $http_query =& $this->Application->recallObject('HTTPQuery');
- $get_sid = getArrayValue($http_query->Get, $this->GETName);
+ if (!empty($this->CachedSID) && $use_cache) {
+ return $this->CachedSID;
+ }
+ // flash sid overrides regular sid
+ $get_sid = $this->getFlashSID();
+
+ if (!$get_sid) {
+ $http_query = $this->Application->recallObject('HTTPQuery');
+ /* @var $http_query kHTTPQuery */
+
+ $get_sid = getArrayValue($http_query->Get, $this->GETName);
+ }
+
if ($this->Application->GetVar('admin') == 1 && $get_sid) {
$sid = $get_sid;
}
Index: units/general/helpers/file_helper.php
===================================================================
--- units/general/helpers/file_helper.php (revision 3249)
+++ units/general/helpers/file_helper.php (working copy)
@@ -238,6 +238,84 @@
return $result;
}
+
+ /**
+ * Transforms given path to file into it's url, where each each component is encoded (excluding domain and protocol)
+ *
+ * @param string $url
+ * @return string
+ * @access public
+ */
+ public function pathToUrl($url)
+ {
+ $url = str_replace(DIRECTORY_SEPARATOR, '/', preg_replace('/^' . preg_quote(FULL_PATH, '/') . '(.*)/', '\\1', $url, 1));
+ $url = implode('/', array_map('rawurlencode', explode('/', $url)));
+
+ return rtrim($this->Application->BaseURL(), '/') . $url;
+ }
+
+ /**
+ * Transforms given url to path to it
+ *
+ * @param string $url
+ * @return string
+ * @access public
+ */
+ public function urlToPath($url)
+ {
+ $base_url = rtrim($this->Application->BaseURL(), '/');
+
+ // escape replacement patterns, like "\<number>"
+ $full_path = preg_replace('/(\\\[\d]+)/', '\\\\\1', FULL_PATH);
+ $path = preg_replace('/^' . preg_quote($base_url, '/') . '(.*)/', $full_path . '\\1', $url, 1);
+
+ return str_replace('/', DIRECTORY_SEPARATOR, rawurldecode($path));
+ }
+
+ /**
+ * Ensures, that new file will not overwrite any of previously created files with same name
+ *
+ * @param string $path
+ * @param string $name
+ * @param Array $forbidden_names
+ * @return string
+ */
+ public function ensureUniqueFilename($path, $name, $forbidden_names = Array())
+ {
+ $parts = pathinfo($name);
+ $ext = '.' . $parts['extension'];
+ $filename = $parts['filename'];
+ $path = rtrim($path, '/');
+
+ $original_checked = false;
+ $new_name = $filename . $ext;
+
+ if ( $parts['dirname'] != '.' ) {
+ $path .= '/' . ltrim($parts['dirname'], '/');
+ }
+
+ // make sure target folder always exists, especially for cases,
+ // when storage engine folder is supplied as a part of $name
+ $this->CheckFolder($path);
+
+ do {
+ if ( preg_match('/(.*)_([0-9]*)(' . preg_quote($ext, '/') . ')/', $new_name, $regs) ) {
+ $new_name = $regs[1] . '_' . ((int)$regs[2] + 1) . $regs[3];
+ }
+ elseif ( $original_checked ) {
+ $new_name = $filename . '_1' . $ext;
+ }
+
+ $original_checked = true;
+ $res = file_exists($path . '/' . $new_name) || in_array($path . '/' . $new_name, $forbidden_names);
+ } while ($res !== false);
+
+ if ( $parts['dirname'] != '.' ) {
+ $new_name = $parts['dirname'] . '/' . $new_name;
+ }
+
+ return $new_name;
+ }
}
?>
\ No newline at end of file
|