$page_content .= $pg->getHTML(); } else { die('Could not generate HTML'); } break; } $tpl->assign('module', $function); $tpl->assign('page_content', $page_content); $tpl->assign('ajax_functions', $ajax_functions); $tpl->assign('thehelp_text', $thehelp_text); ob_start(); sajax_handle_client_request(); $ajax_handle_requests = ob_get_contents(); ob_end_clean(); $tpl->assign('ajax_handle_requests', $ajax_handle_requests); $ajax_javascript = sajax_get_javascript(); $tpl->assign('ajax_javascript', $ajax_javascript); $ajax_functions = ''; // $sajax_debug_mode = 1; /** * extra headers */ $tpl->assign('extra_head_content', $extra_head); // get topbar include_once "includes/topbar.php"; $tpl->assign('topbar', getGroupTopBar($group_title, $function)); /** * SSL Check */ if (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") { $tpl->assign('ssl_check', true);
function sajax_show_javascript() { echo sajax_get_javascript(); }
} sajax_init(); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// /* spit out the javascript for this bugger */ if (array_key_exists('js', $_GET)) { if (getConfig('rss.output.compression')) { ob_start('ob_gzhandler'); } else { ob_start(); } header('Content-Type: text/javascript'); // The javascript output shall be cached // The Etag was set at the start of this file. $js = sajax_get_javascript(); echo $js; // and here is s'more javascript for field editing... ?> /// End Sajax javscript /// From here on: Copyright (C) 2003 - 2006 Marco Bonetti, gregarius.net /// Released under GPL function miniloginform() { span = document.getElementById('loginformcontainer'); if (span.style.display == 'none') { span.style.display = 'block'; } else { span.style.display = 'none'; }
$card->completed = $completed; $card->updated_date = time(); $card->updated_by = $Utilisateur['user_id']; $card->save(); } //$sajax_debug_mode = 1; sajax_init(); sajax_export("sajax_update_completed"); sajax_handle_client_request(); // // HTML output // //Header $smarty->assign('PAGE_TITLE', $card->title); $smarty->assign('PAGE_CSS', 'Themes/' . THEME . '/view.css'); $smarty->assign('SAJAX_JAVASCRIPT_CODE', sajax_get_javascript()); $smarty->assign('PAGE_JS', array('common.js', 'view.js')); $smarty->assign('ACCENT', $card->accent); //View variables $smarty->assign('card_id', $card->id); $smarty->assign('card_title', $card->title); $smarty->assign('card_text', nl2br($card->text)); $smarty->assign('card_keywords_URL', $card->keywords_URL); if ($card->logo) { $smarty->assign('card_logo', URL_LOGOS . $card->logo); } $smarty->assign('card_logo_alt', "Card {$card->title} logo"); $smarty->assign('card_completed', $card->completed); $smarty->assign('card_points', $card->points); $smarty->assign('card_created_date', $card->created_date); $smarty->assign('card_created_by', "<a href='/who/{$card->created_by}'>" . getnom($card->created_by) . '</a>');
$smarty->Confglanguage(); $smarty->assign($smarty->LoadPerfil()); $smarty->LoadPages(); $smarty->SetPages(); $smarty->LoadModulos(); ######################################################## ###### CARREGANDO BIBLIOTECAS SAJAX ###### ######################################################## $sajax_request_type = $smarty->get_config_vars('sajax_request'); //forma como os dados serao enviados sajax_init(); //inicia o SAJAX $sajax_debug_mode = 1; //$smarty->get_config_vars('sajax_debug'); //Debug do funcionamento através de ALERT, 1 = ligado, 0 = desligado $sajax_request_type = 'post'; sajax_export("loadPage", "CheckForm", "SemiPost"); // lista de funcoes a ser exportada sajax_handle_client_request(); $SAJAX = sajax_get_javascript(); $smarty->assign('SAJAX', $SAJAX); ######################################################## $smarty->LoadFunction(); $smarty->display($smarty->actualpage["page_index"]); ######################################################## ###### DEBUG INTERNO ###### ######################################################## //print_r($smarty->actualpage); //print_r($_GET); //print_r($_POST); //print_r($_SESSION); //print_r($_COOKIE);
function sajax_show_javascript() { return sajax_get_javascript(); }
function ajaxUpdateJavascript() { echo sajax_get_javascript(); ?> /// End Sajax javascript /// From here on: Copyright (C) 2003 - 2006 Marco Bonetti, gregarius.net /// Released under GPL document.cdata = new Array(); document.new_ids = new Array(); document.returnedUpdates = 0; document.feedCount = 0; document.feedPointer=0; /** * main entry point: fetch the different channel ids and launch the * channel updates. Might want to have this synchronous to be nice on * the webserver, not sure whether it can be done with Sajax, though */ function doUpdate() { var ids = new Array(); kids = document.getElementById('updatetable').getElementsByTagName("tr"); var i=0; var added = 0; //collect feed ids, titles for (i=0; i < kids.length; i++) { var id = kids[i].id.replace(/[^0-9]/gi,''); if (id) { ids[added++] = id; if (!document.cdata[id]) { var title = ''; if ( tdl = document.getElementById('u_l_' + id)) { title = tdl.innerHTML; if (title) { document.cdata[id] = title; } } } } } document.feedCount = added; var batch = new Array(); var j=0; for (j=0;(j+document.feedPointer) < document.feedCount && j < <?php echo AJAX_BATCH_SIZE; ?> ;j++) { batch[j]=ids[j+document.feedPointer]; if (tdr = document.getElementById('u_r_' + batch[j])) { tdr.innerHTML = '<?php echo UPDATING; ?> '; } } document.feedPointer += j; ajaxUpdate(batch); } /** * AJAX Callback function: split the returned data into variables * and play some DOM tricks */ function ajaxUpdate_cb(data) { //alert(data); superdarr = data.replace(/[^0-9a-zA-Z\(\)\|\s\.,]/gi,'').split('<?php echo GROUP_SPLITTER; ?> '); var lastId = 0; for (var i=0;i<superdarr.length;i++) { darr = superdarr[i].replace(/[^0-9a-zA-Z\(\)\|\s,\.]/gi,'').split('<?php echo SUB_SPLITTER; ?> '); // channel ID id=darr[0]; lastId = id; // unread count if (darr[1] && (unread_ids = darr[1].split('<?php echo SUB_SUB_SPLITTER; ?> '))) { //alert('unread ids: ' + unread_ids); document.new_ids=document.new_ids.concat(unread_ids); //alert('document ids: ' + document.new_ids); unread = unread_ids.length; } else { unread=0; } // an error/result-label label=darr[2]; // class to be applied to the label, unused for now cls=darr[3]; // update the table for this row if (mtd = document.getElementById('u_m_'+id)) { //alert(cls); mtd.innerHTML = '<span class="' + cls + '">' + label + '</span>'; } if (rtd = document.getElementById('u_r_'+id)) { rtd.innerHTML = unread; } // hoorray, we got a result back. document.returnedUpdates++; } if (document.feedPointer < document.feedCount) { if (document.returnedUpdates >= document.feedPointer - <?php echo AJAX_BATCH_SIZE * (AJAX_PARALLEL_SIZE - 1); ?> ) { doUpdate(); } } else { ajaxUpdateCleanup(); window.setTimeout('redirect()', 3000); } } function ajaxUpdateCleanup_cb(dummy) {} function redirect() { document.location = "index.php"; } function ajaxUpdate(batch) { sBatch=''; //alert(batch.length); for(var i=0;i<batch.length;i++) { sBatch += batch[i]; if (i<batch.length-1) { sBatch += '<?php echo GROUP_SPLITTER; ?> '; } } x_ajaxUpdate(sBatch,ajaxUpdate_cb); } function ajaxUpdateCleanup() { ids = ''; for(var i=0;i< document.new_ids.length;i++) { var id = Number(document.new_ids[i]); if (id > 0) { ids += id ; if (i<document.new_ids.length-1) { ids += '<?php echo GROUP_SPLITTER; ?> '; } } } //alert(ids); if (ids != '') { x_ajaxUpdateCleanup(ids,ajaxUpdateCleanup_cb); } } <?php flush(); }