Add favorite in module page

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9039 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
chschy 2011-09-06 02:24:15 +00:00
parent 183f0d6031
commit 5278bb135c
5 changed files with 36 additions and 6 deletions

View file

@ -342,7 +342,7 @@
if (!$output->data) return new Object(); if (!$output->data) return new Object();
$returnObject = new Object(); $returnObject = new Object();
$returnObject->add('favoriteList', $favoriteList); $returnObject->add('favoriteList', $output->data);
return $returnObject; return $returnObject;
} }

View file

@ -3,7 +3,6 @@
<customrules /> <customrules />
<fields> <fields>
<field name="site_srl" required="true" rule="number" /> <field name="site_srl" required="true" rule="number" />
<field name="module_name" required="true" /> <field name="module_name" required="true" />
<field name="key" required="true" />
</fields> </fields>
</ruleset> </ruleset>

View file

@ -27,7 +27,8 @@
**/ **/
function dispModuleAdminList() { function dispModuleAdminList() {
// Obtain a list of modules // Obtain a list of modules
$oModuleModel = &getModel('module'); $oAdminModel = &getAdminModel('admin');
$oModuleModel = &getModel('module');
$oAutoinstallModel = &getModel('autoinstall'); $oAutoinstallModel = &getModel('autoinstall');
$module_list = $oModuleModel->getModuleList(); $module_list = $oModuleModel->getModuleList();
@ -35,7 +36,17 @@
$val->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path); $val->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
} }
Context::set('module_list', $module_list); $output = $oAdminModel->getFavoriteList('0');
if($output->toBool()) debugPrint('ok');
$favoriteList = $output->variables['favoriteList'];
$favoriteModuleList = array();
foreach($favoriteList as $favorite => $favorite_info){
$favoriteModuleList[] = $favorite_info->module;
}
Context::set('favoriteModuleList', $favoriteModuleList);
Context::set('module_list', $module_list);
// Set a template file // Set a template file
$this->setTemplateFile('spInstalledModule'); $this->setTemplateFile('spInstalledModule');

View file

@ -3,7 +3,18 @@
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief module 모듈의 관리자용 javascript * @brief module 모듈의 관리자용 javascript
**/ **/
/* 모듈 즐겨찾기 */
function doToggleFavoriteModule(module_name) {
var params = new Array();
params['module_name'] = module_name;
params['site_srl'] = '0';
exec_xml('admin','procAdminToggleFavorite',params, completeToggleFavoriteModule);
}
function completeToggleFavoriteModule(ret_obj) {
location.reload();
}
/* 카테고리 관련 작업들 */ /* 카테고리 관련 작업들 */
function doUpdateCategory(module_category_srl, message) { function doUpdateCategory(module_category_srl, message) {
if(typeof(message)!='undefined'&&!confirm(message)) return; if(typeof(message)!='undefined'&&!confirm(message)) return;

View file

@ -1,3 +1,4 @@
<!--%import("js/module_admin.js")-->
<div class="content" id="content"> <div class="content" id="content">
<h1 class="h1">Installed Module</h1> <h1 class="h1">Installed Module</h1>
<div class="table even easyList"> <div class="table even easyList">
@ -7,16 +8,24 @@
</caption> </caption>
<thead> <thead>
<tr> <tr>
<th scope="col">즐겨찾기</th>
<th scope="col" class="title">{$lang->module_name}</th> <th scope="col" class="title">{$lang->module_name}</th>
<th scope="col">{$lang->version}</th> <th scope="col">{$lang->version}</th>
<th scope="col">{$lang->author}</th> <th scope="col">{$lang->author}</th>
<th scope="col">{$lang->path}</th> <th scope="col">{$lang->path}</th>
<th scope="col">{$lang->cmd_delete}</th> <th scope="col">{$lang->cmd_delete}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!--@foreach($module_list as $key => $val)--> <!--@foreach($module_list as $key => $val)-->
<tr> <tr>
<td>
<!--@if(in_array($val->module,$favoriteModuleList))-->
<a href="#" class="fvOn" onClick="doToggleFavoriteModule('{$val->module}')">즐겨찾기(켜짐)</a>
<!--@else-->
<a href="#" class="fvOff" onClick="doToggleFavoriteModule('{$val->module}')">즐겨찾기(꺼짐)</a>
<!--@end-->
</td>
<td class="title"> <td class="title">
<p><a href="{getUrl('','module','admin','act',$val->admin_index_act)}">{$val->title}</a></p> <p><a href="{getUrl('','module','admin','act',$val->admin_index_act)}">{$val->title}</a></p>
<p>{$val->description}</p> <p>{$val->description}</p>