* adjust webapp.

This commit is contained in:
wangyidong
2013-02-25 05:59:11 +00:00
parent 9df65ddda0
commit b46581f4c1
11 changed files with 224 additions and 44 deletions
+2
View File
@@ -35,3 +35,5 @@ INSERT INTO `zt_groupPriv` (`company` , `group` , `module` , `method` ) VALUES
('1', '11', 'webapp', 'index');
UPDATE `zt_config` SET `company` = '0', `section` = 'global' WHERE `key` = 'flow';
ALTER TABLE `zt_webapp` ADD `abstract` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `author` ;
ALTER TABLE `zt_webApp` CHANGE `url` `url` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+19 -1
View File
@@ -120,6 +120,24 @@ class webapp extends control
$this->display();
}
/**
* View app.
*
* @param int $webappID
* @param string $type
* @access public
* @return void
*/
public function view($webappID, $type = 'local')
{
$this->view->title = $this->lang->webapp->common . $this->lang->colon . $this->lang->webapp->edit;
$this->view->modules = $this->loadModel('tree')->getOptionMenu(0, 'webapp');
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->webapp = $type == 'local' ? $this->webapp->getLocalAppByID($webappID) : $this->webapp->getAppInfoByAPI($webappID)->webapp;
$this->view->type = $type;
$this->display();
}
/**
* Install web app.
*
@@ -138,7 +156,7 @@ class webapp extends control
die(js::reload('parent'));
}
echo js::alert($this->lang->webapp->successInstall);
die(js::locate(inlink('index', "module={$this->post->module}"), 'parent.parent'));
die(js::reload('parent.parent'));
}
$this->view->title = $this->lang->webapp->common . $this->lang->colon . $this->lang->webapp->install;
+17 -9
View File
@@ -16,6 +16,8 @@ $lang->webapp->obtain = 'Obtain App';
$lang->webapp->install = 'Install';
$lang->webapp->uninstall = 'Remove';
$lang->webapp->useapp = 'Run';
$lang->webapp->view = 'View';
$lang->webapp->preview = 'Preview';
$lang->webapp->installed = 'Installed';
$lang->webapp->edit = 'Edit App';
$lang->webapp->create = 'Create App';
@@ -27,6 +29,7 @@ $lang->webapp->url = 'URL';
$lang->webapp->icon = 'Icon';
$lang->webapp->module = 'Category';
$lang->webapp->author = 'Author';
$lang->webapp->abstract = 'Abstract';
$lang->webapp->desc = 'Desc';
$lang->webapp->target = 'How';
$lang->webapp->size = 'Size';
@@ -36,6 +39,9 @@ $lang->webapp->updatedTime = 'Update Time';
$lang->webapp->downloads = 'Downloads';
$lang->webapp->grade = 'Grade';
$lang->webapp->addType = 'Add Type';
$lang->webapp->addedBy = 'Added By';
$lang->webapp->addedDate = 'Added date';
$lang->webapp->views = 'Views';
$lang->webapp->packup = 'Fold';
$lang->webapp->byDownloads = 'Most Downloads';
@@ -53,16 +59,18 @@ $lang->webapp->targetList['popup'] = 'Popup';
$lang->webapp->targetList['iframe'] = 'Iframe';
$lang->webapp->targetList['blank'] = 'New Window';
$lang->webapp->sizeList[''] = "";
$lang->webapp->sizeList['900x600'] = "900 x 600";
$lang->webapp->sizeList['700x600'] = "700 x 600";
$lang->webapp->sizeList['600x500'] = "600 x 500";
$lang->webapp->sizeList[''] = "";
$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->addTypeList['system'] = 'System App';
$lang->webapp->addTypeList['custom'] = 'Custom App';
$lang->webapp->errorOccurs = 'Error:';
$lang->webapp->errorGetModules = "Get extensions' categories data from the www.zentao.net failed. ";
$lang->webapp->errorGetExtensions = 'Get extensions from www.zentao.net failed. You can visit “<a href="' . inlink('create') . '">Create webapp</a>” to create it.';
$lang->webapp->successInstall = 'Success Install App.';
$lang->webapp->confirmDelete = 'Are you sure delete this app?';
$lang->webapp->errorOccurs = 'Error:';
$lang->webapp->errorGetModules = "Get extensions' categories data from the www.zentao.net failed. ";
$lang->webapp->errorGetExtensions = 'Get extensions from www.zentao.net failed. You can visit “<a href="' . inlink('create') . '">Create webapp</a>” to create it.';
$lang->webapp->successInstall = 'Success Install App.';
$lang->webapp->confirmDelete = 'Are you sure delete this app?';
$lang->webapp->noticeAbstract = 'Sentence describes the application, not more than 30 words';
+15 -7
View File
@@ -14,8 +14,10 @@ $lang->webapp->index = '已加应用';
$lang->webapp->obtain = '获得应用';
$lang->webapp->install = '安装应用';
$lang->webapp->uninstall = '移除';
$lang->webapp->useapp = '使用';
$lang->webapp->uninstall = '删除';
$lang->webapp->useapp = '运行';
$lang->webapp->view = '详情';
$lang->webapp->preview = '预览';
$lang->webapp->installed = '已添加';
$lang->webapp->edit = '编辑应用';
$lang->webapp->create = '创建应用';
@@ -27,7 +29,8 @@ $lang->webapp->url = '网址';
$lang->webapp->icon = '图标';
$lang->webapp->module = '分类';
$lang->webapp->author = '作者';
$lang->webapp->desc = '简介';
$lang->webapp->abstract = '简介';
$lang->webapp->desc = '描述';
$lang->webapp->target = '打开方式';
$lang->webapp->size = '大小';
$lang->webapp->height = '高度';
@@ -36,6 +39,9 @@ $lang->webapp->updatedTime = '更新时间';
$lang->webapp->downloads = '下载量';
$lang->webapp->grade = '评分';
$lang->webapp->addType = '添加类型';
$lang->webapp->addedBy = '安装人';
$lang->webapp->addedDate = '安装日期';
$lang->webapp->views = '浏览次数';
$lang->webapp->packup = '收起';
$lang->webapp->byDownloads = '最多下载';
@@ -53,10 +59,11 @@ $lang->webapp->targetList['popup'] = '弹窗';
$lang->webapp->targetList['iframe'] = '内嵌';
$lang->webapp->targetList['blank'] = '新窗口';
$lang->webapp->sizeList[''] = "";
$lang->webapp->sizeList['900x600'] = "900 x 600";
$lang->webapp->sizeList['700x600'] = "700 x 600";
$lang->webapp->sizeList['600x500'] = "600 x 500";
$lang->webapp->sizeList[''] = "";
$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->addTypeList['system'] = '系统应用';
$lang->webapp->addTypeList['custom'] = '自定义应用';
@@ -66,3 +73,4 @@ $lang->webapp->errorGetModules = '从www.zentao.net获得插件分类失败
$lang->webapp->errorGetExtensions = '从www.zentao.net获得插件失败。可能是因为网络方面的原因,你可以到 “<a href="' . inlink('create') . '">创建应用</a>” 中自行创建。';
$lang->webapp->successInstall = '成功安装应用!';
$lang->webapp->confirmDelete = '是否删除该应用?';
$lang->webapp->noticeAbstract = '用一句话介绍应用,不多于30个字';
+22 -2
View File
@@ -150,6 +150,21 @@ class webappModel extends model
return $data;
}
/**
* Add downloads of webapp by api.
*
* @param int $webappID
* @access public
* @return void
*/
public function addDownloadByAPI($webappID)
{
$apiURL = $this->apiRoot . "downloadApp-$webappID.json";
$data = $this->fetchAPI($apiURL);
return $data;
}
/**
* Get webapps by status.
*
@@ -204,7 +219,7 @@ class webappModel extends model
*/
public function install($webappID)
{
$data = $this->getAppInfoByAPI($webappID);
$data = $this->getAppInfoByAPI($webappID);
$webapp = $data->webapp;
$installWebapp->appid = $webapp->id;
@@ -215,12 +230,17 @@ class webappModel extends model
$installWebapp->icon = $webapp->icon ? $this->config->webapp->url . $webapp->icon : '';
$installWebapp->target = empty($webapp->target) ? 'blank' : $webapp->target;
$installWebapp->size = $webapp->size;
$installWebapp->abstract = $webapp->abstract;
$installWebapp->desc = $webapp->desc;
$installWebapp->addedBy = $this->app->user->account;
$installWebapp->addedDate = helper::now();
$this->dao->insert(TABLE_WEBAPP)->data($installWebapp)->autocheck()->exec();
return $this->dao->lastInsertID();
if(!dao::isError())
{
$this->addDownloadByAPI($webappID);
return $this->dao->lastInsertID();
}
}
/**
+11 -7
View File
@@ -15,31 +15,35 @@
<table class='table-5' align='center'>
<caption><?php echo $lang->webapp->create?></caption>
<tr>
<th><?php echo $lang->webapp->module?></th>
<th align='left'><?php echo $lang->webapp->module?></th>
<td><?php echo html::select('module', $modules, '', "class='select-3'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->name?></th>
<th align='left'><?php echo $lang->webapp->name?></th>
<td><?php echo html::input('name', '', "class='text-3'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->url?></th>
<th align='left'><?php echo $lang->webapp->url?></th>
<td><?php echo html::input('url', '', "class='text-3'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->target?></th>
<th align='left'><?php echo $lang->webapp->target?></th>
<td><?php echo html::select('target', $lang->webapp->targetList, '', "class='select-3'")?></td>
</tr>
<tr class="size hidden">
<th><?php echo $lang->webapp->size?></th>
<th align='left'><?php echo $lang->webapp->size?></th>
<td><?php echo html::select('size', $lang->webapp->sizeList, '', "class='select-3'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->desc?></th>
<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>
</tr>
<tr>
<th align='left'><?php echo $lang->webapp->desc?></th>
<td><?php echo html::textarea('desc', '', "class='area-1' rows='5'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->icon?></th>
<th align='left'><?php echo $lang->webapp->icon?></th>
<td><?php echo html::file('files', "class='text-1' size='57'")?></td>
</tr>
<tr><td colspan='2' align='center'><?php echo html::submitButton()?></td></tr>
+11 -7
View File
@@ -15,34 +15,38 @@
<table class='table-1'>
<caption><?php echo $lang->webapp->edit?></caption>
<tr>
<th><?php echo $lang->webapp->module?></th>
<th align='left'><?php echo $lang->webapp->module?></th>
<td><?php echo html::select('module', $modules, $webapp->module, "class='select-3'")?></td>
</tr>
<?php if($webapp->addType != 'system'):?>
<tr>
<th><?php echo $lang->webapp->name?></th>
<th align='left'><?php echo $lang->webapp->name?></th>
<td><?php echo html::input('name', $webapp->name, "class='text-3'")?></td>
</tr>
<tr>
<th><?php echo $lang->webapp->url?></th>
<th align='left'><?php echo $lang->webapp->url?></th>
<td><?php echo html::input('url', $webapp->url, "class='text-3'")?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->webapp->target?></th>
<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>
<tr class="size">
<th><?php echo $lang->webapp->size?></th>
<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>
<th><?php echo $lang->webapp->desc?></th>
<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>
</tr>
<tr>
<th align='left'><?php echo $lang->webapp->desc?></th>
<td><?php echo html::textarea('desc', $webapp->desc, "class='area-1' rows='5'")?></td>
</tr>
<?php if($webapp->addType == 'custom'):?>
<tr>
<th><?php echo $lang->webapp->icon?></th>
<th align='left'><?php echo $lang->webapp->icon?></th>
<td>
<?php
if($webapp->icon) echo "<p><img src='{$webapp->icon->webPath}' /></p>";
+7 -8
View File
@@ -16,15 +16,14 @@
<tr>
<td>
<ul id='webapps'>
<?php foreach($webapps as $webapp):?>
<?php foreach($webapps as $webapp):?>
<li>
<table class='fixed exttable' id='webapp<?php echo $webapp->id?>'>
<table class='exttable' id='webapp<?php echo $webapp->id?>'>
<tr>
<td rowspan='4' width='73' height='73' class='webapp-icon'><img src='<?php echo empty($webapp->icon) ? '/theme/default/images/main/webapp-default.png' : $webapp->icon?>' width='72' height='72' /></td>
<td class='webapp-name'><?php echo $webapp->name?></td>
<td rowspan='3' width='73' height='73' class='webapp-icon'><img src='<?php echo empty($webapp->icon) ? '/theme/default/images/main/webapp-default.png' : $webapp->icon?>' width='72' height='72' /></td>
<td class='webapp-name'><?php echo $webapp->name . "($webapp->author)"?></td>
</tr>
<tr><td class='webapp-info'><span title='<?php echo $webapp->desc?>'><?php echo empty($webapp->desc) ? '&nbsp;' : $webapp->desc?></span></td></tr>
<tr><td><?php echo $lang->webapp->addTypeList[$webapp->addType];?></td></tr>
<tr><td class='webapp-info'><?php echo empty($webapp->abstract) ? '&nbsp;' : $webapp->abstract?></td></tr>
<tr>
<td>
<?php
@@ -43,14 +42,14 @@
$popup = 'popup';
}
echo html::a($url, $lang->webapp->useapp, $target, "id='useapp$webapp->id' class='button-c $popup' onclick='addView($webapp->id);$method'");
common::printLink('webapp', 'edit', "webappID=$webapp->id", $lang->edit, '', "class='button-c webapp'");
common::printLink('webapp', 'view', "webappID=$webapp->id", $lang->webapp->view, '', "class='button-c webapp'");
common::printLink('webapp', 'uninstall', "webapp=$webapp->id", $lang->webapp->uninstall, 'hiddenwin', "class='button-c'");
?>
</td>
</tr>
</table>
</li>
<?php endforeach;?>
<?php endforeach;?>
</ul>
</td>
</tr>
+2 -2
View File
@@ -14,13 +14,13 @@
<form method='post' target='hiddenwin'>
<div class='box-title'><?php echo $lang->webapp->install?></div>
<div class='box-content'>
<p><span><?php echo $lang->webapp->selectModule?></span>
<p align='center' style='margin-top:10px;'><span><?php echo $lang->webapp->selectModule?></span>
<?php
echo html::select('module', $modules);
echo html::submitButton();
common::printLink('tree', 'browse', "rootID=0&view=webapp", $lang->tree->manage, '_parent');
?>
</p>
<p align='center'><?php echo html::submitButton()?></p>
<div>
</form>
<?php include '../../common/view/footer.lite.html.php';?>
+26 -1
View File
@@ -46,7 +46,32 @@
<td class='webapp-name'><?php echo $webapp->name?></td>
</tr>
<tr><td class='webapp-info'><span title='<?php echo $webapp->desc?>'><?php echo empty($webapp->desc) ? '&nbsp;' : $webapp->desc?></span></td></tr>
<tr><td><?php echo isset($installeds[$webapp->id]) ? html::commonButton($lang->webapp->installed, "disabled='disabled' style='color:gray'") : html::a(inLink('install', "webappID={$webapp->id}"), $lang->webapp->install, '_self', "class='button-c iframe'")?></td></tr>
<tr>
<td>
<?php
$url = $webapp->url;
$method = '';
$popup = '';
$target = '_self';
if($webapp->target == 'popup')
{
$width = 0;
$height = 0;
if($webapp->size) list($width, $height) = explode('x', $webapp->size);
$method = "popup($width, $height);";
$popup = 'popup';
}
else
{
$method = "popup(1024, 600);";
$popup = 'popup';
}
echo isset($installeds[$webapp->id]) ? html::commonButton($lang->webapp->installed, "disabled='disabled' style='color:gray'") : html::a(inLink('install', "webappID={$webapp->id}"), $lang->webapp->install, '_self', "class='button-c iframe'");
common::printLink('webapp', 'view', "webappID=$webapp->id&type=api", $lang->webapp->view, '', "class='button-c webapp'");
echo html::a($url, $lang->webapp->preview, '', "id='useapp$webapp->id' class='button-c $popup' onclick='$method'");
?>
</td>
</tr>
</table>
</li>
<?php endforeach;?>
+92
View File
@@ -0,0 +1,92 @@
<?php
/**
* The view view file of webapp module of ZenTaoPMS.
*
* @copyright Copyright 2009-2013 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package webapp
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<table class='table-1'>
<caption><?php echo $lang->webapp->view?></caption>
<tr>
<th class='a-right' width='60'><?php echo $lang->webapp->module?></th>
<td><?php echo $modules[$webapp->module]?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->name?></th>
<td><?php echo $webapp->name?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->url?></th>
<td><?php echo $webapp->url?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->author?></th>
<td><?php echo $webapp->author?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->target?></th>
<td><?php echo $lang->webapp->targetList[$webapp->target]?></td>
</tr>
<?php if($webapp->target == 'popup'):?>
<tr>
<th class='a-right'><?php echo $lang->webapp->size?></th>
<td><?php echo $lang->webapp->sizeList[$webapp->size]?></td>
</tr>
<?php endif;?>
<tr>
<th class='a-right'><?php echo $lang->webapp->abstract?></th>
<td><?php echo $webapp->abstract?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->desc?></th>
<td><?php echo $webapp->desc?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->icon?></th>
<td>
<?php
if($webapp->icon)
{
$url = $type == 'api' ? $this->config->webapp->url . $webapp->icon : ($webapp->addType == 'system' ? $webapp->icon : $webapp->icon->webPath);
echo "<p><img src='$url' /></p>";
}
?>
</td>
</tr>
<?php if($type == 'local'):?>
<tr>
<th class='a-right'><?php echo $lang->webapp->addType?></th>
<td><?php echo $lang->webapp->addTypeList[$webapp->addType]?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->addedBy?></th>
<td><?php echo $users[$webapp->addedBy]?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->webapp->addedDate?></th>
<td><?php echo $webapp->addedDate?></td>
</tr>
<?php endif;?>
<?php if($type == 'api'):?>
<tr>
<th class='a-right'><?php echo $lang->webapp->downloads?></th>
<td><?php echo $webapp->downloads?></td>
</tr>
<?php endif;?>
<tr>
<th class='a-right'><?php echo $lang->webapp->views?></th>
<td><?php echo $webapp->views?></td>
</tr>
<tr>
<th class='a-right'><?php echo $lang->actions?></th>
<td><?php common::printLink('webapp', 'edit', "webappID=$webapp->id", $lang->edit);?></td>
</tr>
</table>
<?php include '../../common/view/footer.lite.html.php';?>