CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/cwd/proc/3/cwd/usr/local/rvglobalsoft/rvsitebuilder7/lib/RVL/
Upload File :
Current File : //proc/2/cwd/proc/3/cwd/usr/local/rvglobalsoft/rvsitebuilder7/lib/RVL/FrontController.pm

#!/usr/bin/perl
package RVL::FrontController;
# WebSite:  http://www.rvglobalsoft.com
# Unauthorized copying is strictly forbidden and may result in severe legal action.
# Copyright (c) 2013 RV Global Soft Co.,Ltd. All rights reserved.
#
# =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
# Copyright (c) 2013 RV Global Soft Co.,Ltd. All rights reserved.
# This Agreement is a legal contract, which specifies the terms of the license
# and warranty limitation between you and RV Global Soft Co.,Ltd. and RV2Factor Product for RV Global Soft.
# You should carefully read the following terms and conditions before
# installing or using this software.  Unless you have a different license
# agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
# indicates your acceptance of the license and warranty limitation terms
# contained in this Agreement. If you do not agree to the terms of this
# Agreement, promptly delete and destroy all copies of the Software.
#
# =====  Grant of License =======
# The Software may only be installed and used on a single host machine.
#
# =====  Disclaimer of Warranty =======
# THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
# WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
# WARRANTIES WHETHER EXPRESSED OR IMPLIED.   BECAUSE OF THE VARIOUS HARDWARE
# AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
# FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.  THE USER MUST ASSUME THE
# ENTIRE RISK OF USING THIS PROGRAM.  ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
# LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
# IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
# CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
# OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
# BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
# NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
# RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
# RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
# BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
# ===============================

use strict;
use warnings;
use RVL::Request;
use RVL::Registry;
use RVL::Output;
use RVL::CpHandle;
use Smart::Comments '###', '####';
use Class::Std::Utils;
{
    sub new {
        my ($class, $opt) = @_;
        #my ($newClass) = bless anon_scalar(), $class;
         my ($newClass) = bless( {}, $class);
        return $newClass;
    }   
=help
Main invocation, init tasks plus main process.
use constant
=cut
    sub run {
        my ($this) = shift;
        RVL::FrontController::init();
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        $this = (!$this) ? RVL::FrontController->new() : $this;

        my ($req) = RVL::Request::singleton();
        my ($input) = RVL::Registry::singleton();

        $input->setRequest(\$req);
        my ($output) = RVL::Output::singleton();
                
        require 'RVL/Task/Process.pm';
        
        my ($oCustomTask) = $this->customFilterChain(\$input);
        if ($oCustomTask eq 0) {
            my ($oTask) = 
                RVL::Task::Init->new(
                RVL::Task::SetupORM->new(
                RVL::Task::ResolveManager->new(
                RVL::Task::LicenseCycle->new(
                RVL::Task::LoadCpHandle->new(
                RVL::Task::LoadLibsModule->new(
                RVL::Task::CreateSession->new(
                RVL::Task::SetupLangSupport->new(
                RVL::Task::SetupLocale->new(
                RVL::Task::AuthenticateRequest->new(
                RVL::Task::SetupPerms->new(
                
                ## post-process (order: bottom up)
                RVL::Task::BuildHeaders->new(
                RVL::Task::BuildView->new(
                RVL::Task::SetupGui->new(
                RVL::Task::BuildOutputData->new(
                RVL::MainProcess->new()
            )))))))))))))));
            $oTask->process(\$input, \$output);
        } else {
            $oCustomTask->process(\$input, \$output);
        }
       print $output->{data};
    }
    
    sub customFilterChain {
        my ($this, $input) = @_;
        my ($req) = ${$input}->getRequest();
        my ($reqType) = ${$req}->getRequestType();
        if ($reqType eq 'Browser' || $reqType eq 'Cli') {
            return 0;
        } elsif ($reqType eq 'Ajax') {
            RVL::logMessage('Call Ajax Task', __CONSTANT__::RVL_LOG_DEBUG);
            require 'RVL/Task/AuthenticateAjaxRequest.pm';
            require 'RVL/Task/CustomBuildOutputData.pm';
            require 'RVL/Task/BuildAjaxHeaders.pm';
            require 'RVL/Task/BuildAjaxView.pm';
            require 'RVL/Task/ExecuteAjaxAction.pm';
            
            return RVL::Task::Init->new(
                RVL::Task::SetupORM->new(
                RVL::Task::ResolveManager->new(
                RVL::Task::LoadCpHandle->new(
                RVL::Task::LoadLibsModule->new(
                RVL::Task::CreateSession->new(
                RVL::Task::SetupLangSupport->new(
                RVL::Task::AuthenticateAjaxRequest->new(
                RVL::Task::BuildAjaxHeaders->new(
                RVL::Task::BuildAjaxView->new(
                RVL::Task::CustomBuildOutputData->new(
                RVL::Task::ExecuteAjaxAction->new(
            ))))))))))));
        } else {
            return 0;   
        }
    }
    
    sub init {
        require 'data/languages.pl';
        require 'RVL/TaskRunner.pm';
        require 'RVL/Task/Init.pm';
      
        my ($c) = RVL::Config::singleton();
        my ($conf) = $c->getAll();
        my ($oRunner) = RVL::TaskRunner->new();
        $oRunner->addData($conf);
        $oRunner->addTask(RVL::Task::SetupConstantsStart->new());
        $oRunner->addTask(RVL::Task::SetupConstantsFinish->new());
        $oRunner->addTask(RVL::Task::LoadPlatform->new());
        #$oRunner->addTask(RVL::Task::LoadCpHandle->new());
        #$oRunner->addTask(RVL::Task::LoadLibsModule->new());
        $oRunner->main();
    }
    
}

