Example #1
0
 function browseOrgsAction()
 {
     $visit = CerberusApplication::getVisit();
     /* @var $visit CerberusVisit */
     $request = DevblocksPlatform::getHttpRequest();
     $stack = $request->path;
     array_shift($stack);
     // contacts
     array_shift($stack);
     // browseOrgs
     @($id = array_shift($stack));
     $org = DAO_ContactOrg::get($id);
     if (empty($org)) {
         echo "<H1>Invalid Organization ID.</H1>";
         return;
     }
     // Display series support (inherited paging from Display)
     @($view_id = array_shift($stack));
     if (!empty($view_id)) {
         $view = C4_AbstractViewLoader::getView($view_id);
         $range = 250;
         $block_size = 250;
         $page = floor($view->renderLimit * $view->renderPage / $block_size);
         list($series, $series_count) = DAO_ContactOrg::search($view->view_columns, $view->params, $block_size, $page, $view->renderSortBy, $view->renderSortAsc, false);
         $series_info = array('title' => $view->name, 'total' => count($series), 'series' => array_flip(array_keys($series)));
         $visit->set('ch_org_series', $series_info);
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('contacts', 'orgs', 'display', $org->id)));
     exit;
 }
Example #2
0
 /**
  * Open an event, mark it read, and redirect to its URL.
  * Used by Home->Notifications view.
  *
  */
 function redirectReadAction()
 {
     $worker = PortSensorApplication::getActiveWorker();
     $request = DevblocksPlatform::getHttpRequest();
     $stack = $request->path;
     array_shift($stack);
     // home
     array_shift($stack);
     // redirectReadAction
     @($id = array_shift($stack));
     // id
     if (null != ($event = DAO_WorkerEvent::get($id))) {
         // Mark as read before we redirect
         DAO_WorkerEvent::update($id, array(DAO_WorkerEvent::IS_READ => 1));
         DAO_WorkerEvent::clearCountCache($worker->id);
         session_write_close();
         header("Location: " . $event->url);
     }
     exit;
 }
Example #3
0
 function renderLoginForm()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->cache_lifetime = "0";
     // add translations for calls from classes that aren't Page Extensions (mobile plugin, specifically)
     $translate = DevblocksPlatform::getTranslationService();
     $tpl->assign('translate', $translate);
     // set up redirect (to return to original page if redirected to login page)
     $request = DevblocksPlatform::getHttpRequest();
     $prefix = '';
     $query_str = '';
     foreach ($request->query as $key => $val) {
         $query_str .= $prefix . $key . '=' . $val;
         $prefix = '&';
     }
     $original_path = sizeof($request->path) == 0 ? 'login' : implode(',', $request->path);
     $tpl->assign('original_path', $original_path);
     $tpl->assign('original_query', $query_str);
     // TODO: pull this from a config area
     $server = 'localhost';
     $port = '10389';
     $default_dn = 'cn=William Bush,ou=people,o=sevenSeas';
     $tpl->assign('server', $server);
     $tpl->assign('port', $port);
     $tpl->assign('default_dn', $default_dn);
     // display login form
     $tpl->display('file:' . dirname(dirname(__FILE__)) . '/templates/login/login_form_ldap.tpl');
 }
Example #4
0
 function browseAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $visit = CerberusApplication::getVisit();
     /* @var $visit CerberusVisit */
     $request = DevblocksPlatform::getHttpRequest();
     $stack = $request->path;
     array_shift($stack);
     // display
     array_shift($stack);
     // browse
     @($id = array_shift($stack));
     // [JAS]: Mask
     if (!is_numeric($id)) {
         $id = DAO_Ticket::getTicketIdByMask($id);
     }
     $ticket = DAO_Ticket::getTicket($id);
     if (empty($ticket)) {
         echo "<H1>" . $translate->_('display.invalid_ticket') . "</H1>";
         return;
     }
     // Display series support (inherited paging from Display)
     @($view_id = array_shift($stack));
     if (!empty($view_id)) {
         $view = C4_AbstractViewLoader::getView('', $view_id);
         // Restrict to the active worker's groups
         $active_worker = CerberusApplication::getActiveWorker();
         $memberships = $active_worker->getMemberships();
         $view->params['tmp'] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships));
         $range = 250;
         // how far to jump ahead of the current page
         $block_size = 250;
         $page = floor($view->renderPage * $view->renderLimit / $block_size);
         $index = array();
         $found = false;
         $full = false;
         do {
             list($series, $null) = DAO_Ticket::search(array(SearchFields_Ticket::TICKET_MASK), $view->params, $block_size, $page, $view->renderSortBy, $view->renderSortAsc, false);
             // Index by mask
             foreach ($series as $idx => $val) {
                 // Find our match before we index anything
                 if (!$found && $idx == $id) {
                     $found = true;
                 } elseif (!$found) {
                     // Only keep a max of X things behind our match, reserve the most room ahead
                     if (count($index) == 20) {
                         array_shift($index);
                     }
                 }
                 $index[] = $val[SearchFields_Ticket::TICKET_MASK];
                 // Stop if we fill up our desired rows
                 if (count($index) == $range) {
                     $full = true;
                     break;
                 }
             }
             $page++;
         } while (!empty($series) && !$full);
         $series_info = array('title' => $view->name, 'total' => count($index), 'series' => $index);
         $visit->set('ch_display_series', $series_info);
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display', $ticket->mask)));
 }
