Page 1 of 1

Ajax in Calendar module

Posted: Sat Sep 08, 2007 8:53 am
by BuFu
Hi,

I need to use some Ajax functions in Calendar module, but they don’t work. I have tested everything not in CMSMS and they all work fine.

In Template I put:


Do Something


And the function  SomeFunction() is in the „Ajax.js“file:

.
.
.
function SomeFunction(string)
{
document.getElementById("Ajaxoutput ").innerHTML=xmlHttp.responseText
}
.
.
.

Please help. And again sorry for my English  ;)

Re: Ajax in Calendar module

Posted: Sat Sep 08, 2007 11:12 pm
by aln_cms
I think your code is wrong.  Try something like this:

define('XAJAX_DEFAULT_CHAR_ENCODING', $config['admin_encoding']);
require_once(dirnaame(dirname(dirname(__FILE__))) . '/lib/xajax/xajax.inc.php');
$xajax = new xajax();
$xajax->registerFunction('YOUR_FUNCTION_NAME');

$xajax->processRequests();
$headtext = $xajax->getJavascript($config['root_url'] . '/lib/xajax')."\n";
//see note below.

function YOUR_FUNCTION_NAME()
{
$objResponse = new xajaxResponse();
$objResponse->addAssign("contentlist", "innerHTML", 'some html code');
return $objResponse->getXML();
}


output this html to the page

echo ' ';

N.B In Calendar.module.php, you need to overide (add) the function :

function GetHeaderHTML()
{
  if( isset($this->headtext) )
              return $this->headtext;
          else
          return '';
}

Re: Ajax in Calendar module

Posted: Sun Sep 09, 2007 11:16 am
by aln_cms
..... and you need to add this methood to the Calendar.module.php source code:

function SuppressAdminOutput($param){
return true;
}


Works for me with 1.1. Samoa