Skip to content

Commit

Permalink
#211 - removed the ViewController along with links to it and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alphadevx committed Sep 4, 2015
1 parent 444be9d commit f88ac43
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 392 deletions.
2 changes: 1 addition & 1 deletion Alpha/Controller/ActiveRecordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public function doDELETE($request)
$response->redirect($this->getNextJob());
} else {
if ($this->request->isSecureURI()) {
$response->redirect(FrontController::generateSecureURL('act=Alpha\\Controller\\ActiveRecordController&ActiveRecordType='.$ActiveRecordType.'&ActiveRecordOID'));
$response->redirect(FrontController::generateSecureURL('act=Alpha\\Controller\\ActiveRecordController&ActiveRecordType='.$ActiveRecordType.'&start=0&limit='.$config->get('app.list.page.amount')));
} else {
$response->redirect($config->get('app.url').'records/'.$params['ActiveRecordType']);
}
Expand Down
6 changes: 0 additions & 6 deletions Alpha/Controller/Front/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use Alpha\Controller\SearchController;
use Alpha\Controller\SequenceController;
use Alpha\Controller\TagController;
use Alpha\Controller\ViewController;
use Alpha\Controller\IndexController;
use Alpha\Controller\InstallController;
use Alpha\Controller\ActiveRecordController;
Expand Down Expand Up @@ -269,11 +268,6 @@ public function __construct()
return $controller->process($request);
});

$this->addRoute('/view/{ActiveRecordType}/{ActiveRecordOID}', function($request) {
$controller = new ViewController();
return $controller->process($request);
});

$this->addRoute('/install', function($request) {
$controller = new InstallController();
return $controller->process($request);
Expand Down
271 changes: 0 additions & 271 deletions Alpha/Controller/ViewController.php

This file was deleted.

9 changes: 5 additions & 4 deletions Alpha/View/Renderer/Html/RendererProviderHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,14 @@ public function listView($fields=array())

// View button
if (mb_strpos($request->getURI(), '/tk/') !== false) {
$button = new Button("document.location = '".FrontController::generateSecureURL('act=Alpha\Controller\ViewController&ActiveRecordType='.get_class($this->BO).'&ActiveRecordOID='.$this->BO->getOID())."';", 'View', 'view'.$this->BO->getOID().'But');
$button = new Button("document.location = '".FrontController::generateSecureURL('act=Alpha\Controller\ActiveRecordController&ActiveRecordType='.get_class($this->BO).'&ActiveRecordOID='.$this->BO->getOID())."';", 'View', 'view'.$this->BO->getOID().'But');
$fields['viewButton'] = $button->render();
} else {
if ($this->BO->hasAttribute('URL'))
if ($this->BO->hasAttribute('URL')) {
$button = new Button("document.location = '".$this->BO->get('URL')."';", 'View', 'view'.$this->BO->getOID().'But');
else
$button = new Button("document.location = '".$config->get('app.url')."view/".urlencode(get_class($this->BO))."/".$this->BO->getOID()."';", 'View', 'view'.$this->BO->getOID().'But');
} else {
$button = new Button("document.location = '".$config->get('app.url')."record/".urlencode(get_class($this->BO))."/".$this->BO->getOID()."';", 'View', 'view'.$this->BO->getOID().'But');
}

$fields['viewButton'] = $button->render();
}
Expand Down
4 changes: 2 additions & 2 deletions Alpha/View/Widget/RecordSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ public function render($expanded=false, $buttons=true)

// check to see if we are in the admin back-end
if (mb_strpos($URI, '/tk/') !== false) {
$viewURL = FrontController::generateSecureURL('act=Alpha\Controller\ViewController&ActiveRecordType='.get_class($obj).'&ActiveRecordOID='.$obj->getOID());
$editURL = FrontController::generateSecureURL('act=Alpha\Controller\EditController&ActiveRecordType='.get_class($obj).'&ActiveRecordOID='.$obj->getOID());
$viewURL = FrontController::generateSecureURL('act=Alpha\Controller\ActiveRecordController&ActiveRecordType='.get_class($obj).'&ActiveRecordOID='.$obj->getOID());
$editURL = FrontController::generateSecureURL('act=Alpha\Controller\ActiveRecordController&ActiveRecordType='.get_class($obj).'&ActiveRecordOID='.$obj->getOID().'/edit');
} else {
// TOOD: revisit all of these links once the generic CRUD controller is done
if (isset($customViewControllerName)) {
Expand Down
Loading

0 comments on commit f88ac43

Please sign in to comment.