/** * parse file for indexing * @todo convert to using the FileSystem methods */ public function index(CFile $file) { /* Workaround for indexing large files: ** Based on the value defined in config data, ** files with file_size greater than specified limit ** are not indexed for searching. ** Negative value :<=> no filesize limit */ $index_max_file_size = w2PgetConfig('index_max_file_size', 0); if ($file->file_size > 0 && ($index_max_file_size < 0 || (int) $file->file_size <= $index_max_file_size * 1024)) { // get the parser application $parser = w2PgetConfig('parser_' . $file->file_type); if (!$parser) { $parser = w2PgetConfig('parser_default'); } if (!$parser) { return false; } // buffer the file $file->_filepath = W2P_BASE_DIR . '/files/' . $file->file_project . '/' . $file->file_real_filename; if (file_exists($file->_filepath)) { $fp = fopen($file->_filepath, 'rb'); $x = fread($fp, $file->file_size); fclose($fp); $ignore = w2PgetSysVal('FileIndexIgnoreWords'); $ignore = $ignore['FileIndexIgnoreWords']; $ignore = explode(',', $ignore); $x = strtolower($x); $x = preg_replace("/[^A-Za-z0-9 ]/", "", $x); foreach ($ignore as $ignoreWord) { $x = str_replace(" {$ignoreWord} ", ' ', $x); } $x = str_replace(' ', ' ', $x); $words = explode(' ', $x); foreach ($words as $index => $word) { if ('' == trim($word)) { continue; } $q = $this->query; $q->addTable('files_index'); $q->addInsert('file_id', $file->file_id); $q->addInsert('word', $word); $q->addInsert('word_placement', $index); $q->exec(); $q->clear(); } } else { //TODO: if the file doesn't exist.. should we delete the db record? } } $file->file_indexed = 1; $file->store(); return count($words); }
public function showAddress($name, $object) { $countries = w2PgetSysVal('GlobalCountries'); $output = '<div style="margin-left: 11em;">'; $output .= '<a href="http://maps.google.com/maps?q=' . $object->{$name . '_address1'} . '+' . $object->{$name . '_address2'} . '+' . $object->{$name . '_city'} . '+' . $object->{$name . '_state'} . '+' . $object->{$name . '_zip'} . '+' . $object->{$name . '_country'} . '" target="_blank">'; $output .= '<img src="' . w2PfindImage('googlemaps.gif') . '" class="right" alt="Find It on Google" />'; $output .= '</a>'; $output .= $object->{$name . '_address1'} . ($object->{$name . '_address2'} ? '<br />' . $object->{$name . '_address2'} : '') . ($object->{$name . '_city'} ? '<br />' . $object->{$name . '_city'} : '') . ($object->{$name . '_state'} ? ' ' . $object->{$name . '_state'} : '') . ($object->{$name . '_zip'} ? ', ' . $object->{$name . '_zip'} : '') . ($object->{$name . '_country'} ? '<br />' . $countries[$object->{$name . '_country'}] : ''); $output .= '</div>'; echo $output; }
/** * @deprecated */ public function typeSelect() { trigger_error("CResource->typeSelect() has been deprecated in v3.0 and will be removed in v4.0. Please use w2PgetSysVal('ResourceTypes') instead.", E_USER_NOTICE); $typelist = w2PgetSysVal('ResourceTypes'); if (!count($typelist)) { include W2P_BASE_DIR . '/modules/resources/setup.php'; $setup = new SResource(); $setup->upgrade('1.0.1'); $typelist = w2PgetSysVal('ResourceTypes'); } return $typelist; }
public function _fetchCustomRecordTypes() { switch ($this->custom_record_type) { case 'TaskCustomFields': $field_types = 'TaskType'; break; case 'CompanyCustomFields': $field_types = 'CompanyType'; break; } $this->custom_record_types = w2PgetSysVal($field_types); }
LICENSE ===================================== The Dayplanner module was built by Klaus Buecher and is released here under modified BSD license (see GNU.org). Uses jquery, jqueryui and fullcalendar. Please see their separate licences. * Copyright (c) 2013/2014 Klaus Buecher (Opto) No warranty whatsoever is given - use at your own risk. See index.php * */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } global $this_day, $prev_day, $next_day, $first_time, $last_time, $company_id, $event_filter, $event_filter_list, $AppUI; // load the event types $types = w2PgetSysVal('EventType'); $links = array(); $df = $AppUI->getPref('SHDATEFORMAT'); $perms =& $AppUI->acl(); $user_id = $AppUI->user_id; $other_users = false; $no_modify = false; if (canView('admin')) { $other_users = true; if (($show_uid = w2PgetParam($_REQUEST, 'show_user_events', 0)) != 0) { $user_id = $show_uid; $no_modify = true; $AppUI->setState('event_user_id', $user_id); } } class CTask_ex extends CTask
if (isset($_GET['pin'])) { $pin = (int) w2PgetParam($_GET, 'pin', 0); $msg = ''; // load the record data if ($pin) { $msg = CTask::pinUserTask($AppUI->user_id, $task_id); } else { $msg = CTask::unpinUserTask($AppUI->user_id, $task_id); } if (!$msg) { $AppUI->setMsg($msg, UI_MSG_ERROR, true); } $AppUI->redirect('', -1); } $durnTypes = w2PgetSysVal('TaskDurationType'); $taskPriority = w2PgetSysVal('TaskPriority'); $task_project = (int) w2PgetParam($_GET, 'task_project', null); $task_sort_item1 = w2PgetParam($_GET, 'task_sort_item1', ''); $task_sort_type1 = w2PgetParam($_GET, 'task_sort_type1', ''); $task_sort_item2 = w2PgetParam($_GET, 'task_sort_item2', ''); $task_sort_type2 = w2PgetParam($_GET, 'task_sort_type2', ''); $task_sort_order1 = (int) w2PgetParam($_GET, 'task_sort_order1', 0); $task_sort_order2 = (int) w2PgetParam($_GET, 'task_sort_order2', 0); if (isset($_POST['show_task_options'])) { $AppUI->setState('TaskListShowIncomplete', w2PgetParam($_POST, 'show_incomplete', 0)); } $showIncomplete = $AppUI->getState('TaskListShowIncomplete', 0); $project = new CProject(); $allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'p.project_id'); $where_list = count($allowedProjects) ? implode(' AND ', $allowedProjects) : ''; $working_hours = $w2Pconfig['daily_working_hours'] ? $w2Pconfig['daily_working_hours'] : 8;
$AppUI->redirect('m=public&a=access_denied'); } $perms =& $AppUI->acl(); $countries = w2PgetSysVal('GlobalCountries'); // retrieve any state parameters $searchString = w2PgetParam($_GET, 'search_string', ''); if ($searchString != '') { $AppUI->setState('ContIdxWhere', $searchString); } $where = $AppUI->getState('ContIdxWhere') ? $AppUI->getState('ContIdxWhere') : '%'; $orderby = 'contact_first_name'; $search_map = array($orderby, 'contact_first_name', 'contact_last_name'); // optional fields shown in the list (could be modified to allow brief and verbose, etc) $showfields = array('contact_address1' => 'contact_address1', 'contact_address2' => 'contact_address2', 'contact_city' => 'contact_city', 'contact_state' => 'contact_state', 'contact_zip' => 'contact_zip', 'contact_country' => 'contact_country', 'contact_company' => 'contact_company', 'company_name' => 'company_name', 'dept_name' => 'dept_name', 'contact_phone' => 'contact_phone', 'contact_email' => 'contact_email', 'contact_job' => 'contact_job'); $contactMethods = array('phone_alt', 'phone_mobile', 'phone_fax'); $methodLabels = w2PgetSysVal('ContactMethods'); // assemble the sql statement $rows = CContact::searchContacts($AppUI, $where); $carr[] = array(); $carrWidth = 4; $carrHeight = 4; $rn = count($rows); $t = ceil($rn / $carrWidth); if ($rn < $carrWidth * $carrHeight) { $i = 0; for ($y = 0; $y < $carrWidth; $y++) { $x = 0; while ($x < $carrHeight && isset($rows[$i]) && ($row = $rows[$i])) { $carr[$y][] = $row; $x++; $i++;
$titleBlock->addCrumb('?m=system', 'system admin'); $titleBlock->addCrumb('?m=system&a=addeditpref', 'default user preferences'); $titleBlock->show(); // prepare the automated form fields based on db system configuration data $output = null; $last_group = ''; foreach ($rs as $c) { $tooltip = $AppUI->_($c['config_name'] . '_tooltip'); // extraparse the checkboxes and the select lists $extra = ''; $value = ''; switch ($c['config_type']) { case 'select': // Build the select list. if ($c['config_name'] == 'system_timezone') { $timezones = w2PgetSysVal('Timezones'); $entry = arraySelect($timezones, 'w2Pcfg[system_timezone]', 'class=text size=1', w2PgetConfig('system_timezone'), true); } else { $entry = '<select class="text" name="w2Pcfg[' . $c['config_name'] . ']">'; // Find the detail relating to this entry. $children = $w2Pcfg->getChildren($c['config_id']); foreach ($children as $child) { $entry .= '<option value="' . $child['config_list_name'] . '"'; if ($child['config_list_name'] == $c['config_value']) { $entry .= ' selected="selected"'; } $entry .= '>' . $AppUI->_($child['config_list_name'] . '_item_title') . '</option>'; } $entry .= '</select>'; } break;
public function indexStrings() { global $w2Pconfig; $nwords_indexed = 0; /* Workaround for indexing large files: ** Based on the value defined in config data, ** files with file_size greater than specified limit ** are not indexed for searching. ** Negative value :<=> no filesize limit */ $index_max_file_size = w2PgetConfig('index_max_file_size', 0); if ($this->file_size > 0 && ($index_max_file_size < 0 || (int) $this->file_size <= $index_max_file_size * 1024)) { // get the parser application $parser = $w2Pconfig['parser_' . $this->file_type]; if (!$parser) { $parser = $w2Pconfig['parser_default']; } if (!$parser) { return false; } // buffer the file $this->_filepath = W2P_BASE_DIR . '/files/' . $this->file_project . '/' . $this->file_real_filename; if (file_exists($this->_filepath)) { $fp = fopen($this->_filepath, 'rb'); $x = fread($fp, $this->file_size); fclose($fp); // parse it $parser = $parser . ' ' . $this->_filepath; $pos = strpos($parser, '/pdf'); /* * TODO: I *really* hate using error surpression here and I would * normally just detect if safe_mode is on and if it was, skip * this call. Unfortunately, safe_mode has been deprecated in * 5.3 and will be removed in 5.4 */ if (false !== $pos) { $x = @shell_exec(`{$parser} -`); } else { $x = @shell_exec(`{$parser}`); } // if nothing, return if (strlen($x) < 1) { return 0; } // remove punctuation and parse the strings $x = str_replace(array('.', ',', '!', '@', '(', ')'), ' ', $x); $warr = explode(' ', $x); $wordarr = array(); $nwords = count($warr); for ($x = 0; $x < $nwords; $x++) { $newword = $warr[$x]; if (!preg_match('[!"#$%&\'()*+,\\-./:;<=>?@[\\\\]^_`{|}~]', $newword) && mb_strlen(mb_trim($newword)) > 2 && !preg_match('[0-9]', $newword)) { $wordarr[$newword] = $x; } } // filter out common strings $ignore = w2PgetSysVal('FileIndexIgnoreWords'); $ignore = str_replace(' ,', ',', $ignore); $ignore = str_replace(', ', ',', $ignore); $ignore = explode(',', $ignore); foreach ($ignore as $w) { unset($wordarr[$w]); } $nwords_indexed = count($wordarr); // insert the strings into the table while (list($key, $val) = each($wordarr)) { $q = new w2p_Database_Query(); $q->addTable('files_index'); $q->addReplace('file_id', $this->file_id); $q->addReplace('word', $key); $q->addReplace('word_placement', $val); $q->exec(); $q->clear(); } } else { //TODO: if the file doesn't exist.. should we delete the db record? } } $q = new w2p_Database_Query(); $q->addTable('files'); $q->addUpdate('file_indexed', 1); $q->addWhere('file_id = ' . $this->file_id); $q->exec(); return $nwords_indexed; }
public function indexStrings() { global $AppUI, $w2Pconfig; $nwords_indexed = 0; /* Workaround for indexing large files: ** Based on the value defined in config data, ** files with file_size greater than specified limit ** are not indexed for searching. ** Negative value :<=> no filesize limit */ $index_max_file_size = w2PgetConfig('index_max_file_size', 0); if ($index_max_file_size < 0 || $obj->file_size <= $index_max_file_size * 1024) { // get the parser application $parser = $w2Pconfig['parser_' . $this->file_type]; if (!$parser) { $parser = $w2Pconfig['parser_default']; } if (!$parser) { return false; } // buffer the file $this->_filepath = W2P_BASE_DIR . '/files/' . $this->file_project . '/' . $this->file_real_filename; $fp = fopen($this->_filepath, 'rb'); $x = fread($fp, $this->file_size); fclose($fp); // parse it $parser = $parser . ' ' . $this->_filepath; $pos = strpos($parser, '/pdf'); if (false !== $pos) { $x = `{$parser} -`; } else { $x = `{$parser}`; } // if nothing, return if (strlen($x) < 1) { return 0; } // remove punctuation and parse the strings $x = str_replace(array('.', ',', '!', '@', '(', ')'), ' ', $x); $warr = explode(' ', $x); $wordarr = array(); $nwords = count($warr); for ($x = 0; $x < $nwords; $x++) { $newword = $warr[$x]; if (!preg_match('[[:punct:]]', $newword) && mb_strlen(mb_trim($newword)) > 2 && !preg_match('[[:digit:]]', $newword)) { $wordarr[$newword] = $x; } } // filter out common strings $ignore = w2PgetSysVal('FileIndexIgnoreWords'); $ignore = str_replace(' ,', ',', $ignore); $ignore = str_replace(', ', ',', $ignore); $ignore = explode(',', $ignore); foreach ($ignore as $w) { unset($wordarr[$w]); } $nwords_indexed = count($wordarr); // insert the strings into the table while (list($key, $val) = each($wordarr)) { $q = new DBQuery(); $q->addTable('files_index'); $q->addReplace('file_id', $this->file_id); $q->addReplace('word', $key); $q->addReplace('word_placement', $val); $q->exec(); $q->clear(); } } return $nwords_indexed; }
} $action = $del ? 'deleted' : 'stored'; $result = $del ? $obj->delete() : $obj->store(); $redirect = $del ? 'm=projects' : 'm=projects&a=view&project_id=' . $obj->project_id; $notify_owner = w2PgetParam($_POST, 'email_project_owner_box', 'off'); $notify_contacts = w2PgetParam($_POST, 'email_project_contacts_box', 'off'); $notfiyTrigger = $del ? 1 : $obj->project_id; $importTask_projectId = (int) w2PgetParam($_POST, 'import_tasks_from', '0'); if (is_array($result)) { $AppUI->setMsg($result, UI_MSG_ERROR); $AppUI->holdObject($obj); $AppUI->redirect('m=projects&a=addedit'); } if ($result) { if (!$del) { $billingCategory = w2PgetSysVal('BudgetCategory'); $budgets = array(); foreach ($billingCategory as $id => $category) { $budgets[$id] = w2PgetParam($_POST, 'budget_' . $id, 0); } $obj->storeBudget($budgets); } if ($importTask_projectId) { $import_result = $obj->importTasks($importTask_projectId); if (is_array($import_result) && count($import_result)) { $AppUI->setMsg($import_result, UI_MSG_ERROR, true); $AppUI->holdObject($obj); $AppUI->redirect('m=projects&a=addedit'); } } if ('on' == $notify_owner) {
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $tab = $AppUI->processIntState('ResourceTypeTab', $_GET, 'tab', 0); $obj = new CResource(); $perms =& $AppUI->acl(); $canEdit = canEdit('resources'); $titleBlock = new w2p_Theme_TitleBlock('Resources', 'icon.png', $m); if ($canEdit) { $titleBlock->addButton('new resource', '?m=resources&a=addedit'); } $titleBlock->show(); $resource_types = w2PgetSysVal('ResourceTypes'); $tabBox = new CTabBox('?m=resources', W2P_BASE_DIR . '/modules/resources/', $tab); if ($tabBox->isTabbed()) { array_unshift($resource_types, $AppUI->_('All Resources', UI_OUTPUT_RAW)); } foreach ($resource_types as $resource_type) { $tabBox->add('vw_resources', $resource_type); } $tabBox->show();
?> </tr> <?php // Pull the task comments $task = new CTask(); //TODO: this method should be moved to CTaskLog $logs = $task->getTaskLogs($task_id, $problem); $s = ''; $hrs = 0; $canEdit = canEdit('task_log'); $htmlHelper = new w2p_Output_HTMLHelper($AppUI); $billingCategory = w2PgetSysVal('BudgetCategory'); $durnTypes = w2PgetSysVal('TaskDurationType'); $taskLogReference = w2PgetSysVal('TaskLogReference'); $status = w2PgetSysVal('TaskStatus'); $task_types = w2PgetSysVal('TaskType'); $customLookups = array('budget_category' => $billingCategory, 'task_duration_type' => $durnTypes, 'task_log_reference' => $taskLogReference, 'task_status' => $status, 'task_type' => $task_types); if (count($logs)) { foreach ($logs as $row) { $s .= '<tr bgcolor="white" valign="top"><td>'; if ($canEdit) { $s .= '<a href="?m=tasks&a=view&task_id=' . $task_id . '&tab='; $s .= $tab == -1 ? $AppUI->getState('TaskLogVwTab') : '1'; $s .= '&task_log_id=' . $row['task_log_id'] . '">' . w2PshowImage('icons/stock_edit-16.png', 16, 16, '') . '</a>'; } $s .= '<a name="tasklog' . $row['task_log_id'] . '"></a>'; $s .= '</td>'; $htmlHelper->stageRowData($row); foreach ($fieldList as $index => $column) { $s .= $htmlHelper->createCell($fieldList[$index], $row[$fieldList[$index]], $customLookups); }
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('Owner'); ?> :</td> <?php echo $htmlHelper->createCell('task_owner', $obj->task_owner_name); ?> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Priority'); ?> :</td> <td class="hilite"> <?php $task_priotities = w2PgetSysVal('TaskPriority'); echo $AppUI->_($task_priotities[$obj->task_priority]); ?> </td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Web Address'); ?> :</td> <?php echo $htmlHelper->createCell('task_related_url', $obj->task_related_url); ?> </tr> <tr> <td align="right" nowrap="nowrap"><?php
$AppUI->setState('CompIdxOrderDir', $orderdir); } $orderby = $AppUI->getState('CompIdxOrderBy') ? $AppUI->getState('CompIdxOrderBy') : 'company_name'; $orderdir = $AppUI->getState('CompIdxOrderDir') ? $AppUI->getState('CompIdxOrderDir') : 'asc'; $owner_filter_id = $AppUI->processIntState('owner_filter_id', $_POST, 'owner_filter_id', 0); $search_string = w2PgetParam($_POST, 'search_string', ''); $search_string = w2PformSafe($search_string, true); $company = new CCompany(); $canCreate = $company->canCreate(); $perms =& $AppUI->acl(); $baseArray = array(0 => $AppUI->_('All', UI_OUTPUT_RAW)); $allowedArray = $perms->getPermittedUsers('companies'); $owner_list = is_array($allowedArray) ? $baseArray + $allowedArray : $baseArray; // setup the title block $titleBlock = new w2p_Theme_TitleBlock('Companies', 'icon.png', $m); $titleBlock->addSearchCell($search_string); $titleBlock->addFilterCell('Owner', 'owner_filter_id', $owner_list, $owner_filter_id); if ($canCreate) { $titleBlock->addButton('new company', '?m=companies&a=addedit'); } $titleBlock->show(); // load the company types $companyTypes = w2PgetSysVal('CompanyType'); $tabBox = new CTabBox('?m=companies', W2P_BASE_DIR . '/modules/companies/', $tab); if ($tabBox->isTabbed()) { array_unshift($companyTypes, $AppUI->_('All Companies', UI_OUTPUT_RAW)); } foreach ($companyTypes as $type_name) { $tabBox->add('vw_companies', $type_name); } $tabBox->show();
<input type="checkbox" name="show_empty_date" id="show_empty_date" onclick="document.form_buttons.submit()" <?php echo $showEmptyDate ? 'checked="checked"' : ''; ?> /> </td> <td nowrap="nowrap"> <label for="show_empty_date"><?php echo $AppUI->_('Empty Dates'); ?> </label> </td> </tr> <tr> <td colspan = "12" align="right"> <?php $types = array('' => '(Task Type Filter)') + w2PgetSysVal('TaskType'); echo arraySelect($types, 'task_type', 'class="text" onchange="document.form_buttons.submit()"', $task_type, true); ?> </td> </tr> </table> </form> <form name="form" method="post" action="index.php?<?php echo "m={$m}&a={$a}&date={$date}"; ?> " accept-charset="utf-8"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th width="10"> </th> <th width="10"><?php echo $AppUI->_('Pin');
$canAddProject = $canRead; if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $task = new CTask(); $tasks = $task->getAllowedRecords($AppUI->user_id, 'task_id,task_name', 'task_name', null, $extra); $tasks = arrayMerge(array('0' => $AppUI->_('(None)', UI_OUTPUT_RAW)), $tasks); $canViewTasks = canView('tasks'); $canAddTasks = canAdd('tasks'); $canEditTasks = canEdit('tasks'); $canDeleteTasks = canDelete('tasks'); // get ProjectPriority from sysvals $projectPriority = w2PgetSysVal('ProjectPriority'); $projectPriorityColor = w2PgetSysVal('ProjectPriorityColor'); $pstatus = w2PgetSysVal('ProjectStatus'); $ptype = w2PgetSysVal('ProjectType'); $priorities = w2Pgetsysval('TaskPriority'); $types = w2Pgetsysval('TaskType'); $project = new CProject(); // load the record data $project->loadFull($AppUI, $project_id); $obj = $project; if (!$project) { $AppUI->setMsg('Project'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } global $w2Pconfig; $task = new CTask();
<?php /* $Id: vw_usr.php 1595 2011-01-17 07:37:10Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/admin/vw_usr.php $ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $utypes = w2PgetSysVal('UserType'); ?> <table cellpadding="2" cellspacing="1" border="0" width="100%" class="tbl"> <tr> <th> </th> <?php if (w2PgetParam($_REQUEST, 'tab', 0) == 0) { ?> <th width="125"> <?php echo $AppUI->_('Login History'); ?> </th> <?php } $fieldList = array('user_username', 'contact_last_name', 'user_type', 'company_name', 'dept_name'); $fieldNames = array('Login Name', 'Real Name', 'Type', 'Company', 'Department'); foreach ($fieldNames as $index => $name) { ?> <th nowrap="nowrap"> <a href="?m=admin&orderby=<?php echo $fieldList[$index]; ?>
<?php /* $Id: projects.class.php 2024 2011-08-08 04:38:24Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/projects/projects.class.php $ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } /** * @package web2Project * @subpackage modules * @version $Revision: 2024 $ */ // project statii $pstatus = w2PgetSysVal('ProjectStatus'); $ptype = w2PgetSysVal('ProjectType'); $ppriority_name = w2PgetSysVal('ProjectPriority'); $ppriority_color = w2PgetSysVal('ProjectPriorityColor'); $priority = array(); foreach ($ppriority_name as $key => $val) { $priority[$key]['name'] = $val; } foreach ($ppriority_color as $key => $val) { $priority[$key]['color'] = $val; } /* // kept for reference $priority = array( -1 => array( 'name' => 'low', 'color' => '#E5F7FF' ), 0 => array(
function file_show_attr() { global $AppUI, $obj, $ci, $canAdmin, $projects, $file_project, $file_task, $task_name, $preserve, $file_helpdesk_item; if ($ci) { $str_out = '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Minor Revision') . '</td><td><input type="Radio" name="revision_type" value="minor" checked />' . '</td><tr><td align="right" nowrap="nowrap">' . $AppUI->_('Major Revision') . '</td><td><input type="Radio" name="revision_type" value="major" /></td>'; } else { $str_out = '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Version') . ':</td>'; } $str_out .= '<td align="left">'; if ($ci || $canAdmin && $obj->file_checkout == 'final') { $str_out .= '<input type="hidden" name="file_checkout" value="" /><input type="hidden" name="file_co_reason" value="" />'; } if ($ci) { $the_value = strlen($obj->file_version) > 0 ? $obj->file_version + 0.01 : '1'; $str_out .= '<input type="hidden" name="file_version" value="' . $the_value . '" />'; } else { $the_value = strlen($obj->file_version) > 0 ? $obj->file_version : '1'; $str_out .= '<input type="text" name="file_version" maxlength="10" size="5" value="' . $the_value . '" class="text" />'; } $str_out .= '</td>'; $select_disabled = ' '; $onclick_task = ' onclick="popTask()" '; if ($ci && $preserve) { $select_disabled = ' disabled="disabled" '; $onclick_task = ' '; // need because when a html is disabled, it's value it's not sent in submit $str_out .= '<input type="hidden" name="file_project" value="' . $file_project . '" />'; $str_out .= '<input type="hidden" name="file_category" value="' . $obj->file_category . '" />'; } // Category $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Category') . ':</td>'; $str_out .= '<td align="left">' . arraySelect(w2PgetSysVal('FileType'), 'file_category', 'class="text"' . $select_disabled, $obj->file_category, true) . '<td>'; // --------------------------------------------------------------------------------- if ($file_helpdesk_item) { $hd_item = new CHelpDeskItem(); $hd_item->load($file_helpdesk_item); //Helpdesk Item $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Helpdesk Item') . ':</td>'; $str_out .= '<td align="left"><strong>' . $hd_item->item_id . ' - ' . $hd_item->item_title . '</strong></td></tr>'; // Project $str_out .= '<input type="hidden" name="file_project" value="' . $file_project . '" />'; // Task $str_out .= '<input type="hidden" name="file_task" value="0" />'; } else { // Project $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Project') . ':</td>'; $str_out .= '<td align="left">' . projectSelectWithOptGroup($AppUI->user_id, 'file_project', 'size="1" class="text" style="width:270px"' . $select_disabled, $file_project) . '</td></tr>'; // --------------------------------------------------------------------------------- // Task $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Task') . ':</td><td align="left" colspan="2" valign="top"><input type="hidden" name="file_task" value="' . $file_task . '" /><input type="text" class="text" name="task_name" value="' . $task_name . '" size="40" disabled /><input type="button" class="button" value="' . $AppUI->_('select task') . '..."' . $onclick_task . '/></td></tr>'; } return $str_out; }
</tr> <tr> <td align="right"><?php echo $AppUI->_('Postcode') . ' / ' . $AppUI->_('Zip Code'); ?> :</td> <td colspan="2"><input type="text" class="text" name="contact_zip" value="" maxlength="50" size="40" /> </td> </tr> <tr> <td align="right"><?php echo $AppUI->_('Country'); ?> :</td> <td colspan="2"> <?php $countries = array('' => $AppUI->_('(Select a Country)')) + w2PgetSysVal('GlobalCountries'); echo arraySelect($countries, 'contact_country', 'size="1" class="text"', 0); ?> </td> </tr> <tr> <td valign="middle" align="right">* <?php echo $AppUI->_('Anti Spam Security'); ?> :</td> <td valign="middle" width="50"><input type="text" class="text" id="spam" name="spam_check" value="" maxlength="5" size="5" /></td> <td valign="middle" align="left"><img src="<?php echo W2P_BASE_URL; ?> /lib/captcha/CaptchaImage.php?uid=54;<?php echo $uid;
// we are editing an existing task $canEdit = $perms->checkModuleItem('tasks', 'edit', $task_id); } else { // do we have access on this project? $canEdit = $perms->checkModuleItem('projects', 'view', $task_project); // And do we have add permission to tasks? if ($canEdit) { $canEdit = $perms->checkModule('tasks', 'add'); } } if (!$canEdit) { $AppUI->redirect('m=public&a=access_denied&err=noedit'); } //check permissions for the associated project $canReadProject = $perms->checkModuleItem('projects', 'view', $task->task_project); $durnTypes = w2PgetSysVal('TaskDurationType'); // check the document access (public, participant, private) if (!$task->canAccess($AppUI->user_id)) { $AppUI->redirect('m=public&a=access_denied&err=noaccess'); } // pull the related project $project = new CProject(); $project->load($task_project); //Pull all users // TODO: There's an issue that can arise if a user is assigned full access to // a company which is not their own. They will be allowed to create // projects but not create tasks since the task_owner dropdown does not get // populated by the "getPermittedUsers" function. $users = $perms->getPermittedUsers('tasks'); function getSpaces($amount) {
?> " /> <input type="hidden" name="opt_view_addtsks" value="<?php echo isset($view_options[0]['pd_option_view_addtasks']) ? $view_options[0]['pd_option_view_addtasks'] : 1; ?> " /> <input type="hidden" name="opt_view_files" value="<?php echo isset($view_options[0]['pd_option_view_files']) ? $view_options[0]['pd_option_view_files'] : 1; ?> " /> </form> <?php $priorities = w2Pgetsysval('TaskPriority'); $types = w2Pgetsysval('TaskType'); $durntype = w2PgetSysVal('TaskDurationType'); global $task_access; $task_access = is_array($task_access) ? $task_access : array(); $extra = array(0 => '(none)', 1 => 'Milestone', 2 => 'Dynamic Task', 3 => 'Inactive Task'); $sel_priorities = arraySelect($priorities, 'add_task_priority0', 'style="width:80px" class="text"', '0'); $sel_types = arraySelect($types, 'add_task_type0', 'style="width:80px" class="text"', ''); $sel_access = arraySelect($task_access, 'add_task_access0', 'style="width:80px" class="text"', ''); $sel_extra = arraySelect($extra, 'add_task_extra0', 'style="width:80px" class="text"', ''); $sel_durntype = arraySelect($durntype, 'add_task_durntype0', 'style="width:80px" class="text"', '', true); ?> <script language="javascript"> // security improvement: // some javascript functions may not appear on client side in case of user not having write permissions // else users would be able to arbitrarily run 'bad' functions <?php if ($canEdit) {
$tab = $AppUI->processIntState('LinkIdxTab', $_GET, 'tab', 0); $active = intval(!$AppUI->getState('LinkIdxTab')); // get the list of visible companies $extra = array('from' => 'links', 'where' => 'projects.project_id = link_project'); $project = new CProject(); $projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects'); $projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_JS)), $projects); // setup the title block $titleBlock = new CTitleBlock('Links', 'folder5.png', $m, "{$m}.{$a}"); $titleBlock->addCell($AppUI->_('Search') . ':'); $search = ''; $titleBlock->addCell('<input type="text" class="text" SIZE="10" name="search" onChange="document.searchfilter.submit();" value=' . "'{$search}'" . 'title="' . $AppUI->_('Search in name and description fields', UI_OUTPUT_JS) . '"/>', '', '<form action="?m=links" method="post" id="searchfilter" accept-charset="utf-8">', '</form>'); $titleBlock->addCell($AppUI->_('Filter') . ':'); $titleBlock->addCell(arraySelect($projects, 'project_id', 'onChange="document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=links" method="post" accept-charset="utf-8">', '</form>'); if ($canEdit) { $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new link') . '">', '', '<form action="?m=links&a=addedit" method="post" accept-charset="utf-8">', '</form>'); } $titleBlock->show(); $link_types = w2PgetSysVal('LinkType'); if ($tab != -1) { array_unshift($link_types, 'All Links'); } array_map(array($AppUI, '_'), $link_types); $tabBox = new CTabBox('?m=links', W2P_BASE_DIR . '/modules/links/', $tab); $i = 0; foreach ($link_types as $link_type) { $tabBox->add('index_table', $link_type); ++$i; } $showProject = true; $tabBox->show();
/** * Email the task log to assignees, task contacts, project contacts, and others * based upon the information supplied by the user. */ public function email_log(&$log, $assignees, $task_contacts, $project_contacts, $others, $extras, $specific_user = 0) { global $AppUI, $locale_char_set, $w2Pconfig; $mail_recipients = array(); $q = new w2p_Database_Query(); if ((int) $this->task_id > 0 && (int) $this->task_project > 0) { $q->addTable('users', 'u'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_first_name, c.contact_last_name'); $q->addWhere('u.user_id=' . (int) $log->task_log_creator); $row = $q->loadHash(); $creatorname = htmlspecialchars_decode($row['contact_first_name']) . ' ' . htmlspecialchars_decode($row['contact_last_name']); $q->clear(); if (isset($assignees) && $assignees == 'on') { $q->addTable('user_tasks', 'ut'); $q->leftJoin('users', 'ua', 'ua.user_id = ut.user_id'); $q->leftJoin('contacts', 'c', 'c.contact_id = ua.user_contact'); $q->addQuery('c.contact_first_name, c.contact_last_name, c.contact_email'); $q->addWhere('ut.task_id = ' . $this->task_id); if (!$AppUI->getPref('MAILALL')) { $q->addWhere('ua.user_id <>' . (int) $AppUI->user_id); } $assigneeList = $q->loadList(); $q->clear(); foreach ($assigneeList as $myContact) { $mail_recipients[$myContact['contact_email']] = mb_trim($myContact['contact_first_name'] . ' ' . $myContact['contact_last_name']); } } if (isset($task_contacts) && $task_contacts == 'on') { $q->addTable('task_contacts', 'tc'); $q->leftJoin('contacts', 'c', 'c.contact_id = tc.contact_id'); $q->addQuery('c.contact_first_name, c.contact_last_name, c.contact_email'); $q->addWhere('tc.task_id = ' . $this->task_id); $contactList = $q->loadList(); $q->clear(); foreach ($contactList as $myContact) { $mail_recipients[$myContact['contact_email']] = mb_trim($myContact['contact_first_name'] . ' ' . $myContact['contact_last_name']); } } if (isset($project_contacts) && $project_contacts == 'on') { $q->addTable('project_contacts', 'pc'); $q->leftJoin('contacts', 'c', 'c.contact_id = pc.contact_id'); $q->addQuery('c.contact_first_name, c.contact_last_name, c.contact_email'); $q->addWhere('pc.project_id = ' . $this->task_project); $projectContactList = $q->loadList(); $q->clear(); foreach ($projectContactList as $myContact) { $mail_recipients[$myContact['contact_email']] = mb_trim($myContact['contact_first_name'] . ' ' . $myContact['contact_last_name']); } } if (isset($others)) { $others = trim($others, " \r\n\t,"); // get rid of empty elements. if (strlen($others) > 0) { $q->addTable('contacts', 'c'); $q->addQuery('c.contact_first_name, c.contact_last_name, c.contact_email'); $q->addWhere('c.contact_id IN (' . $others . ')'); $otherContacts = $q->loadList(); $q->clear(); foreach ($otherContacts as $myContact) { $mail_recipients[$myContact['contact_email']] = mb_trim($myContact['contact_first_name'] . ' ' . $myContact['contact_last_name']); } } } if (isset($extras) && $extras) { // Search for semi-colons, commas or spaces and allow any to be separators $extra_list = preg_split('/[\\s,;]+/', $extras); foreach ($extra_list as $email) { if ($email && !isset($mail_recipients[$email])) { $mail_recipients[$email] = trim($email); } } } $q->clear(); // Reset to the default state. // If this should be sent to a specific user, add their contact details here if (isset($specific_user) && $specific_user) { $q->addTable('users', 'u'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_first_name, c.contact_last_name'); $q->leftJoin('contacts_methods', 'cm', 'cm.contact_id = c.contact_id'); $q->addWhere("cm.method_name = 'email_primary'"); $q->addQuery('cm.method_value AS contact_email'); $q->addWhere('u.user_id = ' . $specific_user); $su_list = $q->loadList(); foreach ($su_list as $su_contact) { $mail_recipients[$su_contact['contact_email']] = mb_trim($su_contact['contact_first_name'] . ' ' . $su_contact['contact_last_name']); } } if (count($mail_recipients) == 0) { return false; } // Build the email and send it out. $char_set = isset($locale_char_set) ? $locale_char_set : ''; $mail = new w2p_Utilities_Mail(); // Grab the subject from user preferences $prefix = $AppUI->getPref('TASKLOGSUBJ'); $mail->Subject($prefix . ' ' . $log->task_log_name, $char_set); $q->addTable('projects'); $q->addQuery('project_name'); $q->addWhere('project_id=' . (int) $this->task_project); $projname = htmlspecialchars_decode($q->loadResult()); $q->clear(); $body = $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $projname . "\n"; if ($this->task_parent != $this->task_id) { $q->addTable('tasks'); $q->addQuery('task_name'); $q->addWhere('task_id = ' . (int) $this->task_parent); $req =& $q->exec(QUERY_STYLE_NUM); if ($req) { $body .= $AppUI->_('Parent Task', UI_OUTPUT_RAW) . ': ' . htmlspecialchars_decode($req->fields[0]) . "\n"; } $q->clear(); } $body .= $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n"; $task_types = w2PgetSysVal('TaskType'); $body .= $AppUI->_('Task Type', UI_OUTPUT_RAW) . ':' . $task_types[$this->task_type] . "\n"; $body .= $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . "\n\n"; $body .= "------------------------\n\n"; $body .= $AppUI->_('User', UI_OUTPUT_RAW) . ': ' . $creatorname . "\n"; $body .= $AppUI->_('Hours', UI_OUTPUT_RAW) . ': ' . $log->task_log_hours . "\n"; $body .= $AppUI->_('Summary', UI_OUTPUT_RAW) . ': ' . $log->task_log_name . "\n\n"; $body .= $log->task_log_description; // Append the user signature to the email - if it exists. $q->addTable('users'); $q->addQuery('user_signature'); $q->addWhere('user_id = ' . (int) $AppUI->user_id); if ($res = $q->exec()) { if ($res->fields['user_signature']) { $body .= "\n--\n" . $res->fields['user_signature']; } } $q->clear(); $mail->Body($body, $char_set); $recipient_list = ''; $toList = array(); foreach ($mail_recipients as $email => $name) { if ($mail->ValidEmail($email)) { $toList[$email] = $email; $recipient_list .= $email . ' (' . $name . ")\n"; } else { $recipient_list .= "Invalid email address '{$email}' for '{$name}' not sent \n"; } } $sendToList = array_keys($mail_recipients); $mail->SendSeparatelyTo($sendToList); // Now update the log $save_email = $AppUI->getPref('TASKLOGNOTE'); if ($save_email) { //TODO: This is where #38 - http://bugs.web2project.net/view.php?id=38 - should be applied if a change is necessary. $log->task_log_description .= "\n" . 'Emailed ' . date('l F j, Y H:i:s') . ' to:' . "\n" . $recipient_list; return true; } } return false; // No update needed. }
$object->load($object_id); } if (!$object && $object_id > 0) { $AppUI->setMsg('Company'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect('m=' . $m); } // setup the title block $ttl = $object_id > 0 ? 'Edit Company' : 'Add Company'; $titleBlock = new w2p_Theme_TitleBlock($ttl, 'icon.png', $m); $titleBlock->addCrumb('?m=' . $m, $m . ' list'); $titleBlock->addViewLink('company', $object_id); $titleBlock->show(); // load the company types $types = w2PgetSysVal('CompanyType'); $countries = array('' => $AppUI->_('(Select a Country)')) + w2PgetSysVal('GlobalCountriesPreferred') + array('-' => '----') + w2PgetSysVal('GlobalCountries'); ?> <script language="javascript" type="text/javascript"> function submitIt() { var form = document.editFrm; if (form.company_name.value.length < 3) { alert( "<?php echo $AppUI->_('companyValidName', UI_OUTPUT_JS); ?> " ); form.company_name.focus(); } else { form.submit(); } } </script>
<?php /* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } global $search_string, $owner_filter_id, $currentTabId, $orderby, $orderdir; $types = w2PgetSysVal('DepartmentType'); $dept_type_filter = $currentTabId - 1; // get any records denied from viewing $dept = new CDepartment(); $depts = $dept->getFilteredDepartmentList(null, $dept_type_filter, $search_string, $owner_filter_id, $orderby, $orderdir); ?> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl list"> <tr> <?php $fieldList = array(); $fieldNames = array(); $module = new w2p_Core_Module(); $fields = $module->loadSettings('departments', 'index_list'); if (count($fields) > 0) { $fieldList = array_keys($fields); $fieldNames = array_values($fields); } else { // TODO: This is only in place to provide an pre-upgrade-safe // state for versions earlier than v3.0 // At some point at/after v4.0, this should be deprecated $fieldList = array('dept_name', 'countp', 'inactive', 'dept_type'); $fieldNames = array('Department Name', 'Active Projects', 'Archived Projects', 'Type'); } //TODO: The link below is commented out because this module doesn't support sorting... yet.
<input type="hidden" name="dosql" value="do_company_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="company_id" value="<?php echo $company_id; ?> " /> </form> <?php } ?> <?php // load the list of project statii and company types $pstatus = w2PgetSysVal('ProjectStatus'); $types = w2PgetSysVal('CompanyType'); $countries = w2PgetSysVal('GlobalCountries'); ?> <table border="0" cellpadding="4" cellspacing="0" width="100%" class="std"> <tr> <td valign="top" width="50%"> <strong><?php echo $AppUI->_('Details'); ?> </strong> <table cellspacing="1" cellpadding="2" width="100%"> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Company'); ?> :</td>
<?php /* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } global $AppUI, $company_id, $dept_ids, $department, $locale_char_set, $proFilter, $projectStatus, $showInactive, $showLabels, $showAllGantt, $user_id, $w2Pconfig, $project_id, $project_original_id; w2PsetExecutionConditions($w2Pconfig); // get the prefered date format $df = $AppUI->getPref('SHDATEFORMAT'); $projectStatus = w2PgetSysVal('ProjectStatus'); $projectStatus = arrayMerge(array('-2' => $AppUI->_('All w/o in progress')), $projectStatus); $user_id = w2PgetParam($_REQUEST, 'user_id', $AppUI->user_id); if ($AppUI->user_id == $user_id) { $projectStatus = arrayMerge(array('-3' => $AppUI->_('My projects')), $projectStatus); } else { $projectStatus = arrayMerge(array('-3' => $AppUI->_('User\'s projects')), $projectStatus); } $proFilter = w2PgetParam($_REQUEST, 'proFilter', '0'); $company_id = w2PgetParam($_REQUEST, 'company_id', 0); $department = w2PgetParam($_REQUEST, 'department', 0); $showLabels = w2PgetParam($_REQUEST, 'showLabels', 1); $showInactive = w2PgetParam($_REQUEST, 'showInactive', 1); $original_project_id = w2PgetParam($_REQUEST, 'original_project_id', 1); $pjobj = new CProject(); $working_hours = $w2Pconfig['daily_working_hours']; // pull valid projects and their percent complete information // GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours $q = new w2p_Database_Query(); $q->addTable('projects', 'pr'); $q->addQuery('DISTINCT pr.project_id, project_color_identifier, project_name, project_start_date, project_end_date,
<td align="left" class="hilite"><?php echo $link->contact_first_name . ' ' . $link->contact_last_name; ?> </td> </tr> <?php } ?> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Category'); ?> :</td> <td align="left"> <?php echo arraySelect(w2PgetSysVal('LinkType'), 'link_category', '', $link->link_category, true); ?> <td> </tr> <tr> <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Project'); ?> :</td> <td align="left"> <?php echo arraySelect($projects, 'link_project', 'size="1" class="text" style="width:270px"', $link->link_project); ?> </td> </tr> <tr>