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();
    }
Exemple #2
0
    public static function display($menuClasses = null)
    {
        $id = 'MenuUtils_display' . Invocation::next();
        $jsLibraries = JS::libraryWithDependancies(JS::JQUERY_UI);
        $activeMenu = Request::get(self::ACTIVE_MENU, 0);
        $js = <<<JS
            \$().ready ( function () {
                \$( '#{$id}' ).show()
                           .accordion({
                    collapsible: true,
                    active: {$activeMenu}
                });
            });
JS;
        $html = '';
        $html .= Tag::div(['id' => $id, 'style' => 'font-size: 0.8em; width:250px; text-align:left; display:none;']);
        foreach (self::getMenuItems($menuClasses) as $header => $menuList) {
            $html .= Tag::hTag('h3') . Tag::hRef('#', $header) . Tag::_hTag('h3') . Tag::div() . Tag::ul();
            foreach ($menuList as $row) {
                $html .= Tag::li();
                if (isset($row['slug'])) {
                    $html .= Tag::hRef(Cfg::siteUrl() . '/menu.php?S=' . $row['slug'], $row['name'], $row['attribs']);
                } else {
                    $html .= Tag::hRef($row['url'], $row['name'], $row['attribs']);
                }
                $html .= Tag::_li();
            }
            $html .= Tag::_ul() . Tag::_div();
        }
        $html .= Tag::_div();
        return $jsLibraries . JS::javaScript($js) . $html;
    }
Exemple #3
0
    private function loginForm()
    {
        $jsUrl = Cfg::get('js_url');
        $jQuery = <<<JS
    \$().ready(function() {
        \$('#hoverimage').hover ( function () { \$('#extralinks').fadeIn('fast'); },
                                 function () { setTimeout("\$('#extralinks').fadeOut();", 3000 ); });
        \$('a.facebox').facebox({closeImage:   '{$jsUrl}/images/closelabel.png',
                                loadingImage: '{$jsUrl}/images/loading.gif'

        });
    });
JS;
        $formName = 'FancyLogin_loginForm';
        $valid = Validator::factory($formName, 'LF')->addExists(self::LOGIN_FNAME, 'Email field must not be empty')->addExists(self::PASSW_FNAME, 'Password field must not be empty');
        $resp = new Response();
        $html = JS::library(JS::JQUERY) . JS::libraryWithDependancies(JS::FACEBOX) . JS::javaScript($jQuery) . Tag::table() . Tag::tr() . Tag::td(['id' => 'hoverimage', 'class' => 'login', 'nowrap' => 'nowrap']) . $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . $resp->set(self::ACTION, __CLASS__ . '->checkLogin()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text(self::LOGIN_FNAME, ['size' => 10, 'style' => 'opacity:0.5;filter:alpha(opacity=50)']) . Tag::_td() . Tag::td() . 'Password:'******'size' => 10, 'style' => 'opacity:0.5;filter:alpha(opacity=50)']) . Tag::_td() . Tag::td() . Tag::submit('Go') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form() . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['id' => 'extralinks', 'style' => 'display: none;']) . Tag::ul(['id' => 'vertMenu']);
        if (Cfg::get('jb_self_register', false)) {
            $html .= Tag::li() . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->newRegistration()')->toUrl(), 'Register New Account', ['class' => 'facebox']) . Tag::_li();
        }
        $html .= Tag::li() . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->forgotPassword()')->toUrl(), 'Forgot My Password', ['class' => 'facebox']) . Tag::_li() . Tag::_ul() . Tag::_td() . Tag::_tr() . Tag::_table();
        return $html;
    }
    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;
    }
