From 7e63678faadefb806b67aeb30d849e2a4182f4fe Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 2 May 2013 09:00:19 +0000 Subject: [PATCH] * code for custom size in webapp. --- module/webapp/js/common.js | 7 ++++++- module/webapp/model.php | 4 ++-- module/webapp/view/create.html.php | 2 +- module/webapp/view/edit.html.php | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/module/webapp/js/common.js b/module/webapp/js/common.js index 8848b425fa..75c009218d 100644 --- a/module/webapp/js/common.js +++ b/module/webapp/js/common.js @@ -36,7 +36,12 @@ function toggleShowapp(webappID, webappName) function setSize(target) { $('.size').hide(); - if(target == 'popup') $('.size').show(); + $('.customSize').hide(); + if(target == 'popup') + { + $('.size').show(); + customSize($('#size').val()); + } } function addView(webappID) diff --git a/module/webapp/model.php b/module/webapp/model.php index 09d086b5f9..7bfd7d9eae 100644 --- a/module/webapp/model.php +++ b/module/webapp/model.php @@ -254,7 +254,7 @@ class webappModel extends model { $webapp = $this->getLocalAppByID($webappID); $data = fixer::input('post')->remove('files,customWidth,customHeight')->get(); - if($data->size == 'custom') $data->size = $this->post->customWidth . 'x' . $this->post->customHeight; + if($data->size == 'custom') $data->size = (float)$this->post->customWidth . 'x' . (float)$this->post->customHeight; $this->dao->update(TABLE_WEBAPP)->data($data)->where('id')->eq($webappID)->check('url', 'unique', "id != $webappID", false)->exec(); @@ -290,7 +290,7 @@ class webappModel extends model ->add('addedDate', helper::now()) ->add('author', $this->app->user->account) ->remove('files,customWidth,customHeight')->get(); - if($data->size == 'custom') $data->size = $this->post->customWidth . 'x' . $this->post->customHeight; + if($data->size == 'custom') $data->size = (float)$this->post->customWidth . 'x' . (float)$this->post->customHeight; $this->dao->insert(TABLE_WEBAPP)->data($data) ->autocheck() ->batchCheck($this->config->webapp->create->requiredFields, 'notempty') diff --git a/module/webapp/view/create.html.php b/module/webapp/view/create.html.php index e24b2257e3..5dcfc72714 100644 --- a/module/webapp/view/create.html.php +++ b/module/webapp/view/create.html.php @@ -36,7 +36,7 @@ webapp->custom?> - + webapp->abstract?> diff --git a/module/webapp/view/edit.html.php b/module/webapp/view/edit.html.php index 4be6e2c5ad..6fc4a9626e 100644 --- a/module/webapp/view/edit.html.php +++ b/module/webapp/view/edit.html.php @@ -48,7 +48,7 @@ webapp->custom?> - + webapp->abstract?>