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 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);
    }
Example #3
0
 public function browse()
 {
     $classes = array();
     foreach (ClassLocator::getDefaultClassLocator()->getLocatorArray() as $className => $fileName) {
         if (preg_match(AutoLoader::THIRD_PARTY_REGEX, $fileName)) {
             continue;
         }
         $classes[$fileName] = $className;
     }
     asort($classes);
     $html = '<H4>Below are a list of classes, Click on class to view source</h4>' . Tag::form(array('method' => 'get')) . MenuUtils::responseObject()->action(__CLASS__ . '->' . __FUNCTION__ . '()')->toHidden(false) . Lists::select('fldFileName', $classes, array('size' => '7', 'onClick' => 'submit();')) . Tag::_form();
     return $html . $this->sourceCode();
 }
Example #4
0
                            <td nowrap="nowrap" valign="top" align="right" width="100%">
                                <?php 
echo \Jackbooted\Admin\FancyLogin::controller();
?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="600px" width="100%">
                    <table width="100%" height="100%" cellpadding="5" cellspacing="0">
                        <tr>
                            <td nowrap="nowrap" valign="top">
                                <?php 
echo \Jackbooted\G::isLoggedIn() ? \Jackbooted\Util\MenuUtils::display() : '&nbsp;';
?>
                            </td>
                            <td align="left" valign="top" width="100%">
                                <?php 
echo \Jackbooted\Html\WebPage::controller(Cfg::get('def_display'));
?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td width="100%">
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>