- */
- public function render(MultipleFileUpload $upload)
- {
- $template = $this->createTemplate(dirname(__FILE__) . "/html.latte");
- $template->swfuId = $upload->getHtmlId() . "-swfuBox";
- return $template->__toString(TRUE);
- }
-
-
- /**
- * Renders JavaScript body of function.
- */
- public function renderInitJavaScript(MultipleFileUpload $upload)
- {
- $tpl = $this->createTemplate(dirname(__FILE__) . "/initJS.latte");
- $tpl->sizeLimit = ini_get('upload_max_filesize') . 'B';
- $tpl->token = $upload->getToken();
- $tpl->maxFiles = $upload->maxFiles;
- $tpl->backLink = (string) $upload->form->action;
- $tpl->swfuId = $upload->getHtmlId() . "-swfuBox";
- $tpl->simUploadFiles = $upload->simUploadThreads;
- return $tpl->__toString(TRUE);
- }
-
-
- /**
- * Renders JavaScript body of function.
- */
- public function renderDestructJavaScript(MultipleFileUpload $upload)
- {
- return $this->createTemplate(dirname(__FILE__) . "/destructJS.js")->__toString(TRUE);
- }
-
-
- /**
- * Renders set-up tags to attribute
- */
- public function renderHeadSection()
- {
- return $this->createTemplate(dirname(__FILE__) . "/head.latte")->__toString(TRUE);
- }
-
-
+httpRequest->getPost('sender') === "MFU-Swfupload";
+ }
+
+
+ /**
+ * Handles uploaded files
+ * forwards it to model
+ */
+ public function handleUploads()
+ {
+ $token = $this->httpRequest->getPost('token');
+ if (!$token) {
+ return;
+ }
+
+ /* @var $file FileUpload */
+ foreach ($this->httpRequest->getFiles() AS $file) {
+ self::processFile($token, $file);
+ }
+
+ // Response to client
+ echo "1";
+
+ // End the script
+ exit;
+ }
+
+
+ /**
+ * Renders interface to
+ */
+ public function render(MultipleFileUpload $upload)
+ {
+ $template = $this->createTemplate(dirname(__FILE__) . "/html.latte");
+ $template->swfuId = $upload->getHtmlId() . "-swfuBox";
+ return $template->__toString(TRUE);
+ }
+
+
+ /**
+ * Renders JavaScript body of function.
+ */
+ public function renderInitJavaScript(MultipleFileUpload $upload)
+ {
+ $template = $this->createTemplate(dirname(__FILE__) . "/initJS.latte");
+ $template->sizeLimit = ini_get('upload_max_filesize') . 'B';
+ $template->token = $upload->getToken();
+ $template->maxFiles = $upload->maxFiles;
+ $template->backLink = (string) $upload->form->action;
+ $template->swfuId = $upload->getHtmlId() . "-swfuBox";
+ $template->simUploadFiles = $upload->simUploadThreads;
+ $template->flash_url = $this->httpRequest->url->baseUrl . '/swf/swfupload.swf';
+ $template->flash9_url = $this->httpRequest->url->baseUrl . '/swf/swfupload_fp9.swf';
+ $template->button_image_url = $this->httpRequest->url->baseUrl . 'imgs/XPButtonUploadText_89x88.png';
+ return $template->__toString(TRUE);
+ }
+
+
+ /**
+ * Renders JavaScript body of function.
+ */
+ public function renderDestructJavaScript(MultipleFileUpload $upload)
+ {
+ return $this->createTemplate(dirname(__FILE__) . "/destructJS.js")->__toString(TRUE);
+ }
+
+
+ /**
+ * Renders set-up tags to attribute
+ */
+ public function renderHeadSection()
+ {
+ return $this->createTemplate(dirname(__FILE__) . "/head.latte")->__toString(TRUE);
+ }
+
+
}
\ No newline at end of file
diff --git a/MultipleFileUpload/UI/Swfupload/initJS.latte b/MultipleFileUpload/UI/Swfupload/initJS.latte
index dd3d1f4..eb48263 100644
--- a/MultipleFileUpload/UI/Swfupload/initJS.latte
+++ b/MultipleFileUpload/UI/Swfupload/initJS.latte
@@ -1,34 +1,34 @@
-
\ No newline at end of file
diff --git a/MultipleFileUpload/UI/Uploadify/Controller.php b/MultipleFileUpload/UI/Uploadify/Controller.php
index 95ca628..2d50fdf 100644
--- a/MultipleFileUpload/UI/Uploadify/Controller.php
+++ b/MultipleFileUpload/UI/Uploadify/Controller.php
@@ -68,7 +68,8 @@ public function handleUploads()
*/
public function render(MultipleFileUpload $upload)
{
- $template = $this->createTemplate(dirname(__FILE__) . "/html.latte");
+ $template = parent::createTemplate();
+ $template->setFile(__DIR__ . "/html.latte");
$template->uploadifyId = $upload->getHtmlId() . "-uploadifyBox";
return $template->__toString(TRUE);
}
@@ -79,14 +80,15 @@ public function render(MultipleFileUpload $upload)
*/
public function renderInitJavaScript(MultipleFileUpload $upload)
{
- $tpl = $this->createTemplate(dirname(__FILE__) . "/initJS.latte");
- $tpl->sizeLimit = $upload->maxFileSize;
- $tpl->token = $upload->getToken();
- $tpl->maxFiles = $upload->maxFiles;
- $tpl->backLink = (string) $upload->form->action;
- $tpl->uploadifyId = $upload->getHtmlId() . "-uploadifyBox";
- $tpl->simUploadFiles = $upload->simUploadThreads;
- return $tpl->__toString(TRUE);
+ $template = parent::createTemplate();
+ $template->setFile(__DIR__ . "/initJS.latte");
+ $template->sizeLimit = $upload->maxFileSize;
+ $template->token = $upload->getToken();
+ $template->maxFiles = $upload->maxFiles;
+ $template->backLink = (string) $upload->form->action;
+ $template->uploadifyId = $upload->getHtmlId() . "-uploadifyBox";
+ $template->simUploadFiles = $upload->simUploadThreads;
+ return $template->__toString(TRUE);
}
@@ -95,7 +97,8 @@ public function renderInitJavaScript(MultipleFileUpload $upload)
*/
public function renderDestructJavaScript(MultipleFileUpload $upload)
{
- return $this->createTemplate(dirname(__FILE__) . "/destructJS.js")->__toString(TRUE);
+ $template = parent::createTemplate();
+ return $template->setFile(__DIR__ . "/destructJS.js")->__toString(TRUE);
}
@@ -104,7 +107,8 @@ public function renderDestructJavaScript(MultipleFileUpload $upload)
*/
public function renderHeadSection()
{
- return $this->createTemplate(dirname(__FILE__) . "/head.latte")->__toString(TRUE);
+ $template = parent::createTemplate();
+ $template->setFile(__DIR__ . "/head.latte")->__toString(TRUE);
}
diff --git a/MultipleFileUpload/config.neon b/MultipleFileUpload/config.neon
new file mode 100644
index 0000000..6a71320
--- /dev/null
+++ b/MultipleFileUpload/config.neon
@@ -0,0 +1,4 @@
+services:
+ - MultipleFileUpload\UI\Registrator(%productionMode%,)
+ - MultipleFileUpload\UI\HTML4SingleUpload\Controller
+ - MultipleFileUpload\UI\Plupload\Controller
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 93cc56a..955e424 100644
--- a/composer.json
+++ b/composer.json
@@ -22,7 +22,7 @@
}
},
"require": {
- "php": ">= 5.3.0",
- "nette/nette": ">= 2.0"
+ "php": ">= 5.6.0",
+ "nette/nette": "~2.4"
}
}