Esempio n. 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;
 }
Esempio n. 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();
    }
    protected function zoom()
    {
        $siteUrl = Cfg::siteUrl();
        $html = '';
        $html .= JS::library(JS::JQUERY);
        // Get the current Pin
        $url = Request::get('url');
        $jQuery = <<<JS
    var currentXPos = 0;
    var currentYPos = 0;
    var IE = document.all?true:false
    if (!IE) document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = getMouseXY;
    function getMouseXY(e) {
        if (IE) { // grab the x-y pos.s if browser is IE
            currentXPos = event.clientX + document.body.scrollLeft;
            currentYPos = event.clientY + document.body.scrollTop;
        } else {  // grab the x-y pos.s if browser is NS
            currentXPos = e.pageX;
            currentYPos = e.pageY;
        }
        if (currentXPos < 0) currentXPos = 0;
        if (currentYPos < 0) currentYPos = 0;
        return true;
    }
    function movePinToCursor () {
       var offs = \$('#baseImage').offset();
       \$('#PinTop').attr ( 'value', '' + parseInt ( currentYPos - offs.top ) );
       \$('#PinLeft').attr ( 'value', '' + parseInt ( currentXPos - offs.left ) );
    }
JS;
        $html .= JS::javaScript($jQuery);
        $html .= Tag::img($siteUrl . $url, ['title' => 'Click on this image to move the Pin', 'id' => 'baseImage', 'onClick' => 'movePinToCursor();', 'name' => 'voodoo_image']);
        $html .= '<br>X' . Tag::text('PinLeft', '', ['size' => 4, 'id' => 'PinLeft']);
        $html .= '<br>Y' . Tag::text('PinTop', '', ['size' => 4, 'id' => 'PinTop']);
        return $html;
    }
Esempio n. 4
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;
 }
Esempio n. 5
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;
 }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 8
