diff --git a/.gitignore b/.gitignore index ce416c8..5e7248e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*~ *,v igp_* *.gz diff --git a/lib/Foswiki/Plugins/TopicInteractionPlugin/DEPENDENCIES b/lib/Foswiki/Plugins/TopicInteractionPlugin/DEPENDENCIES index e1b8472..17cc106 100644 --- a/lib/Foswiki/Plugins/TopicInteractionPlugin/DEPENDENCIES +++ b/lib/Foswiki/Plugins/TopicInteractionPlugin/DEPENDENCIES @@ -1,4 +1,4 @@ -Foswiki::Contrib::JQPrettyPhotoContrib,>=1.10,perl,Optional +Foswiki::Contrib::JQPhotoSwipeContrib,>=1.00,perl,Optional Foswiki::Plugins::FilterPlugin,>=2.07,perl,Required Foswiki::Plugins::FlexFormPlugin,>=2.40,perl,Required Foswiki::Plugins::DocumentViewerPlugin,>=1.0,perl,Optional diff --git a/locale/TopicInteractionPlugin/Foswiki.pot b/locale/TopicInteractionPlugin/Foswiki.pot index ba16b06..05188cd 100644 --- a/locale/TopicInteractionPlugin/Foswiki.pot +++ b/locale/TopicInteractionPlugin/Foswiki.pot @@ -21,83 +21,67 @@ msgstr "" msgid "%1 attachment(s)" msgstr "" -#: templates/metadata.tmpl:371 +#: templates/metadata.tmpl:370 msgid "Version %2 uploaded by %3 on %4" msgstr "" -#: templates/metadata.tmpl:600 -msgid "Hide the files in the attachment list." -msgstr "" - -#: templates/metadata.tmpl:490 +#: templates/metadata.tmpl:497 msgid "Are you sure that you want to delete %1?" msgstr "" -#: templates/metadata.tmpl:192 +#: templates/metadata.tmpl:568 msgid "Attach files" msgstr "" -#: templates/metadata.tmpl:143 +#: templates/metadata.tmpl:133 templates/metadata.tmpl:138 msgid "Attachments %1" msgstr "" -#: templates/metadata.tmpl:222 +#: templates/metadata.tmpl:191 msgid "Author" msgstr "" -#: templates/metadata.tmpl:450 templates/metadata.tmpl:476 +#: templates/metadata.tmpl:457 templates/metadata.tmpl:483 msgid "Cancel" msgstr "" -#: templates/metadata.tmpl:621 -msgid "Cancel upload" -msgstr "" - -#: templates/metadata.tmpl:620 -msgid "Choose files" -msgstr "" - #: templates/metadata.tmpl:343 msgid "Clear all" msgstr "" -#: templates/attach.topicinteraction.tmpl:10 templates/metadata.tmpl:386 +#: templates/attach.topicinteraction.tmpl:10 templates/metadata.tmpl:385 msgid "Close" msgstr "" -#: templates/metadata.tmpl:433 templates/metadata.tmpl:585 +#: templates/metadata.tmpl:440 msgid "Comment" msgstr "" -#: templates/metadata.tmpl:92 +#: templates/metadata.tmpl:89 msgid "Comments %1" msgstr "" -#: templates/metadata.tmpl:501 +#: templates/metadata.tmpl:508 msgid "Confirmation required" msgstr "" -#: templates/metadata.tmpl:596 -msgid "Create a link to the attached files at the end of the topic." -msgstr "" - #: templates/metadata.tmpl:326 msgid "Create image gallery" msgstr "" -#: templates/metadata.tmpl:518 +#: templates/metadata.tmpl:525 msgid "Creating image gallery" msgstr "" -#: templates/metadata.tmpl:512 +#: templates/metadata.tmpl:519 msgid "Creating links" msgstr "" -#: templates/metadata.tmpl:105 +#: templates/metadata.tmpl:103 msgid "Data form" msgstr "" -#: templates/metadata.tmpl:221 +#: templates/metadata.tmpl:190 msgid "Date" msgstr "" @@ -105,47 +89,47 @@ msgstr "" msgid "Delete" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:199 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:231 msgid "Delete %1" msgstr "" -#: templates/metadata.tmpl:483 +#: templates/metadata.tmpl:490 msgid "Delete attachment?" msgstr "" -#: templates/metadata.tmpl:286 +#: templates/metadata.tmpl:271 msgid "Delete this attachment" msgstr "" -#: templates/metadata.tmpl:542 +#: templates/metadata.tmpl:549 msgid "Deleting" msgstr "" -#: templates/metadata.tmpl:238 +#: templates/metadata.tmpl:207 msgid "Display hidden" msgstr "" -#: templates/metadata.tmpl:516 +#: templates/metadata.tmpl:523 msgid "Do you really want to create an image gallery for %1 attachment(s)?" msgstr "" -#: templates/metadata.tmpl:510 +#: templates/metadata.tmpl:517 msgid "Do you really want to create links to %1 attachment(s)?" msgstr "" -#: templates/metadata.tmpl:540 +#: templates/metadata.tmpl:547 msgid "Do you really want to delete %1 attachment(s)?" msgstr "" -#: templates/metadata.tmpl:522 +#: templates/metadata.tmpl:529 msgid "Do you really want to download %1 attachment(s)?" msgstr "" -#: templates/metadata.tmpl:528 +#: templates/metadata.tmpl:535 msgid "Do you really want to hide %1 attachment(s)?" msgstr "" -#: templates/metadata.tmpl:534 +#: templates/metadata.tmpl:541 msgid "Do you really want to unhide %1 attachment(s)?" msgstr "" @@ -153,47 +137,47 @@ msgstr "" msgid "Download" msgstr "" -#: templates/metadata.tmpl:524 +#: templates/metadata.tmpl:531 msgid "Downloading" msgstr "" -#: templates/metadata.tmpl:571 +#: templates/metadata.tmpl:564 msgid "Drag files here" msgstr "" -#: templates/metadata.tmpl:422 +#: templates/metadata.tmpl:429 msgid "Edit attachment" msgstr "" -#: templates/metadata.tmpl:114 +#: templates/metadata.tmpl:112 msgid "Edit form" msgstr "" -#: templates/metadata.tmpl:280 +#: templates/metadata.tmpl:259 msgid "Edit properties of this attachment" msgstr "" -#: templates/metadata.tmpl:115 +#: templates/metadata.tmpl:113 msgid "Edit this !DataForm" msgstr "" -#: templates/metadata.tmpl:277 +#: templates/metadata.tmpl:256 msgid "Edit this attachment" msgstr "" -#: templates/metadata.tmpl:237 +#: templates/metadata.tmpl:206 msgid "Enable/disable displaying hidden attachments" msgstr "" -#: templates/metadata.tmpl:215 +#: templates/metadata.tmpl:184 msgid "Enter a search pattern to filter the list of attachments" msgstr "" -#: templates/metadata.tmpl:429 +#: templates/metadata.tmpl:436 msgid "File name" msgstr "" -#: templates/metadata.tmpl:107 +#: templates/metadata.tmpl:105 msgid "Help" msgstr "" @@ -201,15 +185,15 @@ msgstr "" msgid "Hide" msgstr "" -#: templates/metadata.tmpl:440 +#: templates/metadata.tmpl:447 msgid "Hide attachment in normal topic view." msgstr "" -#: templates/metadata.tmpl:199 templates/metadata.tmpl:205 +#: templates/metadata.tmpl:574 msgid "Hide options" msgstr "" -#: templates/metadata.tmpl:530 +#: templates/metadata.tmpl:537 msgid "Hiding" msgstr "" @@ -217,7 +201,7 @@ msgstr "" msgid "Insert links" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:193 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:225 msgid "Manage properties of %1" msgstr "" @@ -225,55 +209,55 @@ msgstr "" msgid "More actions" msgstr "" -#: templates/metadata.tmpl:332 templates/metadata.tmpl:475 +#: templates/metadata.tmpl:332 templates/metadata.tmpl:482 msgid "Move" msgstr "" -#: templates/metadata.tmpl:457 +#: templates/metadata.tmpl:464 msgid "Move attachment(s) to a different topic" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:196 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:228 msgid "Move or delete %1" msgstr "" -#: templates/metadata.tmpl:285 +#: templates/metadata.tmpl:270 msgid "Move this attachment to a different topic" msgstr "" -#: templates/metadata.tmpl:220 +#: templates/metadata.tmpl:189 msgid "Name" msgstr "" -#: templates/metadata.tmpl:494 templates/metadata.tmpl:546 +#: templates/metadata.tmpl:501 templates/metadata.tmpl:553 msgid "No, thanks" msgstr "" -#: templates/metadata.tmpl:437 templates/metadata.tmpl:592 +#: templates/metadata.tmpl:444 msgid "Options" msgstr "" -#: templates/metadata.tmpl:379 +#: templates/metadata.tmpl:378 msgid "Preview" msgstr "" -#: templates/metadata.tmpl:282 +#: templates/metadata.tmpl:263 templates/metadata.tmpl:267 msgid "Preview this attachment" msgstr "" -#: templates/metadata.tmpl:108 +#: templates/metadata.tmpl:106 msgid "Read more about Data Forms" msgstr "" -#: templates/metadata.tmpl:227 +#: templates/metadata.tmpl:196 msgid "Results per page" msgstr "" -#: templates/metadata.tmpl:449 +#: templates/metadata.tmpl:456 msgid "Save" msgstr "" -#: templates/metadata.tmpl:214 +#: templates/metadata.tmpl:183 msgid "Search" msgstr "" @@ -281,43 +265,31 @@ msgstr "" msgid "Select all" msgstr "" -#: templates/metadata.tmpl:200 templates/metadata.tmpl:205 +#: templates/metadata.tmpl:575 msgid "Show options" msgstr "" -#: templates/metadata.tmpl:202 +#: templates/metadata.tmpl:577 msgid "Show/hide advanced options" msgstr "" -#: templates/metadata.tmpl:223 +#: templates/metadata.tmpl:192 msgid "Size" msgstr "" -#: templates/metadata.tmpl:218 +#: templates/metadata.tmpl:187 msgid "Sort by" msgstr "" -#: templates/metadata.tmpl:619 -msgid "Start upload" -msgstr "" - -#: templates/metadata.tmpl:632 -msgid "Start upload immediately" -msgstr "" - -#: templates/metadata.tmpl:472 +#: templates/metadata.tmpl:479 msgid "The new topic chosen must already exist." msgstr "" -#: templates/metadata.tmpl:588 -msgid "This comment will be added to every uploaded file." -msgstr "" - -#: templates/metadata.tmpl:469 +#: templates/metadata.tmpl:476 msgid "To topic" msgstr "" -#: templates/metadata.tmpl:465 +#: templates/metadata.tmpl:472 msgid "To web" msgstr "" @@ -325,43 +297,44 @@ msgstr "" msgid "Unhide" msgstr "" -#: templates/metadata.tmpl:536 +#: templates/metadata.tmpl:543 msgid "Unhiding" msgstr "" -#: templates/metadata.tmpl:193 -msgid "Upload files and images to this topic" +#: templates/metadata.tmpl:569 +msgid "Uploading ..." msgstr "" -#: templates/metadata.tmpl:445 +#: templates/metadata.tmpl:452 msgid "Use this image as a thumbnail for the page." msgstr "" -#: templates/metadata.tmpl:305 -msgid "Version %1 uploaded by %2 on %3" +#: templates/metadata.tmpl:291 +msgid "Version %1" msgstr "" -#: templates/metadata.tmpl:493 +#: templates/metadata.tmpl:500 msgid "Yes, delete" msgstr "" -#: templates/metadata.tmpl:545 +#: templates/metadata.tmpl:552 msgid "Yes, please" msgstr "" -#: templates/metadata.tmpl:233 +#: templates/metadata.tmpl:202 msgid "all" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:199 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:231 msgid "delete" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:190 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:222 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/WebDAVUrl.pm:42 msgid "edit" msgstr "" -#: templates/metadata.tmpl:298 +#: templates/metadata.tmpl:283 msgid "hidden" msgstr "" @@ -377,11 +350,11 @@ msgstr "" msgid "more" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:196 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:228 msgid "move" msgstr "" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:193 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:225 msgid "props" msgstr "" @@ -393,7 +366,7 @@ msgstr "" msgid "show previous revisions" msgstr "" -#: templates/metadata.tmpl:300 +#: templates/metadata.tmpl:285 msgid "thumbnail" msgstr "" diff --git a/locale/TopicInteractionPlugin/de.po b/locale/TopicInteractionPlugin/de.po index 12f4b54..126c9fb 100644 --- a/locale/TopicInteractionPlugin/de.po +++ b/locale/TopicInteractionPlugin/de.po @@ -20,83 +20,67 @@ msgstr "" msgid "%1 attachment(s)" msgstr "%1 Anhänge" -#: templates/metadata.tmpl:371 +#: templates/metadata.tmpl:370 msgid "Version %2 uploaded by %3 on %4" msgstr "Version %2 hochgeladen von %3 am %4" -#: templates/metadata.tmpl:600 -msgid "Hide the files in the attachment list." -msgstr "Dateien in der Anhangliste verbergen." - -#: templates/metadata.tmpl:490 +#: templates/metadata.tmpl:497 msgid "Are you sure that you want to delete %1?" msgstr "Sind Sie sicher, dass Sie %1 löschen wollen?" -#: templates/metadata.tmpl:192 +#: templates/metadata.tmpl:568 msgid "Attach files" msgstr "Dateien anhängen" -#: templates/metadata.tmpl:143 +#: templates/metadata.tmpl:133 templates/metadata.tmpl:138 msgid "Attachments %1" msgstr "Anhänge %1" -#: templates/metadata.tmpl:222 +#: templates/metadata.tmpl:191 msgid "Author" msgstr "Autor" -#: templates/metadata.tmpl:450 templates/metadata.tmpl:476 +#: templates/metadata.tmpl:457 templates/metadata.tmpl:483 msgid "Cancel" msgstr "Abbrechen" -#: templates/metadata.tmpl:621 -msgid "Cancel upload" -msgstr "Hochladen abbrechen" - -#: templates/metadata.tmpl:620 -msgid "Choose files" -msgstr "Wähle Dateien aus" - #: templates/metadata.tmpl:343 msgid "Clear all" msgstr "Alles abwählen" -#: templates/attach.topicinteraction.tmpl:10 templates/metadata.tmpl:386 +#: templates/attach.topicinteraction.tmpl:10 templates/metadata.tmpl:385 msgid "Close" msgstr "Schließen" -#: templates/metadata.tmpl:433 templates/metadata.tmpl:585 +#: templates/metadata.tmpl:440 msgid "Comment" msgstr "Kommentar" -#: templates/metadata.tmpl:92 +#: templates/metadata.tmpl:89 msgid "Comments %1" msgstr "Kommentare %1" -#: templates/metadata.tmpl:501 +#: templates/metadata.tmpl:508 msgid "Confirmation required" msgstr "Bestätigung erforderlich" -#: templates/metadata.tmpl:596 -msgid "Create a link to the attached files at the end of the topic." -msgstr "Verweis auf die Anhänge am Ende des Topics erzeugen." - #: templates/metadata.tmpl:326 msgid "Create image gallery" msgstr "Bilder-Galerie anlegen" -#: templates/metadata.tmpl:518 +#: templates/metadata.tmpl:525 msgid "Creating image gallery" msgstr "Bilder-Galerie wird angelegt" -#: templates/metadata.tmpl:512 +#: templates/metadata.tmpl:519 msgid "Creating links" msgstr "Verweise werden einfügt" -#: templates/metadata.tmpl:105 +#: templates/metadata.tmpl:103 msgid "Data form" msgstr "Daten-Formular" -#: templates/metadata.tmpl:221 +#: templates/metadata.tmpl:190 msgid "Date" msgstr "Datum" @@ -104,47 +88,47 @@ msgstr "Datum" msgid "Delete" msgstr "Löschen" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:199 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:231 msgid "Delete %1" msgstr "Lösche %1" -#: templates/metadata.tmpl:483 +#: templates/metadata.tmpl:490 msgid "Delete attachment?" msgstr "Anhang löschen?" -#: templates/metadata.tmpl:286 +#: templates/metadata.tmpl:271 msgid "Delete this attachment" msgstr "Diesen Anhang löschen" -#: templates/metadata.tmpl:542 +#: templates/metadata.tmpl:549 msgid "Deleting" msgstr "Lösche" -#: templates/metadata.tmpl:238 +#: templates/metadata.tmpl:207 msgid "Display hidden" msgstr "Anzeige abschalten" -#: templates/metadata.tmpl:516 +#: templates/metadata.tmpl:523 msgid "Do you really want to create an image gallery for %1 attachment(s)?" msgstr "Wollen Sie wirklich eine Bilder-Galerie für %1 Anhänge anlegen?" -#: templates/metadata.tmpl:510 +#: templates/metadata.tmpl:517 msgid "Do you really want to create links to %1 attachment(s)?" msgstr "Wollen Sie wirklich für %1 Anhänge Links erzeugen?" -#: templates/metadata.tmpl:540 +#: templates/metadata.tmpl:547 msgid "Do you really want to delete %1 attachment(s)?" msgstr "Wollen Sie wirklich %1 Anhänge löschen?" -#: templates/metadata.tmpl:522 +#: templates/metadata.tmpl:529 msgid "Do you really want to download %1 attachment(s)?" msgstr "Wollen Sie wirklich %1 Anhänge herunterladen?" -#: templates/metadata.tmpl:528 +#: templates/metadata.tmpl:535 msgid "Do you really want to hide %1 attachment(s)?" msgstr "Wollen Sie wirklich %1 Anhänge verbergen?" -#: templates/metadata.tmpl:534 +#: templates/metadata.tmpl:541 msgid "Do you really want to unhide %1 attachment(s)?" msgstr "Wollen Sie wirklich %1 Anhänge wieder anzeigen?" @@ -152,47 +136,47 @@ msgstr "Wollen Sie wirklich %1 Anhänge wieder anzeigen?" msgid "Download" msgstr "Herunterladen" -#: templates/metadata.tmpl:524 +#: templates/metadata.tmpl:531 msgid "Downloading" msgstr "Lade Dateien herunter" -#: templates/metadata.tmpl:571 +#: templates/metadata.tmpl:564 msgid "Drag files here" msgstr "Dateien hier hinziehen" -#: templates/metadata.tmpl:422 +#: templates/metadata.tmpl:429 msgid "Edit attachment" msgstr "Anhang bearbeiten" -#: templates/metadata.tmpl:114 +#: templates/metadata.tmpl:112 msgid "Edit form" msgstr "Formular bearbeiten" -#: templates/metadata.tmpl:280 +#: templates/metadata.tmpl:259 msgid "Edit properties of this attachment" msgstr "Eigenschaften dieses Anhangs bearbeiten" -#: templates/metadata.tmpl:115 +#: templates/metadata.tmpl:113 msgid "Edit this !DataForm" msgstr "Dieses Formular bearbeiten" -#: templates/metadata.tmpl:277 +#: templates/metadata.tmpl:256 msgid "Edit this attachment" msgstr "Anhang bearbeiten" -#: templates/metadata.tmpl:237 +#: templates/metadata.tmpl:206 msgid "Enable/disable displaying hidden attachments" msgstr "Verborgene Anhänge ein-/ausschalten" -#: templates/metadata.tmpl:215 +#: templates/metadata.tmpl:184 msgid "Enter a search pattern to filter the list of attachments" msgstr "Geben Sie einen Suchbegriff ein, um die Anhangliste zu filtern" -#: templates/metadata.tmpl:429 +#: templates/metadata.tmpl:436 msgid "File name" msgstr "Dateiname" -#: templates/metadata.tmpl:107 +#: templates/metadata.tmpl:105 msgid "Help" msgstr "Hilfe" @@ -200,15 +184,15 @@ msgstr "Hilfe" msgid "Hide" msgstr "Verbergen" -#: templates/metadata.tmpl:440 +#: templates/metadata.tmpl:447 msgid "Hide attachment in normal topic view." msgstr "Anhänge in der normalen Ansicht nicht angezeigen" -#: templates/metadata.tmpl:199 templates/metadata.tmpl:205 +#: templates/metadata.tmpl:574 msgid "Hide options" msgstr "Optionen verbergen" -#: templates/metadata.tmpl:530 +#: templates/metadata.tmpl:537 msgid "Hiding" msgstr "Verstecke Dateien" @@ -216,7 +200,7 @@ msgstr "Verstecke Dateien" msgid "Insert links" msgstr "Verweis einfügen" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:193 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:225 msgid "Manage properties of %1" msgstr "Eigenschaften von %1 verwalten" @@ -224,55 +208,55 @@ msgstr "Eigenschaften von %1 verwalten" msgid "More actions" msgstr "Weitere Aktionen" -#: templates/metadata.tmpl:332 templates/metadata.tmpl:475 +#: templates/metadata.tmpl:332 templates/metadata.tmpl:482 msgid "Move" msgstr "Verschieben" -#: templates/metadata.tmpl:457 +#: templates/metadata.tmpl:464 msgid "Move attachment(s) to a different topic" msgstr "Verschiebe Dateien zu einem anderen Topic" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:196 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:228 msgid "Move or delete %1" msgstr "Verschieben oder löschen von %1" -#: templates/metadata.tmpl:285 +#: templates/metadata.tmpl:270 msgid "Move this attachment to a different topic" msgstr "Diese Datei an ein anderes Topic anhängen" -#: templates/metadata.tmpl:220 +#: templates/metadata.tmpl:189 msgid "Name" msgstr "Name" -#: templates/metadata.tmpl:494 templates/metadata.tmpl:546 +#: templates/metadata.tmpl:501 templates/metadata.tmpl:553 msgid "No, thanks" msgstr "Nein, danke" -#: templates/metadata.tmpl:437 templates/metadata.tmpl:592 +#: templates/metadata.tmpl:444 msgid "Options" msgstr "Optionen" -#: templates/metadata.tmpl:379 +#: templates/metadata.tmpl:378 msgid "Preview" msgstr "Vorschau" -#: templates/metadata.tmpl:282 +#: templates/metadata.tmpl:263 templates/metadata.tmpl:267 msgid "Preview this attachment" msgstr "Vorschau für diesen Anhang" -#: templates/metadata.tmpl:108 +#: templates/metadata.tmpl:106 msgid "Read more about Data Forms" msgstr "Lesen Sie mehr über Formulare" -#: templates/metadata.tmpl:227 +#: templates/metadata.tmpl:196 msgid "Results per page" msgstr "Ergebnisse pro Seite" -#: templates/metadata.tmpl:449 +#: templates/metadata.tmpl:456 msgid "Save" msgstr "Speichern" -#: templates/metadata.tmpl:214 +#: templates/metadata.tmpl:183 msgid "Search" msgstr "Suchen" @@ -280,43 +264,31 @@ msgstr "Suchen" msgid "Select all" msgstr "Alles auswählen" -#: templates/metadata.tmpl:200 templates/metadata.tmpl:205 +#: templates/metadata.tmpl:575 msgid "Show options" msgstr "Optionen anzeigen" -#: templates/metadata.tmpl:202 +#: templates/metadata.tmpl:577 msgid "Show/hide advanced options" msgstr "Anzeigen/Verbergen von weiteren Optionen" -#: templates/metadata.tmpl:223 +#: templates/metadata.tmpl:192 msgid "Size" msgstr "Größe" -#: templates/metadata.tmpl:218 +#: templates/metadata.tmpl:187 msgid "Sort by" msgstr "Sortieren nach" -#: templates/metadata.tmpl:619 -msgid "Start upload" -msgstr "Hochladen starten" - -#: templates/metadata.tmpl:632 -msgid "Start upload immediately" -msgstr "sofort starten" - -#: templates/metadata.tmpl:472 +#: templates/metadata.tmpl:479 msgid "The new topic chosen must already exist." msgstr "Das neu auszuwählende Topic muß bereits existieren." -#: templates/metadata.tmpl:588 -msgid "This comment will be added to every uploaded file." -msgstr "Dieser Kommentar wird zu jeder hochgeladenen Datei hinzugefügt." - -#: templates/metadata.tmpl:469 +#: templates/metadata.tmpl:476 msgid "To topic" msgstr "Nach Topic" -#: templates/metadata.tmpl:465 +#: templates/metadata.tmpl:472 msgid "To web" msgstr "Nach Web" @@ -324,43 +296,44 @@ msgstr "Nach Web" msgid "Unhide" msgstr "Anzeigen" -#: templates/metadata.tmpl:536 +#: templates/metadata.tmpl:543 msgid "Unhiding" msgstr "Stelle Anzeige um" -#: templates/metadata.tmpl:193 -msgid "Upload files and images to this topic" -msgstr "Dateien und Bilder an diese Topic anhängen" +#: templates/metadata.tmpl:569 +msgid "Uploading ..." +msgstr "Lade ..." -#: templates/metadata.tmpl:445 +#: templates/metadata.tmpl:452 msgid "Use this image as a thumbnail for the page." msgstr "Dieses Bild als Miniaturbild für diese Seite verwenden" -#: templates/metadata.tmpl:305 -msgid "Version %1 uploaded by %2 on %3" -msgstr "Version %1 hochgeladen von %2 am %3" +#: templates/metadata.tmpl:291 +msgid "Version %1" +msgstr "Version %1" -#: templates/metadata.tmpl:493 +#: templates/metadata.tmpl:500 msgid "Yes, delete" msgstr "Ja, löschen" -#: templates/metadata.tmpl:545 +#: templates/metadata.tmpl:552 msgid "Yes, please" msgstr "Ja, bitte" -#: templates/metadata.tmpl:233 +#: templates/metadata.tmpl:202 msgid "all" msgstr "alles" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:199 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:231 msgid "delete" msgstr "löschen" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:190 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:222 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/WebDAVUrl.pm:42 msgid "edit" msgstr "bearbeiten" -#: templates/metadata.tmpl:298 +#: templates/metadata.tmpl:283 msgid "hidden" msgstr "versteckt" @@ -376,11 +349,11 @@ msgstr "weniger" msgid "more" msgstr "mehr" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:196 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:228 msgid "move" msgstr "verschieben" -#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:193 +#: lib/Foswiki/Plugins/TopicInteractionPlugin/Attachments.pm:225 msgid "props" msgstr "Eigensch." @@ -392,7 +365,7 @@ msgstr "alle Anhänge an diesem Topic auswählen" msgid "show previous revisions" msgstr "vorherige Versionen anzeigen" -#: templates/metadata.tmpl:300 +#: templates/metadata.tmpl:285 msgid "thumbnail" msgstr "thumbnail" diff --git a/pub/System/TopicInteractionPlugin/Makefile b/pub/System/TopicInteractionPlugin/Makefile index 9425f6e..dc16958 100644 --- a/pub/System/TopicInteractionPlugin/Makefile +++ b/pub/System/TopicInteractionPlugin/Makefile @@ -7,7 +7,6 @@ TARGET= \ UPLOADER_SOURCE= \ jquery.fileupload.uncompressed.js \ - jquery.fileupload-process.js \ foswiki.fileupload.uncompressed.js METADATA_SOURCE= \ diff --git a/pub/System/TopicInteractionPlugin/foswiki.attachments.uncompressed.js b/pub/System/TopicInteractionPlugin/foswiki.attachments.uncompressed.js index 9360cb0..6f0918e 100644 --- a/pub/System/TopicInteractionPlugin/foswiki.attachments.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/foswiki.attachments.uncompressed.js @@ -861,19 +861,11 @@ As per the GPL, removal of this notice is prohibited. self.showSelection(); }; - /***********************************************************************/ - FoswikiAttachments.prototype.hideAttachmentsTab = function() { - }; - - /***********************************************************************/ - FoswikiAttachments.prototype.showAttachmentsTab = function() { - }; - /***********************************************************************/ FoswikiAttachments.prototype.hideOptionsContainer = function() { var self = this; - self.optionsLabel.html(self.toggleOpts.showText); + self.optionsLabel.html($.i18n("Show options")); self.toggleContainer.slideUp({easing:'easeInOutQuad', duration:'fast'}); self.opts.showOptions = 'off'; }; @@ -882,7 +874,7 @@ As per the GPL, removal of this notice is prohibited. FoswikiAttachments.prototype.showOptionsContainer = function() { var self = this; - self.optionsLabel.html(self.toggleOpts.hideText); + self.optionsLabel.html($.i18n("Hide options")); self.toggleContainer.slideDown({easing:'easeInOutQuad', duration:'fast'}); self.opts.showOptions = 'on'; }; diff --git a/pub/System/TopicInteractionPlugin/foswiki.fileupload.uncompressed.js b/pub/System/TopicInteractionPlugin/foswiki.fileupload.uncompressed.js index 5fca2cb..cde5ee0 100644 --- a/pub/System/TopicInteractionPlugin/foswiki.fileupload.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/foswiki.fileupload.uncompressed.js @@ -3,82 +3,73 @@ * * Copyright (c) 2016 Michael Daum http://michaeldaumconsulting.com * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html + * Licensed GPL http://www.gnu.org/licenses/gpl.html * */ "use strict"; (function($) { - // The actual plugin constructor - function FileUploadButton(elem, opts) { + // The file upload class /////////////////////////////////////////////////// + function FoswikiUploader(elem, opts) { var self = this; self.elem = $(elem); self.opts = $.extend({ topic: foswiki.getPreference("WEB")+"."+foswiki.getPreference("TOPIC") }, self.elem.data(), opts); + self.init(); } - FileUploadButton.prototype.init = function () { - var self = this, dropZone; + FoswikiUploader.prototype.init = function () { + var self = this; - self.fileElem = self.elem.find("input[type=file]"); - self.bar = self.elem.find(".jqFileUploadProgressBar"); - self.progressInfo = self.elem.find(".jqFileUploadProgressInfo"); + self.bar = self.elem.find(".jqUploadProgressBar"); + self.progressInfo = self.elem.find(".jqUploadProgressInfo"); self.uploadedFiles = []; - dropZone = self.elem.find(".jqFileUploadDropZone"); - dropZone.remove(); - $(".jqFileUploadDropZone").remove(); - dropZone.appendTo("body"); - - self.fileElem.fileupload({ - url: foswiki.getScriptUrl("rest", "TopicInteractionPlugin", "upload", { - topic: self.opts.topic - }), + self.elem.fileupload({ + url: foswiki.getScriptUrl("rest", "TopicInteractionPlugin", "upload"), + fileInput: null, dataType: 'json', pasteZone: $(document), sequentialUploads: true, singleFileUploads: true, + replaceFileInput: false, + progress: function(e, data) { + var files = []; + $.each(data.files, function(index, file) { + files.push(file.name); + }); + self.progressInfo.html(files.join(", ")); + }, progressall: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); self.bar.css("width", progress+"%"); - self.progressInfo.html(self.renderExtendedProgress(data)); }, add: function(e, data) { + data.files = data.files; data.formData = self.opts; data.formData.id = Math.ceil(Math.random()*1000); data.submit(); }, start: function() { - self.bar.width(0); self.uploadedFiles = []; + self.bar.width(0); $.blockUI({ - blockMsgClass: "jqFileUploadMsg", - message: self.bar + blockMsgClass: "jqUploadMsg", + message: self.bar.length?self.bar:"" }); }, - stop: function() { - $.pnotify({ - text: $.i18n("Uploaded %num% file(s)", {num: self.uploadedFiles.length}), - type: "success", - delay: 1000 - }); - $(".foswikiAttachments").trigger("refresh", [self.uploadedFiles]); - $.unblockUI(); - }, dragover: function() { if (self.dragoverTimer) { window.clearTimeout(self.dragoverTimer); } - $("body").addClass("jqFileUploadDragging"); + self.elem.addClass("jqUploadDragging"); self.dragoverTimer = window.setTimeout(function() { self.dragoverTimer = null; - $("body").removeClass("jqFileUploadDragging"); + self.elem.removeClass("jqUploadDragging"); }, 1000); }, drop: function() { @@ -86,7 +77,7 @@ window.clearTimeout(self.dragoverTimer); } self.dragoverTimer = null; - $("body").removeClass("jqFileUploadDragging"); + self.elem.removeClass("jqUploadDragging"); }, done: function(e, xhr) { var data = xhr.result; @@ -94,11 +85,20 @@ self.uploadedFiles.push(val.fileName); }); }, - fail: function(e, data) { + stop: function() { $.unblockUI(); - //console.log("upload failed:",data.error); $.pnotify({ - text: $.i18n("Error: %msg%", {msg: data.error.message}), + text: $.i18n("Uploaded %num% file(s)", {num: self.uploadedFiles.length}), + type: "success", + delay: 1000 + }); + $(".foswikiAttachments, .foswikiAttachmentsLoader").trigger("refresh", [self.uploadedFiles]); + }, + fail: function(e, data) { + var response = data.jqXHR.responseJSON; + console.log("upload failed:",response.error.message); + $.pnotify({ + text: $.i18n("Error: %msg%", {msg: response.error.message}), type: "error" }); } @@ -112,42 +112,85 @@ //console.log("init'ed fileupload on",this); }; - FileUploadButton.prototype.formatBitrate = function (bits) { - if (typeof bits !== 'number') { - return ''; - } - if (bits >= 1000000000) { - return (bits / 1000000000).toFixed(2) + ' Gbit/s'; - } - if (bits >= 1000000) { - return (bits / 1000000).toFixed(2) + ' Mbit/s'; - } - if (bits >= 1000) { - return (bits / 1000).toFixed(2) + ' kbit/s'; - } - return bits.toFixed(2) + ' bit/s'; + FoswikiUploader.prototype.add = function (params) { + var self = this; + + self.elem.fileupload("add",params); + }; + + FoswikiUploader.prototype.send = function (params) { + var self = this; + + params.formData = self.opts; + params.formData.id = Math.ceil(Math.random()*1000); + + return self.elem.fileupload("send",params); }; - FileUploadButton.prototype.renderExtendedProgress = function (data) { + // The file upload button class ////////////////////////////////////// + function UploadButton(elem, opts) { + var self = this; + + self.elem = $(elem); + self.opts = $.extend({}, self.elem.data(), opts); + self.init(); + } + + UploadButton.prototype.init = function () { var self = this; - return self.formatBitrate(data.bitrate); + + self.elem.on("change", function() { + /* + self.send().done(function(data) { + console.log("done button with result.",data.result); + }); + */ + self.add(); + }); + }; + + UploadButton.prototype.add = function () { + var self = this; + + return foswiki.uploader.add({ + fileInput: self.elem.find("input[type=file]") + }); + }; + + UploadButton.prototype.send = function () { + var self = this; + + return foswiki.uploader.send({ + fileInput: self.elem.find("input[type=file]") + }); }; - // A plugin wrapper around the constructor, // preventing against multiple instantiations - $.fn.fileUploadButton = function (opts) { + $.fn.uploadButton = function (opts) { + return this.each(function () { + if (!$.data(this, "uploadButton")) { + $.data(this, "uploadButton", new UploadButton(this, opts)); + } + }); + }; + $.fn.foswikiUploader = function (opts) { return this.each(function () { - if (!$.data(this, "fileUploadButton")) { - $.data(this, "fileUploadButton", new FileUploadButton(this, opts)); + if (!foswiki.uploader) { + foswiki.uploader = new FoswikiUploader(this, opts); } }); }; // Enable declarative widget instanziation $(function() { - $(".jqFileUploadButton:not(.jqFileUploadButtonInited)").livequery(function() { - $(this).fileUploadButton().addClass("jqFileUploadButtonInited"); + + // instantiate singleton FoswikiUploader instanze + $("body").foswikiUploader(); + + // have buttons + $(".jqUploadButton:not(.jqUploadButtonInited)").livequery(function() { + $(this).uploadButton().addClass("jqUploadButtonInited"); }); + }); })(jQuery); - diff --git a/pub/System/TopicInteractionPlugin/i18n/de.js b/pub/System/TopicInteractionPlugin/i18n/de.js index 3443e96..49389c8 100644 --- a/pub/System/TopicInteractionPlugin/i18n/de.js +++ b/pub/System/TopicInteractionPlugin/i18n/de.js @@ -8,7 +8,7 @@ "IO error.": "I/O-Fehler.", "N/A" : "Nicht verfügbar", "Security error.": "Sicherheits-Fehler.", - "Uploading %files% of %total% file(s) with %bps%/s": "Lade %files% von %total% Datei(en) hoch mit %bps%/s", + "Uploading ...": "Lade ...", "Deleting %file% ...": "Lösche %file% ...", "Edit failed": "Editieren fehlgeschlagen", "Error during '%action%'": "Fehler während '%action%'", @@ -16,5 +16,7 @@ "Loading preview ...": "Lade Vorschau ...", "Move failed": "Verschieben fehlgeschlagen", "Moving attachment(s) ...": "Verschiebe Anhänge ...", - "Saving changes ...": "Speichere Änderungen ..." + "Saving changes ...": "Speichere Änderungen ...", + "Show options": "Optionen anzeigen", + "Hide options": "Optionen verbergen" } diff --git a/pub/System/TopicInteractionPlugin/i18n/en.js b/pub/System/TopicInteractionPlugin/i18n/en.js index 1851858..a9545dd 100644 --- a/pub/System/TopicInteractionPlugin/i18n/en.js +++ b/pub/System/TopicInteractionPlugin/i18n/en.js @@ -8,7 +8,7 @@ "IO error.": "IO error.", "N/A" : "N/A", "Security error.": "Security error.", - "Uploading %files% of %total% file(s) with %bps%/s": "Uploading %files% of %total% file(s) with %bps%/s", + "Uploading ...": "Uploading ...", "Deleting %file% ...": "Deleting %file% ...", "Edit failed": "Edit failed", "Error during '%action%'": "Error during '%action%'", @@ -17,4 +17,6 @@ "Move failed": "Move failed", "Moving attachment(s) ...": "Moving attachment(s) ...", "Saving changes ...": "Saving changes ..." + "Show options": "Show options", + "Hide options": "Hide options" } diff --git a/pub/System/TopicInteractionPlugin/jquery.fileupload-process.uncompressed.js b/pub/System/TopicInteractionPlugin/jquery.fileupload-process.uncompressed.js index 2c9ea65..08243f8 100644 --- a/pub/System/TopicInteractionPlugin/jquery.fileupload-process.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/jquery.fileupload-process.uncompressed.js @@ -11,7 +11,6 @@ /* jshint nomen:false */ /* global define, require, window */ - ;(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { diff --git a/pub/System/TopicInteractionPlugin/jquery.fileupload.uncompressed.js b/pub/System/TopicInteractionPlugin/jquery.fileupload.uncompressed.js index 4d41f1e..615ec2e 100644 --- a/pub/System/TopicInteractionPlugin/jquery.fileupload.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/jquery.fileupload.uncompressed.js @@ -984,6 +984,7 @@ fileSet, i, j = 0; + if (!filesLength) { return false; } diff --git a/pub/System/TopicInteractionPlugin/metadata.uncompressed.js b/pub/System/TopicInteractionPlugin/metadata.uncompressed.js index a4b42ad..047b438 100644 --- a/pub/System/TopicInteractionPlugin/metadata.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/metadata.uncompressed.js @@ -1046,19 +1046,11 @@ As per the GPL, removal of this notice is prohibited. self.showSelection(); }; - /***********************************************************************/ - FoswikiAttachments.prototype.hideAttachmentsTab = function() { - }; - - /***********************************************************************/ - FoswikiAttachments.prototype.showAttachmentsTab = function() { - }; - /***********************************************************************/ FoswikiAttachments.prototype.hideOptionsContainer = function() { var self = this; - self.optionsLabel.html(self.toggleOpts.showText); + self.optionsLabel.html($.i18n("Show options")); self.toggleContainer.slideUp({easing:'easeInOutQuad', duration:'fast'}); self.opts.showOptions = 'off'; }; @@ -1067,7 +1059,7 @@ As per the GPL, removal of this notice is prohibited. FoswikiAttachments.prototype.showOptionsContainer = function() { var self = this; - self.optionsLabel.html(self.toggleOpts.hideText); + self.optionsLabel.html($.i18n("Hide options")); self.toggleContainer.slideDown({easing:'easeInOutQuad', duration:'fast'}); self.opts.showOptions = 'on'; }; diff --git a/pub/System/TopicInteractionPlugin/uploader.uncompressed.css b/pub/System/TopicInteractionPlugin/uploader.uncompressed.css index 7491737..855a7bd 100644 --- a/pub/System/TopicInteractionPlugin/uploader.uncompressed.css +++ b/pub/System/TopicInteractionPlugin/uploader.uncompressed.css @@ -1,11 +1,11 @@ -/* css definitions for jquery.empty plugin */ +/* css definitions for the foswiki upload plugin */ -.jqFileUploadButton { +.jqUploadButton { position: relative; overflow: hidden; display: inline-block; } -.jqFileUploadButton input { +.jqUploadButton input { position: absolute; top: 0; right: 0; @@ -17,13 +17,13 @@ cursor: pointer; } -.jqFileUploadMsg { +.jqUploadMsg { width:40%; left:30%; background-color:#b0d0ef; } -.jqFileUploadProgressBar { +.jqUploadProgressBar { font-size:1.3em; color:#fff; padding:0.5em 1em; @@ -32,17 +32,17 @@ box-sizing:border-box; display:none; } -.jqFileUploadMsg .jqFileUploadProgressBar { +.jqUploadMsg .jqUploadProgressBar { display:block; } -.jqFileUploadProgressInfo { +.jqUploadProgressInfo { font-size:0.77em; } -.jqFileUploadDropZone { +.jqUploadDropZone { display:none; } -.jqFileUploadDropZone span { +.jqUploadDropZone span { position:relative; text-align:center; top:50%; @@ -50,7 +50,7 @@ font-size:200%; font-weight:bold; } -.jqFileUploadDragging .jqFileUploadDropZone { +.jqUploadDragging .jqUploadDropZone { display:block; box-sizing:border-box; opacity: 0.5; diff --git a/pub/System/TopicInteractionPlugin/uploader.uncompressed.js b/pub/System/TopicInteractionPlugin/uploader.uncompressed.js index cce9fdb..31da346 100644 --- a/pub/System/TopicInteractionPlugin/uploader.uncompressed.js +++ b/pub/System/TopicInteractionPlugin/uploader.uncompressed.js @@ -984,6 +984,7 @@ fileSet, i, j = 0; + if (!filesLength) { return false; } @@ -1480,87 +1481,78 @@ }); })); -(function(e){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","./jquery.fileupload"],e)}else if(typeof exports==="object"){e(require("jquery"),require("./jquery.fileupload"))}else{e(window.jQuery)}})(function(e){"use strict";var r=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(s,i){var t=e(this);i.process(function(){return t.fileupload("process",i)});r.call(this,s,i)}},processActions:{},_processFile:function(r,s){var i=this,t=e.Deferred().resolveWith(i,[r]),o=t.promise();this._trigger("process",null,r);e.each(r.processQueue,function(r,t){var n=function(r){if(s.errorThrown){return e.Deferred().rejectWith(i,[s]).promise()}return i.processActions[t.action].call(i,r,t)};o=o.then(n,t.always&&n)});o.done(function(){i._trigger("processdone",null,r);i._trigger("processalways",null,r)}).fail(function(){i._trigger("processfail",null,r);i._trigger("processalways",null,r)});return o},_transformProcessQueue:function(r){var s=[];e.each(r.processQueue,function(){var i={},t=this.action,o=this.prefix===true?t:this.prefix;e.each(this,function(s,t){if(e.type(t)==="string"&&t.charAt(0)==="@"){i[s]=r[t.slice(1)||(o?o+s.charAt(0).toUpperCase()+s.slice(1):s)]}else{i[s]=t}});s.push(i)});r.processQueue=s},processing:function(){return this._processing},process:function(r){var s=this,i=e.extend({},this.options,r);if(i.processQueue&&i.processQueue.length){this._transformProcessQueue(i);if(this._processing===0){this._trigger("processstart")}e.each(r.files,function(t){var o=t?e.extend({},i):i,n=function(){if(r.errorThrown){return e.Deferred().rejectWith(s,[r]).promise()}return s._processFile(o,r)};o.index=t;s._processing+=1;s._processingQueue=s._processingQueue.then(n,n).always(function(){s._processing-=1;if(s._processing===0){s._trigger("processstop")}})})}return this._processingQueue},_create:function(){this._super();this._processing=0;this._processingQueue=e.Deferred().resolveWith(this).promise()}})});/* +/* * foswiki file upload plugin 1.0 * * Copyright (c) 2016 Michael Daum http://michaeldaumconsulting.com * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html + * Licensed GPL http://www.gnu.org/licenses/gpl.html * */ "use strict"; (function($) { - // The actual plugin constructor - function FileUploadButton(elem, opts) { + // The file upload class /////////////////////////////////////////////////// + function FoswikiUploader(elem, opts) { var self = this; self.elem = $(elem); self.opts = $.extend({ topic: foswiki.getPreference("WEB")+"."+foswiki.getPreference("TOPIC") }, self.elem.data(), opts); + self.init(); } - FileUploadButton.prototype.init = function () { - var self = this, dropZone; + FoswikiUploader.prototype.init = function () { + var self = this; - self.fileElem = self.elem.find("input[type=file]"); - self.bar = self.elem.find(".jqFileUploadProgressBar"); - self.progressInfo = self.elem.find(".jqFileUploadProgressInfo"); + self.bar = self.elem.find(".jqUploadProgressBar"); + self.progressInfo = self.elem.find(".jqUploadProgressInfo"); self.uploadedFiles = []; - dropZone = self.elem.find(".jqFileUploadDropZone"); - dropZone.remove(); - $(".jqFileUploadDropZone").remove(); - dropZone.appendTo("body"); - - self.fileElem.fileupload({ - url: foswiki.getScriptUrl("rest", "TopicInteractionPlugin", "upload", { - topic: self.opts.topic - }), + self.elem.fileupload({ + url: foswiki.getScriptUrl("rest", "TopicInteractionPlugin", "upload"), + fileInput: null, dataType: 'json', pasteZone: $(document), sequentialUploads: true, singleFileUploads: true, + replaceFileInput: false, + progress: function(e, data) { + var files = []; + $.each(data.files, function(index, file) { + files.push(file.name); + }); + self.progressInfo.html(files.join(", ")); + }, progressall: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); self.bar.css("width", progress+"%"); - self.progressInfo.html(self.renderExtendedProgress(data)); }, add: function(e, data) { + data.files = data.files; data.formData = self.opts; data.formData.id = Math.ceil(Math.random()*1000); data.submit(); }, start: function() { - self.bar.width(0); self.uploadedFiles = []; + self.bar.width(0); $.blockUI({ - blockMsgClass: "jqFileUploadMsg", - message: self.bar - }); - }, - stop: function() { - $.pnotify({ - text: $.i18n("Uploaded %num% file(s)", {num: self.uploadedFiles.length}), - type: "success", - delay: 1000 + blockMsgClass: "jqUploadMsg", + message: self.bar.length?self.bar:"" }); - $(".foswikiAttachments").trigger("refresh", [self.uploadedFiles]); - $.unblockUI(); }, dragover: function() { if (self.dragoverTimer) { window.clearTimeout(self.dragoverTimer); } - $("body").addClass("jqFileUploadDragging"); + self.elem.addClass("jqUploadDragging"); self.dragoverTimer = window.setTimeout(function() { self.dragoverTimer = null; - $("body").removeClass("jqFileUploadDragging"); + self.elem.removeClass("jqUploadDragging"); }, 1000); }, drop: function() { @@ -1568,7 +1560,7 @@ window.clearTimeout(self.dragoverTimer); } self.dragoverTimer = null; - $("body").removeClass("jqFileUploadDragging"); + self.elem.removeClass("jqUploadDragging"); }, done: function(e, xhr) { var data = xhr.result; @@ -1576,11 +1568,20 @@ self.uploadedFiles.push(val.fileName); }); }, - fail: function(e, data) { + stop: function() { $.unblockUI(); - //console.log("upload failed:",data.error); $.pnotify({ - text: $.i18n("Error: %msg%", {msg: data.error.message}), + text: $.i18n("Uploaded %num% file(s)", {num: self.uploadedFiles.length}), + type: "success", + delay: 1000 + }); + $(".foswikiAttachments, .foswikiAttachmentsLoader").trigger("refresh", [self.uploadedFiles]); + }, + fail: function(e, data) { + var response = data.jqXHR.responseJSON; + console.log("upload failed:",response.error.message); + $.pnotify({ + text: $.i18n("Error: %msg%", {msg: response.error.message}), type: "error" }); } @@ -1594,42 +1595,85 @@ //console.log("init'ed fileupload on",this); }; - FileUploadButton.prototype.formatBitrate = function (bits) { - if (typeof bits !== 'number') { - return ''; - } - if (bits >= 1000000000) { - return (bits / 1000000000).toFixed(2) + ' Gbit/s'; - } - if (bits >= 1000000) { - return (bits / 1000000).toFixed(2) + ' Mbit/s'; - } - if (bits >= 1000) { - return (bits / 1000).toFixed(2) + ' kbit/s'; - } - return bits.toFixed(2) + ' bit/s'; + FoswikiUploader.prototype.add = function (params) { + var self = this; + + self.elem.fileupload("add",params); }; - FileUploadButton.prototype.renderExtendedProgress = function (data) { + FoswikiUploader.prototype.send = function (params) { var self = this; - return self.formatBitrate(data.bitrate); + + params.formData = self.opts; + params.formData.id = Math.ceil(Math.random()*1000); + + return self.elem.fileupload("send",params); + }; + + // The file upload button class ////////////////////////////////////// + function UploadButton(elem, opts) { + var self = this; + + self.elem = $(elem); + self.opts = $.extend({}, self.elem.data(), opts); + self.init(); + } + + UploadButton.prototype.init = function () { + var self = this; + + self.elem.on("change", function() { + /* + self.send().done(function(data) { + console.log("done button with result.",data.result); + }); + */ + self.add(); + }); + }; + + UploadButton.prototype.add = function () { + var self = this; + + return foswiki.uploader.add({ + fileInput: self.elem.find("input[type=file]") + }); + }; + + UploadButton.prototype.send = function () { + var self = this; + + return foswiki.uploader.send({ + fileInput: self.elem.find("input[type=file]") + }); }; - // A plugin wrapper around the constructor, // preventing against multiple instantiations - $.fn.fileUploadButton = function (opts) { + $.fn.uploadButton = function (opts) { return this.each(function () { - if (!$.data(this, "fileUploadButton")) { - $.data(this, "fileUploadButton", new FileUploadButton(this, opts)); + if (!$.data(this, "uploadButton")) { + $.data(this, "uploadButton", new UploadButton(this, opts)); + } + }); + }; + $.fn.foswikiUploader = function (opts) { + return this.each(function () { + if (!foswiki.uploader) { + foswiki.uploader = new FoswikiUploader(this, opts); } }); }; // Enable declarative widget instanziation $(function() { - $(".jqFileUploadButton:not(.jqFileUploadButtonInited)").livequery(function() { - $(this).fileUploadButton().addClass("jqFileUploadButtonInited"); + + // instantiate singleton FoswikiUploader instanze + $("body").foswikiUploader(); + + // have buttons + $(".jqUploadButton:not(.jqUploadButtonInited)").livequery(function() { + $(this).uploadButton().addClass("jqUploadButtonInited"); }); + }); })(jQuery); - diff --git a/templates/metadata.tmpl b/templates/metadata.tmpl index a98f771..8fedcf6 100644 --- a/templates/metadata.tmpl +++ b/templates/metadata.tmpl @@ -1,18 +1,19 @@ %{ ################################################################################ }% -%TMPL:DEF{"metadata"}% -%TMPL:P{"metadata::start"}% +%TMPL:DEF{"metadata"}%%TMPL:P{"metadata::start"}% %TMPL:P{"metadata::form"}% %TMPL:P{"metadata::attachments"}% %TMPL:P{"metadata::comments"}% -%TMPL:P{"metadata::end"}% -%TMPL:END% +%TMPL:P{"metadata::end"}%%TMPL:END% %{ ################################################################################ }% %TMPL:DEF{"metadata::start"}% -%CLEAR% +%CLEAR%%TMPL:P{"metadata::css"}%%TMPL:P{"metadata::javascript"}% +%TMPL:P{"uploadbutton::progress"}%%TMPL:P{"uploadbutton::dropzone"}%
-%TABPANE{select="%URLPARAM{"metadata_tab"}%" animate="on" class="plain"}% -%TMPL:END% +%TABPANE{select="%URLPARAM{"metadata_tab"}%" animate="on" class="plain"}%%TMPL:END% + +%{ ################################################################################ }% +%TMPL:DEF{"metadata::end"}%%ENDTABPANE%
%TMPL:END% %{ ################################################################################ }% %TMPL:DEF{"metadata::form"}%%TMPL:P{"form"}%%TMPL:END% @@ -29,11 +30,6 @@ else="" }%%TMPL:END% -%{ ################################################################################ }% -%TMPL:DEF{"metadata::end"}% -%ENDTABPANE% - -%TMPL:END% %{ ################################################################################ }% %TMPL:DEF{"metadata::lightbox"}%%IF{ @@ -58,7 +54,7 @@ %{ ################################################################################ }% %TMPL:DEF{"metadata::javascript"}% %TMPL:P{"metadata::lightbox"}% -%JQREQUIRE{"ui::tooltip, ui, uploader, twisty, mediaelement" warn="off"}% +%JQREQUIRE{"ui::tooltip, ui, uploader, twisty, mediaelement, loader" warn="off"}% %ADDTOZONE{"script" id="METADATA::JS" requires="JQUERYPLUGIN::LIVEQUERY, JQUERYPLUGIN::UI, JQUERYPLUGIN::UPLOADER" @@ -92,11 +88,11 @@ %TMPL:DEF{"comments::tab"}% %TAB{"%MAKETEXT{"Comments [_1]" args="%METACOMMENTS{limit="1" format="($count)" singular="$count" plural="$count"}%"}%" id="comments" - url="%SCRIPTURL{"rest"}%/RenderPlugin/template?name=metacomments;expand=metacomments;topic=%WEB%.%TOPIC%;render=on;_t=%GMTIME{"$epoch"}%" -}%
 
-%ENDTAB% -%TMPL:P{"metadata::css"}%%TMPL:P{"metadata::javascript"}% -%TMPL:END% + url="%SCRIPTURL{"rest"}%/RenderPlugin/template?name=metacomments;expand=metacomments;topic=%WEB%.%TOPIC%;render=on;%GMTIME{"$epoch"}%" +}% +
 
+ +%ENDTAB%%TMPL:END% %{ ################################################################################ }% %TMPL:DEF{"dataform::tab"}% @@ -130,35 +126,18 @@ $title: $value " - footer="$percntENDTAB$percnt - $percntTMPL:P{\"metadata::css\"}$percnt - $percntTMPL:P{\"metadata::javascript\"}$percnt" + footer="$percntENDTAB$percnt" }%%TMPL:END% %{ ################################################################################ }% -%TMPL:DEF{"attachments::tab"}%%TMPL:P{"metadata::css"}%%TMPL:P{"metadata::javascript"}% -%TAB{"%MAKETEXT{"Attachments [_1]" args=""}%" +%TMPL:DEF{"attachments::tab_DIS"}%%TAB{"%MAKETEXT{"Attachments [_1]" args="($count)"}%" id="attachments" url="%SCRIPTURL{"rest"}%/RenderPlugin/template?name=metadata;expand=attachments;topic=%WEB%.%TOPIC%;render=on;_t=%GMTIME{"$epoch"}%" -}%
 
-%ENDTAB%%TMPL:END% +}%%ENDTAB%%TMPL:END% -%TMPL:DEF{"attachments::tab_old"}% -%ATTACHMENTS{ - hidenull="on" - warn="off" - attr="^[^h]*$" - header="$percntTAB{ - \"%MAKETEXT{"Attachments [_1]" args="($count)"}%\" - id=\"attachments\" - url=\"%SCRIPTURL{"rest"}%/RenderPlugin/template?name=metadata;expand=attachments;topic=%WEB%.%TOPIC%;render=on;_t=%GMTIME{"$epoch"}%\" - }$percnt -
 
- $percntENDTAB$percnt" - limit="1" - format="" - footer="$percntTMPL:P{\"metadata::css\"}$percnt$percntTMPL:P{\"metadata::javascript\"}$percnt" -}%%TMPL:END% +%TMPL:DEF{"attachments::tab"}%%TAB{"%MAKETEXT{"Attachments [_1]" args="($count)"}%" + id="attachments" +}%%TMPL:P{"attachments"}%%ENDTAB%%TMPL:END% %{ ################################################################################ }% %TMPL:DEF{"attachments::sort"}%%URLPARAM{ @@ -577,12 +556,12 @@ %TMPL:END% %{ ################################################################################ }% -%TMPL:DEF{"uploadbutton"}%%TMPL:P{"uploadbutton::start"}%%TMPL:P{"uploadbutton::input"}%%TMPL:P{"uploadbutton::progress"}%%TMPL:P{"uploadbutton::dropzone"}%%TMPL:P{"uploadbutton::end"}%%TMPL:END% +%TMPL:DEF{"uploadbutton"}%%TMPL:P{"uploadbutton::start"}%%TMPL:P{"uploadbutton::input"}%%TMPL:P{"uploadbutton::end"}%%TMPL:END% -%TMPL:DEF{"uploadbutton::start"}%%TMPL:P{"uploadbutton::icon"}%%TMPL:P{"uploadbutton::label"}%%TMPL:END% +%TMPL:DEF{"uploadbutton::start"}%%TMPL:P{"uploadbutton::icon"}%%TMPL:P{"uploadbutton::label"}%%TMPL:END% %TMPL:DEF{"uploadbutton::input"}%%TMPL:END% -%TMPL:DEF{"uploadbutton::progress"}%%TMPL:END% -%TMPL:DEF{"uploadbutton::dropzone"}%
%MAKETEXT{"Drag files here"}%
%TMPL:END% +%TMPL:DEF{"uploadbutton::progress"}%
%TMPL:P{"uploadbutton::progress::label"}%
%TMPL:END% +%TMPL:DEF{"uploadbutton::dropzone"}%
%MAKETEXT{"Drag files here"}%
%TMPL:END% %TMPL:DEF{"uploadbutton::end"}%
%TMPL:END% %TMPL:DEF{"uploadbutton::icon"}%%TMPL:END% @@ -597,6 +576,5 @@ }%" title="%MAKETEXT{"Show/hide advanced options"}%" icon="fa-wrench" - class="simple foswikiAttachmentsOptionsToggle" - data="showText:\"%MAKETEXT{"Show options"}%\", hideText:\"%MAKETEXT{"Hide options"}%\"" + class="simple foswikiAttachmentsOptionsToggle i18n" }%%TMPL:END%