Skip to content

Commit

Permalink
Item14782: moved progress bar into js land
Browse files Browse the repository at this point in the history
Item14781: removed excess /div in metadata.tmpl
  • Loading branch information
MichaelDaum committed Nov 6, 2018
1 parent 8ebb009 commit 698cf28
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 206 deletions.
15 changes: 8 additions & 7 deletions data/System/TopicInteractionPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1540399921" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1541499354" format="1.1" version="1"}%
---+!! %TOPIC%
%FORMFIELD{"Description"}%

Expand Down Expand Up @@ -228,6 +228,7 @@ generates:

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 06 Nov 2018: | removed excess div in templates; moved progress bar into js land |
| 24 Oct 2018: | improved "insert link" action; added "create link & hide file" action; performance improvements to other actions |
| 05 Mar 2018: | fixed selecting attachments with brackets in its filename |
| 16 Feb 2018: | added a legacy uploader to be somewhat backwards compatible to the old plupload just enough to please natedit |
Expand Down Expand Up @@ -291,9 +292,9 @@ generates:
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/%25TOPIC%25"}%
%META:FIELD{name="Support" title="Support" value="Foswiki:Support/%25TOPIC%25"}%
%META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap5.png" attachment="TopicInteractionPluginSnap5.png" attr="" comment="" date="1540399921" size="36218" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap4.png" attachment="TopicInteractionPluginSnap4.png" attr="" comment="" date="1540399921" size="45039" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap3.png" attachment="TopicInteractionPluginSnap3.png" attr="" comment="" date="1540399921" size="99574" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap2.png" attachment="TopicInteractionPluginSnap2.png" attr="" comment="" date="1540399921" size="111026" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap1.png" attachment="TopicInteractionPluginSnap1.png" attr="" comment="" date="1540399921" size="16199" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="LibreOfficeWebDAV.reg" attachment="LibreOfficeWebDAV.reg" attr="" comment="" date="1540399921" moveby="micha" movedto="System.TopicInteractionPlugin.LibreOfficeWebDAV.reg" movedwhen="1470922302" movefrom="Sandbox.OpenToEditTest.LibreOfficeWebDAV.reg" size="1126" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap5.png" attachment="TopicInteractionPluginSnap5.png" attr="" comment="" date="1541499354" size="36218" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap4.png" attachment="TopicInteractionPluginSnap4.png" attr="" comment="" date="1541499354" size="45039" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap3.png" attachment="TopicInteractionPluginSnap3.png" attr="" comment="" date="1541499354" size="99574" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap2.png" attachment="TopicInteractionPluginSnap2.png" attr="" comment="" date="1541499354" size="111026" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="TopicInteractionPluginSnap1.png" attachment="TopicInteractionPluginSnap1.png" attr="" comment="" date="1541499354" size="16199" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="LibreOfficeWebDAV.reg" attachment="LibreOfficeWebDAV.reg" attr="" comment="" date="1541499354" moveby="micha" movedto="System.TopicInteractionPlugin.LibreOfficeWebDAV.reg" movedwhen="1470922302" movefrom="Sandbox.OpenToEditTest.LibreOfficeWebDAV.reg" size="1126" user="ProjectContributor" version="1"}%
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/TopicInteractionPlugin.pm
Expand Up @@ -18,8 +18,8 @@ package Foswiki::Plugins::TopicInteractionPlugin;
use strict;
use warnings;

our $VERSION = '8.00';
our $RELEASE = '24 Oct 2018';
our $VERSION = '8.10';
our $RELEASE = '06 Nov 2018';
our $SHORTDESCRIPTION = 'Improved interaction with attachments and !DataForms';
our $NO_PREFS_IN_TOPIC = 1;
our $core;
Expand Down
13 changes: 8 additions & 5 deletions pub/System/TopicInteractionPlugin/dialog.uncompressed.js
Expand Up @@ -24,7 +24,6 @@ As per the GPL, removal of this notice is prohibited.
/*eslint-disable no-console */

"use strict";
var Dialog;

(function($) {

Expand All @@ -34,11 +33,11 @@ var Dialog;
};

/* constructor **********************************************************/
Dialog = function(opts) {
function Dialog(opts) {
var self = this;

self.opts = $.extend({}, defaults, opts);
};
}

/* shortcut *************************************************************/
Dialog.load = function(opts) {
Expand All @@ -62,10 +61,10 @@ var Dialog;

/* load *****************************************************************/
Dialog.prototype.load = function(params) {
var self = this,
var self = this,
opts = $.extend({}, self.opts, params),
$dialog = typeof(opts.id) === 'undefined'?undefined:$(opts.id),
data,
data,
dfd = $.Deferred();

self.log("called load() opts=",opts);
Expand Down Expand Up @@ -109,4 +108,8 @@ var Dialog;

return dfd.promise();
};

// export
window.Dialog = Dialog;

})(jQuery);
Expand Up @@ -21,7 +21,10 @@ As per the GPL, removal of this notice is prohibited.
*/

