예제 #1
0
파일: index.php 프로젝트: skhal/kslog
    public function body()
    {
        parent::body();
        ?>

<div id='log'></div>

<script type='text/javascript'>
var _application = null;

window.addEvent( 'domready', function() {
  _application = new KSApplication();

<?php 
        if (isset($GLOBALS['KS_USER']) && $GLOBALS['KS_USER']->isValid()) {
            ?>
  _application.auth.onLogin({
    uid : <?php 
            echo $GLOBALS['KS_USER']->id();
            ?>
,
    name: '<?php 
            echo $GLOBALS['KS_USER']->name();
            ?>
'.capitalize()
  });
<?php 
        }
        ?>

  {
    var _el = $( 'log');

    _application.post      .dom.box.inject  ( _el, 'before');
    _application.log.main  .dom.box.inject  ( _el, 'before' );
    _application.log.search.dom.box.replaces( _el );
  }

  // Run application once all Services are downloaded and available for use
  //
  gKSInitializer.add( gKSComposer);  
  gKSInitializer.add( gKSGrowl);  
  gKSInitializer.add( gKSProgress);  

  gKSInitializer.addEvent( 'ks:initialized', _application.run.bind( _application) );

  gKSInitializer.run();
});
</script>

<?php 
    }
예제 #2
0
파일: index.php 프로젝트: skhal/kslog
  public function body()
  {
    parent::body();
?>

<h1 class='page_title' id='ks_page_title'>
  WELCOME to Test Page
</h1>

<a href='./pages/test/get.php'>Get Entries</a><br>
<a href='javascript:void(0)'>More Entries</a>(under construction)<br>
<a href='javascript:void(0)'>Update Entries</a>(under construction)<br>

<?php 
    }
예제 #3
0
파일: get.php 프로젝트: skhal/kslog
  public function body()
  {
    parent::body();
?>

<h1 class='page_title' id='ks_page_title'>
  Test Area: Get Entries
</h1>

Mode: 
<select id='mode' name='mode'>
  <option value='normal'>Normal</option>
  <option value='id'>IDs</option>
  <option value='trange'>Time Range</option>
  <option value='author'>Author</option>
</select>

Data:
<input id='data' type='text' value='' style='width: 300px'>
<a id='get' href='javascript:void(0)'>Get Entries</a><br>

<br>

Request Data:<br>
<textarea id='request' cols='80' rows='5' readonly></textarea><br>

<br>

Respond Data:<br>
<div id='respond'></div>

<script type='text/javascript'>
function print_r(theObj)
{
  var _result = '';

  if( 'array'  == $type( theObj) ||
      'object' == $type( theObj) )
  {
    _result += '<ul>';
    $each( theObj, function( _val, _key) {
      if( 'array'  == $type( _val) ||
          'object' == $type( _val) )
      {
        _result += "<li>[" + _key + "] => " + $type( theObj) + "</li><ul>";
        _result += print_r( _val);
        _result += "</ul>";
      } else
        _result += "<li>[" + _key + "] => " + _val + "</li>";
    });
    _result += "</ul>";
  }

  return _result;
}

var KSGet = new Class({
  Binds: [ 'onClickGet', 'onGet' ],

  initialize: function()
  {
    this.data    = $( 'data');
    this.request = $( 'request');
    this.respond = $( 'respond');
  },

  //------------------------------- SLOTS -----------------------------------
  onClickGet: function()
  {
    KSProgress.show();

    var _data = this.data.get( 'value').trim().stripScripts();

    this.request.set( 'value', _data);

    new Request.JSON({
      url: './pages/get/entries.php?t=' + $time(),

      data: encodeURIComponent( _data),

      onSuccess: this.onGet,

      onFailure: function( _xhr)
      {
        KSProgress.hide();

        KSGrowl.notify({
          title: 'Authentication',
          entry: 'Failed to Make Request to Server. Check connection.',
          style: 'error'
        });
      }
    }).send();
  },

  onGet: function( _json)
  {
    KSProgress.hide();

    if( _json.error)
    {
      KSGrowl.notify({
        title: 'Test Area',
        entry: _json.message,
        style: 'error'
      });

      return;
    }

    this.respond.set( 'html', print_r( _json) );
  }
});

window.addEvent( 'domready', function() {
  KSInitializer.add( KSGrowl);  
  KSInitializer.add( KSLayerService);  
  KSInitializer.add( KSProgress);  

  var _func = function( _f) {
    if( !KSInitializer.isInitialized() )
    {
      _f.delay( 100, null, _f);

      return;
    }

    $( 'mode').addEvent( 'change', function() {
      console.log( 'changed to: ' + $( 'mode').get( 'value') );
    });

    var _get = new KSGet();

    $( 'get').addEvent( 'click', _get.onClickGet);
  };

  _func( _func);
});
</script>

<?php 
    }