Now all modules are in core modules folder
This commit is contained in:
parent
5ba1cdfa0b
commit
05b6a91b0c
1907 changed files with 0 additions and 0 deletions
429
modules/storm/stormproject/stormproject.admin.inc
Normal file
429
modules/storm/stormproject/stormproject.admin.inc
Normal file
|
@ -0,0 +1,429 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
function stormproject_list() {
|
||||
$breadcrumb = array();
|
||||
$breadcrumb[] = l(t('SuiteDesk'), 'dashboard');
|
||||
drupal_set_breadcrumb($breadcrumb);
|
||||
|
||||
if (array_key_exists('organization_nid', $_GET)) {
|
||||
if ($_SESSION['stormproject_list_filter']['organization_nid'] != $_GET['organization_nid']) {
|
||||
$_SESSION['stormproject_list_filter']['organization_nid'] = $_GET['organization_nid'];
|
||||
}
|
||||
}
|
||||
|
||||
$i = new stdClass();
|
||||
$i->type = 'stormproject';
|
||||
|
||||
$header = array(
|
||||
array(
|
||||
'data' => ' ',
|
||||
),
|
||||
array(
|
||||
'data' => t(' '),
|
||||
'field' => 'spr.projectstatus',
|
||||
),
|
||||
array(
|
||||
'data' => t('Title') . ' / ' . t('Organization') . ' » ' . t('Project manager'),
|
||||
'field' => 'n.title',
|
||||
),
|
||||
array(
|
||||
'data' => t('Created'),
|
||||
'field' => 'n.created',
|
||||
'class' => 'storm_list_date',
|
||||
),
|
||||
array(
|
||||
'data' => t('Updated'),
|
||||
'field' => 'n.changed',
|
||||
'class' => 'storm_list_date',
|
||||
'sort' => 'desc',
|
||||
),
|
||||
array(
|
||||
'data' => t('Rev.'),
|
||||
'field' => 'spr.version',
|
||||
'class' => 'storm_list_version',
|
||||
),
|
||||
array(
|
||||
'data' => t('Pr.'),
|
||||
'field' => 'spr.projectpriority',
|
||||
),
|
||||
array(
|
||||
'data' => storm_icon_add_node($i, $_GET),
|
||||
'class' => 'storm_list_operations',
|
||||
),
|
||||
);
|
||||
|
||||
$s = "SELECT n.*, spr.*, nre.format FROM {node} AS n
|
||||
INNER JOIN {stormproject} AS spr ON n.vid=spr.vid
|
||||
INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
|
||||
WHERE n.status=1 AND n.type='stormproject'";
|
||||
|
||||
$where = array();
|
||||
$args = array();
|
||||
$filterfields = array();
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['organization_nid']) && ($_SESSION['stormproject_list_filter']['organization_nid'] != 0)) {
|
||||
$where[] = 'spr.organization_nid=%d';
|
||||
$args[] = $_SESSION['stormproject_list_filter']['organization_nid'];
|
||||
$filterfields[] = t('Organization');
|
||||
}
|
||||
|
||||
$category_list = storm_attributes_bydomain('project category search');
|
||||
$projectcategory = isset($_SESSION['stormproject_list_filter']['projectcategory']) ? $_SESSION['stormproject_list_filter']['projectcategory'] : $category_list['default'];
|
||||
$_SESSION['stormproject_list_filter']['projectcategory'] = $projectcategory;
|
||||
|
||||
if ($projectcategory != '-') {
|
||||
$where[] = "spr.projectcategory='%s'";
|
||||
$args[] = $projectcategory;
|
||||
$filterfields[] = t('Category');
|
||||
}
|
||||
|
||||
$status_list = storm_attributes_bydomain('project status search');
|
||||
$projectstatus = isset($_SESSION['stormproject_list_filter']['projectstatus']) ? $_SESSION['stormproject_list_filter']['projectstatus'] : $status_list['default'];
|
||||
$_SESSION['stormproject_list_filter']['projectstatus'] = $projectstatus;
|
||||
|
||||
if ($projectstatus != '-') {
|
||||
$status = split(',', $projectstatus);
|
||||
$v = array();
|
||||
foreach ($status as $item) $v[] = '%s';
|
||||
$where[] = "spr.projectstatus IN ('". implode("','", $v) ."')";
|
||||
foreach ($status as $key => $value) {
|
||||
$args[] = $value;
|
||||
}
|
||||
$filterfields[] = t('Status');
|
||||
}
|
||||
|
||||
$priority_list = storm_attributes_bydomain('project priority search');
|
||||
$projectpriority = isset($_SESSION['stormproject_list_filter']['projectpriority']) ? $_SESSION['stormproject_list_filter']['projectpriority'] : $priority_list['default'];
|
||||
$_SESSION['stormproject_list_filter']['projectpriority'] = $projectpriority;
|
||||
|
||||
if ($projectpriority != '-') {
|
||||
$where[] = "spr.projectpriority='%s'";
|
||||
$args[] = $projectpriority;
|
||||
$filterfields[] = t('Priority');
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['datebeginfrom'])) {
|
||||
$datebeginfrom = $_SESSION['stormproject_list_filter']['datebeginfrom'];
|
||||
$datebeginfrom['hour'] = 0;
|
||||
$datebeginfrom['minute'] = 0;
|
||||
$t = _storm_datetime_to_gmtimestamp($datebeginfrom);
|
||||
if ($datebeginfrom['year']>0 && $t>=0) {
|
||||
$where[] = 'spr.datebegin>=%d';
|
||||
$args[] = $t;
|
||||
$filterfields[] = t('Date');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['datebeginto'])) {
|
||||
$datebeginto = $_SESSION['stormproject_list_filter']['datebeginto'];
|
||||
$datebeginto['hour'] = 23;
|
||||
$datebeginto['minute'] = 59;
|
||||
$t = _storm_datetime_to_gmtimestamp($datebeginto);
|
||||
if ($datebeginto['year']>0 && $t>=0) {
|
||||
$where[] = 'spr.datebegin<=%d';
|
||||
$args[] = $t;
|
||||
$filterfields[] = t('Date');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['dateendfrom'])) {
|
||||
$dateendfrom = $_SESSION['stormproject_list_filter']['dateendfrom'];
|
||||
$dateendfrom['hour'] = 0;
|
||||
$dateendfrom['minute'] = 0;
|
||||
$t = _storm_datetime_to_gmtimestamp($dateendfrom);
|
||||
if ($dateendfrom['year']>0 && $t>=0) {
|
||||
$where[] = 'spr.dateend>=%d';
|
||||
$args[] = $t;
|
||||
$filterfields[] = t('Date');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['dateendto'])) {
|
||||
$dateendto = $_SESSION['stormproject_list_filter']['dateendto'];
|
||||
$dateendto['hour'] = 23;
|
||||
$dateendto['minute'] = 59;
|
||||
$t = _storm_datetime_to_gmtimestamp($dateendto);
|
||||
if ($dateendto['year']>0 && $t>=0) {
|
||||
$where[] = 'spr.dateend<=%d';
|
||||
$args[] = $t;
|
||||
$filterfields[] = t('Date');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['assigned_to'])) {
|
||||
if (!is_numeric($_SESSION['stormproject_list_filter']['assigned_to'])) {
|
||||
switch ($_SESSION['stormproject_list_filter']['assigned_to']) {
|
||||
case 'all':
|
||||
// NO FILTER
|
||||
break;
|
||||
case 'mine':
|
||||
// CURRENT USER
|
||||
if (!empty($user->stormperson_nid) && is_numeric($user->stormperson_nid)) {
|
||||
$assigned_to_nid = $user->stormperson_nid;
|
||||
}
|
||||
break;
|
||||
case 'none':
|
||||
$where[] = '(spr.assigned_nid IS NULL OR spr.assigned_nid = 0) ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$assigned_to_nid = $_SESSION['stormproject_list_filter']['assigned_to'];
|
||||
}
|
||||
if (!empty($assigned_to_nid) && is_numeric($assigned_to_nid)) {
|
||||
$where[] = 'spr.assigned_nid=%d';
|
||||
$args[] = $assigned_to_nid;
|
||||
$filterfields[] = t('Assigned to');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['billable']) && $_SESSION['stormproject_list_filter']['billable'] != '-') {
|
||||
$where[] = 'spr.billable=%d';
|
||||
$args[] = $_SESSION['stormproject_list_filter']['billable'];
|
||||
$filterfields[] = t('Billable');
|
||||
}
|
||||
|
||||
if (isset($_SESSION['stormproject_list_filter']['billed']) && $_SESSION['stormproject_list_filter']['billed'] != '-') {
|
||||
$where[] = 'spr.billed=%d';
|
||||
$args[] = $_SESSION['stormproject_list_filter']['billed'];
|
||||
$filterfields[] = t('Billed');
|
||||
}
|
||||
|
||||
$itemsperpage = isset($_SESSION['stormproject_list_filter']['itemsperpage']) ? $_SESSION['stormproject_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
|
||||
|
||||
if (count($filterfields) == 0) {
|
||||
$filterdesc = t('Not filtered');
|
||||
}
|
||||
else {
|
||||
$filterdesc = t('Filtered by !fields', array('!fields' => implode(", ", array_unique($filterfields))));
|
||||
}
|
||||
$filterdesc .= ' | '. t('!items items per page', array('!items' => $itemsperpage));
|
||||
|
||||
$o = drupal_get_form('stormproject_list_filter', $filterdesc);
|
||||
|
||||
$tablesort = tablesort_sql($header);
|
||||
|
||||
$s = stormproject_access_sql($s, $where);
|
||||
$s = db_rewrite_sql($s);
|
||||
$r = pager_query($s . $tablesort, $itemsperpage, 0, NULL, $args);
|
||||
|
||||
$projects = array();
|
||||
while ($project = db_fetch_object($r)) {
|
||||
$projects[] = $project;
|
||||
}
|
||||
|
||||
$o .= theme('stormproject_list', $header, $projects);
|
||||
$o .= theme('pager', NULL, 10, 0);
|
||||
print theme('page', $o);
|
||||
}
|
||||
|
||||
function stormproject_list_filter(&$form_state, $filterdesc = 'Filter') {
|
||||
$organization_nid = isset($_SESSION['stormproject_list_filter']['organization_nid']) ? $_SESSION['stormproject_list_filter']['organization_nid'] : 0;
|
||||
|
||||
$category_list = storm_attributes_bydomain('project category search');
|
||||
$projectcategory = isset($_SESSION['stormproject_list_filter']['projectcategory']) ? $_SESSION['stormproject_list_filter']['projectcategory'] : $category_list['default'];
|
||||
|
||||
$status_list = storm_attributes_bydomain('project status search');
|
||||
$projectstatus = isset($_SESSION['stormproject_list_filter']['projectstatus']) ? $_SESSION['stormproject_list_filter']['projectstatus'] : $status_list['default'];
|
||||
|
||||
$priority_list = storm_attributes_bydomain('project priority search');
|
||||
$projectpriority = isset($_SESSION['stormproject_list_filter']['projectpriority']) ? $_SESSION['stormproject_list_filter']['projectpriority'] : $priority_list['default'];
|
||||
|
||||
$datebeginfrom = isset($_SESSION['stormproject_list_filter']['datebeginfrom']) ? $_SESSION['stormproject_list_filter']['datebeginfrom'] : NULL;
|
||||
$datebeginto = isset($_SESSION['stormproject_list_filter']['datebeginto']) ? $_SESSION['stormproject_list_filter']['datebeginto'] : NULL;
|
||||
$dateendfrom = isset($_SESSION['stormproject_list_filter']['dateendfrom']) ? $_SESSION['stormproject_list_filter']['dateendfrom'] : NULL;
|
||||
$dateendto = isset($_SESSION['stormproject_list_filter']['dateendto']) ? $_SESSION['stormproject_list_filter']['dateendto'] : NULL;
|
||||
|
||||
$assigned_to = isset($_SESSION['stormproject_list_filter']['assigned_to']) ? $_SESSION['stormproject_list_filter']['assigned_to'] : NULL;
|
||||
|
||||
$itemsperpage = isset($_SESSION['stormproject_list_filter']['itemsperpage']) ? $_SESSION['stormproject_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
|
||||
$_SESSION['stormproject_list_filter']['itemsperpage'] = $itemsperpage;
|
||||
|
||||
$form = array();
|
||||
|
||||
$form['filter'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => $filterdesc,
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
$s = "SELECT n.nid, n.title FROM {node} AS n INNER JOIN {stormorganization} AS sor ON n.vid=sor.vid WHERE n.status=1 AND n.type='stormorganization' ORDER BY n.title ";
|
||||
$s = stormorganization_access_sql($s);
|
||||
$s = db_rewrite_sql($s);
|
||||
$r = db_query($s);
|
||||
|
||||
$organizations = array();
|
||||
while ($organization = db_fetch_object($r)) {
|
||||
$organizations[$organization->nid] = $organization->title;
|
||||
}
|
||||
$form['filter']['organization_nid'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Organization'),
|
||||
'#default_value' => $organization_nid,
|
||||
'#options' => array(0 => t('All')) + $organizations,
|
||||
);
|
||||
|
||||
$form['filter']['group1'] = array(
|
||||
'#type' => 'markup',
|
||||
'#theme' => 'storm_form_group',
|
||||
);
|
||||
|
||||
$form['filter']['group1']['projectcategory'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Category'),
|
||||
'#default_value' => $projectcategory,
|
||||
'#options' => $category_list['values'],
|
||||
);
|
||||
|
||||
$form['filter']['group1']['projectstatus'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Status'),
|
||||
'#default_value' => $projectstatus,
|
||||
'#options' => $status_list['values'],
|
||||
);
|
||||
|
||||
$form['filter']['group1']['projectpriority'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Priority'),
|
||||
'#default_value' => $projectpriority,
|
||||
'#options' => $priority_list['values'],
|
||||
);
|
||||
|
||||
$form['filter']['group2'] = array(
|
||||
'#type' => 'markup',
|
||||
'#theme' => 'storm_form_group',
|
||||
);
|
||||
|
||||
$form['filter']['group2']['datebeginfrom'] = array(
|
||||
'#type' => 'dateext',
|
||||
'#withnull' => 'true',
|
||||
'#title' => t('Date begin from'),
|
||||
'#default_value' => $datebeginfrom,
|
||||
);
|
||||
|
||||
$form['filter']['group2']['datebeginto'] = array(
|
||||
'#type' => 'dateext',
|
||||
'#withnull' => 'true',
|
||||
'#title' => t('Date begin to'),
|
||||
'#default_value' => $datebeginto,
|
||||
);
|
||||
|
||||
$form['filter']['group3'] = array(
|
||||
'#type' => 'markup',
|
||||
'#theme' => 'storm_form_group',
|
||||
);
|
||||
|
||||
$form['filter']['group3']['dateendfrom'] = array(
|
||||
'#type' => 'dateext',
|
||||
'#withnull' => 'true',
|
||||
'#title' => t('Date end from'),
|
||||
'#default_value' => $dateendfrom,
|
||||
);
|
||||
|
||||
$form['filter']['group3']['dateendto'] = array(
|
||||
'#type' => 'dateext',
|
||||
'#withnull' => 'true',
|
||||
'#title' => t('Date end to'),
|
||||
'#default_value' => $dateendto,
|
||||
);
|
||||
|
||||
$form['filter']['group4'] = array(
|
||||
'#type' => 'markup',
|
||||
'#theme' => 'storm_form_group',
|
||||
);
|
||||
|
||||
// ASSIGNED TO
|
||||
$options = storm_get_assignment_options(0, 0);
|
||||
$form['filter']['group4']['assigned_to'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Assigned to'),
|
||||
'#default_value' => $assigned_to,
|
||||
'#options' => $options,
|
||||
);
|
||||
|
||||
$form['filter']['group4']['billable'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Billable'),
|
||||
'#options' => array('-' => t('all'), '1' => t('billable'), '0' => t('not billable')),
|
||||
'#default_value' => isset($_SESSION['stormproject_list_filter']['billable']) ? $_SESSION['stormproject_list_filter']['billable'] : '-',
|
||||
);
|
||||
|
||||
$form['filter']['group4']['billed'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Billed'),
|
||||
'#options' => array('-' => t('all'), '1' => t('billed'), '0' => t('not billed')),
|
||||
'#default_value' => isset($_SESSION['stormproject_list_filter']['billed']) ? $_SESSION['stormproject_list_filter']['billed'] : '-',
|
||||
);
|
||||
|
||||
$form['filter']['group5'] = array(
|
||||
'#type' => 'markup',
|
||||
'#theme' => 'storm_form_group',
|
||||
'#attributes' => array('class' => 'formgroup-submit'),
|
||||
);
|
||||
|
||||
$form['filter']['group5']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Filter'),
|
||||
'#submit' => array('stormproject_list_filter_filter'),
|
||||
);
|
||||
|
||||
$form['filter']['group5']['reset'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Reset'),
|
||||
'#submit' => array('stormproject_list_filter_reset'),
|
||||
);
|
||||
|
||||
$form['filter']['group5']['itemsperpage'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Items'),
|
||||
'#size' => 10,
|
||||
'#default_value' => $itemsperpage,
|
||||
'#prefix' => '<div class="container-inline">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function stormproject_list_filter_filter($form, &$form_state) {
|
||||
$_SESSION['stormproject_list_filter']['organization_nid'] = $form_state['values']['organization_nid'];
|
||||
$_SESSION['stormproject_list_filter']['projectcategory'] = $form_state['values']['projectcategory'];
|
||||
$_SESSION['stormproject_list_filter']['projectstatus'] = $form_state['values']['projectstatus'];
|
||||
$_SESSION['stormproject_list_filter']['projectpriority'] = $form_state['values']['projectpriority'];
|
||||
$_SESSION['stormproject_list_filter']['datebeginfrom'] = $form_state['values']['datebeginfrom'];
|
||||
$_SESSION['stormproject_list_filter']['datebeginto'] = $form_state['values']['datebeginto'];
|
||||
$_SESSION['stormproject_list_filter']['dateendfrom'] = $form_state['values']['dateendfrom'];
|
||||
$_SESSION['stormproject_list_filter']['dateendto'] = $form_state['values']['dateendto'];
|
||||
$_SESSION['stormproject_list_filter']['billable'] = $form_state['values']['billable'];
|
||||
$_SESSION['stormproject_list_filter']['billed'] = $form_state['values']['billed'];
|
||||
$_SESSION['stormproject_list_filter']['assigned_to'] = $form_state['values']['assigned_to'];
|
||||
$_SESSION['stormproject_list_filter']['itemsperpage'] = $form_state['values']['itemsperpage'];
|
||||
}
|
||||
|
||||
function stormproject_list_filter_reset($form, &$form_state) {
|
||||
unset($_SESSION['stormproject_list_filter']);
|
||||
}
|
||||
|
||||
function _stormproject_organization_projects_js($organization_nid=0) {
|
||||
$projects = array();
|
||||
|
||||
if ($organization_nid) {
|
||||
$s = "SELECT n.nid, n.title FROM {node} n INNER JOIN {stormproject} AS spr ON n.vid=spr.vid WHERE n.status=1 AND n.type='stormproject' AND spr.organization_nid=%d ORDER BY n.title";
|
||||
$s = stormproject_access_sql($s);
|
||||
$s = db_rewrite_sql($s);
|
||||
$r = db_query($s, $organization_nid);
|
||||
|
||||
while ($item = db_fetch_object($r)) {
|
||||
$nid = $item->nid;
|
||||
$projects[$nid] = check_plain($item->title);
|
||||
}
|
||||
}
|
||||
print drupal_to_js($projects);
|
||||
exit();
|
||||
}
|
||||
|
12
modules/storm/stormproject/stormproject.info
Normal file
12
modules/storm/stormproject/stormproject.info
Normal file
|
@ -0,0 +1,12 @@
|
|||
name = Storm Project
|
||||
description = "Allows recording of projects based on SuiteDesk Organizations"
|
||||
dependencies[] = storm
|
||||
dependencies[] = stormorganization
|
||||
package = Storm
|
||||
core = 6.x
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-08-05
|
||||
version = "6.x-2.2"
|
||||
core = "6.x"
|
||||
project = "storm"
|
||||
datestamp = "1375697500"
|
260
modules/storm/stormproject/stormproject.install
Normal file
260
modules/storm/stormproject/stormproject.install
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Installation functions for the SuiteDesk project module
|
||||
*/
|
||||
function stormproject_install() {
|
||||
drupal_install_schema('stormproject');
|
||||
variable_set('node_options_stormproject', array('status'));
|
||||
|
||||
$attributes = array();
|
||||
|
||||
$attributes['Project status'] = array(
|
||||
'inserted' => 'inserted',
|
||||
'in progress' => 'in progress',
|
||||
'on hold' => 'on hold',
|
||||
'completed' => 'completed'
|
||||
);
|
||||
|
||||
$attributes['Project status search'] = array(
|
||||
'-' => 'all',
|
||||
'inserted,in progress,on hold' => 'open',
|
||||
'inserted' => '-- inserted',
|
||||
'in progress' => '-- in progress',
|
||||
'on hold' => '-- on hold',
|
||||
'completed' => 'completed'
|
||||
);
|
||||
|
||||
$attributes['Project category'] = array(
|
||||
'development' => 'development',
|
||||
'support' => 'support',
|
||||
);
|
||||
|
||||
$attributes['Project category search'] = array(
|
||||
'-' => 'all',
|
||||
'development' => 'development',
|
||||
'support' => 'support',
|
||||
);
|
||||
|
||||
$attributes['Project priority'] = array(
|
||||
'1-low' => 'low',
|
||||
'2-normal' => 'normal',
|
||||
'3-high' => 'high',
|
||||
'4-urgent' => 'urgent'
|
||||
);
|
||||
|
||||
$attributes['Project priority search'] = array(
|
||||
'-' => 'all',
|
||||
'1-low' => 'low',
|
||||
'2-normal' => 'normal',
|
||||
'3-high' => 'high',
|
||||
'4-urgent' => 'urgent'
|
||||
);
|
||||
|
||||
$attributes['Duration unit'] = array(
|
||||
'hour' => 'Hour',
|
||||
'day' => 'Day',
|
||||
);
|
||||
|
||||
$s = "INSERT INTO {stormattribute} (domain, akey, avalue, weight) VALUES ('%s', '%s', '%s', %d)";
|
||||
$prevdomain = '';
|
||||
$weight = 0;
|
||||
foreach ($attributes as $domain => $attribute) {
|
||||
if ($domain != $prevdomain) $weight=0;
|
||||
foreach ($attribute as $key => $value) {
|
||||
db_query($s, $domain, $key, $value, $weight);
|
||||
$weight++;
|
||||
}
|
||||
$prevdomain = $domain;
|
||||
}
|
||||
}
|
||||
|
||||
function stormproject_disable() {
|
||||
drupal_set_message(t('Nodes of type "Project" have not been deleted on disabling SuiteDesk Project. Please note that they will now have reduced functionality, and will not be protected by SuiteDesk Project access controls.'), 'warning');
|
||||
}
|
||||
|
||||
function stormproject_uninstall() {
|
||||
drupal_uninstall_schema('stormproject');
|
||||
|
||||
db_query($s = "DELETE FROM {stormattribute} WHERE domain IN ('Project status', 'Project status search', 'Project category', 'Project category search', 'Project priority', 'Project priority search', 'Duration unit')");
|
||||
}
|
||||
|
||||
function stormproject_schema() {
|
||||
$schema['stormproject'] = array(
|
||||
'fields' => array(
|
||||
'vid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
||||
'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
||||
'organization_nid' => array('type' => 'int'),
|
||||
'organization_title' => array('type' => 'varchar', 'length' => 100),
|
||||
'projectstatus' => array('type' => 'varchar', 'length' => 100),
|
||||
'projectcategory' => array('type' => 'varchar', 'length' => 100),
|
||||
'projectpriority' => array('type' => 'varchar', 'length' => 100),
|
||||
'pricemode' => array('type' => 'varchar', 'length' => 100),
|
||||
'price' => array('type' => 'float'),
|
||||
'currency' => array('type' => 'varchar', 'length' => 100),
|
||||
'datebegin' => array('type' => 'int', 'default' => 0),
|
||||
'dateend' => array('type' => 'int', 'default' => 0),
|
||||
'durationunit' => array('type' => 'varchar', 'length' => 100),
|
||||
'duration' => array('type' => 'float', 'default' => 0),
|
||||
'manager_nid' => array('type' => 'int'),
|
||||
'manager_title' => array('type' => 'varchar', 'length' => 100),
|
||||
'assigned_nid' => array('type' => 'int'),
|
||||
'assigned_title' => array('type' => 'varchar', 'length' => 100),
|
||||
'version' => array('type' => 'varchar', 'length' => 12),
|
||||
'billable' => array('type' => 'int', 'default' => 0),
|
||||
'billed' => array('type' => 'int', 'default' => 0),
|
||||
),
|
||||
'primary key' => array('vid'),
|
||||
'indexes' => array(
|
||||
'nid' => array('nid'),
|
||||
'organization_nid' => array('organization_nid'),
|
||||
'manager_nid' => array('manager_nid'),
|
||||
'assigned_nid' => array('assigned_nid'),
|
||||
)
|
||||
);
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function stormproject_update_1() {
|
||||
$ret = array();
|
||||
db_add_field($ret, 'stormproject', 'projectpriority', array('type' => 'varchar', 'length' => 20));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function stormproject_update_2() {
|
||||
$ret = array();
|
||||
db_add_field($ret, 'stormproject', 'datebegin', array('type' => 'int', 'default' => 0));
|
||||
db_add_field($ret, 'stormproject', 'dateend', array('type' => 'int', 'default' => 0));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function stormproject_update_3() {
|
||||
$ret = array();
|
||||
db_add_field($ret, 'stormproject', 'durationunit', array('type' => 'varchar', 'length' => 20));
|
||||
db_add_field($ret, 'stormproject', 'duration', array('type' => 'float', 'default' => 0));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add manager_nid, manager_title, assigned_nid and assigned_title fields.
|
||||
*/
|
||||
function stormproject_update_6104() {
|
||||
$ret = array();
|
||||
db_add_field($ret, 'stormproject', 'manager_nid', array('type' => 'int'));
|
||||
db_add_field($ret, 'stormproject', 'manager_title', array('type' => 'varchar', 'length' => 100));
|
||||
db_add_field($ret, 'stormproject', 'assigned_nid', array('type' => 'int'));
|
||||
db_add_field($ret, 'stormproject', 'assigned_title', array('type' => 'varchar', 'length' => 100));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added billable and billed fields to stormproject table for issue 567558
|
||||
*/
|
||||
function stormproject_update_6105() {
|
||||
$ret = array();
|
||||
db_add_field($ret, 'stormproject', 'billable', array('type' => 'int', 'default' => 0));
|
||||
db_add_field($ret, 'stormproject', 'billed', array('type' => 'int', 'default' => 0));
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @function
|
||||
* Database update for issue #899970
|
||||
*/
|
||||
function stormproject_update_6106() {
|
||||
$ret = array();
|
||||
|
||||
db_change_field($ret, 'stormproject', 'projectstatus', 'projectstatus', array('type' => 'varchar', 'length' => 100));
|
||||
db_change_field($ret, 'stormproject', 'projectcategory', 'projectcategory', array('type' => 'varchar', 'length' => 100));
|
||||
db_change_field($ret, 'stormproject', 'projectpriority', 'projectpriority', array('type' => 'varchar', 'length' => 100));
|
||||
db_change_field($ret, 'stormproject', 'pricemode', 'pricemode', array('type' => 'varchar', 'length' => 100));
|
||||
db_change_field($ret, 'stormproject', 'currency', 'currency', array('type' => 'varchar', 'length' => 100));
|
||||
db_change_field($ret, 'stormproject', 'durationunit', 'durationunit', array('type' => 'varchar', 'length' => 100));
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Improve primary keys and indexes
|
||||
*/
|
||||
function stormproject_update_6201() {
|
||||
$return = array();
|
||||
db_drop_primary_key($return, 'stormproject');
|
||||
db_add_primary_key($return, 'stormproject', array('vid'));
|
||||
$indexes = array(
|
||||
'nid' => array('nid'),
|
||||
'organization_nid' => array('organization_nid'),
|
||||
'manager_nid' => array('manager_nid'),
|
||||
'assigned_nid' => array('assigned_nid'),
|
||||
);
|
||||
foreach ($indexes as $name => $fields) {
|
||||
db_add_index($return, 'stormproject', $name, $fields);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move SuiteDesk Attribute module into component modules
|
||||
*/
|
||||
function stormproject_update_6202() {
|
||||
$attributes = array();
|
||||
|
||||
// Only run this update if was not previously run as part of the legacy stormattribute module
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 1) {
|
||||
$attributes['Project priority'] = array(
|
||||
'1-low' => 'low',
|
||||
'2-normal' => 'normal',
|
||||
'3-high' => 'high',
|
||||
'4-urgent' => 'urgent'
|
||||
);
|
||||
|
||||
$attributes['Project priority search'] = array(
|
||||
'1-low' => 'low',
|
||||
'2-normal' => 'normal',
|
||||
'3-high' => 'high',
|
||||
'4-urgent' => 'urgent'
|
||||
);
|
||||
}
|
||||
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 4) {
|
||||
$attributes['Duration unit'] = array(
|
||||
'hour' => 'Hour',
|
||||
'day' => 'Day',
|
||||
);
|
||||
}
|
||||
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 6) {
|
||||
$attributes['Project status search'] = array('-' => 'all');
|
||||
$attributes['Project priority search'] = array('-' => 'all');
|
||||
}
|
||||
|
||||
$s = "INSERT INTO {stormattribute} (domain, akey, avalue, weight) VALUES ('%s', '%s', '%s', %d)";
|
||||
$prevdomain = '';
|
||||
$weight = 0;
|
||||
foreach ($attributes as $domain => $attribute) {
|
||||
if ($domain != $prevdomain) $weight=0;
|
||||
foreach ($attribute as $key => $value) {
|
||||
db_query($s, $domain, $key, $value, $weight);
|
||||
$weight++;
|
||||
}
|
||||
$prevdomain = $domain;
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 6107) {
|
||||
$ret[] = update_sql("INSERT INTO {stormattribute} (domain, akey, avalue, weight, isactive) VALUES ('Project category search', 'development', 'development', 0, 1)");
|
||||
$ret[] = update_sql("INSERT INTO {stormattribute} (domain, akey, avalue, weight, isactive) VALUES ('Project category search', 'support', 'support', 0, 1)");
|
||||
}
|
||||
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 6109) {
|
||||
$ret[] = update_sql("INSERT INTO {stormattribute} (domain, akey, avalue, weight, isactive) VALUES ('Project category search', '-', 'all', 0, 1)");
|
||||
}
|
||||
|
||||
if (db_result(db_query("SELECT schema_version FROM {system} WHERE name = 'stormattribute'")) < 6112) {
|
||||
$ret[] = update_sql("UPDATE {stormproject} set pricemode='fixed_price' where pricemode='fixed_timetracking'");
|
||||
}
|
||||
return $ret;
|
||||
}
|
19
modules/storm/stormproject/stormproject.js
Normal file
19
modules/storm/stormproject/stormproject.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
function stormproject_organization_projects(_organization_select, _project_select_id, _with_all_option, _all_text) {
|
||||
var project_select = $("#" + _project_select_id).get(0);
|
||||
storm_empty_select(project_select);
|
||||
var organization_nid = _organization_select.value;
|
||||
if (!organization_nid) organization_nid=0;
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
async: true,
|
||||
url: Drupal.settings.storm.organization_projects_url + Drupal.encodeURIComponent(organization_nid),
|
||||
dataType: "string",
|
||||
success: function (data) {
|
||||
var items = Drupal.parseJson(data);
|
||||
storm_fill_select(project_select, items, _with_all_option, _all_text);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
1113
modules/storm/stormproject/stormproject.module
Normal file
1113
modules/storm/stormproject/stormproject.module
Normal file
File diff suppressed because it is too large
Load diff
376
modules/storm/stormproject/stormproject.test
Normal file
376
modules/storm/stormproject/stormproject.test
Normal file
|
@ -0,0 +1,376 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Test definitions for the SuiteDesk Project module
|
||||
*/
|
||||
class StormprojectTestCase extends DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => t('SuiteDesk Project Functionality'),
|
||||
'description' => t('Test the functionality of the SuiteDesk Project module'),
|
||||
'group' => 'Storm',
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp('storm', 'stormorganization', 'stormproject', 'stormperson', 'stormteam');
|
||||
}
|
||||
|
||||
public function testStormprojectAccess() {
|
||||
$this->drupalGet('projects');
|
||||
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for anonymous user'));
|
||||
|
||||
$basic_user = $this->drupalCreateUser();
|
||||
$this->drupalLogin($basic_user);
|
||||
$this->drupalGet('projects');
|
||||
$this->assertResponse(403, t('Make sure access is denied to SuiteDesk Projects list for basic user'));
|
||||
|
||||
$privileged_user = $this->drupalCreateUser(array('Storm project: access'));
|
||||
$this->drupalLogin($privileged_user);
|
||||
$this->drupalGet('projects');
|
||||
$this->assertText(t('Projects'), t('Make sure the correct page has been displayed by checking that the title is "Projects".'));
|
||||
}
|
||||
|
||||
public function testStormprojectCreate() {
|
||||
// Create and login user
|
||||
$user = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: add', 'Storm project: view all'));
|
||||
$this->drupalLogin($user);
|
||||
|
||||
// Create organization and invoice
|
||||
$org = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
);
|
||||
$prj = array(
|
||||
'title' => $this->randomName(32),
|
||||
'organization_nid' => '1',
|
||||
);
|
||||
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
|
||||
$this->drupalPost('node/add/stormproject', $prj, t('Save'));
|
||||
|
||||
$this->assertText(t('Project @title has been created.', array('@title' => $prj['title'])));;
|
||||
}
|
||||
|
||||
public function testStormprojectList() {
|
||||
// Create and login user
|
||||
$userAll = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit all', 'Storm project: delete all', 'Storm person: add', 'Storm team: add', 'Storm person: view all', 'Storm team: view all'));
|
||||
$userOrg = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view of user organization', 'Storm project: edit of user organization', 'Storm project: delete of user organization'));
|
||||
$userOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view own', 'Storm project: edit own', 'Storm project: delete own'));
|
||||
$userManager = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if project manager', 'Storm project: edit if project manager', 'Storm project: delete if project manager'));
|
||||
$userAssigned = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
|
||||
$userAssignedTeam = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view if assigned to project', 'Storm project: edit if assigned to project', 'Storm project: delete if assigned to project'));
|
||||
$userViewAllEditOwn = $this->drupalCreateUser(array('Storm organization: add', 'Storm organization: view all', 'Storm project: access', 'Storm project: add', 'Storm project: view all', 'Storm project: edit own', 'Storm project: delete own'));
|
||||
|
||||
$this->drupalLogin($userAll);
|
||||
|
||||
// Create organization
|
||||
$org = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
);
|
||||
$this->drupalPost('node/add/stormorganization', $org, t('Save'));
|
||||
$org = node_load(array('title' => $org['title']));
|
||||
|
||||
// Create organization
|
||||
$org2 = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
);
|
||||
$this->drupalPost('node/add/stormorganization', $org2, t('Save'));
|
||||
$org2 = node_load(array('title' => $org2['title']));
|
||||
|
||||
// Create stormperson with organization to userOrg
|
||||
$personOrg = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org->nid,
|
||||
'user_name' => $userOrg->name,
|
||||
);
|
||||
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
|
||||
|
||||
$personOrg = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org->nid,
|
||||
'user_name' => $userManager->name,
|
||||
);
|
||||
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
|
||||
$manager = node_load(array('title' => $personOrg['title']));
|
||||
|
||||
$personOrg = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org->nid,
|
||||
'user_name' => $userAssigned->name,
|
||||
);
|
||||
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
|
||||
$assignedPerson = node_load(array('title' => $personOrg['title']));
|
||||
|
||||
$personOrg = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org->nid,
|
||||
'user_name' => $userAssignedTeam->name,
|
||||
);
|
||||
$this->drupalPost('node/add/stormperson', $personOrg, t('Save'));
|
||||
$assignedPersonTeam = node_load(array('title' => $personOrg['title']));
|
||||
|
||||
$team = array(
|
||||
'title' => $this->randomName(32),
|
||||
'members_array_1' => $assignedPersonTeam->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormteam', $team, t('Save'));
|
||||
$team = node_load(array('title' => $team['title']));
|
||||
|
||||
// Create project
|
||||
$project1 = array(
|
||||
'organization_nid' => $org->nid,
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $project1, t('Save'));
|
||||
$project1 = node_load(array('title' => $project1['title']));
|
||||
|
||||
$projectManager = array(
|
||||
'organization_nid' => $org->nid,
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'manager_nid' => $manager->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $projectManager, t('Save'));
|
||||
$projectManager = node_load(array('title' => $projectManager['title']));
|
||||
|
||||
$projectAssigned = array(
|
||||
'organization_nid' => $org->nid,
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'assigned_nid' => $assignedPerson->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $projectAssigned, t('Save'));
|
||||
$projectAssigned = node_load(array('title' => $projectAssigned['title']));
|
||||
|
||||
$projectAssignedTeam = array(
|
||||
'organization_nid' => $org->nid,
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'assigned_nid' => $team->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $projectAssignedTeam, t('Save'));
|
||||
$projectAssignedTeam = node_load(array('title' => $projectAssignedTeam['title']));
|
||||
|
||||
$this->drupalLogin($userOwn);
|
||||
$project2 = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $project2, t('Save'));
|
||||
$project2 = node_load(array('title' => $project2['title']));
|
||||
|
||||
$this->drupalLogin($userViewAllEditOwn);
|
||||
$project3 = array(
|
||||
'title' => $this->randomName(32),
|
||||
'body' => $this->randomName(64),
|
||||
'organization_nid' => $org2->nid,
|
||||
);
|
||||
$this->drupalPost('node/add/stormproject', $project3, t('Save'));
|
||||
$project3 = node_load(array('title' => $project3['title']));
|
||||
|
||||
// Test for 'Storm project: view all'
|
||||
$this->drupalLogin($userAll);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertLink($project1->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($project2->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($project3->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
// Test for 'Storm project: view of user organization'
|
||||
$this->drupalLogin($userOrg);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertLink($project1->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project1->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project1->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($project2->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertNoLink($project3->title, 0, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
// Test for 'Storm project: view own'
|
||||
$this->drupalLogin($userOwn);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($project2->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project2->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
// Test for 'Storm project: view all', 'Storm project: edit own'
|
||||
$this->drupalLogin($userViewAllEditOwn);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertLink($project1->title, 0, 'The Project appears on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($project2->title, 0, 'The Project appears on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($project3->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $project3->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $project3->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
// Test for 'Storm project: view if project manager'
|
||||
$this->drupalLogin($userManager);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectManager->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
// Test for 'Storm project: view if assigned to project'
|
||||
$this->drupalLogin($userAssigned);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectAssigned->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
|
||||
$this->assertNoLink($projectAssignedTeam->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
// Test for 'Storm project: view if assigned to project' (using team)
|
||||
$this->drupalLogin($userAssignedTeam);
|
||||
$this->drupalGet('projects');
|
||||
|
||||
$this->assertNoLink($project1->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project1->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project2->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project2->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($project3->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $project3->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectManager->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectManager->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertNoLink($projectAssigned->title, 'The Project does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/edit', 'The Project edit icon does not appear on the list');
|
||||
$this->assertNoRaw('node/'. $projectAssigned->nid .'/delete', 'The Project delete icon does not appear on the list');
|
||||
|
||||
$this->assertLink($projectAssignedTeam->title, 0, 'The Project appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/edit', 'The Project edit icon appears on the list');
|
||||
$this->assertRaw('node/'. $projectAssignedTeam->nid .'/delete', 'The Project delete icon appears on the list');
|
||||
}
|
||||
}
|
181
modules/storm/stormproject/stormproject.theme.inc
Normal file
181
modules/storm/stormproject/stormproject.theme.inc
Normal file
|
@ -0,0 +1,181 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
function theme_stormproject_list($header, $projects) {
|
||||
drupal_add_css(drupal_get_path('module', 'storm') .'/storm.css', 'module');
|
||||
|
||||
$rows = array();
|
||||
foreach ($projects as $key => $project) {
|
||||
$rows[] = array(
|
||||
storm_icon('projectcategory_'. $project->projectcategory, storm_attribute_value('Project category', $project->projectcategory)),
|
||||
storm_icon('status_'. $project->projectstatus, storm_attribute_value('Project status', $project->projectstatus)),
|
||||
'<span class="project-title status_' . str_replace(' ', '_', $project->projectstatus) . '">' . l($project->title, 'node/'. $project->nid) . theme('mark', node_mark($project->nid, $project->changed)) . '</span><br />' .
|
||||
l($project->organization_title, 'node/'. $project->organization_nid) .
|
||||
(!empty($project->manager_title) ? ' » ' . l($project->manager_title, 'node/'. $project->manager_nid) : '' ),
|
||||
format_date($project->created, 'small'),
|
||||
format_date($project->changed, 'small'),
|
||||
$project->version,
|
||||
storm_icon('priority_'. $project->projectpriority, storm_attribute_value('Project priority', $project->projectpriority)),
|
||||
array(
|
||||
'data' => storm_icon_gantt_project($project, $_GET) . storm_icon_edit_node($project, $_GET) . storm_icon_delete_node($project, $_GET),
|
||||
'class' => 'storm_list_operations',
|
||||
),
|
||||
);
|
||||
}
|
||||
$o = theme('table', $header, $rows, array('id' => 'stormprojects'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
function theme_stormproject_view($node, $teaser = FALSE, $page = FALSE) {
|
||||
drupal_add_css(drupal_get_path('module', 'storm') . '/storm-node.css', 'module');
|
||||
|
||||
$node = node_prepare($node, $teaser);
|
||||
$l_pos = 1; // Used to increase the link position number (see issue 814820)
|
||||
|
||||
$node->content['links'] = array(
|
||||
'#prefix' => '<div class="stormlinks"><dl>',
|
||||
'#suffix' => '</dl></div>',
|
||||
'#weight' => -25,
|
||||
);
|
||||
|
||||
$node->content['links']['tasks'] = theme('storm_link', 'stormproject', 'stormtask', $node->nid, $l_pos++);
|
||||
$node->content['links']['tickets'] = theme('storm_link', 'stormproject', 'stormticket', $node->nid, $l_pos++);
|
||||
$node->content['links']['doks'] = theme('storm_link', 'stormproject', 'stormdok', $node->nid, $l_pos++);
|
||||
$node->content['links']['notes'] = theme('storm_link', 'stormproject', 'stormnote', $node->nid, $l_pos++);
|
||||
$node->content['links']['events'] = theme('storm_link', 'stormproject', 'stormevent', $node->nid, $l_pos++);
|
||||
$node->content['links']['expenses'] = theme('storm_link', 'stormproject', 'stormexpense', $node->nid, $l_pos++);
|
||||
$node->content['links']['invoices'] = theme('storm_link', 'stormproject', 'storminvoice', $node->nid, $l_pos++);
|
||||
$node->content['links']['timetrackings'] = theme('storm_link', 'stormproject', 'stormtimetracking', $node->nid, $l_pos++);
|
||||
|
||||
// Code to create invoice auto_add link
|
||||
if (module_exists('storminvoice')) {
|
||||
|
||||
$node->content['links']['auto_invoice'] = array(
|
||||
'#prefix' => variable_get('storm_icons_display', TRUE) ? '<dt id="storminvoice-item" class="stormcomponent">' : '<dt class="stormcomponent">',
|
||||
'#suffix' => '</dt>',
|
||||
'#value' => theme('storminvoice_autoadd_links', $node->nid, $node->billable, $node->billed),
|
||||
'#weight' => $l_pos++,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$node->content['group1'] = array(
|
||||
'#prefix' => '<div class="stormfields">',
|
||||
'#suffix' => '</div>',
|
||||
'#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'group1') : -20,
|
||||
);
|
||||
|
||||
$node->content['group1']['organization'] = array(
|
||||
'#prefix' => '<div class="organization">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Organization'), l($node->organization_title, 'node/'. $node->organization_nid)),
|
||||
'#weight' => 1,
|
||||
);
|
||||
$node->content['group1']['author'] = array(
|
||||
'#prefix' => '<div class="author">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Submitted by'), theme('username', $node)),
|
||||
'#weight' => 11,
|
||||
);
|
||||
$node->content['group1']['created'] = array(
|
||||
'#prefix' => '<div class="created">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
|
||||
'#weight' => 12,
|
||||
);
|
||||
if ($node->changed != $node->created) {
|
||||
$node->content['group1']['modified'] = array(
|
||||
'#prefix' => '<div class="modified">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
|
||||
'#weight' => 13,
|
||||
);
|
||||
}
|
||||
$node->content['group1']['version'] = array(
|
||||
'#prefix' => '<div class="version">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Revision'), $node->version),
|
||||
'#weight' => 14,
|
||||
);
|
||||
|
||||
$node->content['group2'] = array(
|
||||
'#prefix' => '<div class="stormfields">',
|
||||
'#suffix' => '</div>',
|
||||
'#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'group2') : -19,
|
||||
);
|
||||
|
||||
$node->content['group2']['projectcategory'] = array(
|
||||
'#prefix' => '<div class="projectcategory">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Category'), check_plain(storm_attribute_value('Project category', $node->projectcategory))),
|
||||
'#weight' => 1,
|
||||
);
|
||||
|
||||
$node->content['group2']['projectstatus'] = array(
|
||||
'#prefix' => '<div class="projectstatus">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Status'), check_plain(storm_attribute_value('Project status', $node->projectstatus))),
|
||||
'#weight' => 2,
|
||||
);
|
||||
|
||||
$node->content['group2']['projectpriority'] = array(
|
||||
'#prefix' => '<div class="projectpriority">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Priority'), check_plain(storm_attribute_value('Project priority', $node->projectpriority))),
|
||||
'#weight' => 3,
|
||||
);
|
||||
|
||||
$node->content['group3'] = array(
|
||||
'#prefix' => '<div class="stormfields">',
|
||||
'#suffix' => '</div>',
|
||||
'#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'group3') : -18,
|
||||
);
|
||||
|
||||
$node->content['group3']['datebegin'] = array(
|
||||
'#prefix' => '<div class="datebegin">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : substr(format_date($node->datebegin, 'small'), 0, 10)),
|
||||
'#weight' => 2,
|
||||
);
|
||||
|
||||
$node->content['group3']['dateend'] = array(
|
||||
'#prefix' => '<div class="dateend">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : substr(format_date($node->dateend, 'small'), 0, 10)),
|
||||
'#weight' => 3,
|
||||
);
|
||||
|
||||
$node->content['group5'] = array(
|
||||
'#prefix' => '<div class="stormfields">',
|
||||
'#suffix' => '</div>',
|
||||
'#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'group5') : -16,
|
||||
);
|
||||
|
||||
$node->content['group5']['manager'] = array(
|
||||
'#prefix' => '<div class="manager">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Project Manager'), l($node->manager_title, 'node/'. $node->manager_nid)),
|
||||
'#weight' => 1,
|
||||
);
|
||||
|
||||
$node->content['group5']['assigned'] = array(
|
||||
'#prefix' => '<div class="assigned">',
|
||||
'#suffix' => '</div>',
|
||||
'#value' => theme('storm_view_item', t('Assigned to'), l($node->assigned_title, 'node/'. $node->assigned_nid)),
|
||||
'#weight' => 2,
|
||||
);
|
||||
|
||||
# $node->content['body_field'] = array(
|
||||
# '#prefix' => '<div class="stormbody">',
|
||||
# '#suffix' => '</div>',
|
||||
# '#value' => theme('storm_view_item', t('Description'), $node->content['body']['#value']),
|
||||
# '#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'body_field') : -18,
|
||||
# );
|
||||
|
||||
unset($node->content['body']);
|
||||
|
||||
return $node;
|
||||
}
|
380
modules/storm/stormproject/stormproject.views.inc
Normal file
380
modules/storm/stormproject/stormproject.views.inc
Normal file
|
@ -0,0 +1,380 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Functions to expose SuiteDesk Project data to the views module
|
||||
*/
|
||||
|
||||
function stormproject_views_data() {
|
||||
$data['stormproject']['table']['group'] = 'SuiteDesk Project';
|
||||
$data['stormproject']['table']['join'] = array(
|
||||
'node' => array(
|
||||
'left_field' => 'vid',
|
||||
'field' => 'vid',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['organization_nid'] = array(
|
||||
'title' => t('Organization'),
|
||||
'help' => t('Project -> Organization'),
|
||||
'relationship' => array(
|
||||
'base' => 'node',
|
||||
'field' => 'nid',
|
||||
'handler' => 'views_handler_relationship',
|
||||
'label' => t('Project -> Organization'),
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['organization_title'] = array(
|
||||
'title' => t('Organization'),
|
||||
'help' => t('SuiteDesk Project Organization (title only)'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['projectstatus'] = array(
|
||||
'title' => t('Status'),
|
||||
'help' => t('SuiteDesk Project Status'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
'handler' => 'storm_handler_field_attributes_domain',
|
||||
'domain' => 'Project Status',
|
||||
'icon' => 'status',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'storm_handler_filter_attributes_domain',
|
||||
'domain' => 'Project Status',
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['projectcategory'] = array(
|
||||
'title' => t('Category'),
|
||||
'help' => t('SuiteDesk Project Category'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
'handler' => 'storm_handler_field_attributes_domain',
|
||||
'domain' => 'Project Category',
|
||||
'icon' => 'projectcategory',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'storm_handler_filter_attributes_domain',
|
||||
'domain' => 'Project Category',
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['projectpriority'] = array(
|
||||
'title' => t('Priority'),
|
||||
'help' => t('SuiteDesk Project Priority'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
'handler' => 'storm_handler_field_attributes_domain',
|
||||
'domain' => 'Project Priority',
|
||||
'icon' => 'priority'
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'storm_handler_filter_attributes_domain',
|
||||
'domain' => 'Project Priority',
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['pricemode'] = array(
|
||||
'title' => t('Price mode'),
|
||||
'help' => t('SuiteDesk Project Price Mode'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['price'] = array(
|
||||
'title' => t('Price'),
|
||||
'help' => t('SuiteDesk Project Price'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_numeric',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_numeric',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['currency'] = array(
|
||||
'title' => t('Currency'),
|
||||
'help' => t('SuiteDesk Project Currency'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['datebegin'] = array(
|
||||
'title' => t('Date begin'),
|
||||
'help' => t('SuiteDesk Project Date Begin'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
'handler' => 'views_handler_field_date',
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort_date',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_date',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['dateend'] = array(
|
||||
'title' => t('Date end'),
|
||||
'help' => t('SuiteDesk Project Date End'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
'handler' => 'views_handler_field_date',
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort_date',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_date',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['duration unit'] = array(
|
||||
'title' => t('Duration unit'),
|
||||
'help' => t('SuiteDesk Project Duration Unit'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['duration'] = array(
|
||||
'title' => t('Duration'),
|
||||
'help' => t('SuiteDesk Project Duration'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_numeric',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_numeric',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['manager_nid'] = array(
|
||||
'title' => t('Manager'),
|
||||
'help' => t('Project -> Manager'),
|
||||
'relationship' => array(
|
||||
'base' => 'node',
|
||||
'field' => 'nid',
|
||||
'handler' => 'views_handler_relationship',
|
||||
'label' => t('Project -> Manager'),
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['manager_title'] = array(
|
||||
'title' => t('Project manager'),
|
||||
'help' => t('SuiteDesk Project Manager (title only)'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['assigned_nid'] = array(
|
||||
'title' => t('Assigned'),
|
||||
'help' => t('Project -> Assigned'),
|
||||
'relationship' => array(
|
||||
'base' => 'node',
|
||||
'field' => 'nid',
|
||||
'handler' => 'views_handler_relationship',
|
||||
'label' => t('Project -> Assigned'),
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['assigned_title'] = array(
|
||||
'title' => t('Assigned'),
|
||||
'help' => t('SuiteDesk Project Assigned (title only)'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['billable'] = array(
|
||||
'title' => t('Project billable'),
|
||||
'help' => t('SuiteDesk Project Billable'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_numeric',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['billed'] = array(
|
||||
'title' => t('Project billed'),
|
||||
'help' => t('SuiteDesk Project Billed'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_numeric',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['version'] = array(
|
||||
'title' => t('Review'),
|
||||
'help' => t('SuiteDesk Project Review'),
|
||||
'field' => array(
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'sort' => array(
|
||||
'handler' => 'views_handler_sort',
|
||||
),
|
||||
'filter' => array(
|
||||
'handler' => 'views_handler_filter_string',
|
||||
),
|
||||
'argument' => array(
|
||||
'handler' => 'views_handler_argument_string',
|
||||
),
|
||||
);
|
||||
|
||||
$data['stormproject']['operation'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Operations (…/edit/delete) link'),
|
||||
'help' => t('Provide links to edit, delete, … the node.'),
|
||||
'handler' => 'storm_handler_field_operation',
|
||||
'type' => 'stormproject',
|
||||
),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function stormproject_views_handlers() {
|
||||
return array(
|
||||
'info' => array(
|
||||
'path' => drupal_get_path('module', 'storm'),
|
||||
),
|
||||
'handlers' => array(
|
||||
'storm_handler_field_attributes_domain' => array(
|
||||
'parent' => 'views_handler_field',
|
||||
),
|
||||
'storm_handler_filter_attributes_domain' => array(
|
||||
'parent' => 'views_handler_filter_in_operator',
|
||||
),
|
||||
'storm_handler_field_operation' => array(
|
||||
'parent' => 'views_handler_field_node_link',
|
||||
'path' => drupal_get_path('module', 'storm'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_date_api_fields().
|
||||
* on behalf of core fields.
|
||||
*
|
||||
* All modules that create custom fields that use the
|
||||
* 'views_handler_field_date' handler can provide
|
||||
* additional information here about the type of
|
||||
* date they create so the date can be used by
|
||||
* the Date API views date argument and date filter.
|
||||
*/
|
||||
|
||||
function stormproject_date_api_fields($field) {
|
||||
$values = array(
|
||||
'sql_type' => DATE_UNIX,
|
||||
'tz_handling' => 'site',
|
||||
'timezone_field' => '',
|
||||
'offset_field' => '',
|
||||
'related_fields' => array(),
|
||||
'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
|
||||
);
|
||||
|
||||
switch ($field) {
|
||||
case 'stormproject.datebegin':
|
||||
case 'stormproject.dateend':
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_date_api_tables().
|
||||
*/
|
||||
function stormproject_date_api_tables() {
|
||||
return array('stormproject');
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* This file will contain default views for the SuiteDesk Project module
|
||||
*/
|
||||
|
||||
|
Reference in a new issue