* fix for task #404

This commit is contained in:
wangyidong
2011-04-12 02:39:16 +00:00
parent 5ee2a83d57
commit 5adb86b96d
3 changed files with 40 additions and 2 deletions
+16
View File
@@ -53,6 +53,7 @@ class tree extends control
if($viewType == 'story')
{
$this->product->setMenu($this->product->getPairs(), $rootID, 'story');
$this->view->allProduct = $this->product->getPairs();
$this->lang->tree->menu = $this->lang->product->menu;
$this->lang->set('menugroup.tree', 'product');
@@ -200,6 +201,8 @@ class tree extends control
*/
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $rootModuleID = 0)
{
$this->view->productModules = $this->tree->getOptionMenu($rootID, 'story');
$optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID);
die( html::select("module", $optionMenu, '', 'onchange=setAssignedTo()'));
}
@@ -223,4 +226,17 @@ class tree extends control
foreach($modules as $key => $name) $modules[$key] = str_replace(" "," ","$name");
die(json_encode($modules));
}
/**
* AJAX: get modules.
*
* @param int $moduleID
* @param int $rootID
* @access public
* @return string json_encoded modules.
*/
public function ajaxGetModules($rootID = 0, $type='story')
{
$modules = $this->tree->getOptionMenu($rootID, 'story');
die(json_encode($modules));
}
}
+15 -1
View File
@@ -1,4 +1,4 @@
function syncModule()
function syncModule(rootID)
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
$.getJSON(link, function(modules)
@@ -19,6 +19,20 @@ function syncModule()
})
})
}
function syncProduct(obj)
{
link = createLink('tree', 'ajaxGetModules', 'rootID=' + obj.value);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$('#productModule').empty();
$.each(modules, function(key, value)
{
$('#productModule').append('<option value=' + key + '>' + value + '</option')
});
})
$('#copyModule').attr('onclick', 'syncModule('+obj.value+')');
}
$(document).ready(function()
{
$("a.iframe").colorbox({width:480, height:240, iframe:true, transition:'none'});
+9 -1
View File
@@ -54,7 +54,15 @@
if($viewType != 'story' and strpos($viewType, 'doc') === false)
{
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule()');
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule('.$rootID.')');
echo '<br />';
}
else if($viewType == 'story')
{
echo html::select('allProduct', $allProduct, $rootID, 'class=select-3 onchange=syncProduct(this)');
echo '<br>';
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'id=copyModule onclick=syncModule('.$rootID.')');
echo '<br />';
}
$maxOrder = 0;