From: Luca P. <lpa...@us...> - 2004-04-11 15:34:14
|
Update of /cvsroot/planeshift/planeshift/www/serverconsole/kas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31845/kas Added Files: ka_actions.php listkas.php viewka.php viewkaLeftFrame.php Log Message: new serverconsole by orogor --- NEW FILE: ka_actions.php --- <? function ka_actions(){ ?> <HTML> <BODY> <?PHP // gets operation to perform $operation = $_GET['operation']; /** * delete a synonym */ if ($operation == 'deleteka'){ $ka = $_POST['ka']; // delete all responses $query = "select response_id from npc_triggers where area='$ka'"; $result = mysql_query2($query); while ($line = mysql_fetch_array($result, MYSQL_NUM)){ $query2 = "delete from npc_responses where id=$line[0]"; $result2 = mysql_query2($query2); } // delete all triggers $query = "delete from npc_triggers where area='$ka'"; $result = mysql_query2($query); // redirect ?><SCRIPT language="javascript"> document.location = "index.php?page=listkas"; </script> <?PHP /** * add a ka */ }else if ($operation == 'createka'){ $ka = $_POST['ka']; // get last response id $newrespid = getNextId("npc_responses", "id"); // get trigger id $newtriggerid = getNextId("npc_triggers", "id"); // insert trigger $query = "insert into npc_triggers values($newtriggerid,'newka $ka', $newrespid, 0, -100, 100, '$ka',0)"; $result = mysql_query2($query); // insert response $query = "insert into npc_responses values($newrespid,'newka $ka', '','','','','','','','','',0)"; $result = mysql_query2($query); // redirect ?><SCRIPT language="javascript"> document.location = "index.php?page=listkas"; </script> <?PHP }else{ // manage another operation here echo "Operation $operation not supported."; } ?> </body> </html> <? } ?> --- NEW FILE: listkas.php --- <? function listkas(){ ?> <SCRIPT language=javascript> function confirmDelete() { return confirm("Are you sure you want to delete this KA?"); } </SCRIPT> <?PHP include './npcs/npc_common.php'; $result = getKAs(); echo ' <TABLE BORDER=1>'; echo ' <TH> KA </TH> <TH> Functions</TH>'; for ($i = 0; $i < sizeof($result); $i++){ echo "<TR><TD><A HREF=index.php?page=viewka&area=$result[$i]>$result[$i] </A> </TD>"; echo "<TD><FORM ACTION=index.php?page=ka_actions&operation=deleteka METHOD=POST onsubmit=\"return confirmDelete()\">"; echo "<INPUT TYPE=hidden NAME=ka VALUE=\"$result[$i]\">"; echo "<INPUT TYPE=SUBMIT NAME=submit VALUE=Delete>"; echo '</FORM></TD></TR>'; } echo '</TABLE><br><br>'; echo "<FORM ACTION=index.php?page=ka_actions&operation=createka METHOD=POST>"; echo "Create a New KA with name: <INPUT TYPE=text NAME=ka>"; echo " <INPUT TYPE=SUBMIT NAME=submit VALUE=Create>"; echo '</FORM>'; echo '<br><br>'; } ?> --- NEW FILE: viewka.php --- <? function viewka(){ ?> <html> <head> <title>View/Edit Knowledge Area</title> <script> function op() { //This function is used with folders that do not open pages themselves. See online docs. } </script> </head> <!-- (Please keep all copyright notices.) This frameset document includes the Treeview script. Script found in: http://www.treeview.net Author: Marcelino Alves Martins You may make other changes, see online instructions, but do not change the names of the frames (treeframe and basefrm) --> <FRAMESET cols="30%,*" onResize="if (navigator.family == 'nn4') window.location.reload()"> <FRAME src="index.php?page=viewkaLeftFrame&area=<?PHP $area = $_GET['area']; echo "$area"; ?>" name="treeframe" > <FRAME SRC="index.php?page=npc_actions&operation=viewka&type=ka&area=<?PHP $area = $_GET['area']; echo "$area"; ?>" name="basefrm"> </FRAMESET> <? } ?> --- NEW FILE: viewkaLeftFrame.php --- <? function viewkaLeftFrame(){ ?> <!-- (Please keep all copyright notices.) This page document includes the Treeview script. Script found at: http://www.treeview.net Author: Marcelino Alves Martins --> <html> <head> <title>View Knowledge Area</title> <link rel="stylesheet" href="../newstyles.css" type="text/css"> <!-- As in a client-side built tree, all the tree infrastructure is put in place within the HEAD block, but the actual tree rendering is trigered within the BODY --> <!-- Code for browser detection --> <script src="ua.js"></script> <!-- Infrastructure code for the tree --> <script src="ftiens4.js"></script> <!-- Execution of the code that actually builds the specific tree. The variable foldersTree creates its structure with calls to gFld, insFld, and insDoc --> <script> USETEXTLINKS = 1 STARTALLOPEN = 0 PERSERVESTATE = 1 ICONPATH = 'images/' <?PHP include './npcs/npc_common.php'; $area = $_GET['area']; // output knowledge folder echo "foldersTree = gFld(\"<b>KA: $area</b>\", \"index.php?page=npc_actions&operation=viewka&type=ka&area=$area\");\n"; // start printing the triggers from triggers with prior=0 printTrigger("foldersTree", $area, 0, 2, 1, "ka"); ?> </script> </head> <body topmargin=16 marginheight=16 > <!-- By removing the follwoing code you are violating your user agreement. Corporate users or any others that want to remove the link should check the online FAQ for instructions on how to obtain a version without the link --> <!-- Removing this link will make the script stop from working --> <div style="position:absolute; top:0; left:0; "><table border=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank>JavaScript Tree Menu</a></font></td></tr></table></div> <!-- Build the browser's objects and display default view of the tree. --> <script> initializeDocument() </script> <noscript> A tree for site navigation will open here if you enable JavaScript in your browser. </noscript> <div valign='bottom'><p><A HREF=index.php target='_top'>Back to Server Console Index </A></p></div> </body> </html> <? } ?> |