Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Service: Dropzones #586

Merged
Merged
Show file tree
Hide file tree
Changes from 212 commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
1f96a8c
Create basic interface structure for file dropzones.
May 5, 2017
8dc546a
Create basic class structure for file dropzones.
May 5, 2017
63fc928
Add phpdoc comments and implement interface methods.
May 5, 2017
3687895
Add phpdoc comments and needed private methods.
May 5, 2017
703985a
Add dropzone.js library to templates.
May 8, 2017
3f4dbaa
Create template for standard file dropzone.
May 8, 2017
ac67831
Add description and implementation for file dropzones to the UI Factory.
May 8, 2017
294c522
Create unit test FileDropzoneRendererer render standard dropzone.
May 8, 2017
0641d23
Merge branch 'trunk' into feature/5-3/ui-service-dropzones
May 8, 2017
d80f0de
Fix type hint error.
May 8, 2017
20ea633
Fix id in expected html.
May 8, 2017
d6291df
Implement unit test FileDropzoneRenderer render standard dropzone.
May 8, 2017
3e2cfc5
Add fileDropzone method.
May 8, 2017
9b98fe7
Fix method scope problem.
May 8, 2017
6b9fed5
Add less for drop zones.
May 8, 2017
a490664
Add javascript for drop zones.
May 8, 2017
809f5e9
Import dropzone less.
May 8, 2017
9c2283e
Add FileDropzone Standard example.
May 8, 2017
713907d
Add css class .standard
May 9, 2017
7b69065
Register dropzone.js resource.
May 9, 2017
4b35cee
Create unit test FileDropzoneRenderer render wrapper dropzone.
May 9, 2017
2bb03bc
Create wrapper dropzone template.
May 9, 2017
624bd1b
Override normalizeHtml method and fix spelling error in expected html.
May 9, 2017
0891f83
Implement unit test FileDropzone Renderer render wrapper dropzone.
May 9, 2017
5140de8
Create unit test FileDropzone Renderer render standard drop zone with…
May 9, 2017
f946b6e
Implement unit test FileDropzone Renderer render standard dropzone wi…
May 9, 2017
ec85cc7
Make Wrapper Dropzone with constructor argument.
May 9, 2017
2d394fb
Fix unit test with Wrapper Dropzone constructor argument.
May 9, 2017
4820db3
Add method checkEmptyArray().
May 9, 2017
74caee5
Make the methods scope public.
May 9, 2017
7974fa1
Refactor FileDropzone Renderer.
May 9, 2017
fb69840
Make the methods scope public.
May 9, 2017
84b53d8
Add example FileDropzone Standard with default message.
May 9, 2017
90c9cab
Add example FileDropzone with alternative highlight.
May 9, 2017
f89aab2
Create basic class structure.
May 9, 2017
37fed19
Add phpdoc comments.
May 9, 2017
9973555
Create unit test JavascriptHelper enable drop design.
May 9, 2017
2b7617a
Implement unit test JavascriptHelper enable drop design.
May 9, 2017
8171102
Create unit test JavascriptHelper disable drop design.
May 9, 2017
506ad69
Implement unit test JavascriptHelper disable drop design.
May 9, 2017
162c35e
Create unit test JavascriptHelper initialize drop zone.
May 9, 2017
5c4b8f5
Implement unit test JavascriptHelper initialize dropzone.
May 9, 2017
6e806a9
Create unit test JavascriptHelper trigger signals.
May 9, 2017
688314c
Implement unit test JavascriptHelper trigger signals.
May 9, 2017
317d072
Remove php7 syntax.
May 9, 2017
363ee4c
Update expected javascript in JavascriptHelperTest.
May 9, 2017
7f65b7b
Update JavascriptHelper with js function in string.
May 9, 2017
9fd7799
Add wrappToJSEventFunction method.
May 9, 2017
72a3e47
Add javascript onload code for dropzones.
May 9, 2017
17bad8e
Add phpdoc and refactor method wrapToJSEventFunction.
May 9, 2017
2ce1aef
Add the previewsContainer options the javascript code.
May 9, 2017
e00ae5c
Add phpdoc comments.
May 9, 2017
dfaf8f3
Add jsdoc to functions.
May 9, 2017
37a67d9
Add registeredSignals variable.
May 12, 2017
3879664
Update unit tests JavascriptHelper with updated expected javascript c…
May 12, 2017
e59a2d8
Implement updated unit test for JavascriptHelper class.
May 12, 2017
c85a2bd
Remove private variable $darkendBackground.
May 12, 2017
eac34e6
Add javascript functions to enable darkened Design for a dropzone.
May 12, 2017
54e0591
Update renderer for Standard Dropzone with the new javascript code.
May 12, 2017
f84a73c
Update phpdoc for Standard Dropzone.
May 12, 2017
731fc11
Update Standard Dropzone example with darkened background option.
May 12, 2017
8befee3
Delete outdated example.
May 12, 2017
5c4edb1
Update css for Standard Dropzone.
May 12, 2017
1c0c373
Add private variable $darkedBackground.
May 12, 2017
329f345
Set $darkendBackground to true in constructor.
May 12, 2017
4e7b2e8
Change $darkendBackground to false and make its scope protected.
May 12, 2017
e0af1ed
Update javascript unload code in FileDropzone Renderer.
May 12, 2017
83508c1
Create Wrapper Dropzone example.
May 12, 2017
57144b0
Add css for wrapper drop zones.
May 12, 2017
91c389c
Add Wrapper Dropzone example with alternativeDesign.
May 12, 2017
add2640
Add css for wrapper dropzone with darkened background.
May 12, 2017
a564069
Fix spelling error.
May 12, 2017
98705a6
Add javascript doc comments.
May 12, 2017
34c1d8d
Make argument for wrapper content to array or Component.
May 15, 2017
ff45787
Rename DefaultMassage to message for methods and variables.
May 15, 2017
6513a61
Change parameter to array or Component type.
May 15, 2017
1fbfa41
Add jQuery dragster library.
May 15, 2017
61ad645
Extend JavascriptHelper class with additional Javascript code for dro…
May 15, 2017
c3f3390
Add additional javascript functions for dropzones.
May 15, 2017
2b81712
Reimplement javascript setup for wrapper dropzones.
May 15, 2017
01d0059
Update css less for drop zones.
May 15, 2017
a4be402
Make JavascriptHelper class more responsible to render javascript cod…
May 16, 2017
4ac653c
Delete unnecessary unit test for JavascriptHelper class.
May 16, 2017
c8dfae0
Extend javascript functions for the dropzone behavior.
May 16, 2017
cb255a3
Update the javascript function name.
May 16, 2017
0f72b2c
Exclude javascript code into JavascriptHelper class.
May 16, 2017
142ee90
Add variable to contain css selectors which are used.
May 16, 2017
01aacc4
Remove unnecessary div tag.
May 16, 2017
e316560
Remove dropzone.js library.
May 16, 2017
2ec6c8c
Add default design function for drop zones.
May 16, 2017
b96f4a0
Fix css classes for default design.
May 16, 2017
5e2c779
Make SimpleDropzone class able to hold the option to auto discovery t…
May 16, 2017
cf5037d
Fix spelling error in comment.
May 16, 2017
db0805e
Use setter chaining for SimpleDropzone instances.
May 16, 2017
40fb58e
Update php doc comments for wrapper and standard drop zone.
May 16, 2017
19c4ff6
Fix php7 syntax.
May 16, 2017
e231ff4
Update examples for dropzones.
May 16, 2017
cb5ca01
Rename function to withMessage.
May 16, 2017
8dd874a
Delete example for file dropzone with wrong name.
May 16, 2017
b5f60be
Add less variables for dropzone styles.
May 16, 2017
8f34eec
Add public scope to methods.
May 16, 2017
addac8c
Add full namespace to phpdoc @return stamement.
May 16, 2017
a1e0604
Update phpdoc comments of the Droppable interface.
May 18, 2017
0932310
Rename BasicFileDropzone interface to FileDropzone.
May 18, 2017
6dc0619
Rename FileDropzone to Dropzone.
May 18, 2017
602b651
Fix spelling error darkend -> darkened.
May 18, 2017
a037ee9
Rename “file dropzone” to “dropzone”.
May 18, 2017
45fa917
Update php doc comment.
May 18, 2017
46cbc86
Move jQuery dragster to the libs directory.
May 18, 2017
62b50ef
Add ComponentHelper.
May 18, 2017
69e564e
Add missing return statement.
May 18, 2017
1b26975
Rename fileDropzone() method to dropzone().
May 18, 2017
835fb78
Update dropzone description in the factory classes.
May 19, 2017
5f30b60
Fix spelling error in method call.
May 19, 2017
109cee3
Rename directory for examples from FileDropzone to Dropzone.
May 19, 2017
cfc3c55
Delete dropzone examples in wrong directory.
May 19, 2017
dfa225d
Reimplement the dropzone behavior.
May 19, 2017
270b3dd
Remove File Dropzone js.
May 22, 2017
fc4be81
Update SimpleDropzone with type attribute.
May 22, 2017
4e77cfd
Create class JSDropzoneInitializer and add basic methods.
May 22, 2017
79e26d2
Fix arg list check method call.
May 22, 2017
3378ad3
Add phpdoc comments.
May 22, 2017
be84ee6
Prevent defaults on browser drop events and update js doc.
May 22, 2017
6b55d34
Add authors email.
May 22, 2017
0b62fdc
Update dropzone init.
May 22, 2017
6c6c69c
Implement Wrapper drop zone behavior.
May 22, 2017
3ccfe26
Remove JavascriptHelper class.
May 22, 2017
41048a7
Update DropzoneRendererTest.
May 22, 2017
99aafcb
Remove old FileDropzoneRendererTest.
May 22, 2017
77dff79
Remove default from method name.
May 22, 2017
31dfa89
Create unit test cases for JSDropzoneInitializer class.
May 22, 2017
baa040d
Update jsdoc comment.
May 22, 2017
df193e8
Optimize rendering of dropzone content.
May 22, 2017
c83afcc
Fix bug when a signal is not used as string.
May 22, 2017
29ea4af
Move Dropzone to Dropzone/File.
May 22, 2017
d346111
Fix namespace errors.
May 22, 2017
4820e55
Delete old drop zone templates.
May 22, 2017
b7e65b1
Move unit tests to the File directory.
May 22, 2017
c292030
Delete old unit tests.
May 22, 2017
9066b13
Fix bug with jQuery foreach.
May 23, 2017
d1a0a9d
code-format proposal
chfsx May 30, 2017
5317d5e
code-format II
chfsx May 30, 2017
cc0ce30
Merge branch 'feature/5-3/ui-service-dropzones-codeformat' into 'feat…
May 30, 2017
c3f4938
Fix yaml parse errors.
Jun 1, 2017
a408a49
Implement upload-container.js.
Jun 13, 2017
105b8c5
Implement uploader.js component.
Jun 13, 2017
436f0ae
Extend dropzone-behavior.js with the Upload dropzone component.
Jun 13, 2017
a0fe5e4
Add additional attributes for dropzones.
Jun 13, 2017
5555236
Add additional attributes in the json options parameter.
Jun 13, 2017
1af127b
Register upload-container.js and uploader.js.
Jun 13, 2017
08bd755
Fix path to js resource.
Jun 13, 2017
dd193ee
Fix event.dataTransfer call and $.each loop.
Jun 13, 2017
2a568ae
Update type of ajax request.
Jun 13, 2017
50c8d39
Implement server side part of “proof of concept” upload dropzone and …
wanze Jun 15, 2017
f197f03
Add fineuploader library as upload dependency
wanze Jun 28, 2017
58cb103
Implement JS wrapper to upload files (WIP)
wanze Jun 28, 2017
096c4b6
Add validation for file uploads: Allowed file types, Max file size, M…
wanze Jun 29, 2017
d24eb72
Refactoring of file dropzones
wanze Jul 18, 2017
15ff641
Update factory descriptions and add a proof of concept of how one can…
wanze Jul 19, 2017
3626f8d
Merge branch 'trunk' into feature/5-3/ui-service-dropzones-2
wanze Jul 20, 2017
06a1d4f
Extend javascript wrapper of uploader with the possbility to bind upl…
wanze Jul 20, 2017
0dfe022
Update examples, update factory descriptions and fix rendering unit t…
wanze Jul 21, 2017
c10faf2
Remove some unecessary files of 3thparty dependency “FineUploader”
wanze Jul 24, 2017
a4dc212
Some updates after feedback on pull request, mainly factory descripti…
wanze Jul 31, 2017
e1d0d5b
added bower dependency description
chfsx Aug 3, 2017
32d2a83
Merge branch 'trunk' into feature/5-3/ui-service-dropzones-2
chfsx Aug 3, 2017
41eeebf
Merge branch 'proposal/5-3/bower' into feature/5-3/ui-service-dropzon…
chfsx Aug 3, 2017
fb06b73
switched to bower for JS-dependency, another PR will be opened for th…
chfsx Aug 3, 2017
b888b6a
updated KS-data
chfsx Aug 3, 2017
afa019b
corrected some naming on Droppable
chfsx Aug 3, 2017
d016585
renaming some methods in both interface and implementation based on f…
chfsx Aug 3, 2017
a2d9be1
switched jquery.dragster.js to bower
chfsx Aug 3, 2017
6add51d
withUserDefinedDescriptionEnabled and withUserDefinedFileNamesEnabled
chfsx Aug 3, 2017
52eac04
first attempt to implement #578
chfsx Aug 3, 2017
fe2fe6e
fixed two small BT tasks
chfsx Aug 3, 2017
935e3b2
Merge branch 'trunk' into feature/5-3/ui-service-dropzones-2
chfsx Aug 4, 2017
19b6994
dropzone-specific css rendered
chfsx Aug 4, 2017
fa8b081
implemented more accurate version of the standard-dropzone as discuss…
chfsx Aug 4, 2017
4209c2d
language improvements for DZ
chfsx Aug 4, 2017
eac8ccb
finalized standard dropzone and prototype of usage in standard (legac…
chfsx Aug 5, 2017
d3cacc6
finished implementation of wrapper dropzone
chfsx Aug 5, 2017
5c0a89a
missed template file in commit
chfsx Aug 5, 2017
6aad4ae
Merge branch 'trunk' into feature/5-3/ui-service-dropzones-2
chfsx Aug 8, 2017
6283e43
implemented alternative version of filelists in d&d uploads
chfsx Aug 8, 2017
2b4db82
fixed margin of closebutton within the filelist
chfsx Aug 9, 2017
479d459
again the margin...
chfsx Aug 9, 2017
a35c391
changes due to integration in legacy forms
chfsx Aug 10, 2017
7d15ba6
updated classmap
chfsx Aug 10, 2017
293911f
moved ilFileStandardDropzoneGUI
chfsx Aug 10, 2017
34546be
updated classmap
chfsx Aug 10, 2017
f7e72c5
latest changes to form-usage of dropzones
chfsx Aug 10, 2017
f3e03e1
coding conventions
chfsx Aug 10, 2017
a325c36
implemented stronger rule for wrapper-dz
chfsx Aug 10, 2017
ed34979
Updated Tests
chfsx Aug 10, 2017
e3eb8fa
added additional tests for dropzones
chfsx Aug 10, 2017
3a22fee
Merge branch 'trunk' into feature/5-3/ui-service-dropzones-2
chfsx Aug 15, 2017
3703fca
comment why the ilFileStandardDropzoneInputGUI is not a replacement f…
chfsx Aug 15, 2017
debbdbe
describing the public interface of ilFileStandardDropzoneInputGUI
chfsx Aug 15, 2017
b11be2d
moved ilFileStandardDropzoneInputGUI.js out of examples to a more app…
chfsx Aug 15, 2017
a31abe0
removed @version descriptions
chfsx Aug 15, 2017
59d3abc
renamed withIdentifier to withParameterName
chfsx Aug 15, 2017
2e08d94
comment for the drop-event
chfsx Aug 15, 2017
97e4e9c
comments in the Examples
chfsx Aug 15, 2017
bada67b
removed debugging in ilFileStandardDropzoneInputGUI.js
chfsx Aug 15, 2017
6ea9296
descriptions in Wrapper-Dropzone Examples
chfsx Aug 15, 2017
559d676
commented out log() in uploader.js
chfsx Aug 15, 2017
d9d6be6
removed logging in dropzone.js
chfsx Aug 15, 2017
d39ece7
removed another @version
chfsx Aug 16, 2017
07b2516
describing public method
chfsx Aug 16, 2017
8019727
use withAdditionalOnLoadCode() for the upload button
chfsx Aug 16, 2017
fe9a2ba
!important; no longer needed
chfsx Aug 16, 2017
0fac873
removed unused jquery.dragster
chfsx Aug 16, 2017
954a27c
push those libraries for tho moment, if #608 won't be accepted we wil…
chfsx Aug 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions Services/Form/classes/class.ilFileStandardDropzoneInputGUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
<?php
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */

/**
* Class ilFileStandardDropzoneInputGUI
*
* A ilFileStandardDropzoneInputGUI is used in a (legacy) Form to upload Files using the Dropzone
* of the UI-Framework introduced with ILIAS 5.3. In some cases this can be used as a
* Drop-In-Replacement of the ilFileInputGUI, but check your usecase after. If you need an example
* how to use it, see e.g. in UI/examples/Dropzone/File/Standard/with_usage_in_legacy_form.php
*
* Why make it a Drop-In-Replacement and not just replace ilFileInputGUI?
* - There are a lot of different ways a form is handled in ILIAS, sometimes only checkInput is
* called, sometime developers send their own error-messages and so on. The
* ilFileStandardDropzoneInputGUI excepts some standard-behavior and would fail in some cases when
* just replacing the ilFileInputGUI
* - There are a lot of options in ilFileInputGUI which would be difficult to reimplement in
* ilFileStandardDropzoneInputGUI without discussing them with all devs.
* - Beside ilFileInputGUI there are many other File-InputGUIs with different functionality. We
* should consolidate their use-cases first.
*
* Attention: This ilFileStandardDropzoneInputGUI changes the behaviour of your form when used: The
* Form will be sent asynchronously due to limitations of dropped files (see
* https://stackoverflow.com/questions/1017224/dynamically-set-value-of-a-file-input )
*
* @author Fabian Schmid <[email protected]>
*/
class ilFileStandardDropzoneInputGUI extends ilFileInputGUI implements ilToolbarItem {

const ASYNC_FILEUPLOAD = "async_fileupload";
/**
* @var int if there are more than one ilFileStandardDropzoneInputGUI in the same Form, this
* value will be incremented during rendering to make sure all Inputs will be handled
* correctly
*/
protected static $count = 0;
/**
* @var string Set it to the URL (using ilCtrl->getFormAction() ) to override the Endpoint the
* Form will be sent to. If not set, the ilFileStandardDropzoneInputGUI will get the
* Form-Action of it's nearest form
*/
protected $upload_url = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what this variable does here.

/**
* @var int The amount of files which can be uploaded. Standard is 1 since the old
* ilFileInputGUI in most cases allows one.
*/
protected $max_files = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what this variable does here.

/**
* @var \ILIAS\Data\DataSize only files beneath this size will be accepted to upload. Currently
* this uses the defined valued of the php.ini
*/
protected $max_file_size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what this variable does here.

/**
* @var string The message which will be rendered within the dropzone.
*/
protected $dropzone_message = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what this variable does here.



/**
* @return string the URL where the form will be sent to.
*/
public function getUploadUrl() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe this public function here.

return $this->upload_url;
}


/**
* Set the URL (using ilCtrl->getFormAction() ) to override the Endpoint the
* Form will be sent to. If not set, the ilFileStandardDropzoneInputGUI will get the
* Form-Action of it's nearest form
*
* @param string $upload_url
*
* @return $this
*/
public function setUploadUrl($upload_url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe this public function here.

$this->upload_url = $upload_url;

return $this;
}


/**
* @return int Amount of allowed files in this input
*/
public function getMaxFiles() {
return $this->max_files;
}


/**
* @param int $max_files The amount of files which can be uploaded. Standard is 1 since the old
* ilFileInputGUI in most cases allows one.
*/
public function setMaxFiles($max_files) {
$this->max_files = $max_files;
}


/**
* @return \ILIAS\Data\DataSize allowed size of files which can be uploaded
*/
public function getMaxFilesize() {
return $this->max_file_size;
}


/**
* @param \ILIAS\Data\DataSize $max_file_size only files beneath this size will be accepted to
* upload. Currently this uses the defined valued of
* the php.ini
*/
public function setMaxFilesize(\ILIAS\Data\DataSize $max_file_size) {
$this->max_file_size = $max_file_size;
}


/**
* @return string The message which will be rendered within the dropzone.
*/
public function getDropzoneMessage() {
return $this->dropzone_message;
}


/**
* @param string $dropzone_message The message which will be rendered within the dropzone.
*/
public function setDropzoneMessage($dropzone_message) {
$this->dropzone_message = $dropzone_message;
}


/**
* @inheritdoc
*/
public function render($a_mode = "") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably you should use:
/** * @inheritdoc */

global $DIC;

$this->handleUploadURL();
$this->handleSuffixes();

$f = $DIC->ui()->factory();
$r = $DIC->ui()->renderer();

$dropzone = $f->dropzone()
->file()
->standard($this->getUploadUrl())
->withParameterName($this->getPostVar())
->withMaxFiles($this->getMaxFiles())
->withMessage($this->getDropzoneMessage())
->withAllowedFileTypes($this->getSuffixes());
$dropzone = $this->handleMaxFileSize($dropzone);
if ($this->isFileNameSelectionEnabled()) {
$dropzone = $dropzone->withUserDefinedFileNamesEnabled(true);
}

$render = $r->render($dropzone);

$n = ++ self::$count;
$out = "<div id='ilFileStandardDropzoneInputGUIWrapper{$n}'>" . $render . '</div>';
// We need some javascript magic
/** @var ilTemplate $tpl */
$tpl = $DIC['tpl'];
$tpl->addJavaScript('./Services/Form/js/ilFileStandardDropzoneInputGUI.js');
$tpl->addOnLoadCode("ilFileStandardDropzoneInputGUI.init('ilFileStandardDropzoneInputGUIWrapper{$n}');");

return $out;
}


