diff --git a/module/webapp/js/common.js b/module/webapp/js/common.js index 7bf0dc2daa..8848b425fa 100644 --- a/module/webapp/js/common.js +++ b/module/webapp/js/common.js @@ -44,9 +44,16 @@ function addView(webappID) $.get(createLink('webapp', 'ajaxAddView', 'webappID=' + webappID)); } +function customSize(value) +{ + $('.customSize').hide(); + if(value == 'custom') $('.customSize').show(); +} + $(function(){ setSize($('#target').val()); $('#target').change(function(){setSize($(this).val())}); + $('#size').change(function(){customSize($(this).val())}); $('#modulemenu ul li').removeClass('active'); if(typeof(module) != "undefined") $('#modulemenu ul li #submenu' + module).parent().addClass('active'); }) diff --git a/module/webapp/lang/en.php b/module/webapp/lang/en.php index 75090c1020..9c8e5d494e 100644 --- a/module/webapp/lang/en.php +++ b/module/webapp/lang/en.php @@ -43,6 +43,7 @@ $lang->webapp->addedBy = 'Added By'; $lang->webapp->addedDate = 'Added date'; $lang->webapp->views = 'Views'; $lang->webapp->packup = 'Fold'; +$lang->webapp->custom = 'Custom'; $lang->webapp->byDownloads = 'Most Downloads'; $lang->webapp->byAddedTime = 'New Add'; @@ -64,6 +65,7 @@ $lang->webapp->sizeList['1024x600'] = "1024 x 600"; $lang->webapp->sizeList['900x600'] = "900 x 600"; $lang->webapp->sizeList['700x600'] = "700 x 600"; $lang->webapp->sizeList['600x500'] = "600 x 500"; +$lang->webapp->sizeList['custom'] = "Custom size"; $lang->webapp->addTypeList['system'] = 'System App'; $lang->webapp->addTypeList['custom'] = 'Custom App'; diff --git a/module/webapp/lang/zh-cn.php b/module/webapp/lang/zh-cn.php index 3dda2eaaa3..6a94f35de8 100644 --- a/module/webapp/lang/zh-cn.php +++ b/module/webapp/lang/zh-cn.php @@ -43,6 +43,7 @@ $lang->webapp->addedBy = '安装人'; $lang->webapp->addedDate = '安装日期'; $lang->webapp->views = '使用次数'; $lang->webapp->packup = '收起'; +$lang->webapp->custom = '自定义'; $lang->webapp->byDownloads = '最多下载'; $lang->webapp->byAddedTime = '最新添加'; @@ -64,6 +65,7 @@ $lang->webapp->sizeList['1024x600'] = "1024 x 600"; $lang->webapp->sizeList['900x600'] = "900 x 600"; $lang->webapp->sizeList['700x600'] = "700 x 600"; $lang->webapp->sizeList['600x500'] = "600 x 500"; +$lang->webapp->sizeList['custom'] = "自定义尺寸"; $lang->webapp->addTypeList['system'] = '系统应用'; $lang->webapp->addTypeList['custom'] = '自定义应用'; diff --git a/module/webapp/model.php b/module/webapp/model.php index 66318adc16..09d086b5f9 100644 --- a/module/webapp/model.php +++ b/module/webapp/model.php @@ -253,7 +253,8 @@ class webappModel extends model public function update($webappID) { $webapp = $this->getLocalAppByID($webappID); - $data = fixer::input('post')->remove('files')->get(); + $data = fixer::input('post')->remove('files,customWidth,customHeight')->get(); + if($data->size == 'custom') $data->size = $this->post->customWidth . 'x' . $this->post->customHeight; $this->dao->update(TABLE_WEBAPP)->data($data)->where('id')->eq($webappID)->check('url', 'unique', "id != $webappID", false)->exec(); @@ -288,7 +289,8 @@ class webappModel extends model ->add('addType', 'custom') ->add('addedDate', helper::now()) ->add('author', $this->app->user->account) - ->remove('files')->get(); + ->remove('files,customWidth,customHeight')->get(); + if($data->size == 'custom') $data->size = $this->post->customWidth . 'x' . $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 d14921ab04..e24b2257e3 100644 --- a/module/webapp/view/create.html.php +++ b/module/webapp/view/create.html.php @@ -34,6 +34,10 @@