Ajax in Calendar module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
BuFu

Ajax in Calendar module

Post 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  ;)
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

Re: Ajax in Calendar module

Post 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 '';
}
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

Re: Ajax in Calendar module

Post 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
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Post Reply

Return to “Developers Discussion”