/**
* @inheritdoc
*/
public function checkInput() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably you should use:
/** * @inheritdoc */

global $DIC;

$hasUploads = $DIC->upload()->hasUploads();
if ($this->getRequired() && !$hasUploads) {
return false; // No file uploaded but is was required
}

if ($hasUploads) {
try {
$_POST[$this->getPostVar()] = $_FILES[$this->getPostVar()];
} catch (Exception $e) {
return false;
}

return true;
}

return true;
}


protected function handleUploadURL() {
if (!$this->getUploadUrl()) {
$parentWrapper = $this;
while (!$parentWrapper instanceof ilPropertyFormGUI && $parentWrapper !== null) {
$parentWrapper = $parentWrapper->getParent();
}

$str_replace = str_replace("&amp;", "&", $parentWrapper->getFormAction());
$this->setUploadUrl($str_replace . "&" . self::ASYNC_FILEUPLOAD . "=true");
}
}


protected function handleSuffixes() {
if (!is_array($this->getSuffixes())) {
$this->setSuffixes(array());
}
}


/**
* @param ILIAS\UI\Component\Dropzone\File\Standard $dropzone
*
* @return ILIAS\UI\Component\Dropzone\File\Standard
*/
protected function handleMaxFileSize($dropzone) {
if ($this->getMaxFilesize()) {
$dropzone = $dropzone->withFileSizeLimit($this->getMaxFilesize());
}

return $dropzone;
}
}
61 changes: 61 additions & 0 deletions Services/Form/js/ilFileStandardDropzoneInputGUI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
var ilFileStandardDropzoneInputGUI = (function ($) {

var init = function (wrapper_id) {
var wrapper = $('#' + wrapper_id);
var uploadId = wrapper.find('.il-dropzone-base').attr('id');
var form = wrapper.closest('form');
var handledUpload = false;
var buttonName = form.find('input[type=submit]:first').attr('name');
form.find('input[type=submit]').on("click", function () {
buttonName = $(this).attr('name');
});

form.on('submit', function (event) {
if (handledUpload) {
return;
}
if ($(this)[0].checkValidity()) {
// If we have any files to upload, start uploading process prior to submitting form
if (il.UI.uploader.getUploads(uploadId).length) {
event.preventDefault();

var params = {};

$.each($(this).serializeArray(), function (_, kv) {
if (params.hasOwnProperty(kv.name)) {
params[kv.name] = $.makeArray(params[kv.name]);
params[kv.name].push(kv.value);
} else {
params[kv.name] = kv.value;
}
});

params[buttonName] = true;

il.UI.uploader.setUploadParams(uploadId, params);
il.UI.uploader.onError(uploadId, function (xmlHttpRequest) {
handledUpload = true;
return false;
});
il.UI.uploader.onAllUploadCompleted(uploadId, function () {
handledUpload = true;
return true;
}, function () {
handledUpload = true;
return false;
});

il.UI.uploader.upload(uploadId);
}
else {
handledUpload = true;
}
}
});
};

return {
init: init
}

})($);
2 changes: 1 addition & 1 deletion Services/Style/System/data/data.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -5311,6 +5311,7 @@ common#:#visitors#:#Besucher
common#:#visits#:#Besuche
common#:#web_resources#:#Weblinks
common#:#webdav#:#WebDAV
common#:#edit_metadata#:#Metadaten bearbeiten
common#:#webdav_pear_auth_http_needed#:#Sie benötigen PEAR-Auth_HTTP um diese Funktion zu verwenden. Geben Sie im Terminal-Fenster <code>pear install Auth_HTTP</code> ein.
common#:#webdav_pwd_instruction#:#Um das ILIAS-Magazin als Webordner außerhalb der aktuellen Sitzung als Webordner zu öffnen, empfehlen wir ein lokales Passwort anzulegen.<br />Dieses Passwort wird nur für die Webordner-Funktionalitäten benötigt, die ILIAS-Anmeldung erfolgt weiterhin mit Ihrem gewohnten Passwort.
common#:#webdav_pwd_instruction_success#:#Ein neues lokales Passwort wurde angelegt. Sie können nun das Magazin als Webordner öffnen.
Expand Down Expand Up @@ -12680,7 +12681,7 @@ trac#:#trac_lp_list_gui#:#Persönlicher Schreibtisch, Magazin, Suche
trac#:#trac_lp_list_gui_info#:#Wenn aktiviert, wird der Lernfortschrittsstatus in Objekt-Listen angezeigt.
common#:#hide_all_details#:#Alle Details ausblenden
common#:#show_all_details#:#Alle Details anzeigen
common#:#select_files_from_computer#:#Wählen Sie die Dateien von Ihrem Computer aus
common#:#select_files_from_computer#:#Dateien wählen
common#:#drag_files_here#:#Ziehen Sie die Dateien in diesen Bereich
common#:#selected_files#:#Ausgewählte Dateien
common#:#num_of_selected_files#:#%s Datei(en) ausgewählt
Expand Down
3 changes: 2 additions & 1 deletion lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2790,6 +2790,7 @@ common#:#notes_and_comments#:#Notes and Comments
common#:#notes#:#Notes
common#:#notifications#:#Notifications
common#:#num_users#:#Number of Users
common#:#edit_metadata#:#Edit Metadata
rbac#:#nwss_edit_permission#:#User can change permission settings in News and Web Feeds administration
rbac#:#nwss_read#:#User has read access to ews and Web Feeds administration
rbac#:#nwss_visible#:#News and Web Feeds administration is visible
Expand Down Expand Up @@ -10426,7 +10427,7 @@ trac#:#trac_lp_list_gui#:#Personal Desktop, Repository, Search
trac#:#trac_lp_list_gui_info#:#If activated, the learning progress status is included in objects lists.
common#:#hide_all_details#:#Hide all details
common#:#show_all_details#:#Show all details
common#:#select_files_from_computer#:#Select the files from your computer
common#:#select_files_from_computer#:#Select Files
common#:#drag_files_here#:#Drag-and-drop your files here
common#:#selected_files#:#Selected files
common#:#num_of_selected_files#:#%s file(s) selected
Expand Down
5 changes: 3 additions & 2 deletions libs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dependency Management in ILIAS

