Ejemplo n.º 1
0
/**
 * @param Page $parentPage
 * @param string $message
 */
function ShowSecurityErrorPage($parentPage, $message)
{
    $urlToRedirect = '';
    if ($parentPage instanceof Page) {
        $linkBuilder = $parentPage->CreateLinkBuilder();
        GetApplication()->GetSuperGlobals()->fillGetParams($linkBuilder);
        $urlToRedirect = '?redirect=' . urlencode($linkBuilder->GetLink());
    }
    $renderer = new ViewAllRenderer($parentPage->GetLocalizerCaptions());
    $errorPage = new CustomErrorPage($parentPage->GetLocalizerCaptions()->GetMessageString('AccessDenied'), $parentPage->GetContentEncoding(), $message, sprintf($parentPage->GetLocalizerCaptions()->GetMessageString('AccessDeniedErrorSuggestions'), 'login.php' . $urlToRedirect), $parentPage);
    echo $renderer->Render($errorPage);
}
 public function ProcessMessages()
 {
     if ($this->superGlobals->GetPostValueDef('edit_operation') == 'commit') {
         $this->state = VerticalGridState::JSONResponse;
         GetApplication()->SetOperation(OPERATION_COMMIT);
         $this->grid->SetState(OPERATION_COMMIT);
         $this->grid->GetState()->SetIsInlineOperation(true);
         $this->grid->ProcessMessages();
         if ($this->grid->GetErrorMessage() != '') {
             $this->response['type'] = 'error';
             $this->response['error_message'] = $this->grid->GetErrorMessage();
         } else {
             $this->response['type'] = 'ok';
             $this->grid->GetDataset()->SetSingleRecordState($this->grid->GetDataset()->GetPrimaryKeyValuesAfterEdit());
             GetApplication()->SetOperation(OPERATION_VIEWALL);
             $this->grid->SetState(OPERATION_VIEWALL);
             $this->grid->ProcessMessages();
             $viewAllRenderer = new ViewAllRenderer($this->grid->GetPage()->GetLocalizerCaptions());
             $viewAllRenderer->renderSingleRow = true;
             $this->response['row'] = $viewAllRenderer->Render($this->grid);
         }
     } else {
         if ($this->superGlobals->GetPostValueDef('edit_operation') == 'commit_insert') {
             $this->state = VerticalGridState::JSONResponse;
             GetApplication()->SetOperation(OPERATION_COMMIT_INSERT);
             $this->grid->SetState(OPERATION_COMMIT_INSERT);
             $this->grid->GetState()->SetIsInlineOperation(true);
             $this->grid->GetPage()->UpdateValuesFromUrl();
             $this->grid->ProcessMessages();
             if ($this->grid->GetErrorMessage() != '') {
                 $this->response['type'] = 'error';
                 $this->response['error_message'] = $this->grid->GetErrorMessage();
             } else {
                 $this->response['type'] = 'ok';
                 $this->grid->GetDataset()->SetSingleRecordState($this->grid->GetDataset()->GetPrimaryKeyValuesAfterInsert());
                 GetApplication()->SetOperation(OPERATION_VIEWALL);
                 $this->grid->SetState(OPERATION_VIEWALL);
                 $this->grid->ProcessMessages();
                 $viewAllRenderer = new ViewAllRenderer($this->grid->GetPage()->GetLocalizerCaptions());
                 $viewAllRenderer->renderSingleRow = true;
                 $this->response['row'] = $viewAllRenderer->Render($this->grid);
             }
         } else {
             if ($this->superGlobals->GetGetValueDef(ModalOperation::Param) == ModalOperation::OpenModalEditDialog) {
                 GetApplication()->SetOperation(OPERATION_EDIT);
                 $this->grid->SetState(OPERATION_EDIT);
             } else {
                 if ($this->superGlobals->GetGetValueDef(ModalOperation::Param) == ModalOperation::OpenModalInsertDialog) {
                     $this->state = VerticalGridState::DisplayInsertGrid;
                     GetApplication()->SetOperation(OPERATION_INSERT);
                     $this->grid->SetState(OPERATION_INSERT);
                 } else {
                     if ($this->superGlobals->GetGetValueDef(ModalOperation::Param) == ModalOperation::OpenModalCopyDialog) {
                         $this->state = VerticalGridState::DisplayCopyGrid;
                         GetApplication()->SetOperation(OPERATION_COPY);
                         $this->grid->SetState(OPERATION_COPY);
                     }
                 }
             }
             $this->grid->ProcessMessages();
         }
     }
 }
Ejemplo n.º 3
0
/**
 * @param Page $parentPage
 * @param string $message
 */
function ShowSecurityErrorPage($parentPage, $message)
{
    $renderer = new ViewAllRenderer($parentPage->GetLocalizerCaptions());
    $errorPage = new CustomErrorPage($parentPage, $parentPage->GetLocalizerCaptions()->GetMessageString('AccessDenied'), $message, sprintf($parentPage->GetLocalizerCaptions()->GetMessageString('AccessDeniedErrorSuggesstions'), 'login.php'));
    echo $renderer->Render($errorPage);
}
Ejemplo n.º 4
0
 public function __construct($captions, $exception)
 {
     parent::__construct($captions);
     $this->exception = $exception;
 }