Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'twit.inc.php');
- $action= (isset($_GET['action'])) ? $_GET['action'] : '';
- $line_name =(isset($_GET['line_name'])) ? $_GET['line_name'] : '';
- $twit = new Twit;
- if ($action) {
- echo $twit->$action($line_name);
- exit();
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>twit lines</title>
- <script type="text/javascript" src="jquery.min.js"></script>
- <script type="text/javascript">
- $(document).ready(init);
- ajax_get='';
- ajax_post='';
- //------------------------------------------
- function init() {
- //-------------------
- $('a[rel^="_"], input:button[rel^="_"]').unbind('click').click ( function(ev) {
- var ev = ev || event;
- if ($(this).get(0).tagName=='A')
- if ($(this).get(0).hasAttribute("rel")) {
- $(this).prev().attr('checked','checked');
- }
- //--------------------------------
- if (this.hasAttribute('lnname'))
- var line_name = this.getAttribute('lnname');
- else
- var line_name = '';
- //--------------------------------
- if (this.hasAttribute('pg'))
- var page_id = this.getAttribute('pg');
- else
- var page_id = 'z';
- //--------------------------------
- if (!ajax_get)
- ajax_get = new Ajax_get();
- ajax_get.query($(this).attr('rel').slice(1), line_name, page_id);
- if (ev.preventDefault)
- ev.preventDefault();
- else
- ev.returnValue = false;
- });
- //-------------------
- $('form').filter(
- function(index) {
- return (this.hasAttribute('rel')) && ($(this).attr('rel').substr(0,1)=='_');})
- .unbind('submit')
- .submit( function(ev) {
- var ev = ev || event;
- if (!ajax_post)
- ajax_post = new Ajax_post();
- var data8 = {};
- $(this).find('input[name]').each (
- function(i) {
- data8[this.name]=this.value;
- }
- );
- $.when (ajax_post.query($(this).attr('rel').slice(1), data8))
- .done(function(){updateState();});
- if (ev.preventDefault)
- ev.preventDefault();
- else
- ev.returnValue = false;
- });
- //-------------------
- $('.controls a[rel="refill_twitline"]').unbind('click').click (
- function() {
- $('#ajaxblock').empty().append(
- $('<iframe/>', {id:'ziframe', width:'700', height: '400', scrolling: 'no'}));
- $('#ziframe').css('border','solid 1px #888');
- $('#ziframe').attr('src',
- location.protocol+'//'+location.hostname+location.pathname+
- '?action=refill_twitline&line_name='+
- $('#lineform input:radio:checked').val());
- }
- );
- //----------------------------------
- $('#contentheader').unbind().ajaxStart(
- function() {
- $(this).html('ajax request started...');
- }
- );
- //----------------------------------
- $('#contentheader').unbind().ajaxStop(
- function() {
- $(this).html('ajax request finished');
- }
- );
- //----------------------------------
- };
- //------------------------------------------
- Ajax_get = function () {
- var _self = this;
- //----------------------
- this.onSuccess = function(inf, status, xhr) {
- $('#ajaxblock').empty().html(inf);
- init();
- }
- //----------------------
- this.onError = function(xhr, status, exception) {
- var inf = [];
- inf.push ('ajaxResponse: <pre>'+xhr.responseText+'</pre>');
- inf.push ('status: '+xhr.status);
- inf.push ('ready state: '+xhr.readyState);
- inf.push ('text status: '+status);
- inf.push ('exception: '+exception);
- s = inf.join('<br/>');
- $('#ajaxblock').empty().html(s);
- }
- //----------------------
- this.query = function (action, line_name, page_id) {
- var line_name = line_name || $('#lineform input:radio:checked').val();
- var data = {
- action: action,
- line_name: line_name
- };
- if (!isNaN(page_id)) {
- data['page'] = page_id
- }
- return $.ajax ( {
- type: 'GET',
- url: location.protocol + '//' +
- location.hostname + location.pathname,
- data: data,
- success: _self.onSuccess,
- error: _self.onError
- })
- }
- };
- //------------------------------------------
- Ajax_post = function () {
- var _self = this;
- //----------------------
- this.onSuccess = function (inf, status, xhr) {
- $('#ajaxblock').empty().html(inf);
- }
- //----------------------
- this.onError = function (xhr, status, exception) {
- var inf = [];
- inf.push ('ajaxResponse: <pre>'+xhr.responseText+'</pre>');
- inf.push ('exception: '+exception);
- s = inf.join('<br/>');
- $('#ajaxblock').empty().html(s);
- }
- //----------------------
- this.query = function (action, data) {
- return $.ajax ( {
- type: 'POST',
- url: location.protocol+'//'+ location.hostname +
- location.pathname +'?action='+action,
- data : data,
- success: _self.onSuccess,
- error: _self.onError
- });
- }
- }
- //-------------------------------------------------
- function updateState() {
- var addr = location.protocol+'//'+location.hostname+location.pathname;
- $.when ($.get( addr, {action: 'loginstatus'})).done(
- function(tx) {
- $('#loginblock').empty().html(tx);
- init();
- }
- );
- $.when ($.get( addr, {action: 'show_twitlines'})).done(
- function(tx) {
- $('#twitlines').empty().html(tx);
- init();
- }
- )
- }
- </script>
- <style type="text/css">
- * {
- margin: 0;
- padding: 0;
- font-size: inherit;
- }
- ul {
- list-style-type: none;
- }
- a {
- color:inherit;
- }
- body {
- font-family: verdana, helvetica, sans-serif;
- font-size: 1em;
- }
- #container {
- width: 90%;
- margin: 0 auto;
- }
- #header {
- height: 100px;
- background: #800;
- color: white;
- position:relative;
- }
- #loginblock {
- position: absolute;
- left:50px;
- top: 20px;
- border: solid 1px #eee;
- padding: 20px 50px 15px 50px;
- }
- #sidebar {
- float:left;
- width: 300px;
- padding: 20px 0 0 0;
- }
- #twitlines li {
- height: 1.5em;
- line-height:1.5em;
- border-bottom: dotted 1px;
- }
- #twitlines input[type=radio] {
- width:50px;
- }
- #twitlines li a {
- text-decoration: none;
- }
- .controls {
- overflow: auto;
- margin: 10px 0 0 0;
- padding: 0 0 20px 0;
- }
- .controls li {
- float:left;
- margin-top: 5px;
- margin-right:10px;
- border: solid 1px #500;
- border-radius: 10px;
- background: #ffe;
- padding: 5px 10px;
- font-size: 0.75em;
- }
- .controls li a {
- text-decoration: none;
- }
- .controls li a:hover {
- text-decoration: underline;
- }
- #content {
- margin-left: 320px;
- }
- #contentheader {
- height: 30px;
- background: #400;
- color: white;
- }
- #ajaxblock {
- border: dotted 1px #888;
- }
- #footer {
- height: 50px;
- background: #444;
- clear:left;
- }
- /*-------------------------*/
- .twitfeed {
- font-size: 0.75em;
- }
- .twitfeed li {
- position: relative;
- border-bottom: dotted 1px #888;
- padding-bottom: 3px;
- padding-right: 160px;
- }
- .twitid {
- display:none;
- }
- .twittitle {
- line-height:1.5;
- }
- .twitdesc {
- display:none;
- }
- .twitlink {
- display: none;
- }
- .twitpubdate {
- position:absolute;
- right:0;
- bottom:0;
- background: #ffe;
- border: solid 1px #f5f5f5;
- color: #555;
- padding: 0 10px;
- width: 130px;
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- }
- .pager {
- overflow: auto;
- padding: 10px 0 15px 0;
- }
- .pager li {
- float:left;
- margin: 0 5px 4px 0;
- border: solid 1px #500;
- border-radius: 10px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- background: #ffe;
- font-size:0.75em;
- overflow:hidden;
- }
- .pager li a {
- display:block;
- height: 100%;
- padding: 0.5em 10px;
- text-decoration: none;
- }
- .pager li a:hover {
- background: #444;
- color: white;
- }
- /*-------------------------*/
- form {
- overflow: auto;
- padding: 5px;
- margin:5px;
- }
- form p {
- }
- form input[type=text] {
- margin-left:20px;
- }
- form input[type=button],
- form input[type=submit],
- form input[type=reset] {
- display:block;
- float: left;
- margin: 5px 5px 0 0;
- padding: 5px 8px;
- background: #f0f0f0;
- cursor:pointer;
- border: solid 1px #444;
- border-radius: 10px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- }
- form input[type=submit] {
- clear: left;
- }
- </style>
- </head>
- <body>
- <div id="container">
- <div id="header">
- <div id="loginblock">
- <?php echo $twit->loginstatus(); ?>
- </div>
- </div>
- <div id="sidebar">
- <div id="twitlines">
- <?php try {echo $twit->show_twitlines();} catch (Exception $e) {echo $e->getMessage();} ?>
- </div>
- <div id="controls">
- <?php try {echo $twit->show_controls();} catch( Exception $e) {echo $e->getMessage();} ?>
- </div>
- </div>
- <div id="content">
- <div id="contentheader">
- </div>
- <div id="ajaxblock">
- </div>
- </div>
- <div id="footer">
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement