2 * Event Calendar for Elxis CMS 2008.x and 2009.x
\r
7 * @package eventCalendar
\r
8 * @author Apostolos Koutsoulelos <akoutsoulelos@yahoo.gr>
\r
9 * @copyright Copyright (C) 2009-2010 Apostolos Koutsoulelos. All rights reserved.
\r
10 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
\r
13 * ======================= NOTE =======================
\r
15 * Based on Ioannis Sannos (datahell) code
\r
21 if(window.XMLHttpRequest){ // Non-IE browsers
\r
22 ro = new XMLHttpRequest();
\r
23 } else if (window.ActiveXObject){ // IE
\r
24 ro=new ActiveXObject("Msxml2.XMLHTTP");
\r
26 ro=new ActiveXObject("Microsoft.XMLHTTP");
\r
32 var http = newobj();
\r
34 var cajax = new sack();
\r
36 /* GENERAL FUNCTIONS */
\r
38 function whenLoadingcon(){
\r
39 var e = document.getElementById(cajax.element);
\r
40 e.innerHTML = "<img src='images/loading.gif' border='0'>";
\r
43 function whenLoadedcon(){
\r
44 var e = document.getElementById(cajax.element);
\r
45 e.innerHTML = "<img src='images/loading.gif' border='0'>";
\r
48 function whenInteractivecon(){
\r
49 var e = document.getElementById(cajax.element);
\r
50 e.innerHTML = "<img src='images/loading.gif' border='0'>";
\r
53 function whenLoadingconHTML(){
\r
54 var e = document.getElementById(cajax.element);
\r
55 e.innerHTML = "<img src='administrator/images/loading.gif' border='0'>";
\r
58 function whenLoadedconHTML(){
\r
59 var e = document.getElementById(cajax.element);
\r
60 e.innerHTML = "<img src='administrator/images/loading.gif' border='0'>";
\r
63 function whenInteractiveconHTML(){
\r
64 var e = document.getElementById(cajax.element);
\r
65 e.innerHTML = "<img src='administrator/images/loading.gif' border='0'>";
\r
68 /* CHANGE PUBLISHING STATE */
\r
69 function changeContentState(elem, id, state){
\r
70 ajelem = 'constatus'+elem;
\r
71 var e = document.getElementById(ajelem);
\r
72 e.style.display = "";
\r
74 cajax.setVar("option", 'com_eventcalendar');
\r
75 cajax.setVar("task", 'ajaxpub');
\r
76 cajax.setVar("elem", elem);
\r
77 cajax.setVar("id", id);
\r
78 cajax.setVar("state", state);
\r
80 cajax.requestFile = "index3.php";
\r
82 cajax.method = 'POST';
\r
83 cajax.element = ajelem;
\r
84 cajax.onLoading = whenLoadingcon;
\r
85 cajax.onLoaded = whenLoadedcon;
\r
86 cajax.onInteractive = whenInteractivecon;
\r
90 /* VALIDATE SEO TITLE */
\r
91 function validateSEO() {
\r
92 var seotitle = document.adminForm.seotitle.value;
\r
93 var coid = document.adminForm.id.value;
\r
94 var cocatid = document.adminForm.catid.options[document.adminForm.catid.selectedIndex].value;
\r
96 cajax.setVar("option", 'com_eventcalendar');
\r
97 cajax.setVar("task", 'validate');
\r
98 cajax.setVar("coid", coid);
\r
99 cajax.setVar("cocatid", cocatid);
\r
100 cajax.setVar("seotitle", seotitle);
\r
102 cajax.requestFile = "index3.php";
\r
104 cajax.method = 'POST';
\r
105 cajax.element = 'valseo';
\r
106 cajax.onLoading = whenLoadingcon;
\r
107 cajax.onLoaded = whenLoadedcon;
\r
108 cajax.onInteractive = whenInteractivecon;
\r
112 /* SUGGEST SEO TITLE */
\r
113 function suggestSEO() {
\r
114 var cotitle = document.adminForm.title.value;
\r
115 var coid = document.adminForm.id.value;
\r
116 var cocatid = document.adminForm.catid.options[document.adminForm.catid.selectedIndex].value;
\r
118 if (cotitle == '') {
\r
119 alert('Please write a title!');
\r
121 var rnd = Math.random();
\r
123 http.open('POST', 'index3.php');
\r
124 http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
\r
125 http.setRequestHeader('charset', 'utf-8');
\r
126 http.onreadystatechange = showresultsug;
\r
127 http.send('option=com_eventcalendar&task=suggest&cotitle='+cotitle+'&coid='+coid+'&cocatid='+cocatid+'&rnd='+rnd);
\r
134 /* SHOW SUGGESTION RESULTS */
\r
135 function showresultsug() {
\r
136 var stitle = document.getElementById('seotitle');
\r
137 if(http.readyState == 4) {
\r
138 if(http.status!=200) {
\r
139 alert('Error, please retry');
\r
141 var reply = http.responseText;
\r
142 var update = new Array();
\r
143 update = reply.split('|');
\r
144 if (update[1]==1) {
\r
145 stitle.value = update[2];
\r
152 /* SET RESERVATIONS */
\r
153 function showReserve(user_id, event_id, state){
\r
154 var e = document.getElementById('reserve');
\r
155 e.style.display = "";
\r
157 cajax.element = 'reserve';
\r
159 cajax.setVar("option", 'com_eventcalendar');
\r
160 cajax.setVar("task", 'ajaxrsv');
\r
161 cajax.setVar("elem", 'rerserve');
\r
162 cajax.setVar("user-id", user_id);
\r
163 cajax.setVar("eventid", event_id);
\r
164 cajax.setVar("state", state);
\r
166 cajax.requestFile = "index2.php";
\r
167 cajax.method = 'POST';
\r
169 cajax.onLoading = whenLoadingconHTML;
\r
170 cajax.onLoaded = whenLoadedconHTML;
\r
171 cajax.onInteractive = whenInteractiveconHTML;
\r