function _amiandoGetNewSubmitForm() { var submitForm = document.createElement("form"); document.body.appendChild(submitForm); submitForm.method = "post"; return submitForm; } function _amiandoPresetData(partnerData, elementName, elementValue) { if (typeof partnerData[elementName] == "undefined") { partnerData[elementName] = elementValue; } } function _amiandoCreateNewFormElement(inputForm, elementName, elementValue) { var inp = document.createElement('input'); inp.setAttribute('type', 'hidden'); inp.setAttribute('name', elementName); inputForm.appendChild(inp); inp.value = "" + elementValue; return inp; } function amiandoEditTicketShop(partnerData, callback) { _amiandoPopupSuccess = false; _amiandoEditTicketShop(partnerData, "step02", "closePopup", 970, 700, callback); } function amiandoSynchronizeTicketShop(partnerData, callback) { _amiandoPopupSuccess = true; _amiandoEditTicketShop(partnerData, "save", "synchronizationPopup", 250, 200, callback); } function _checkPopupOpened() { if (typeof _amiandoPopupWindow == "undefined") { alert("Popups must be allowed. Please deactivate your popup blocker for this domain."); return false; } return true; } function _amiandoEditTicketShop(partnerData, step, nextAction, width, height, callback) { _amiandoSyncCallback = callback; _editType = "edit"; _amiandoSubmitForm = _amiandoGetNewSubmitForm(); // preset default values if values are not set yet // and ticket shop does not exist yet if (!amiandoIsTicketShopActive()) { _amiandoPresetData(partnerData, "requestLanguage", "en"); _amiandoPresetData(partnerData, "visibility", 2); _amiandoPresetData(partnerData, "displayChatBoard", "false"); _amiandoPresetData(partnerData, "displayChatBoard_exists", "true"); _amiandoPresetData(partnerData, "displayCarpool", "false"); _amiandoPresetData(partnerData, "displayCarpool_exists", "true"); _amiandoPresetData(partnerData, "displayPhotos", "false"); _amiandoPresetData(partnerData, "displayPhotos_exists", "true"); _amiandoPresetData(partnerData, "showGuests", "false"); _amiandoPresetData(partnerData, "showGuests_exists", "true"); _amiandoPresetData(partnerData, "bringFriends", "false"); _amiandoPresetData(partnerData, "bringFriends_exists", "true"); _amiandoPresetData(partnerData, "maybeOptionAllowed", "false"); _amiandoPresetData(partnerData, "maybeOptionAllowed_exists", "true"); _amiandoPresetData(partnerData, "declineOptionAllowed", "false"); _amiandoPresetData(partnerData, "declineOptionAllowed_exists", "true"); _amiandoPresetData(partnerData, "partnerEmailNotification", "true"); } // set/overwrite control values partnerData["viewType"] = "popupTicketShop"; partnerData["oneclick"] = "true"; partnerData["ticketShopActive"] = "true"; partnerData["eventIdentifier"] = "YzixK"; partnerData["partnerIdentifier"] = "dp07U109H8jqA9sKV6eX"; partnerData["puid"] = ""; partnerData["step"] = step; partnerData["nextAction"] = nextAction; partnerData["partnerEmailNotification_exists"] = true; // partner values for (var i in partnerData) { _amiandoCreateNewFormElement(_amiandoSubmitForm, i, partnerData[i]); } _amiandoSubmitForm.action = "http://studentbox.amiando.com/event/wizard.html"; if (partnerData["partnerSynchronizationPopup"] == "true" || nextAction != "synchronizationPopup") { _amiandoSubmitForm.target = "wizardPopup"; _amiandoPopupWindow = window.open('', 'wizardPopup','width=' + width + ',height=' + height + ',scrollbars=yes,location=no,menubar=no,toolbar=no,status=no,resizable=no,screenX=10,screenY=10'); if (!_checkPopupOpened()) return; _popupInterval = window.setInterval("_amiandoCheckPopup()", 300); } else { _hiddenIFrame = document.createElement('iframe'); _hiddenIFrame.setAttribute('id','hiddenIframe'); _hiddenIFrame.setAttribute('name','hiddenIframe'); _hiddenIFrame.style.border='0px'; _hiddenIFrame.style.width='0px'; _hiddenIFrame.style.height='0px'; document.body.appendChild(_hiddenIFrame); for (var i = 0; i < frames.length; i++) { if (frames[i].name == "hiddenIframe") frames["hiddenIframe"] = frames[i]; } _amiandoSubmitForm.target = "hiddenIframe"; _iframeInterval = window.setInterval("_amiandoCheckIframe()", 300); } _amiandoSubmitForm.submit(); } function _amiandoCheckPopup() { /* Some sanity checks */ if (typeof _popupInterval == "undefined") return; if (typeof _amiandoPopupWindow == "undefined") { window.clearInterval(_popupInterval); _popupInterval = undefined; return; } /* Check if the popup was closed. If it was closed, check * if it was successful */ if (_amiandoPopupWindow.closed == true) { if (typeof _amiandoSubmitForm != "undefined") { document.body.removeChild(_amiandoSubmitForm); _amiandoSubmitForm = undefined; } window.clearInterval(_popupInterval); _popupInterval = undefined; if (_amiandoPopupSuccess) { if (_editType == "edit") { _deletable = true; _active = true; } else if (_editType == "delete") { _deletable = false; _active = false; } } if (typeof _amiandoSyncCallback != "undefined") { try { _amiandoSyncCallback(_amiandoPopupSuccess); _amiandoSyncCallback = undefined; } catch (ignored) { } } if (typeof _hiddenIFrame != "undefined") { document.body.removeChild(_hiddenIFrame); _hiddenIFrame = undefined; if (typeof frames["closePopup"] != "undefined") { if(navigator.appVersion.indexOf("MSIE 8") == -1) { frames["closePopup"].close(); } frames["closePopup"] = undefined; } } return; } /* Check if the user is finished in the popup. If he is, signal the popup that it can * close itself using the closePopup iframe */ try { if (typeof _amiandoPopupWindow.frames["doneLoading"] != "undefined" && typeof frames["closePopup"] == "undefined") { _amiandoPopupSuccess = true; _hiddenIFrame = document.createElement('iframe'); _hiddenIFrame.setAttribute('id','closePopup'); _hiddenIFrame.setAttribute('name','closePopup'); _hiddenIFrame.style.border='0px'; _hiddenIFrame.style.width='0px'; _hiddenIFrame.style.height='0px'; document.body.appendChild(_hiddenIFrame); for (var i = 0; i < frames.length; i++) { if (frames[i].name == "closePopup") frames["closePopup"] = frames[i]; } } } catch (err) { // Ignored } } function _amiandoCheckIframe() { /* Some sanity checks */ if (typeof _iframeInterval == "undefined") return; /* Check if the sync frame is done. This will be signaled by the creation * of the doneLoading iframe */ try { if (typeof frames["hiddenIframe"].frames["doneLoading"] != "undefined") { document.body.removeChild(_amiandoSubmitForm); _amiandoSubmitForm = undefined; window.clearInterval(_iframeInterval); _popupInterval = undefined; if (typeof _amiandoSyncCallback != "undefined") { try { _amiandoSyncCallback(true); _amiandoSyncCallback = undefined; } catch (ignored) { } } if (typeof _hiddenIFrame != "undefined") { document.body.removeChild(_hiddenIFrame); _hiddenIFrame = undefined; if(navigator.appVersion.indexOf("MSIE 8") == -1) { frames["hiddenIframe"].close(); } frames["hiddenIframe"] = undefined; } return; } } catch (err) { //Ignored } } function amiandoDeleteTicketShop(callback) { if (!amiandoIsTicketShopDeletable()) return; _amiandoPopupSuccess = false; _amiandoSyncCallback = callback; _editType = "delete"; _amiandoPopupWindow = window.open('http://studentbox.amiando.com/deletePopup.html?eventIdentifier=YzixK&partnerIdentifier=dp07U109H8jqA9sKV6eX&chooser=true&puid=', 'wizardPopup','width=950,height=550,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no,resizable=no,screenX=10,screenY=10'); if (!_checkPopupOpened()) return; _popupInterval = window.setInterval("_amiandoCheckPopup()", 300); } function amiandoShowTicketsOverview(callback) { if (!amiandoIsTicketShopActive()) return; _amiandoPopupSuccess = true; _amiandoSyncCallback = callback; _editType = "view"; _amiandoPopupWindow = window.open('http://studentbox.amiando.com/event/event.html?eventIdentifier=YzixK&partnerIdentifier=dp07U109H8jqA9sKV6eX&puid=&viewType=tsu&open=analyze', 'wizardPopup','width=970,height=550,scrollbars=yes,location=no,menubar=no,toolbar=no,status=no,resizable=no,screenX=10,screenY=10'); if (!_checkPopupOpened()) return; _popupInterval = window.setInterval("_amiandoCheckPopup()", 300); } _deletable = false; function amiandoIsTicketShopDeletable() { return _deletable; } _active = false; function amiandoTicketShopIFrame(width, height, additional, language) {} function amiandoIsTicketShopActive(){ return _active; } /* amiando Export: Resizing of iframe height */ function _amiandoResizeIframe(amiandoIFrameID) { if (navigator.appName == "Opera") { document.getElementById(amiandoIFrameID).style.height = "500px"; } else { if (typeof frames[amiandoIFrameID] == "undefined" || !frames[amiandoIFrameID]) return false; var _amiandoIFrameHeight = 0; var iframe; for (var n = 0; n < frames[amiandoIFrameID].frames.length; n++) { try { if (typeof frames[amiandoIFrameID].frames[n].frames["resizeMarker"] != "undefined" && frames[amiandoIFrameID].frames[n].frames["resizeMarker"]) { iframe = frames[amiandoIFrameID].frames[n]; break; } } catch (err) { // ignore } } if (typeof iframe == "undefined" || !iframe) return false; for (var i = 11; i >= 0; i--) { _amiandoIFrameHeight <<= 1; try { if (typeof iframe.frames["frame" + i] != "undefined" && iframe.frames["frame" + i]) { _amiandoIFrameHeight += 1; } } catch (err) { // ignore } } var iframeScroll = false; try { if (typeof iframe.frames["scrollIframe"] != "undefined" && iframe.frames["scrollIframe"]) { iframeScroll = true; } } catch (err) { // ignore } if (_amiandoIFrameHeight != 0 && _amiandoIFrameHeight != _amiandoIFrameOldHeight[amiandoIFrameID]) { document.getElementById(amiandoIFrameID).style.height = (_amiandoIFrameHeight + 20) + "px"; } _amiandoIFrameOldHeight[amiandoIFrameID] = _amiandoIFrameHeight; if (_amiandoIFrameOldScroll[amiandoIFrameID] != iframeScroll) { _amiandoIFrameOldScroll[amiandoIFrameID] = iframeScroll; var element = document.getElementById(amiandoIFrameID); if (typeof amiandoScrollCallback != "undefined") { element.scrollIntoView(true); amiandoScrollCallback(); } else { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); window.scrollTo(valueL, valueT); } } } } function _amiandoStartInterval(_amiandoIFramesOnPage) { if (typeof _amiandoIFrameTimer[_amiandoIFramesOnPage.id] != "undefined" && _amiandoIFrameTimer[_amiandoIFramesOnPage.id]) window.clearTimeout(_amiandoIFrameTimer[_amiandoIFramesOnPage.id]); _amiandoIFrameOldHeight[_amiandoIFramesOnPage.id] = 0; _amiandoIFrameOldScroll[_amiandoIFramesOnPage.id] = false; _amiandoIFrameTimer[_amiandoIFramesOnPage.id] = window.setInterval(function() { _amiandoResizeIframe(_amiandoIFramesOnPage.id); }, 100); } _amiandoIFrameOldScroll = {}; _amiandoIFrameOldHeight = {}; _amiandoIFrameTimer = {}; function _amiandoStartResize() { _amiandoIFramesOnPage = document.getElementsByTagName("iframe"); var _amiandoIFrames = new Array(); var found = false; for (var i = 0; i < _amiandoIFramesOnPage.length; i++) { var _amiandoIFramesId = _amiandoIFramesOnPage[i].id; var _amiandoIFramesSrc = _amiandoIFramesOnPage[i].src; if (_amiandoIFramesId.indexOf("_amiandoIFrame") == 0 && _amiandoIFramesSrc.indexOf("resizeIFrame") != -1) { _amiandoStartInterval(_amiandoIFramesOnPage[i]); found = true; } } if (found == false) window.setTimeout("_amiandoStartResize()", 1000); } function _amiandoGetIFramesOnPage() { if (typeof _amiandoIFramesOnPage != "undefined") return; _amiandoStartResize(); } if (window.addEventListener) { window.addEventListener('load', _amiandoGetIFramesOnPage, false); } else if (window.attachEvent) { attachEvent('onload', _amiandoGetIFramesOnPage); }