Exemple #5
0
 public static function form($attribs = [], $doubleClickProtection = true)
 {
     if (!isset($attribs['action'])) {
         $attribs['action'] = '?';
     }
     if (!isset($attribs['method'])) {
         $attribs['method'] = 'post';
     }
     if (!isset($attribs['id'])) {
         $attribs['id'] = 'FRM_' . self::$formCount++;
     }
     if (isset($attribs['submitmsg'])) {
         $submitMsg = $attribs['submitmsg'];
         unset($attribs['submitmsg']);
     } else {
         $submitMsg = 'Submitting...';
     }
     if (isset($attribs['onsubmit'])) {
         $attribs['onSubmit'] = $attribs['onsubmit'];
         unset($attribs['onsubmit']);
     }
     $html = '';
     if ($doubleClickProtection) {
         $killDblClk = "\$('#{$attribs['id']} input[type=submit]').val('{$submitMsg}').attr('disabled',true);";
         if (isset($attribs['onSubmit'])) {
             if (preg_match('/^(.*)(return true;)$/', $attribs['onSubmit'], $matches)) {
                 $attribs['onSubmit'] = $matches[1] . $killDblClk . $matches[2];
             } else {
                 $attribs['onSubmit'] = $killDblClk . $attribs['onSubmit'];
             }
         } else {
             $attribs['onSubmit'] = $killDblClk;
         }
         $html .= JS::library(JS::JQUERY);
     }
     $html .= self::hTag('form', $attribs);
     return $html;
 }
Exemple #6
0
    public function editJSONEditForm($currentConfigKey)
    {
        $json = json_encode(Config::get($currentConfigKey));
        $js = <<<JS
            var json = {$json};
            main.load(json);
            main.resize();
            var pageDirty = false;
            \$().ready(function() {
                window.onbeforeunload = function () {
                    if ( ! pageDirty ) return;
                    return 'Changes have been made on this page and will be discarded.'
                };
                \$('textarea.jsonformatter-textarea').change( function() {
                    pageDirty = true;
                });
                \$('div.jsoneditor-value').change( function() {
                    pageDirty = true;
                });
                \$('#fldCfgValue').val( editor.get() );
            });

            function submitClicked () {
                var button = \$('#editJSONEditFormButton').attr('disabled',true);

                var orig = \$('#fldCfgValue').val();
                var ed   = editor.get();    // JSON Editor, RHS fields labels
                var form = formatter.get(); // Formatted Text Editor LHS

                if ( orig == ed && orig == form ) {
                    pageDirty = false;
                    alert( 'No changes, nothing to save' );
                    button.attr('disabled',false );
                    return false;
                }
                else if ( orig != ed && orig == form ) {
                    if ( confirm( 'Looks like you have made changes in the JSON Editor on right pane and not copied to Formatted Text Editor on left pane. Ok to save changes?' ) ) {
                        pageDirty = false;
                        \$('#fldCfgValue').val( ed );
                        \$('#editJSONEditForm').submit();
                        return true;
                    }
                    else {
                        button.attr('disabled',false );
                        return false;
                    }
                }
                else if ( orig == ed && orig != form ) {
                    if ( confirm( 'Looks like you have made changes in the Formatted Text Editor on left pane and not copied to the JSON Editor on right pane. Ok to save?' ) ) {
                        pageDirty = false;
                        \$('#fldCfgValue').val( form );
                        \$('#editJSONEditForm').submit();
                        return true;
                    }
                    else {
                        button.attr('disabled',false );
                        return false;
                    }
                }
                else if ( orig != ed && orig != form ) {
                    if ( ed == form ) {
                        pageDirty = false;
                        \$('#fldCfgValue').val( ed );
                        \$('#editJSONEditForm').submit();
                        return true;
                    }
                    else {
                        alert( 'You have changed both the JSON Editor on right pane and the Formatted Text Editor on left pane and they are inconsistent. ' +
                               'Please press one of the arrow buttons to fix and re-submit' );
                        button.attr('disabled',false );
                        return false;
                    }
                }
            }

            \$('body')
                .on( 'focus', '[contenteditable]', function() {
                    var t = \$(this);
                    t.data('before', t.html());
                    return t;
                })
                .on( 'blur keyup paste input', '[contenteditable]', function() {
                    var t = \$(this);
                    if (t.data('before') !== t.html() ) {
                        t.data('before', t.html());
                        t.trigger('change');
                    }
                    return t;
                });
JS;
        return JS::library(JS::JQUERY) . JS::library('jsoneditor.css') . JS::library('interface.css') . JS::library('jsoneditor.js') . JS::library('interface.js') . Tag::div(['id' => 'auto']) . Tag::div(['id' => 'contents', 'height' => '100%']) . Tag::table(['border' => '0', 'height' => '100%', 'width' => '100%']) . Tag::tr() . Tag::td(['valign' => 'top', 'width' => '45%', 'height' => '100%']) . Tag::hTag('b') . '&nbsp;&nbsp;&nbsp;&nbsp;Formatted Text Editor' . Tag::_hTag('b') . Tag::div(['id' => 'jsonformatter']) . Tag::_div() . Tag::_td() . Tag::td(['valign' => 'top', 'width' => '10%', 'align' => 'center']) . Tag::div(['id' => 'splitter']) . Tag::_div() . Tag::_td() . Tag::td(['valign' => 'top', 'width' => '45%', 'height' => '100%']) . Tag::hTag('b') . '&nbsp;&nbsp;&nbsp;&nbsp;JSON Editor' . Tag::_hTag('b') . Tag::div(['id' => 'jsoneditor']) . Tag::_div() . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_div() . Tag::_div() . Tag::form(['id' => 'editJSONEditForm'], false) . MenuUtils::responseObject()->set('fldCfgKey', $currentConfigKey)->action(__CLASS__ . '->saveConfig()')->toHidden() . Tag::textArea('fldCfgValue', '', ['id' => 'fldCfgValue', 'style' => 'display: none;']) . '<b>Currently editing : <i>' . $currentConfigKey . '</i></b> ' . Tag::button('Save', ['onClick' => 'submitClicked();', 'id' => 'editJSONEditFormButton']) . Tag::_form() . JS::javaScript($js);
    }