0
 /**
  * @return string
  */
 public function toHtml()
 {
     $this->auditStartRow();
     $rowsPerPage = intval($this->getPageSize());
     $startingRow = intval($this->getStart());
     $startingPage = intval($this->get(self::STARTING_PAGE));
     $totalRows = intval($this->getRows());
     $saveStartingRow = intval($this->getStart());
     if ($rowsPerPage <= 0) {
         $rowsPerPage = self::$pagination[self::ROWS_PER_PAGE];
     }
     // Not enough rows for pagination
     if ($totalRows <= $rowsPerPage) {
         if ($this->dispPageSize && $totalRows > 10) {
             return Tag::div($this->attribs) . Tag::form(['method' => 'get']) . $this->toHidden([self::ROWS_PER_PAGE]) . '&nbsp;Max Rows:&nbsp;' . Lists::select($this->toFormName(self::ROWS_PER_PAGE), self::$itemsPerPageList, ['default' => $rowsPerPage, 'onChange' => 'submit();']) . Tag::_form() . Tag::_div();
         } else {
             return '';
         }
     }
     if ($startingPage > 0) {
         $startingRow = ($startingPage - 1) * $rowsPerPage;
         $this->set(self::STARTING_PAGE, 0);
     }
     if ($startingRow >= $totalRows) {
         $startingRow = $totalRows - 1;
     }
     $pageContainingStartRow = intval($startingRow / $rowsPerPage);
     $this->set(self::SQL_START, $rowsPerPage * $pageContainingStartRow);
     // Get number of pages
     $numberOfPages = intval($totalRows / $rowsPerPage);
     if ($totalRows % $rowsPerPage != 0) {
         $numberOfPages++;
     }
     $previousPage = '';
     $nextPage = '';
     $firstPage = '';
     $lastPage = '';
     $pageSizeHtml = '';
     $html = [[], []];
     // This is the navigation from the current page forward
     for ($currentPage = $pageContainingStartRow + 1, $incr = 1; $currentPage < $numberOfPages - 1; $currentPage += $incr) {
         $startingRowForThisPage = $currentPage * $rowsPerPage;
         $currentPageDisplay = $currentPage + 1;
         $this->set(self::STARTING_ROW, $startingRowForThisPage);
         $html[1][] = Tag::hRef($this->toUrl(), number_format($currentPageDisplay), ['title' => 'Go to Page ' . $currentPageDisplay, 'class' => $this->styles[self::PAGE_LINK_CLASS]]);
         $incr *= count($html[1]);
     }
     // This is the navigation for next and last page
     if ($pageContainingStartRow + 1 < $numberOfPages) {
         $this->setStart($rowsPerPage * ($numberOfPages - 1));
         $lastPage = Tag::button('>> ' . number_format($numberOfPages), ['onclick' => "location.href='" . $this->toUrl() . "';return true;", 'title' => 'Go to Last Page - ' . $numberOfPages, 'class' => $this->styles[self::PAGE_BUTTON_CLASS]]);
         $this->setStart($rowsPerPage * ($pageContainingStartRow + 1));
         $nextPage = Tag::button('>', ['onclick' => "location.href='" . $this->toUrl() . "';return true;", 'title' => 'Go to Next Page - ' . ($pageContainingStartRow + 2), 'class' => $this->styles[self::PAGE_BUTTON_CLASS]]);
     }
     // Navigation for the current page nackwards
     for ($currentPage = $pageContainingStartRow - 1, $incr = 1; $currentPage > 0; $currentPage -= $incr) {
         $startingRowForThisPage = $currentPage * $rowsPerPage;
         $currentPageDisplay = $currentPage + 1;
         $this->setStart($startingRowForThisPage);
         $html[0][] = Tag::hRef($this->toUrl(), number_format($currentPageDisplay), ['title' => 'Go to Page ' . $currentPageDisplay, 'class' => $this->styles[self::PAGE_LINK_CLASS]]);
         $incr *= count($html[0]);
     }
     // Reverse the array so that it appears in correct order for pagination
     $html[0] = array_reverse($html[0]);
     // Navigation for previous and first pages
     if ($pageContainingStartRow != 0) {
         // Calculate navigation for first page
         $this->setStart(0);
         $firstPage = Tag::button('<< 1', ['onclick' => "location.href='" . $this->toUrl() . "';return true;", 'title' => 'Go to First Page - 1', 'class' => $this->styles[self::PAGE_BUTTON_CLASS]]);
         // Calculate navigation for previous page
         $this->setStart($rowsPerPage * ($pageContainingStartRow - 1));
         $previousPage = Tag::button('< ', ['onclick' => "location.href='" . $this->toUrl() . "';return true;", 'title' => 'Go to Previous Page - ' . ($pageContainingStartRow - 1), 'class' => $this->styles[self::PAGE_BUTTON_CLASS]]);
     }
     $this->setStart($saveStartingRow);
     $curPage = (string) ($pageContainingStartRow + 1);
     $exemptVars = [self::STARTING_PAGE];
     // Create the drop down to set the number of rows displayed per page
     if ($this->dispPageSize) {
         $exemptVars[] = self::ROWS_PER_PAGE;
         $pageSizeHtml = '&nbsp;Rows:&nbsp;' . Lists::select($this->toFormName(self::ROWS_PER_PAGE), self::$itemsPerPageList, ['default' => $rowsPerPage, 'title' => 'This changes the number of rows to display', 'onChange' => 'submit();']);
     }
     return Tag::div($this->attribs) . Tag::form(['method' => 'get']) . $this->toHidden($exemptVars) . $firstPage . $previousPage . '&nbsp;' . join('&nbsp;&#183;&nbsp;', $html[0]) . '&nbsp;' . Tag::text($this->toFormName(self::STARTING_PAGE), ['value' => $curPage, 'align' => 'middle', 'size' => 1 + max(1, strlen($curPage) - 1), 'title' => 'Manually enter the page number that you want and press enter', 'style' => 'font-weight:bold;']) . '&nbsp;' . join('&nbsp;&#183;&nbsp;', $html[1]) . '&nbsp;' . $nextPage . $lastPage . $pageSizeHtml . Tag::_form() . Tag::_div();
 }
Esempio n. 9
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;
 }