=head

=cut

package RVL::InstanceProcess;
use strict;
use warnings;
use Class::Std::Utils;
{
    # class attribute
    my (@props);
    
    sub new {
        my ($class, $opt) = @_;
        my ($newClass) = bless anon_scalar(), $class;
        return $newClass;
    }

    sub singleton {
        my ($class) = __PACKAGE__;
        
        if (!defined $RVL::INSTANCE{$class}) {
            $RVL::INSTANCE{$class} = $class->new();
        }
        return $RVL::INSTANCE{$class}
    }
    
    sub set {
        my ($this, $task) = @_;
        unshift(@props, $task);
    }
 
    sub get {
        my ($this) = @_;
        return (@props == 0) ? 0 : shift @props;
    }
}

=head

=cut
package RVL::ProcessRequest;
use strict;
use warnings;
use Class::Std::Utils;
{
    sub new {
        my ($class, $opt) = @_;
        my ($this) = bless anon_scalar(), $class;
        my ($ident) = ident($this);
        return $this;
    }
    
    sub process {
        my ($this, $input, $output) = @_;
        
    }
}

=head

=cut
package RVL::DecorateProcess;
use strict;
use warnings;
use base qw(RVL::ProcessRequest);
use Class::Std::Utils;
{
    my (@processRequest);
    sub new {
        my ($class, $opt) = @_;
        my ($this) = $class->SUPER::new($opt);
        my ($ident) = ident($this);
        if (defined $opt) {
            my ($oInsPro) = RVL::InstanceProcess::singleton();
            $oInsPro->set($opt);
        }
        return $this;
    }
    
    sub process {
        my ($this, $input, $output) = @_;
        
        my ($ident) = ident($this);

        my ($oInsPro) = RVL::InstanceProcess::singleton();
        my ($class) = $oInsPro->get();
        
        return 1 if (!$class);
        $class->process($input, $output);
    }
}

=head

=cut
package RVL::MainProcess;
use base qw(RVL::DecorateProcess);
use Class::Std::Utils;
{
    sub new {
        my ($class, $opt) = @_;
        my ($newClass) = bless anon_scalar(), $class;
        return $newClass;
    }
    
    sub process {
        my ($this, $input, $output) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        my ($req)  = ${$input}->getRequest();
        my ($mgr)  = ${$input}->get('manager');    
        eval {
            ${$mgr}->validate(${$req}, $input);
        
        
            ${$input}->aggregate($output);

            if (${$mgr}->isValid()) {
                my ($ok) = ${$mgr}->process($input, $output);
            }
        
            RVL::Manager::display($output);
            ${$mgr}->display($output);
        };
        
        if ($@) {
        	RVL::fatalErrors($@);
        }
        
                
        $this->SUPER::process($input, $output);
    }
}

1;

__END__;

Copyright 2K16 - 2K18 Indonesian Hacker Rulez