Skip to content

Commit aa17242

Browse files
committed
Added ISPConfig help module and a the first parts of a basic trouble ticket system.
1 parent 0108768 commit aa17242

13 files changed

+482
-0
lines changed

install/sql/ispconfig3.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,27 @@ CREATE TABLE `spamfilter_wblist` (
590590
--
591591

592592

593+
-- --------------------------------------------------------
594+
595+
--
596+
-- Tabellenstruktur für Tabelle `support_message`
597+
--
598+
599+
CREATE TABLE `support_message` (
600+
`support_message_id` bigint(20) NOT NULL auto_increment,
601+
`sys_userid` int(11) NOT NULL default '0',
602+
`sys_groupid` int(11) NOT NULL default '0',
603+
`sys_perm_user` varchar(5) default NULL,
604+
`sys_perm_group` varchar(5) default NULL,
605+
`sys_perm_other` varchar(5) default NULL,
606+
`recipient_id` int(11) NOT NULL default '0',
607+
`sender_id` int(11) NOT NULL default '0',
608+
`subject` varchar(255) default NULL,
609+
`message` varchar(255) default NULL,
610+
`tstamp` int(11) NOT NULL default '1187707778',
611+
PRIMARY KEY (`support_message_id`)
612+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
613+
593614
-- --------------------------------------------------------
594615

595616
--
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?php
2+
3+
//* Title of the form
4+
$form["title"] = "Support Message";
5+
6+
//* Description of the form (optional)
7+
$form["description"] = "";
8+
9+
//* Name of the form. The name shall not contain spaces or foreign characters
10+
$form["name"] = "support_message";
11+
12+
//* The file that is used to call the form in the browser
13+
$form["action"] = "support_message_edit.php";
14+
15+
//* The name of the database table that shall be used to store the data
16+
$form["db_table"] = "support_message";
17+
18+
//* The name of the database table index field, this field must be a numeric auto increment column
19+
$form["db_table_idx"] = "support_message_id";
20+
21+
//* Shall changes to this table be stored in the database history (sys_datalog) table.
22+
//* This should be set to "yes" for all tables that store configuration information.
23+
$form["db_history"] = "no"; // yes / no
24+
25+
//* The name of the tab that is shown when the form is opened
26+
$form["tab_default"] = "message";
27+
28+
//* The name of the default list file of this form
29+
$form["list_default"] = "support_message_list.php";
30+
31+
//* Use the internal authentication system for this table. This should
32+
//* be set to yes in most cases
33+
$form["auth"] = 'yes'; // yes / no
34+
35+
//* Authentocation presets. The defaults below does not need to be changed in most cases.
36+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
37+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
38+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
39+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
40+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
41+
42+
43+
//* Begin of the form definition of the first tab. The name of the tab is called "message". We refer
44+
//* to this name in the $form["tab_default"] setting above.
45+
$form["tabs"]['message'] = array (
46+
'title' => "Message", // Title of the Tab
47+
'width' => 100, // Tab width
48+
'template' => "templates/support_message_edit.htm", // Template file name
49+
'fields' => array (
50+
##################################
51+
# Begin Datatable fields
52+
##################################
53+
'recipient_id' => array (
54+
'datatype' => 'INTEGER',
55+
'formtype' => 'SELECT',
56+
'default' => '',
57+
'datasource' => array ( 'type' => 'SQL',
58+
'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
59+
'keyfield' => 'userid',
60+
'valuefield' => 'username'
61+
),
62+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
63+
'errmsg'=> 'recipient_id_is_not_integer'),
64+
),
65+
'value' => ''
66+
),
67+
'sender_id' => array (
68+
'datatype' => 'INTEGER',
69+
'formtype' => 'SELECT',
70+
'default' => '',
71+
'datasource' => array ( 'type' => 'SQL',
72+
'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
73+
'keyfield' => 'userid',
74+
'valuefield' => 'username'
75+
),
76+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
77+
'errmsg'=> 'recipient_id_is_not_integer'),
78+
),
79+
'value' => ''
80+
),
81+
'subject' => array (
82+
'datatype' => 'VARCHAR',
83+
'formtype' => 'TEXT',
84+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
85+
'errmsg'=> 'subject_is_empty'),
86+
),
87+
'default' => '',
88+
'value' => '',
89+
'width' => '30',
90+
'maxlength' => '255'
91+
),
92+
'message' => array (
93+
'datatype' => 'VARCHAR',
94+
'formtype' => 'TEXTAREA',
95+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
96+
'errmsg'=> 'message_is_empty'),
97+
),
98+
'default' => '',
99+
'value' => '',
100+
'cols' => '30',
101+
'rows' => '10',
102+
'maxlength' => '255'
103+
),
104+
'tstamp' => array (
105+
'datatype' => 'INTEGER',
106+
'formtype' => 'TEXT',
107+
'default' => time(),
108+
'value' => '',
109+
'width' => '30',
110+
'maxlength' => '30'
111+
),
112+
##################################
113+
# ENDE Datatable fields
114+
##################################
115+
)
116+
);
117+
118+
119+
120+
?>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
/*
4+
The admin.conf.php file contains menu definitions to be displayed in the administration modile.
5+
*/
6+
7+
8+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["recipient_id_txt"] = 'recipient_id';
3+
$wb["sender_id_txt"] = 'sender_id';
4+
$wb["subject_txt"] = 'subject';
5+
$wb["message_txt"] = 'message';
6+
$wb["tstamp_txt"] = 'tstamp';
7+
$wb["btn_save_txt"] = 'Save';
8+
$wb["btn_cancel_txt"] = 'Cancel';
9+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["list_head_txt"] = 'support_message';
3+
$wb["sender_id_txt"] = 'sender_id';
4+
$wb["subject_txt"] = 'subject';
5+
$wb["page_txt"] = 'Page';
6+
$wb["page_of_txt"] = 'of';
7+
$wb["page_next_txt"] = 'Next';
8+
$wb["page_back_txt"] = 'Back';
9+
$wb["delete_txt"] = 'Delete';
10+
$wb["filter_txt"] = 'Filter';
11+
?>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
//* Name of the module. The module name must match the name of the module directory. The module name may not contain spaces.
4+
$module["name"] = "help";
5+
6+
//* Title of the module. The title is dispalayed in the top navigation.
7+
$module["title"] = "Help";
8+
9+
//* The template file of the module. This is always module.tpl.htm if you do not have any special requirements like a 3 column layout.
10+
$module["template"] = "module.tpl.htm";
11+
12+
//* The page that is displayed when the module is loaded. the path must is relative to the web directory
13+
$module["startpage"] = "help/index.php";
14+
15+
//* The width of the tab. Normally you should leave this empty and let the browser define the width automatically.
16+
$module["tab_width"] = '';
17+
18+
/*
19+
------------------------------------------
20+
- Menu Definition
21+
------------------------------------------
22+
*/
23+
24+
//* make sure that the items array is empty
25+
$items = array();
26+
27+
//* Add a menu item with the label "Send message"
28+
$items[] = array( 'title' => 'Send message',
29+
'target' => 'content',
30+
'link' => 'help/support_message_edit.php');
31+
32+
//* Add a menu item with the label "View messages"
33+
$items[] = array( 'title' => 'View messages',
34+
'target' => 'content',
35+
'link' => 'help/support_message_list.php');
36+
37+
38+
//* Add the menu items defined above to a menu section labeled 'Support'
39+
$module["nav"][] = array( 'title' => 'Support',
40+
'open' => 1,
41+
'items' => $items);
42+
43+
?>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
//* Name of the list
4+
$liste["name"] = "support_message";
5+
6+
//* Database table
7+
$liste["table"] = "support_message";
8+
9+
//* Index index field of the database table
10+
$liste["table_idx"] = "support_message_id";
11+
12+
//* Search Field Prefix
13+
$liste["search_prefix"] = "search_";
14+
15+
//* Records per page
16+
$liste["records_per_page"] = 15;
17+
18+
//* Script File of the list
19+
$liste["file"] = "support_message_list.php";
20+
21+
//* Script file of the edit form
22+
$liste["edit_file"] = "support_message_edit.php";
23+
24+
//* Script File of the delete script
25+
$liste["delete_file"] = "support_message_del.php";
26+
27+
//* Paging Template
28+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
29+
30+
//* Enable auth
31+
$liste["auth"] = "yes";
32+
33+
34+
/*****************************************************
35+
* Search fields
36+
*****************************************************/
37+
38+
$liste["item"][] = array( 'field' => "sender_id",
39+
'datatype' => "VARCHAR",
40+
'formtype' => "SELECT",
41+
'op' => "=",
42+
'prefix' => "",
43+
'suffix' => "",
44+
'width' => "",
45+
'datasource'=> array ( 'type' => 'SQL',
46+
'querystring' => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
47+
'keyfield' => 'userid',
48+
'valuefield' => 'username'
49+
),
50+
'value' => "");
51+
52+
$liste["item"][] = array( 'field' => "subject",
53+
'datatype' => "VARCHAR",
54+
'formtype' => "TEXT",
55+
'op' => "like",
56+
'prefix' => "%",
57+
'suffix' => "%",
58+
'width' => "",
59+
'value' => "");
60+
61+
62+
?>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of ISPConfig nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
32+
33+
//* From and List definition files
34+
$list_def_file = "list/support_message.list.php";
35+
$tform_def_file = "form/support_message.tform.php";
36+
37+
//* Include the base libraries
38+
require_once('../../lib/config.inc.php');
39+
require_once('../../lib/app.inc.php');
40+
41+
// Check module permissions
42+
if(!stristr($_SESSION["s"]["user"]["modules"],'help')) {
43+
header("Location: ../index.php");
44+
exit;
45+
}
46+
47+
//* Load the form
48+
$app->uses("tform_actions");
49+
$app->tform_actions->onDelete();
50+
51+
?>

0 commit comments

Comments
 (0)