Private GIT

Skip to content
Snippets Groups Projects
Commit 52c98411 authored by Cedrick Facon's avatar Cedrick Facon
Browse files

ajout d'un javascript pour plier/deplier la topology

git-svn-id: http://svn.centreon.com/oreon-dev@2755 6bcd3966-0018-0410-8128-fd23d134de7e
parent 52df2406
No related branches found
No related tags found
No related merge requests found
......@@ -278,6 +278,7 @@ For information : contact@oreon-project.org
print "DB Error : ".$DBRESULT->getDebugInfo()."<br>";
$ret = array();
$ret = $form->getSubmitValue("lca_topos");
if (is_array($ret))
$ret = array_keys($ret);
for($i = 0; $i < count($ret); $i++) {
......
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
{$form.javascript}
<form {$form.attributes}>
<div>
......@@ -47,10 +48,57 @@
</div>
<div id='tab3' class="tab">
<table id="ListTable">
<tr class="ListHeader"><td class="FormHeader" colspan="2"><img src='./img/icones/16x16/application_lock.gif'>&nbsp;&nbsp;{$form.header.title}</td></tr>
<tr class="list_lvl_1"><td class="ListColLvl1_name" colspan="2"><img src='./img/icones/16x16/window_application_delete.gif'>&nbsp;&nbsp;{$form.header.pages}</td></tr>
<tr class="list_one"><td class="FormRowField">{$form.lca_topos.label}</td><td class="FormRowValue">&nbsp;&nbsp;{$form.lca_topos.html}</td></tr>
<tr class="ListHeader"><td class="FormHeader" ><img src='./img/icones/16x16/application_lock.gif'>&nbsp;&nbsp;{$form.header.title}</td></tr>
<tr class="list_lvl_1"><td class="ListColLvl1_name" ><img src='./img/icones/16x16/window_application_delete.gif'>&nbsp;&nbsp;{$form.header.pages}</td></tr>
<tr >
<td>
<ul class="arbo_a">
{foreach key=key item=a from=$lca_topos2}
<li >
<img src="img/icones/16x16/arrow_right_blue.gif" onclick="toggleDisplay('{$a.c_id}');">
<input id="i{$a.c_id}" name="lca_topos[{$a.id}]" type="checkbox" {if $a.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$a.c_id}');" /><label for="{$a.id}">{$a.name}</label>
<ul class="arbo_b" id="{$a.c_id}">
{foreach key=key item=b from=$a.childs}
<li>
<img src="img/icones/16x16/arrow_right_blue.gif" onclick="toggleDisplay('{$b.c_id}');">
<input id="i{$b.c_id}" name="lca_topos[{$b.id}]" type="checkbox" {if $b.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$b.c_id}');" /><label for="{$b.id}">{$b.name}</label>
<ul class="arbo_c" id="{$b.c_id}">
{foreach key=key item=c from=$b.childs}
<li>
<img src="img/icones/16x16/arrow_right_blue.gif" onclick="toggleDisplay('{$c.c_id}');">
<input id="i{$c.c_id}" name="lca_topos[{$c.id}]" type="checkbox" {if $c.checked == "true"}checked="checked"{/if} value="1" onclick="toggleCheckAll(this, 'i{$c.c_id}');" /><label for="{$c.id}">{$c.name}</label>
<ul class="arbo_d" id="{$c.c_id}">
{foreach key=key item=d from=$c.childs}
<li>
<input id="i{$d.c_id}" name="lca_topos[{$d.id}]" type="checkbox" {if $c.checked == "true"}checked="checked"{/if} value="1" /><label for="{$d.id}">{$d.name}</label>
</li>
{/foreach}
</ul>
</li>
{/foreach}
</ul>
</li>
{/foreach}
</ul>
</li>
{/foreach}
</ul>
</td></tr>
</table>
</div>
<div id="validForm">
{if $o == "a" || $o == "c"}
......
......@@ -52,6 +52,10 @@ For information : contact@oreon-project.org
$lca["lca_topos"][$topo["topology_topology_id"]] = 1;
$DBRESULT->free();
}
if(!isset($lca["lca_topos"]))
$lca["lca_topos"] = array();
# Init LCA
$lca_data = getLCAHostByID($pearDB);
......@@ -191,24 +195,79 @@ For information : contact@oreon-project.org
$DBRESULT1 =& $pearDB->query($rq);
#
$lca_topos = array();
$lca_topos2 = array();
$a = 0;
while ($DBRESULT1->fetchInto($topo1)) {
$lca_topos2[$a] = array();
$lca_topos2[$a]["name"] = array_key_exists($topo1["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo1["topology_name"]] : "&nbsp;&nbsp;#UNDEF#";
$lca_topos2[$a]["id"] = $topo1["topology_id"];
$lca_topos2[$a]["checked"] = array_key_exists($topo1["topology_id"],$lca["lca_topos"]) ? "true" : "false";
$lca_topos2[$a]["c_id"] = $a;
$lca_topos2[$a]["childs"] = array();
/*old*/
$lca_topos[] = &HTML_QuickForm::createElement('checkbox', $topo1["topology_id"], null, array_key_exists($topo1["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo1["topology_name"]]."<br>" : "&nbsp;&nbsp;#UNDEF#"."<br>", array("style"=>"margin-top: 5px;", "id"=>$topo1["topology_id"]));
$rq = "SELECT topology_id, topology_page, topology_name, topology_parent FROM topology WHERE topology_parent = '".$topo1["topology_page"]."' AND topology_page IN (".$oreon->user->lcaTStr.") ORDER BY topology_order";
$DBRESULT2 =& $pearDB->query($rq);
/*old*/
$b = 0;
while ($DBRESULT2->fetchInto($topo2)) {
$lca_topos2[$a]["childs"][$b] = array();
$lca_topos2[$a]["childs"][$b]["name"] = array_key_exists($topo2["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo2["topology_name"]] : "&nbsp;&nbsp;#UNDEF#";
$lca_topos2[$a]["childs"][$b]["id"] = $topo2["topology_id"];
$lca_topos2[$a]["childs"][$b]["checked"] = array_key_exists($topo2["topology_id"],$lca["lca_topos"]) ? "true" : "false";
$lca_topos2[$a]["childs"][$b]["c_id"] = $a."_".$b;
$lca_topos2[$a]["childs"][$b]["childs"] = array();
/*old*/
$lca_topos[] = &HTML_QuickForm::createElement('checkbox', $topo2["topology_id"], NULL, array_key_exists($topo2["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo2["topology_name"]]."<br>" : "&nbsp;&nbsp;#UNDEF#"."<br>", array("style"=>"margin-top: 5px; margin-left: 20px;"));
$rq = "SELECT topology_id, topology_name, topology_parent, topology_page FROM topology WHERE topology_parent = '".$topo2["topology_page"]."' AND topology_page IN (".$oreon->user->lcaTStr.") ORDER BY topology_order";
$DBRESULT3 =& $pearDB->query($rq);
/*old*/
$c = 0;
while ($DBRESULT3->fetchInto($topo3)){
$lca_topos2[$a]["childs"][$b]["childs"][$c] = array();
$lca_topos2[$a]["childs"][$b]["childs"][$c]["name"] = array_key_exists($topo3["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo3["topology_name"]] : "&nbsp;&nbsp;#UNDEF#";
$lca_topos2[$a]["childs"][$b]["childs"][$c]["id"] = $topo3["topology_id"];
$lca_topos2[$a]["childs"][$b]["childs"][$c]["checked"] = array_key_exists($topo3["topology_id"],$lca["lca_topos"]) ? "true" : "false";
$lca_topos2[$a]["childs"][$b]["childs"][$c]["c_id"] = $a."_".$b."_".$c;
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"] = array();
/*old*/
$lca_topos[] = &HTML_QuickForm::createElement('checkbox', $topo3["topology_id"], null, array_key_exists($topo3["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo3["topology_name"]]."<br>" : "&nbsp;&nbsp;#UNDEF#"."<br>", array("style"=>"margin-top: 5px; margin-left: 40px;"));
$rq = "SELECT topology_id, topology_name, topology_parent FROM topology WHERE topology_parent = '".$topo3["topology_page"]."' AND topology_page IN (".$oreon->user->lcaTStr.") ORDER BY topology_order";
$DBRESULT4 =& $pearDB->query($rq);
while ($DBRESULT4->fetchInto($topo4))
$lca_topos[] = &HTML_QuickForm::createElement('checkbox', $topo4["topology_id"], null, array_key_exists($topo4["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo4["topology_name"]]."<br>" : "&nbsp;&nbsp;#UNDEF#"."<br>", array("style"=>"margin-top: 5px; margin-left: 55px;"));
/*old*/
$d = 0;
while ($DBRESULT4->fetchInto($topo4)){
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d] = array();
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["name"] = array_key_exists($topo4["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo4["topology_name"]] : "&nbsp;&nbsp;#UNDEF#";
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["id"] = $topo4["topology_id"];
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["checked"] = array_key_exists( $topo4["topology_id"],$lca["lca_topos"]) ? "true" : "false";
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["c_id"] = $a."_".$b."_".$c."_".$d;
$lca_topos2[$a]["childs"][$b]["childs"][$c]["childs"][$d]["childs"] = array();
/*old*/
$lca_topos[] = &HTML_QuickForm::createElement('checkbox', $topo4["topology_id"], null, array_key_exists($topo4["topology_name"], $lang) ? "&nbsp;&nbsp;".$lang[$topo4["topology_name"]]."<br>" : "&nbsp;&nbsp;#UNDEF#"."<br>", array("style"=>"margin-top: 5px; margin-left: 55px;"));
/*old*/
$d++;
}
$c++;
}
$b++;
}
$a++;
}
if ($o == "a") {
function one($v) {
$v->setValue(1);
......@@ -224,6 +283,7 @@ For information : contact@oreon-project.org
$form->addGroup($tab, 'action', $lang["action"], '&nbsp;');
$form->setDefaults(array('action'=>'1'));
$form->addElement('hidden', 'lca_id');
$redirect =& $form->addElement('hidden', 'o');
$redirect->setValue($o);
......@@ -264,6 +324,9 @@ For information : contact@oreon-project.org
}
$tpl->assign('msg', array ("changeL"=>"?p=".$p."&o=c&lca_id=".$lca_id, "changeT"=>$lang['modify']));
$tpl->assign("lca_topos2", $lca_topos2);
$tpl->assign("sort1", $lang['lca_infos']);
$tpl->assign("sort2", $lang['lca_sortRes']);
$tpl->assign("sort3", $lang['lca_sortTopo']);
......@@ -293,4 +356,10 @@ For information : contact@oreon-project.org
$tpl->assign('o', $o);
$tpl->display("formLCA.ihtml");
}
/*
echo "<pre>";
print_r($lca_topos2);
echo "</pre>";
*/
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment