* finish task #1313.

This commit is contained in:
wangyidong
2013-04-28 02:09:46 +00:00
parent 3a92b7fa4c
commit 76fdadde8e
7 changed files with 46 additions and 3 deletions

View File

@@ -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');
})

View File

@@ -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';

View File

@@ -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'] = '自定义应用';

View File

@@ -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')

View File

@@ -34,6 +34,10 @@
<th align='left'><?php echo $lang->webapp->size?></th>
<td><?php echo html::select('size', $lang->webapp->sizeList, '', "class='select-3'")?></td>
</tr>
<tr class="customSize hidden">
<th align='left'><?php echo $lang->webapp->custom?></th>
<td><?php echo html::input('customWidth', '', "class='w-40px'") . ' x ' . html::input('customHeight', '', "class='w-40px'");?></td>
</tr>
<tr>
<th align='left'><?php echo $lang->webapp->abstract?></th>
<td><?php echo html::input('abstract', '', "class='text-3' maxlength='30'")?> <span><?php echo $lang->webapp->noticeAbstract?></span></td>

View File

@@ -32,10 +32,24 @@
<th align='left'><?php echo $lang->webapp->target?></th>
<td><?php echo html::select('target', $lang->webapp->targetList, $webapp->target, "class='select-3'")?></td>
</tr>
<?php
$customWidth = '';
$customHeight = '';
if(!array_key_exists($webapp->size, $lang->webapp->sizeList))
{
$size = $webapp->size;
$webapp->size = 'custom';
if(strpos($size, 'x') !== false) list($customWidth, $customHeight) = explode('x', $size);
}
?>
<tr class="size">
<th align='left'><?php echo $lang->webapp->size?></th>
<td><?php echo html::select('size', $lang->webapp->sizeList, $webapp->size, "class='select-3'")?></td>
</tr>
<tr class="customSize <?php if($webapp->size != 'custom') echo 'hidden'?>">
<th align='left'><?php echo $lang->webapp->custom?></th>
<td><?php echo html::input('customWidth', $customWidth, "class='w-40px'") . ' x ' . html::input('customHeight', $customHeight, "class='w-40px'");?></td>
</tr>
<tr>
<th align='left'><?php echo $lang->webapp->abstract?></th>
<td><?php echo html::input('abstract', $webapp->abstract, "class='text-3' maxlength='30'")?> <span><?php echo $lang->webapp->noticeAbstract?></span></td>

View File

@@ -39,9 +39,21 @@
<td><?php echo $lang->webapp->targetList[$webapp->target]?></td>
</tr>
<?php if($webapp->target == 'popup'):?>
<?php
if(!array_key_exists($webapp->size, $lang->webapp->sizeList))
{
$size = $webapp->size;
$webapp->size = 'custom';
}
?>
<tr>
<th class='a-right'><?php echo $lang->webapp->size?></th>
<td><?php echo $lang->webapp->sizeList[$webapp->size]?></td>
<td>
<?php
echo $lang->webapp->sizeList[$webapp->size];
if(isset($size)) echo ' ' . $size;
?>
</td>
</tr>
<?php endif;?>
<tr>