Exemple #7
0
 public static function js($targetFile)
 {
     $param = self::param($targetFile);
     return JS::javaScript("var tgUrlParam = '{$param}';");
 }
Exemple #8
0
 public function index()
 {
     if (!$this->ok) {
         return 'Invalid table: ' . $this->tableName;
     }
     $html = $this->controller();
     $paginationHtml = $this->paginator->toHtml();
     $html .= Tag::form(['action' => $this->formAction, 'onSubmit' => "if (!checkIfADelete('{$this->delTag}')) return false; return true;"]) . Tag::table(array_merge(['id' => 'CRUD' . $this->suffix], $this->styles[self::TABLE_C])) . Tag::tr();
     if ($this->canDelete) {
         $js = "\$().ready(function() { \$('input[type=checkbox][name^={$this->delTag}]').shiftClick(); });";
         $html .= JS::library('jquery.shiftclick.js') . JS::javaScript($js) . Tag::th() . Tag::hTag('span', ['title' => 'Click here to Toggle all the Delete checkboxes']) . 'D' . Tag::_hTag('span') . Tag::br() . Tag::checkBox('_dcheck', 'Y', false, ['onClick' => "toggleAll(this,'{$this->delTag}','{$this->submitId}')", 'title' => 'Toggle all the Delete checkboxes.']) . Tag::_th();
     }
     if ($this->canUpdate) {
         $js = "\$().ready(function() { \$('input[type=checkbox][name^={$this->updTag}]').shiftClick(); });";
         $html .= JS::library('jquery.shiftclick.js') . JS::javaScript($js) . Tag::th() . Tag::hTag('span', ['title' => 'Click here to Toggle all the Update checkboxes']) . 'U' . Tag::_hTag('span') . Tag::br() . Tag::checkBox('_ucheck', 'Y', false, ['onClick' => "toggleAll(this,'{$this->updTag}','{$this->submitId}')", 'title' => 'Toggle all the Update checkboxes.']) . Tag::_th();
     }
     foreach ($this->columnTitles as $colName => $title) {
         if (isset($this->displayType[$colName])) {
             if (is_string($this->displayType[$colName])) {
                 $type = $this->displayType[$colName];
             } else {
                 $type = $this->displayType[$colName][0];
             }
         } else {
             $type = self::DISPLAY;
         }
         if (!in_array($type, [self::HIDDEN, self::NONE])) {
             $html .= Tag::th() . $this->columnator->toHtml($colName, $title) . Tag::_th();
         }
     }
     foreach ($this->extraCols as $title => $col) {
         $html .= Tag::th();
         if (isset($this->columnTitles[$title])) {
             $html .= $this->columnator->toHtml($title, $this->columnTitles[$title]);
         } else {
             $html .= $title;
         }
         $html .= Tag::_th();
     }
     $html .= Tag::_tr() . "\n";
     $tab = $this->createSQLResult();
     $this->calculateColumnWidths($tab);
     foreach ($tab as $idx => $row) {
         $html .= Tag::tr();
         if ($this->canDelete) {
             $html .= Tag::td(['align' => 'center']) . Tag::checkBox("{$this->delTag}[{$idx}]", $row[$this->primaryKey], false, ['id' => "{$this->delTag}_{$idx}", 'onClick' => "showSubmit('{$this->submitId}')", 'title' => 'Toggle to delete this row.']) . Tag::_td();
         }
         if ($this->canUpdate) {
             $html .= Tag::td(['align' => 'center']) . Tag::checkBox("{$this->updTag}[{$idx}]", $row[$this->primaryKey], false, ['id' => "{$this->updTag}_{$idx}", 'onClick' => "showSubmit('{$this->submitId}')", 'title' => 'Toggle to update this row.']) . Tag::_td();
         }
         foreach ($row as $key => $value) {
             $html .= $this->renderValue($idx, $key, $value);
         }
         foreach ($this->extraCols as $col) {
             $html .= Tag::td() . call_user_func_array($col, [$idx, $row[$this->primaryKey]]) . Tag::_td();
         }
         $html .= Tag::_tr() . "\n";
     }
     $this->resp->set($this->action, 'applyChanges');
     $html .= Tag::_table() . $this->resp->toHidden() . Tag::submit('Apply Changes', ['style' => 'display: none', 'id' => $this->submitId, 'title' => 'Click here to apply the changes to this table']) . Tag::_form();
     return self::header() . Widget::styleTable('#CRUD' . $this->suffix) . ($this->topPage ? $paginationHtml : '') . $html . ($this->bottomPage ? $paginationHtml : '') . $this->insertForm();
 }