Example #5
0
 function browseOppsAction()
 {
     $visit = CerberusApplication::getVisit();
     /* @var $visit CerberusVisit */
     $request = DevblocksPlatform::getHttpRequest();
     $stack = $request->path;
     array_shift($stack);
     // crm
     array_shift($stack);
     // browseOpps
     @($id = array_shift($stack));
     $opp = DAO_CrmOpportunity::get($id);
     if (empty($opp)) {
         echo "<H1>Invalid Opportunity ID.</H1>";
         return;
     }
     // Display series support (inherited paging from Display)
     @($view_id = array_shift($stack));
     if (!empty($view_id)) {
         $view = C4_AbstractViewLoader::getView('', $view_id);
         // Restrict to the active worker's groups
         $active_worker = CerberusApplication::getActiveWorker();
         //			$memberships = $active_worker->getMemberships();
         //			$view->params['tmp'] = new DevblocksSearchCriteria(SearchFields_CrmOpportunity::TEAM_ID, 'in', array_keys($memberships));
         $range = 100;
         $pos = $view->renderLimit * $view->renderPage;
         $page = floor($pos / $range);
         list($series, $series_count) = DAO_CrmOpportunity::search($view->view_columns, $view->params, $range, $page, $view->renderSortBy, $view->renderSortAsc, false);
         $series_info = array('title' => $view->name, 'total' => count($series), 'series' => $series);
         $visit->set('ch_opp_series', $series_info);
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('crm', 'opps', $opp->id)));
     exit;
 }
Example #6
0
 function render()
 {
     // draws HTML form of controls needed for login information
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->cache_lifetime = "0";
     // add translations for calls from classes that aren't Page Extensions (mobile plugin, specifically)
     $translate = DevblocksPlatform::getTranslationService();
     $tpl->assign('translate', $translate);
     $request = DevblocksPlatform::getHttpRequest();
     $prefix = '';
     $query_str = '';
     foreach ($request->query as $key => $val) {
         $query_str .= $prefix . $key . '=' . $val;
         $prefix = '&';
     }
     //$url_service = DevblocksPlatform::getUrlService();
     //$original_url = $url_service->writeDevblocksHttpIO($request);
     //$tpl->assign('original_url', $original_url);
     $original_path = sizeof($request->path) == 0 ? 'login' : implode(',', $request->path);
     $tpl->assign('original_path', $original_path);
     $tpl->assign('original_query', $query_str);
     $tpl->display('file:' . dirname(__FILE__) . '/templates/login/login_form_default.tpl');
 }
Example #7
0
 function explorerAction()
 {
     $request = DevblocksPlatform::getHttpRequest();
     $stack = $request->path;
     array_shift($stack);
     // forums
     array_shift($stack);
     // explorer
     switch (array_shift($stack)) {
         case 'navigation':
             $this->_renderExplorerNavigation($stack);
             break;
         default:
             $visit = CerberusApplication::getVisit();
             @($start = DevblocksPlatform::importGPC($_REQUEST['start'], 'integer', 0));
             // Load results cache
             if (null == ($forums_view = C4_AbstractViewLoader::getView(C4_ForumsThreadView::DEFAULT_ID))) {
                 // Do something
                 $forums_view = new C4_ForumsThreadView();
             }
             $tpl = DevblocksPlatform::getTemplateService();
             $tpl->cache_lifetime = "0";
             $tpl->assign('path', $this->tpl_path);
             $view_start = $forums_view->renderLimit * $forums_view->renderPage;
             $view_page = floor($view_start / 100);
             list($posts, $count) = DAO_ForumsThread::search($forums_view->params, 100, $view_page, $forums_view->renderSortBy, $forums_view->renderSortAsc, true);
             // Advance the internal pointer to the requested start position
             if (!empty($start) && isset($posts[$start])) {
                 while (key($posts) != $start) {
                     next($posts);
                 }
             }
             if (empty($start)) {
                 $start = key($posts);
             }
             $current = current($posts);
             $visit->set('forums_explorer_results', $posts);
             $visit->set('forums_explorer_results_pos', $start);
             //				$visit->set('forums_explorer_results_total', $count);
             $tpl->assign('current_post', $current);
             $tpl->display('file:' . $this->tpl_path . '/explorer/index.tpl');
             break;
     }
     session_write_close();
     exit;
 }
Example #8
0
 function searchviewAction()
 {
     $visit = CerberusApplication::getVisit();
     $response = DevblocksPlatform::getHttpRequest();
     $path = $response->path;
     array_shift($path);
     // tickets
     array_shift($path);
     // searchview
     $id = array_shift($path);
     $view = C4_AbstractViewLoader::getView($id);
     if (!empty($view->params)) {
         $params = array();
         // Index by field name for search system
         if (is_array($view->params)) {
             foreach ($view->params as $key => $criteria) {
                 /* @var $criteria DevblocksSearchCriteria */
                 $params[$key] = $criteria;
             }
         }
     }
     if (null == ($search_view = C4_AbstractViewLoader::getView(CerberusApplication::VIEW_SEARCH))) {
         $search_view = C4_TicketView::createSearchView();
     }
     $search_view->params = $params;
     $search_view->renderPage = 0;
     C4_AbstractViewLoader::setView($search_view->id, $search_view);
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('tickets', 'search')));
 }
Example #9
0
 public function render()
 {
     // draws HTML form of controls needed for login information
     $tpl = DevblocksPlatform::getTemplateService();
     // add translations for calls from classes that aren't Page Extensions (mobile plugin, specifically)
     $translate = DevblocksPlatform::getTranslationService();
     $tpl->assign('translate', $translate);
     $request = DevblocksPlatform::getHttpRequest();
     $original_path = sizeof($request->path) == 0 ? 'login' : implode(',', $request->path);
     $tpl->assign('original_path', $original_path);
     $tpl->display('file:' . $this->_TPL_PATH . 'login.tpl');
 }