* fix for bug

This commit is contained in:
wangyidong
2011-04-26 08:32:01 +00:00
parent 0fe6ca37d4
commit 18065ba29b
3 changed files with 19 additions and 30 deletions
+11 -1
View File
@@ -53,7 +53,17 @@ class tree extends control
if($viewType == 'story')
{
$this->product->setMenu($this->product->getPairs(), $rootID, 'story');
$this->view->allProduct = $this->product->getPairs();
$products = $this->product->getPairs();
$allProduct = array();
foreach($products as $key => $productVal)
{
if($key == $rootID) continue;
$allProduct[$key] = $productVal;
}
$this->view->allProduct =$allProduct;
$keys = array_keys($allProduct);
$this->view->key = $keys[0];
$this->view->productModules = $this->tree->getOptionMenu($keys[0], 'story');
$this->lang->tree->menu = $this->lang->product->menu;
$this->lang->set('menugroup.tree', 'product');
+3 -24
View File
@@ -14,33 +14,12 @@ function syncModule(rootID)
})
});
$.each(modules, function(key, value)
{
if(value) $('#sonModule').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
function syncProductModule(rootID)
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$.each(modules, function(key, value)
{
moduleName = value;
$('.text-3').each(function()
{
if(this.value == moduleName) modules[key] = null;
if(!this.value) $(this).parent().addClass('hidden');
})
});
$('#sonModule').empty();
$.each(modules, function(key, value)
{
{
if(value) $('#sonModule').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
function syncProduct(obj)
{
link = createLink('tree', 'ajaxGetModules', 'rootID=' + obj.value);
@@ -53,7 +32,7 @@ function syncProduct(obj)
$('#productModule').append('<option value=' + key + '>' + value + '</option')
});
})
$('#copyModule').attr('onclick', 'syncProductModule('+obj.value+')');
$('#copyModule').attr('onclick', 'syncModule('+obj.value+')');
}
$(document).ready(function()
{
+5 -5
View File
@@ -59,22 +59,22 @@
}
else if($viewType == 'story')
{
echo html::select('allProduct', $allProduct, $rootID, 'class=select-3 onchange=syncProduct(this)');
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'id=copyModule onclick=syncProductModule('.$rootID.')');
echo html::select('allProduct', $allProduct, 'onchange=syncProduct(this)');
echo html::select('productModule', $productModules, '');
echo html::commonButton($lang->tree->syncFromProduct, 'id=copyModule onclick=syncModule('.$key.')');
echo '<br />';
echo '<br />';
echo '<br />';
}
$maxOrder = 0;
echo '<div id=sonModule>';
echo '<div id="sonModule">';
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
?>
?>
</div>
</td>
</tr>