projects
/
timetracker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
48ba99d
)
Refactoring in UploadFile.class.php to simplify things.
author
Nik Okuntseff
<support@anuko.com>
Tue, 16 Apr 2019 16:59:17 +0000
(16:59 +0000)
committer
Nik Okuntseff
<support@anuko.com>
Tue, 16 Apr 2019 16:59:17 +0000
(16:59 +0000)
WEB-INF/lib/form/Form.class.php
patch
|
blob
|
history
WEB-INF/lib/form/UploadFile.class.php
patch
|
blob
|
history
WEB-INF/templates/footer.tpl
patch
|
blob
|
history
project_files.php
patch
|
blob
|
history
time_files.php
patch
|
blob
|
history
diff --git
a/WEB-INF/lib/form/Form.class.php
b/WEB-INF/lib/form/Form.class.php
index
19dd011
..
1f77414
100644
(file)
--- a/
WEB-INF/lib/form/Form.class.php
+++ b/
WEB-INF/lib/form/Form.class.php
@@
-95,6
+95,12
@@
class Form {
$el = new Submit($params['name']);
break;
$el = new Submit($params['name']);
break;
+ case 'upload':
+ import('form.UploadFile');
+ $el = new UploadFile($params['name']);
+ if (isset($params['maxsize'])) $el->setMaxSize($params['maxsize']);
+ break;
+
// TODO: refactoring ongoing down from here.
case "checkboxgroup":
import('form.CheckboxGroup');
// TODO: refactoring ongoing down from here.
case "checkboxgroup":
import('form.CheckboxGroup');
@@
-129,12
+135,6
@@
class Form {
$el->setData(@$params["data"]);
$el->setWidth(@$params["width"]);
break;
$el->setData(@$params["data"]);
$el->setWidth(@$params["width"]);
break;
-
- case "upload":
- import('form.UploadFile');
- $el = new UploadFile($params["name"]);
- if (isset($params["maxsize"])) $el->setMaxSize($params["maxsize"]);
- break;
}
if ($el!=null) {
$el->setFormName($this->name);
}
if ($el!=null) {
$el->setFormName($this->name);
diff --git
a/WEB-INF/lib/form/UploadFile.class.php
b/WEB-INF/lib/form/UploadFile.class.php
index
e46f29d
..
50e8aad
100644
(file)
--- a/
WEB-INF/lib/form/UploadFile.class.php
+++ b/
WEB-INF/lib/form/UploadFile.class.php
@@
-29,7
+29,8
@@
import('form.FormElement');
class UploadFile extends FormElement {
import('form.FormElement');
class UploadFile extends FormElement {
- var $mMaxSize = 100000; // 100kb // TODO: refactor this.
+
+ var $maxSize = 8388608; // 8MB default max size.
function __construct($name)
{
function __construct($name)
{
@@
-37,21
+38,14
@@
class UploadFile extends FormElement {
$this->name = $name;
}
$this->name = $name;
}
-// TODO: refactoring ongoing down from here.
- function setMaxSize($value) { $this->mMaxSize = $value; }
- function getMaxSize() { return $this->mMaxSize; }
-
- function getHtml() {
+ function setMaxSize($value) { $this->maxSize = $value; }
- if ($this->id=="") $this->id = $this->name;
-
- $html = "\n\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$this->mMaxSize."\"/>";
- $html .= "\n\t<input";
- $html .= " name=\"$this->name\" id=\"$this->id\"";
-
- $html .= " type=\"file\"";
- $html .= ">";
+ function getHtml() {
- return $html;
- }
+ if ($this->id == '') $this->id = $this->name;
+
+ $html = "\n\t<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$this->maxSize\">";
+ $html .= "\n\t<input type=\"file\" id=\"$this->id\" name=\"$this->name\">";
+ return $html;
+ }
}
}
diff --git
a/WEB-INF/templates/footer.tpl
b/WEB-INF/templates/footer.tpl
index
f584e2d
..
0cd9a3d
100644
(file)
--- a/
WEB-INF/templates/footer.tpl
+++ b/
WEB-INF/templates/footer.tpl
@@
-12,7
+12,7
@@
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.65.494
8
| Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.65.494
9
| Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
diff --git
a/project_files.php
b/project_files.php
index
9ca15e3
..
6ffe123
100644
(file)
--- a/
project_files.php
+++ b/
project_files.php
@@
-57,8
+57,7
@@
$files = $fileHelper::getEntityFiles($cl_project_id, 'project');
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id));
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_project_id));
-$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit'),'maxsize'=>67108864)); // 64 MB file upload limit.
-// Note: for the above limit to work make sure to set upload_max_filesize and post_max_size in php.ini to at least 64M.
+$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit')));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.add')));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.add')));
diff --git
a/time_files.php
b/time_files.php
index
c499b25
..
33273da
100644
(file)
--- a/
time_files.php
+++ b/
time_files.php
@@
-57,8
+57,7
@@
$files = $fileHelper::getEntityFiles($cl_id, 'time');
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
$form = new Form('fileUploadForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
-$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit'),'maxsize'=>67108864)); // 64 MB file upload limit.
-// Note: for the above limit to work make sure to set upload_max_filesize and post_max_size in php.ini to at least 64M.
+$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit')));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.add')));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.add')));