The are currently three type of external libraries:
- PHP dependencies installed using composer in /libs/composer, see [composer-readme](libs/composer/README.md).
- PHP dependencies installed using composer in /libs/composer, see [composer-readme](composer/README.md).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes can be ignored in this PR since the dependency-management using bower will be part of another PR

- PHP dependencies installad manually, located in some /Services/\*/libs and /Modules/\*/libs
- JS- and client-side Frameworks, currently also located in /Services\/* and /Modules\/*
- JS- and client-side Frameworks installed using bower, see [bower-readme](bower/README.md)
- JS- and client-side Frameworks installed manually, currently also located in /Services\/* and /Modules\/*
21 changes: 21 additions & 0 deletions libs/bower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# How to add dependencies with bower in ILIAS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes can be ignored in this PR since the dependency-management using bower will be part of another PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #603


**New dependencies need to be approved by the Jour Fixe of the ILIAS society.**

## Dependencies for production
- Comment all lines in libs/.gitignore which begin with bower/
- Add a new library using bower, e.g. "bower install [email protected] --save"
- Add a section in "extra" with the following metadata":
```json
"jquery": {
"introduction": "03.08.2017",
"introduced-by": "fschmid"
},
```
- Run "bower install --no-dev"
- Add all files to ILIAS git-repository and commit

## Dependencies for development
- Add a new library using bower, e.g. "bower install mocha --save-dev"
- Ignore all directories which are added by installation (uncomment existing)
- commit changes in gitignore and bower.json.
Loading