saved.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:6k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: saved.php,v $
- // | $Date: 2004/02/10 01:34:30 $
- // | $Revision: 1.14 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Saved tickets management.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('tickets');
- // default do
- $_REQUEST['do'] = trim($_REQUEST['do']);
- if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
- $_REQUEST['do'] = "view";
- }
- // globalise variables
- $global = array (
- array('id') // ticketid
- );
- rg($global);
- $result = $db->query_return("SELECT categories FROM tech_folders WHERE type = 'savedtickets' AND techid = '$user[id]'");
- $categories = unserialize($result['categories']);
- $cat_jump[0] = 'Top Category';
- if (is_array($categories)) {
- foreach ($categories AS $key => $var) {
- $cat_jump[$key] = $var;
- }
- }
- if ($_REQUEST['go'] == 'Go') {
- $_REQUEST['do'] = 'view';
- }
- ############################### ADD A BOOKMARK (2) ###############################
- if ($_REQUEST['do'] == "add2") {
- $message = xss_check($_REQUEST['message'], 'tech');
- $db->query("INSERT INTO tech_ticket_save SET
- techid = '$user[id]',
- ticketid = '$_REQUEST[ticketid]',
- category = '$_REQUEST[category]',
- message = '" . mysql_escape_string($message) . "'
- ");
- alert('Saved ticket added');
- $_REQUEST['do'] = 'view';
- }
- ############################### ADD ENTRY ###############################
- if ($_REQUEST['do'] == "add") {
- $table[] = array('<b>Ticket ID</b>', $_REQUEST['ticketid']);
- $table[] = array('<b>Category</b>', form_select($i, $cat_jump, 'category'));
- $table[] = array('<b>Note</b>', form_textarea('message', 100, 15));
-
- table_header('Add To Saved Tickets', 'saved.php', array('do' => 'add2', 'ticketid' => $_REQUEST['ticketid']));
- table_content('', $table);
- table_footer('Add Bookmarks');
- }
- ############################### BOOKMARKS ACTIONS ###############################
- if ($_REQUEST['do'] == "doactions") {
- if (is_array($_REQUEST['ids'])) {
- foreach ($_REQUEST['ids'] AS $key => $var) {
- if ($var = 1) {
- $id_array[] = $key;
- }
- }
- }
- if (is_array($id_array)) {
- if ($_REQUEST['actiontype'] == 'delete') {
- $db->query("DELETE FROM tech_ticket_save
- WHERE techid = '$user[id]'
- AND id IN " . array2sql($id_array) . "
- ");
- } elseif ($_REQUEST['actiontype'] == 'move') {
- $db->query("UPDATE tech_ticket_save
- SET category = '$_REQUEST[B]'
- WHERE techid = '$user[id]'
- AND id IN " . array2sql($id_array) . "
- ");
- }
- }
- $_REQUEST['do'] = 'view';
- }
- ############################### VIEW BOOKMARKS ###############################
- if ($_REQUEST['do'] == "view") {
- foreach($cat_jump AS $key => $var) {
- $js .= ""$var","$key",";
- }
- $js = substr($js, 0, -1);
- echo get_javascript('DynamicOptionList.js');
- echo "
- <SCRIPT LANGUAGE="JavaScript">
- var listB = new DynamicOptionList("B","actiontype");
- listB.addOptions("move",$js);
- listB.setDefaultOption("move","0");
- function init() {
- var theform = document.forms[0];
- listB.init(theform);
- }
- </SCRIPT>
- ";
- $form =
- "<select name="actiontype" onChange="listB.populate();">
- <option value="delete">Delete</option>
- <option value="move">Move</option>
- </select>
-
- <select name="B" id="B">
- <script language="JavaScript">listB.printOptions()</script>
- </select>
-
- <input type="submit" name="Process" value="Process">
- <script language="JavaScript">
- init()
- </script>
- ";
- $db->query("SELECT tech_ticket_save.ticketid, tech_ticket_save.id, tech_ticket_save.message, ticket.subject
- FROM tech_ticket_save
- LEFT JOIN ticket ON (ticket.id = tech_ticket_save.ticketid)
- WHERE tech_ticket_save.techid = '$user[id]'
- AND tech_ticket_save.category = '$_REQUEST[category]'
- ");
- while ($result = $db->row_array()) {
- $table[] = array(
- "<center>" . form_checkbox_single($result['id'], 1, '', 'ids') . "</center>",
- "<a href="ticketview.php?id=$result[ticketid]">$result[ticketid]</a>",
- $result['subject'],
- $result['message']
- );
- }
- $toprow = "<p align="right"><b>Category Jump:</b> " . form_select('category', $cat_jump, '', $_REQUEST['category']) . " <input type="submit" name="go" value="Go">";
- $width = array('5', '10%', '30%', '60%');
- $cols = array("<center><input type="checkbox" name="allbox" onclick="checkall(this.form);" /></center>", 'Ticket ID', 'Subject', 'Comments');
- table_header('Your Saved Tickets', 'saved.php', array('do' => 'doactions'), '', 'dpform');
- table_content($cols, $table, '', '', $toprow, '', $width);
- table_footer('', 'Left', $form);
- echo "<br /><br /><center><a href="./../resources/folders.php?type=savedtickets"><b>Edit Folders</b></a></center>";
- }
- tech_footer();
- ?>