Exemple #9
0
    public static function reload($callBack, $url, $numOfSeconds = 20, $css = 'ReloadWidget')
    {
        $id = '_' . Invocation::next();
        $js = <<<JS
            var countDownInterval{$id} = {$numOfSeconds}; //configure refresh interval (in seconds)
            var countDownTime{$id} = countDownInterval{$id} + 1;
            var reloadTimes{$id} = 0;
            var counter{$id};

            function countDown{$id}(){
                countDownTime{$id}--;
                \$('#stop{$id}').show();
                \$('#start{$id}').hide();
                if ( countDownTime{$id} <= 0 ) {
                    clearTimeout(counter{$id});
                    updateReloadArea{$id}();
                    return;
                }
                \$('#countDownText{$id}').html( countDownTime{$id} + '' );
                counter{$id} = setTimeout( "countDown{$id}()", 1000 );
            }

            function stopCount{$id}(){
                clearTimeout(counter{$id})
                \$('#stop{$id}').hide();
                \$('#start{$id}').show();
            }

            function updateReloadArea{$id}(){
                countDownTime{$id} = countDownInterval{$id} + 1;
                reloadTimes{$id} = reloadTimes{$id} + 1;
                \$('#reload{$id}').load('{$url}&R='+reloadTimes{$id}, function() {
                    countDown{$id} ();
                });
            }

            \$().ready ( function () {
                countDown{$id} ();
            });
JS;
        $html = 'Next ' . Tag::hRef("javascript:countDownTime{$id}=0", 'refresh', ['title' => 'Click here to refresh now.', 'class' => $css]) . ' in ' . Tag::hTag('span', ['id' => "countDownText{$id}", 'class' => $css]) . $numOfSeconds . Tag::_hTag('span') . ' seconds ' . Tag::hRef("javascript:stopCount{$id}()", 'Stop', ['id' => "stop{$id}", 'title' => 'Click here to stop the timer.', 'class' => $css]) . Tag::hRef("javascript:countDown{$id}()", 'Start', ['id' => "start{$id}", 'title' => 'Click here to start the timer.', 'class' => $css]) . '<br/>' . Tag::div(['id' => "reload{$id}", 'class' => $css]) . call_user_func($callBack) . Tag::_div();
        return JS::library(JS::JQUERY) . JS::javaScript($js) . $html;
    }