/* global Dialog, window */

/*eslint-disable no-console */

"use strict";
(function($) {

Expand All @@ -38,14 +41,14 @@ As per the GPL, removal of this notice is prohibited.
};

/* The actual plugin constructor ****************************************/
function FoswikiAttachments(elem, opts) {
function FoswikiAttachments(elem, opts) {
var self = this;

self.elem = $(elem);
self.opts = $.extend({}, defaults, self.elem.data(), opts);
self.elem = $(elem);
self.opts = $.extend({}, defaults, self.elem.data(), opts);
self.log("new FoswikiAttachments opts=",self.opts);
self.init();
}
self.init();
}

/* logger ***************************************************************/
FoswikiAttachments.prototype.log = function() {
Expand All @@ -61,7 +64,7 @@ As per the GPL, removal of this notice is prohibited.
};

/* init attachments *****************************************************/
FoswikiAttachments.prototype.init = function () {
FoswikiAttachments.prototype.init = function () {
var self = this, tabpane;

self.log("called init()");
Expand Down Expand Up @@ -144,7 +147,7 @@ As per the GPL, removal of this notice is prohibited.
val = $input.val();
if (val === 'none') {
val = '';
}
}
self.load({
"showempty": true,
"filter": val
Expand Down Expand Up @@ -197,7 +200,7 @@ As per the GPL, removal of this notice is prohibited.
$(this).removeClass("foswikiAttachmentHover");
}
).on("click", function(e) {
var $attachment = $(this),
var $attachment = $(this),
id = $attachment.data('id');

if (!$(e.target).is("a,img,i")) { // dont propagate the attachment clicks
Expand Down Expand Up @@ -242,7 +245,7 @@ As per the GPL, removal of this notice is prohibited.

if (extension.match(/mp3|wav/)) {
previewType = "audio";
} else if (extension.match(/flv|swf|mp4|mpe?g|mov|ogg|webm|ogv/)) {
} else if (extension.match(/flv|swf|mp4|mpe?g|mov|ogg|webm|ogv/)) {
previewType = "video";
} else if (extension.match(/vsd/)) {
previewType = "visio";
Expand All @@ -257,7 +260,7 @@ As per the GPL, removal of this notice is prohibited.
});

Dialog.load({
expand: "attachments::previewer::"+previewType,
expand: "attachments::previewer::"+previewType,
data: {
filename: decodeURIComponent(attachmentOpts.filename)
}
Expand All @@ -277,7 +280,7 @@ As per the GPL, removal of this notice is prohibited.
thumbnail = $attachment.find(".foswikiThumbnail").clone().removeClass("foswikiLeft");

Dialog.load({
id:"#foswikiAttachmentConfirmDelete",
id:"#foswikiAttachmentConfirmDelete",
expand:"attachments::confirmdelete",
init: function() {
var $this = this;
Expand All @@ -300,16 +303,16 @@ As per the GPL, removal of this notice is prohibited.
ev.stopPropagation();
});

// add button behaviour
// add button behaviour
self.elem.find(".foswikiAttachmentPropertiesButton").on("click", function() {
var $button = $(this),
$attachment = $button.parents(".foswikiAttachment:first"),
attachmentOpts = self.getAttachmentData($attachment),
thumbnail = $attachment.find(".foswikiThumbnail").clone().removeClass("foswikiLeft");

Dialog.load({
id:"#foswikiAttachmentEditor",
expand:"attachments::editor",
id:"#foswikiAttachmentEditor",
expand:"attachments::editor",
init: function() {
var $this = this;

Expand Down Expand Up @@ -353,7 +356,7 @@ As per the GPL, removal of this notice is prohibited.
thumbnail = $attachment.find(".foswikiThumbnail").clone().removeClass("foswikiLeft");

Dialog.load({
id: "#foswikiAttachmentMove",
id: "#foswikiAttachmentMove",
expand: "attachments::moveattachment",
init: function() {
var $this = this;
Expand All @@ -363,7 +366,7 @@ As per the GPL, removal of this notice is prohibited.
$this.find(".foswikiThumbnailContainer").html(thumbnail);
}
$this.find(".foswikiGenericThumbnail").hide();

$this.dialog("option", "position", "center");
}
});
Expand All @@ -374,7 +377,7 @@ As per the GPL, removal of this notice is prohibited.
// add bulk action behaviour
self.elem.find(".foswikiAttachmentsBulkAction select").on("change", function() {
var $select = $(this),
action = $select.val(),
action = $select.val(),
hideFile,
msgClass,
len = self.selection?self.selection.length:0;
Expand Down Expand Up @@ -410,12 +413,11 @@ As per the GPL, removal of this notice is prohibited.

if (action !== "move") {
Dialog.load({
id: "#foswikiAttachmentConfirmBulk",
id: "#foswikiAttachmentConfirmBulk",
expand: "attachments::confirmbulkaction",
init: function() {
var $this = this,
$form = $this.find("form"),
$hideFile = $form.find("input[name=hidefile]");
$form = $this.find("form");

$form.find("input[type='hidden'][name='filename']").remove();
$form.find("input[type='hidden'][name='hidefile']").val(hideFile);
Expand All @@ -435,9 +437,9 @@ As per the GPL, removal of this notice is prohibited.
});

} else {
// move attachments
// move attachments
Dialog.load({
id: "#foswikiAttachmentMove",
id: "#foswikiAttachmentMove",
expand: "attachments::moveattachment",
init: function() {
var $this = this,
Expand All @@ -460,7 +462,7 @@ As per the GPL, removal of this notice is prohibited.
}
});

// add show more versions behaviour
// add show more versions behaviour
self.elem.find(".foswikiShowVersions").each(function() {
var $this = $(this),
$attachment = $this.parents(".foswikiAttachment:first"),
Expand All @@ -474,15 +476,15 @@ As per the GPL, removal of this notice is prohibited.
"expand": "attachments::versions",
"filename": attachmentOpts.filename
};

$this.on("click", function() {
if($versionContainer.is(".foswikiVersionsContainerLoaded")) {
$this.hide();
$attachment.find(".foswikiHideVersions").show();
$versionContainer.slideDown("fast");
} else {
$versionContainer.show();
$versionContainer.load(url, params, function(resp, stat) {
$versionContainer.load(url, params, function() {
$versionContainer.addClass("foswikiVersionsContainerLoaded");
$attachment.effect("highlight");
$this.hide();
Expand All @@ -492,13 +494,13 @@ As per the GPL, removal of this notice is prohibited.
return false;
});
});
// add hide more versions behaviour

// add hide more versions behaviour
self.elem.find(".foswikiHideVersions").each(function() {
var $this = $(this),
$attachment = $this.parents(".foswikiAttachment:first"),
$versionContainer = $attachment.find(".foswikiVersionsContainer");

$this.on("click", function() {
$this.hide();
$attachment.find(".foswikiShowVersions").show();
Expand Down Expand Up @@ -637,23 +639,23 @@ As per the GPL, removal of this notice is prohibited.
success: function(data) {
$.unblockUI();
// perform reload
if (action === "createlink" || action == "createlink_hidefile" || action === "createimagegallery") {
if (action === "createlink" || action === "createlink_hidefile" || action === "createimagegallery") {
//self.log("reloading topic");
window.location.href = foswiki.getScriptUrl("view", foswiki.getPreference("WEB"), foswiki.getPreference("TOPIC"));
}
}

// perform redirect
else if (action === "download") {
//self.log("redirect url="+data.result);
window.location.href = data.result;
}
}

// clear selection
else if (action === 'delete') {
self.clearSelection();
self.load();
}

// default
else {
self.load();
Expand All @@ -676,7 +678,7 @@ As per the GPL, removal of this notice is prohibited.
}
});
});

}; // end of init()

/* get number of attachments ********************************************/
Expand All @@ -697,7 +699,7 @@ As per the GPL, removal of this notice is prohibited.

/* get data of attachments **********************************************/
FoswikiAttachments.prototype.getAttachmentData = function(elem) {
var self = this, id;
var id;

if (typeof(elem) === 'string') {
id = elem;
Expand Down Expand Up @@ -726,14 +728,14 @@ As per the GPL, removal of this notice is prohibited.

/* all attachments *************************************************/
FoswikiAttachments.prototype.load = function(params) {
var self = this,
var self = this,
url, thisParams = {},
dfd = $.Deferred();

self.log("called load()");

$.each(params, function(key, val) {
thisParams["attachments_"+key] = val;
thisParams["attachments_"+key] = val;
});

params = $.extend({
Expand Down Expand Up @@ -770,7 +772,7 @@ As per the GPL, removal of this notice is prohibited.
self.container.load(url, params, function() {
self.elem.unblock();
self.container.height('auto');
self.elem.removeData("FoswikiAttachments"); // remove reference
self.elem.removeData("FoswikiAttachments"); // remove reference
dfd.resolve();
});

Expand Down Expand Up @@ -808,7 +810,7 @@ As per the GPL, removal of this notice is prohibited.
return;
}

id = id.replace(/[^0-9a-zA-Z_]/g, "_");
id = id.replace(/[^0-9a-zA-Z_]/g, "_");

//self.log(" select("+id+")");
if (typeof(self.selection) === 'undefined') {
Expand Down

0 comments on commit 698cf28

Please sign in to comment.