Example #1
0
 public function reset()
 {
     $resp = MenuUtils::responseObject();
     $html = '';
     $html .= '<H4>***WARNING*** You are about to reset configuration</h4>' . Tag::form() . $resp->action(sprintf('%s->%sSave()', __CLASS__, __FUNCTION__))->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Please type "RESET CONFIG" without the quotes for finalise reset.' . Tag::_td() . Tag::td() . Tag::text('fldConfirm') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2]) . Tag::submit('Confirm Reset') . Tag::linkButton('?' . $resp->action(__CLASS__ . '->resetCancelled()'), 'Cancel Reset') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
     return $html;
 }
Example #2
0
    public function index()
    {
        $schedulerList = Scheduler::getList(true);
        $formName = 'SchedulerManager_index';
        $id = 'SchedulerManager_table';
        $js = "\$().ready ( function () {\n";
        $valid = Validator::factory($formName);
        $html = Tag::table(['id' => $id]) . Tag::tr() . Tag::th() . 'Upd' . Tag::_th() . Tag::th() . 'Del' . Tag::_th() . Tag::th() . 'Command' . Tag::_th() . Tag::th() . 'Start Date' . Tag::_th() . Tag::th() . 'Cron' . Tag::_th() . Tag::th() . 'Active' . Tag::_th() . Tag::th() . 'Last Run' . Tag::_th() . Tag::_tr();
        if (count($schedulerList) == 0) {
            $html .= Tag::tr() . Tag::td(['colspan' => 20]) . 'No Scheduled Tasks' . Tag::_td() . Tag::_tr();
        } else {
            $js .= <<<JS
                \$('input[type=checkbox][name^=fldUpd]').shiftClick();

JS;
            $rowIdx = 0;
            foreach ($schedulerList as $idx => $schedulerItem) {
                $row = '_' . $idx;
                $valid->addExists('fldCommand' . $row, 'Command must exist')->addExists('fldCron' . $row, 'Interval must exist');
                $js .= <<<JS
                    \$( '#fldStartDate{$row}' ).datetimepicker({
                        dateFormat: 'yy-mm-dd',
                        timeFormat: 'HH:mm'
                    });
JS;
                $lastRun = $schedulerItem->lastRun == '' ? '*Never*' : $schedulerItem->lastRun;
                $html .= Tag::tr() . Tag::td() . Tag::checkBox('fldUpd[]', $idx, false, ['id' => 'U' . $rowIdx]) . Tag::_td() . Tag::td() . Tag::linkButton('?' . Response::factory()->set('fldID', $idx)->action(__CLASS__ . '->deleteItem()'), 'Delete', ['onClick' => "confirm('Are you sure?')"]) . Tag::_td() . Tag::td(['width' => '100%', 'nowrap' => 'nowrap']) . Tag::text('fldCommand' . $row, $schedulerItem->cmd, ['style' => 'width:100%;', 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Tag::text('fldStartDate' . $row, $schedulerItem->start, ['id' => 'fldStartDate' . $row, 'size' => '18', 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Tag::text('fldCron' . $row, $schedulerItem->cron, ['onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Lists::select('fldActive' . $row, ['Yes', 'No'], ['default' => $schedulerItem->active, 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . $lastRun . Tag::_td() . Tag::_tr();
                $rowIdx++;
            }
        }
        $html .= Tag::_table();
        $js .= '});';
        return JS::libraryWithDependancies(JS::JQUERY_UI_DATETIME) . JS::library('jquery.shiftclick.js') . JS::javaScript($js) . $valid->toHtml() . Widget::styleTable('#' . $id) . Tag::form(['name' => $formName, 'onSubmit' => $valid->onSubmit()]) . $html . Response::factory()->action(__CLASS__ . '->save()')->toHidden() . Tag::submit('Save') . Tag::linkButton('?' . Response::factory()->action(__CLASS__ . '->newItem()'), 'New Item') . Tag::_form();
    }
Example #3
0
 public function forgotPassword()
 {
     // Initialise the $msg and $action and $disclaimer variables
     $formName = 'FancyLogin_forgotPassword';
     $valid = Validator::factory($formName, 'FP')->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email is in valid format. Must be of the form a@b.com');
     $html = $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->set(self::ACTION, __CLASS__ . '->sendPW()')->toHidden() . Tag::table(['align' => 'center', 'border' => 0, 'cellspacing' => 0, 'cellpadding' => 2]) . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text('fldEmail') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2, 'align' => 'center']) . 'Your Password will be reset and sent to you via email you have provided' . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2, 'align' => 'center']) . Tag::submit('Send Password') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
     return $html;
 }
Example #4
0
 public function addForm()
 {
     $resp = MenuUtils::responseObject();
     $html = Tag::form() . $resp->action(__CLASS__ . '->addFormSave()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'New Key' . Tag::_td() . Tag::td() . Tag::text('fldCfgKey') . Tag::_td() . Tag::td() . Tag::submit('Add New Key') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
     return $html;
 }
Example #5
0
 protected function askCommand()
 {
     $text = Request::get('CMDTEXT');
     $html = '<b>Direct Command Access</b><br/>' . Tag::form() . Response::factory()->action(__CLASS__ . '->runCommand()')->toHidden() . Tag::textArea('CMDTEXT', $text, ['rows' => 5, 'cols' => 40]) . '<br/>' . Tag::submit('Go') . Tag::_form();
     return $html;
 }
Example #6
0
 private function insertForm()
 {
     if (!$this->canInsert) {
         return '';
     }
     $this->resp->set($this->action, 'insertRows');
     $html = Tag::form(['action' => $this->formAction]) . Tag::text('rows', ['value' => '1', 'size' => '3']) . $this->resp->toHidden() . Tag::submit('Insert') . Tag::_form();
     return $html;
 }
Example #7
0
 public function forgotPassword()
 {
     // Initialise the $msg and $action and $disclaimer variables
     $formName = 'Login_forgotPassword';
     $valid = Validator::factory($formName, 'FP')->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email is in valid format. Must be of the form a@b.com');
     $html = '<h2>Password Reset</h2>' . $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->action(__CLASS__ . '->sendPW()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text('fldEmail', ['title' => 'Your Password will be reset and sent to you via email you have provided']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['align' => 'left']) . Tag::submit('Reset PW') . Tag::_td() . Tag::td(['align' => 'right']) . Tag::linkButton('?' . Response::factory()->action(__CLASS__ . '->index()')->toUrl(), 'Back to Login') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
     return $html;
 }
Example #8
0
 public function newUser()
 {
     $formName = 'Admin_newUser';
     $valid = Validator::factory($formName)->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email needs to exist and be correct format')->addExists('fldFirstName', 'First Name must exist')->addExists('fldCaptcha', 'You must enter Captcha Code')->addExists('fldLastName', 'Last Name must exist');
     $html = $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->action(__CLASS__ . '->newUserSave()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email:' . Tag::_td() . Tag::td() . Tag::text('fldEmail', Request::get('fldEmail')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'First&nbsp;Name:' . Tag::_td() . Tag::td() . Tag::text('fldFirstName', Request::get('fldFirstName')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Last&nbsp;Name:' . Tag::_td() . Tag::td() . Tag::text('fldLastName', Request::get('fldLastName')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2]) . Tag::submit('Create Account') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
     return $html;
 }