Exemple #10
0
    public function editAccount()
    {
        $resp = new Response();
        $uid = G::get('fldUserID');
        $html = '';
        $props = [];
        $jsUrl = Cfg::get('js_url');
        $jQuery = <<<JS
            \$().ready(function() {
                \$('a.facebox').facebox({closeImage:   '{$jsUrl}/images/closelabel.png',
                                        loadingImage: '{$jsUrl}/images/loading.gif'

                });
            });
JS;
        $userSql = DB::driver() == DB::MYSQL ? self::USER_SQL_MYSQL : self::USER_SQL_SQLITE;
        if (G::accessLevel(Privileges::getSecurityLevel('SITE ADMIN'))) {
            $uid = Request::get('fldUserID', G::get('fldUserID'));
            $props['where'] = ['fldUserID' => G::get('fldUserID')];
            $html .= Tag::form() . $resp->action(sprintf('%s->%s()', __CLASS__, __FUNCTION__))->toHidden() . Tag::table() . Tag::tr() . Tag::th() . 'User to edit' . Tag::_th() . Tag::td() . Lists::select('fldUserID', $userSql, ['onChange' => 'submit()', 'default' => $uid]) . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
        }
        $formName = 'Admin_editAccount';
        $valid = Validator::factory($formName)->addEqual('fldPassword', 'fldPassword_CHK', 'Your passwords do not match')->addLength('fldPassword', 'Password must be at least 6 characters', 6, null, true)->addExists('fldFirstName', 'You must enter your first name')->addExists('fldLastName', 'You must enter your last name');
        $row = DB::oneRow(DB::DEF, 'SELECT * FROM tblUser WHERE fldUserID=?', $uid);
        $html .= '<h2>Edit User Account</h2>' . $valid->toHtml() . Tag::form(['name' => $formName, 'onSubmit' => $valid->onSubmit()]) . $resp->action(sprintf('%s->%sSave()', __CLASS__, __FUNCTION__))->set('fldUserID', $uid)->toHidden() . Tag::table();
        $html .= Tag::tr() . Tag::td() . Tag::table() . Tag::tr() . Tag::td() . 'User Name/Email' . Tag::_td() . Tag::td() . Tag::text('fldUser', $row['fldUser']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Old Password' . Tag::_td() . Tag::td() . Tag::password('fldPassword_OLD') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Password' . Tag::_td() . Tag::td() . Tag::password('fldPassword') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Confirm Password' . Tag::_td() . Tag::td() . Tag::password('fldPassword_CHK') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Title' . Tag::_td() . Tag::td() . Tag::text('fldSalutation', $row['fldSalutation']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'First Name' . Tag::_td() . Tag::td() . Tag::text('fldFirstName', $row['fldFirstName']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Last Name' . Tag::_td() . Tag::td() . Tag::text('fldLastName', $row['fldLastName']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Time Zone' . Tag::_td() . Tag::td() . Lists::select('fldTimeZone', self::TZ_SQL, ['default' => $row['fldTimeZone']]) . Tag::_td() . Tag::_tr();
        if (G::accessLevel(Privileges::getSecurityLevel('SITE ADMIN'))) {
            $html .= Tag::tr() . Tag::td() . 'Security Level' . Tag::_td() . Tag::td() . Lists::select('fldLevel', self::LEVEL_SQL, ['default' => $row['fldLevel']]) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Login Fails' . Tag::_td() . Tag::td() . Tag::text('fldFails', $row['fldFails']) . Tag::_td() . Tag::_tr();
        } else {
            $html .= Tag::tr() . Tag::td() . 'Security Level' . Tag::_td() . Tag::td() . Privileges::getSecurityLevel($row['fldLevel']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Login Fails' . Tag::_td() . Tag::td() . $row['fldFails'] . Tag::_td() . Tag::_tr();
        }
        $html .= Tag::tr() . Tag::td(['colspan' => 2]) . Tag::submit('Save') . Tag::_td() . Tag::_tr();
        if (G::accessLevel(Privileges::getSecurityLevel('SITE ADMIN'))) {
            $html .= Tag::tr() . Tag::td(['colspan' => 2]) . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->newUser()')->toUrl(), 'Create New User', ['class' => 'facebox']) . Tag::_td() . Tag::_tr();
        }
        $html .= Tag::_table() . Tag::_td() . Tag::td(['valign' => 'top', 'align' => 'center']) . Tag::table() . Tag::tr() . Tag::td(['valign' => 'top', 'align' => 'center']) . Gravatar::icon($row['fldUser'], 128) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . Tag::linkButton(Gravatar::getURL(), 'Change Picture', ['target' => '_blank', 'title' => 'your gravatar is associated with your email address ' . $row['fldUser'] . ' (up to 24 hrs to change)']) . Tag::_td() . Tag::_tr();
        if (G::accessLevel(Privileges::getSecurityLevel('SITE ADMIN')) && $uid != G::get('fldUserID')) {
            $name = $row['fldFirstName'] . ' ' . $row['fldLastName'];
            $html .= Tag::tr() . Tag::td() . Tag::linkButton('?' . $resp->action(__CLASS__ . '->loginAs()')->set('fldUser', $row['fldUser'])->toUrl(), 'Login as this User', ['title' => "Login as this user ({$name})"]) . Tag::_td() . Tag::_tr();
        }
        $html .= Tag::_table() . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form();
        return JS::library(JS::JQUERY) . JS::libraryWithDependancies(JS::FACEBOX) . JS::javaScript($jQuery) . $html;
    }
Exemple #11
0
 /**
  * Generates HTML and Javascript to do the tests on this form.
  *
  * @since 1.0
  * @return string
  */
 public function toHtml()
 {
     $msg = $this->headerJS;
     foreach ($this->usedFunct as $key => $val) {
         $msg .= $this->addJSFunctions($key);
     }
     // Then create the validation function that will test all the
     // different form variables
     $msg .= sprintf($this->validateHeaderJS, $this->formName);
     foreach ($this->testCases as $val) {
         $nam = $val['NAME'];
         $desc = $val['DESC'];
         $xtra = $val['XTRA'];
         // Test is in java and check if the form variable exists
         // Ensures the Javascript does not crash on
         // missing Form Variables
         $msg .= sprintf($this->testCaseHeaderJS, $nam);
         $msg .= $this->createCaseJSTests($val, $xtra, $desc);
         // End of the if test that check if the form var exists
         $msg .= sprintf($this->validateFooterJS, $this->formName);
         // Check if we are notifying the user on missing form vars
         if ($this->alertOnMissingFormVar) {
             $msg .= sprintf($this->caseAlertMissingJS, $nam);
         }
     }
     $msg .= sprintf($this->validateFunctionJS, $this->formName);
     return JS::library(JS::JQUERY) . JS::javaScript($msg);
 }
Exemple #12
0
    public static function errorHandler($errno, $errstr, $errfile, $errline)
    {
        if (!preg_match('/^.*\\/3rdparty\\/.*$/', $errfile)) {
            self::$log->error("{$errno}-{$errstr}: {$errfile}({$errline})");
        }
        switch ($errno) {
            case E_STRICT:
            case E_USER_WARNING:
                return;
            default:
                if (self::get('debug')) {
                    $errMsg = sprintf('(!) Fatal error: %s in %s on line: %s', $errstr, $errfile, $errline);
                    $html = Tag::table(['cellpadding' => 3, 'cellspacing' => 0, 'border' => 1]) . Tag::tr(['bgcolor' => 'silver']) . Tag::th(['colspan' => 4, 'align' => 'left']) . $errMsg . Tag::_th() . Tag::_tr() . Tag::tr(['bgcolor' => 'silver']) . Tag::th() . 'Stk' . Tag::_th() . Tag::th() . 'File' . Tag::_th() . Tag::th() . 'Line' . Tag::_th() . Tag::th() . 'Function' . Tag::_th() . Tag::_tr();
                    foreach (debug_backtrace() as $idx => $row) {
                        if ($idx == 0) {
                            continue;
                        }
                        if (isset($row['file'])) {
                            $file = basename($row['file']);
                            $title = $row['file'];
                        } else {
                            $file = '&nbsp;';
                            $title = ' ';
                        }
                        $line = isset($row['line']) ? $row['line'] : '&nbsp;';
                        $function = $row['function'];
                        if (isset($row['class'])) {
                            $function = $row['class'] . $row['type'] . $function;
                        }
                        $style = $idx % 2 == 0 ? [] : ['bgcolor' => 'yellow'];
                        $html .= Tag::tr($style) . Tag::td() . $idx . Tag::_td() . Tag::td(['title' => $title]) . $file . Tag::_td() . Tag::td() . $line . Tag::_td() . Tag::td() . $function . Tag::_td() . Tag::_tr();
                    }
                    $html .= Tag::_table();
                    $html = str_replace(["\n", "'"], ['', "\\'"], $html);
                    $url = self::siteUrl() . '/ajax.php?' . Response::factory()->action('\\Jackbooted\\Html\\WebPage->blank()')->toUrl();
                    $js = <<<JS
                    \$().ready(function() {
                        newWindow = window.open ( '{$url}','Error Output','height=300,width=700');
                        var tmp = newWindow.document;
                        tmp.write ( '<html><head><title>{$errMsg}</title>' );
                        tmp.write ( '<style type="text/css">' );
                        tmp.write ( '</style>');
                        tmp.write ( '</head><body>');
                        tmp.write ( '{$html}' );
                        tmp.write ( '</body></html>');
                        tmp.close();
                    });
JS;
                    echo JS::library(JS::JQUERY) . JS::javaScript($js) . $errMsg;
                }
                break;
        }
    }
Exemple #13
0
 /**
  * Organizes the created javascript code for the page
  *
  * @param Boolean $includeJS: False to create js class here and True to include the js class file
  */
 public function run($echoJS = true)
 {
     if ($this->ran) {
         return;
     }
     $this->ran = true;
     $js = '';
     foreach ($this->functions as $function) {
         $js .= $this->createFunction($function);
     }
     foreach ($this->objectMethods as $objectName => $objectInfo) {
         $js .= $this->createClass($objectName, $objectInfo);
     }
     if ($echoJS) {
         echo JS::javaScript($js);
     } else {
         return $js;
     }
 }
Exemple #14
0
echo Cfg::get('desc');
?>
" />
        <meta name="keywords"    content="<?php 
echo Cfg::get('desc');
?>
" />
        <link type="text/css" rel="stylesheet" media="screen" href="style.css" />
        <?php 
/* <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" > */
?>
        <?php 
/* <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> */
?>
        <?php 
echo JS::libraryWithDependancies(JS::JQUERY);
?>
    </head>
    <body>
        <table width="100%" cellpadding="5" cellspacing="0" border="1">
            <tr>
                <td width="100%">
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td nowrap="nowrap" valign="top" height="50" width="100">
                                <a href="?"><img alt="ONEDC Appliance Logo" src="<?php 
echo \App\Jack::logo();
?>
" border=0 height="90"/></a>
                            </td>
                            <td nowrap="nowrap" valign="top" align="left">