Hi you all.
I've developed a small module that adds to the Storm suite, reusing some features in a new fashion. I've done it for my own site but maybe someone could find it useful or an inspiring example of how to easily extend Storm.
That module assumes that we are going to use one of own (site owner) projects as "Help Desk" and the different tasks defined inside it as the "Help Desk Areas".
The module adds a block on the storm at the bottom of the admin page and among the different Projects from the organization selected as the owner of the site list all the projects and allows to select one as the "Help Desk" area. Then it creates two new menus, one displaying all the tasks inside that only project (for the support team, they will see here all the new tickets for support) and a link to the node/add/stormticket. Users allowed to enter those tickets won't see the Organization and Project popups in order that they only will be able to select the different tasks inside the "HelpDesk" project as the different support areas.
It's been made for drupal 5 storm, but I think that only the menu arrays should be changed for drupal 6 storm. Some details could be polished as the permissions but with that present length does what is supposed to do :-)
Here the code for the stormsupportarea.module:
<?php
// $Id: stormsupportarea.module,v 1.0 2008/11/02 08:00:00 jorditr Exp $
function stormsupportarea_help($path) {
$o = '';
switch ($path) {
case "admin/help#stormproject":
$o = '<p>'. t("Allows to select one of the projects assigned to the organization that owns this system as the one for the support area for customers. All the tasks on that area will be the different sub-areas for support. It is selected from the Storm admin page.") .'</p>';
break;
}
return $o;
}
function stormsupportarea_perm() {
return array(
'Storm Support Area: access suport area',
'Storm Support Area: customer add ticket', // neither organization nor project fields on node-add
);
}
function stormsupportarea_menu($may_cache) {
$items = array();
if (!$may_cache) { }
$items[] = array(
'path' => 'support',
'title' => t(variable_get('storm_support_area_name', 'Help Desk')),
'description' => t('Support Area for customers'),
'callback' => 'stormsupportarea_goto_support_page',
'callback arguments' => variable_get('storm_support_area_nid', 0),
'access' => user_access('Storm project: access suport area'),
'type' => MENU_NORMAL_ITEM
);
$items[] = array(
'path' => 'add-ticket',
'title' => t('Add Ticket'),
'description' => t('Add a ticket for asking for support.'),
'callback' => 'stormsupportarea_add_support_ticket',
'callback arguments' => variable_get('storm_support_area_nid', 0),
'access' => user_access('Storm project: access suport area'),
'type' => MENU_NORMAL_ITEM
);
return $items;
}
function stormsupportarea_add_support_ticket($project) {
$path = drupal_urlencode('node/add/stormticket/destination=storm/tickets&project_nid='.$project);
drupal_goto($path);
}
function stormsupportarea_goto_support_page($project) {
$path = 'storm/tickets/?project_nid=' . $project;
drupal_goto($path);
}
function stormsupportarea_form_alter($form_id, &$form) {
switch ($form_id) {
case 'storm_admin_settings':
$org = variable_get('storm_organization_nid', 0);
$sql = "SELECT n.nid, n.title
FROM {node} AS n
INNER JOIN {stormproject} AS pr ON pr.nid=n.nid
WHERE n.status=1 AND pr.organization_nid = %d
ORDER BY n.title";
$result = db_query(db_rewrite_sql($sql), $org);
$projects = array();
while ($project = db_fetch_object($result)) {
$projects[$project->nid] = $project->title;
}
$form['storm_support_area'] = array(
'#type' => 'fieldset',
'#title' => t('Support Area'),
'#collapsed' => false,
'#collapsible' => true,
'#description' => t('Allows to select one of the projects assigned to the organization that owns this system as the one for the support area for customers. All the tasks on that area will be the different sub-areas for support.'),
'#weight' => -4,
);
$form['storm_support_area']['storm_support_area_nid'] = array(
'#type' => 'select',
'#title' => t('Project selected for Support Area'),
'#options' => $projects,
'#default_value' => variable_get('storm_support_area_nid', 0),
'#description' => t('Select the project asigned to be the Support Area of your site. All the tasks on that area will be the different sub-areas for support.'),
'#weight' => -8,
);
$form['storm_support_area']['storm_support_area_name'] = array(
'#type' => 'textfield',
'#title' => t('Support Area Name'),
'#default_value' => variable_get('storm_support_area_name', 'Help Desk'),
'#description' => t('Here you can customize the general name for your support area, basically appearing on the menu to acces it.'),
'#size' => -6,
);
case 'stormticket_node_form':
if (!user_access('Storm Support Area: customer add ticket')) {
$form['group1']['organization_nid']['#type'] = 'hidden';
$form['group1']['project_nid']['#type'] = 'hidden';
$form['group1']['task_nid']['#title'] = t('Question related with');
$form['group1']['task_nid']['#weight'] = -50;
}
}
}
?>
And the code for the stormsupportarea.info:
; $Id: stormsupportarea.info,v 1.0 2008/11/02 08:00:00 jorditr Exp $
name = Storm Support Area
description = "SpeedTech Organizer and Resource Manager - Support Area based on one Project and Tickets"
dependencies = storm stormproject stormticket
package = Storm
Comments
Comment #1
jorditr commentedSorry, I've rechecked the module and it does not work properly. I was wrong with my testing environment and I published too early. I've realized it requires to pass certain session parameters.
Comment #2
Magnity commentedDevelopment has stopped on the 5.x branch (see #410784: Looking for a new maintainer), so I am marking this as "Won't Fix".
If the issue also affects the 6.x branch please reopen under that category.