Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET['mktabs'])) {
- mktabs();
- exit();
- }
- function mktabs() {
- $sqls = array(
- //-----------------------------
- 'drop table if exists digests',
- 'drop table if exists digests_elements',
- //-----------------------------
- 'create table digests (
- digest_id int(11) not null auto_increment,
- digest_title varchar(50),
- digest_text varchar(500),
- digest_schedule_type int(11),
- digest_date datetime,
- primary key(`digest_id`)) ',
- //-----------------------------
- 'create table digests_elements (
- element_id int(11) not null auto_increment,
- digest_id int(11),
- element_rss_name varchar(20),
- element_page_order int(11),
- element_output_type int(11),
- primary key(`element_id`))');
- $db = new mysqli('','','','');
- foreach ($sqls as $sql) {
- $db->query($sql);
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta name="description" content="JQuery tests" />
- <title>JQuery tests</title>
- <?php $cur_url = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']); ?>
- <style type="text/css">
- * {
- margin: 0;
- padding: 0;
- border: none;
- outline: none;
- }
- body {
- font-family: verdana, sans-serif;
- font-size:100%;
- }
- #container {
- width:1000px;
- margin:0 auto;
- }
- #questions {
- margin-bottom: 10px;
- }
- .header {
- height:100px;
- color:#333;
- font-size:1.5em;
- line-height:1.5em;
- text-align:center;
- letter-spacing:3px;
- background: #eee;
- border-radius: 100px 60px 50px 10px;
- -moz-border-radius: 100px 60px 50px 10px;
- -webkit-border-radius: 100px 60px 50px 10px;
- display: none;
- }
- .content {
- float:left;
- width:1000px;
- margin-bottom: 5px;
- margin-top: 20px;
- }
- .page {
- float:left;
- }
- .page>div {
- float:left;
- margin-top:0;
- margin-right:0;
- margin-bottom:0;
- height: 30px;
- width: 130px;
- padding: 4px 10px;
- border-right: solid 1px #aaa;
- border-top: solid 1px #aaa;
- font-size: 12px;
- }
- div.entrytitle {
- margin-top: 0;
- font-size:1.2em;
- font-weight:bold;
- height:30px;
- line-height:30px;
- text-align:center;
- background: #eee;
- border-radius:10px;
- -moz-border-radius:10px;
- -webkit-border-radius:10px;
- float: left;
- padding: 4px 50px;
- clear:left;
- width:200px;
- }
- .entrytitle a {
- color:#999;
- text-decoration: none;
- }
- .entrytitle a:hover {
- color:#555;
- }
- .entrycontent {
- padding: 4px 20px 5px 10px;
- border-bottom: solid 1px #999;
- }
- .entrycategory {
- height:30px;
- background: #eee;
- }
- .entryuser {
- font-family:georgia, serif;
- font-size:0.75em;
- }
- .entrydate {
- font-size:0.75em;
- font-style: italic;
- }
- .entryeditpanel {
- margin-top:10px;
- overflow:hidden;
- }
- .editpanel {
- overflow:hidden;
- }
- .editbutton, .deletebutton, .addbutton, .backtolistbutton {
- background:#ff9;
- font-weight:bold;
- font-size: 12px;
- text-align:center;
- padding:4px 10px;
- margin-right:5px;
- border: solid 2px #800;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
- border-radius: 8px;
- float:left;
- }
- .editbutton a, .deletebutton a, .addbutton a, .backtolistbutton a{
- color:#c00;
- text-decoration: none;
- }
- div.editbutton {
- }
- div.deletebutton {
- }
- .addbutton {
- }
- .backtolistbutton {
- }
- .sidebar {
- float:right;
- width:190px;
- margin-top:10px;
- background: #f5f5f5;
- display:none;
- }
- .footer {
- clear:both;
- background: #f0f0f0;
- padding:0;
- margin-bottom:20px;
- }
- .navigation {
- margin-top:4px;
- overflow: hidden;
- }
- .navigation ul {
- list-style-type:none;
- }
- .navigation li {
- float:left;
- margin-right: 5px;
- text-align:center;
- height:40px;
- line-height:40px;
- background: white;
- font-weight: bold;
- width: 40px;
- border: solid 1px #555;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
- }
- .navigation li a, .navigation li a:visited {
- text-decoration:none;
- color: #800;
- }
- .navigation li a:hover {
- text-decoration: underline;
- }
- form {
- padding:20px 40px 10px 20px;
- }
- fieldset {
- padding-top:10px;
- }
- legend {
- border:solid 1px #aaa;
- border-radius:4px;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
- padding:4px 20px;
- display: none;
- }
- label {
- display:block;
- float:left;
- clear:left;
- width:200px;
- margin-right:10px;
- margin-top: 5px;
- }
- input, select {
- display: block;
- border: solid 1px #aaa;
- border-radius: 4px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- padding:2px 5px;
- margin-top:5px;
- }
- input[type=text] {
- width:400px;
- }
- input[type=submit], input[type=button] {
- background:#ffa;
- float:left;
- border:solid 2px #a00;
- border-radius 8px;
- -moz-border-radius 8px;
- -webkit-border-radius 8px;
- color:#b00;
- cursor:pointer;
- padding:4px 20px;
- font-size:1em;
- margin-right:10px;
- margin-top:10px;
- }
- #all_ajax_status {
- display: none;
- }
- </style>
- <script src="<?php echo $cur_url;?>/jquery.min.js"></script>
- <script type="text/javascript">
- var gl_current_digest = 0;
- //-----------------------------------------
- function init() {
- $('#all_ajax_status').ajaxStart( function() {
- $(this).html('Request started, Please wait...');
- });
- //--------------------
- $('#all_ajax_status').ajaxStop( function() {
- $(this).html('Request finished.');
- });
- //--------------------
- $('#all_ajax_status').ajaxSend( function (ev, xhr, options) {
- $(this).html('Request sent, status:'+xhr.status);
- });
- //--------------------
- $('#all_ajax_status').ajaxSuccess (function( ev, xhr, options) {
- $(this).html('Request success, status:'+xhr.status+', readystate:'+xhr.readyState);
- $(options.statusblock).html('');
- });
- //--------------------
- $('#all_ajax_status').ajaxError( function( ev, xhr, options, err) {
- $(this).html('Error occured: '+err+', status:'+xhr.status);
- $(options.statusblock).html('error occured :'+err);
- $(options.targetblock).html('response: '+xhr.responseText+'<br/>'+
- ' xhr status:'+xhr.status+'<br/>xhr ready state:'+xhr.readyState+'<br/>');
- });
- //--------------------
- $('#all_ajax_status').ajaxComplete( function( ev, xhr, options) {
- });
- }
- //-----------------------------------------
- function ajaxBeforeSend (xhr, options) {
- $(options.statusblock).html('request started, please wait...');
- }
- //-----------------------------------------
- function ajaxSuccess (target_block) {
- return function(inf, status, xhr) {
- $(target_block).html(inf);
- redir_links(target_block);
- if (target_block=='#digests_ajax')
- master_detail_events(target_block);
- }
- }
- //-----------------------------------------
- function ajaxError (xhr, status, err) {
- }
- //-----------------------------------------
- function ajaxComplete (xhr, status) {
- }
- //-----------------------------------------
- function master_detail_events(target_block) {
- $('.entrytitle a',$(target_block)).unbind('click').click(
- function() {
- var re = /digest_id=(\d+)/;
- var zid = re.exec(this.href);
- gl_current_digest = zid[1];
- ajax_request('#digests_details_ajax_info',
- '#digests_details_ajax', "<?=$cur_url?>/ajax_ind.php?controller=digestelements&filterdigestelements="+
- encodeURIComponent('digest_id='+gl_current_digest));
- return false;
- }
- )
- $('.entrytitle a',$(target_block)).eq(0).trigger('click');
- }
- //-----------------------------------------
- function redir_links(target_block) {
- $('a',target_block).click( function() {
- ajax_request(target_block+'_info', target_block, $(this).attr('href'));
- return false;
- });
- $('input:hidden[name=digest_id]').attr('value', gl_current_digest);
- $('form',target_block).submit( function() {
- var data = {};
- $(this).find('input[name],select[name]').each(
- function(ind, el4) {
- data[el4.name] = el4.value;
- })
- ajax_request(target_block+'_info', target_block, this.action, 'POST', data);
- return false;
- });
- $('input:button[name="cancel"]',target_block).attr('onclick','').click( function() {
- ajax_request(target_block+'_info', target_block,
- $(this).parent().find('input:hidden[name="cancelroute"]').attr('value'));
- return false;
- });
- /*var re = /back_to_list.*?/;
- if (tx!==undefined) {
- res = re.exec(tx);
- console.log(res);
- }
- var re = /(\w+)\s(\w+)/;
- var str = "John Smith";
- var newstr = str.replace(re, "$2, $1");
- alert(newstr); // "Smith, John"
- */
- /*for (var i in document.scripts) {
- var tx = document.scripts[i].text;
- }*/
- }
- //-----------------------------------------
- function ajax_request(status_block, target_block, inurl, intype, indata) {
- var intype = intype || 'GET';
- var indata = indata || {};
- $.ajax ( {
- url: inurl,
- type: intype,
- data: indata,
- dataType: 'html',
- statusblock: status_block,
- targetblock: target_block,
- beforeSend: ajaxBeforeSend,
- success: ajaxSuccess(target_block),
- error: ajaxError,
- complete: ajaxComplete
- })
- }
- //-----------------------------------------
- $(document).ready ( function() {
- init();
- ajax_request('#digests_ajax_info', '#digests_ajax', "<?=$cur_url?>/ajax_ind.php?controller=digests");
- });
- </script>
- </head>
- <body>
- <h3>List of Digests</h3>
- <div id="all_ajax_status"></div>
- <div id="digests_ajax_info"></div>
- <div id="digests_ajax"></div>
- <h3 id="current_digest">Digest details</h3>
- <div id="digests_details_ajax_info"></div>
- <div id="digests_details_ajax"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement