/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) window.XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP') } @end @*/ function openModalWindow(url,width, height, popupName,scrollbars, resizable) { var options = 'toolbar=no,directories=no,status=no,menubar=no'; skipCyclePermanently = true; if(width != null) { options = options + ',width=' + width; } if(height != null) { options = options + ',height=' + height; } if(scrollbars != null) { options = options + ',scrollbars=yes'; } else { options = options + ',scrollbars=no'; } if(resizable != null) { options = options + ',resizable=yes'; } else { options = options + ',resizable=no'; } if(popupName == null) { popupName = 'popup'; } var tmp = window.open(url, popupName, options); tmp.focus(); return false; } function goBack() { if (navigator.appName != "Netscape") { var url = window.location.href; var idx = url.indexOf("#findHighlighted"); if (idx > -1) { javascript:history.go(-2); } else { javascript:history.go(-1); } } else { javascript:history.go(-1); } } function openPrintPreviewWindow(url, width, height,popupname) { var tmp = window.open(url,popupname, 'height=' + height + ',width=' + width + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,location=no'); return false; } function openDocument(id, disableHighlightning, anchor) { var url; if (disableHighlightning == undefined) { disableHighlightning = "true"; } if (anchor == undefined) { url = './document.do?method=view&nav=1&id=' + id + '&disableHighlightning=' + disableHighlightning; } else { url = './document.do?method=view&nav=1&id=' + id + '&disableHighlightning=' + disableHighlightning + '#' + anchor; } openModalWindow(url, null, null, 'document', true, true); } var skipCycle = false; var skipCyclePermanently = false; function initModalWindow() { var inputs = document.getElementsByTagName('input'); for(var i = 0; i < inputs.length; i++) { inputs[i]['onfocus'] = function() { skipCycle = true; } inputs[i]['onblur'] = function() { skipCycle = false; } } var selects = document.getElementsByTagName('select'); for(var i = 0; i < selects.length; i++) { selects[i]['onfocus'] = function() { skipCycle = true; } selects[i]['onblur'] = function() { skipCycle = false; } } var textareas = document.getElementsByTagName('textarea'); for(var i = 0; i < textareas.length; i++) { textareas[i]['onfocus'] = function() { skipCycle = true; } textareas[i]['onblur'] = function() { skipCycle = false; } } focusModalWindow(); } function focusModalWindow() { if(!skipCyclePermanently) { if(!skipCycle) { window.focus(); } mytimer = setTimeout('focusModalWindow()', 200); } } var subscriptionType; var subscriptionId; function processSubscription(type, id) { subscriptionId = id; //var answer = confirm(message); //if (answer) //{ if(type == undefined) { alert("error"); } else { if(type == "document") { subscriptionType = 'doc'; retrieveSubscriptionURL(contextPath + '/document.do?method=validateSubscription&subscribedId=' + id, 0, 'validation'); } else { subscriptionType = 'search'; var url = contextPath + '/document.do?method=validateSubscription'; if(id != undefined && id != '') { url += '&subscribedId=' + id; } retrieveSubscriptionURL(url, '', 'validation'); } } //} } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function verifySimpleSearch(val) { if(trim(val) == '') { alert(noValidSearchCriteriaMsg); return false; } return true; } function refineSearch(form, methodName) { if(!verifySimpleSearch(form['refineSearchText'].value)) { return; } if(form['incrementalSearch'][0].checked) { form['method'].value = methodName; } else { if(form['params.selectedCategoryId'] != undefined) { form['params.selectedCategoryId'].value = ''; } form['method'].value = 'simpleSearch'; } form.action = 'search.do'; form['params.pageNumber'].value = '1'; form.submit() } function buildSelectedDocUrl(displayContent,allCurrentContent,txtMaxDoc,txtAtLeastOne,caller){ var url= "./document.do?method=printSelectedDocuments&caller=" + caller + "&displayContent=" + displayContent + "&"; var form = document.forms[2]; var params = ""; var pdfParams = new Array(); var cpt = 0; var nbPdfDoc = 0; var nbHtmlDoc = 0; var concatenateDoc = false; var singleDoc = false; var CheckBoxSelect = null; if(form['cbDoc'].length != null){ // Several checkboxes for (var i=0;i< form['cbDoc'].length;i++){ if((form['cbDoc'][i].checked || allCurrentContent)){ CheckBoxSelect = oCheckBoxes.FindItem(form['cbDoc'][i].id); switch(CheckBoxSelect.docType){ case "pdf": if(displayContent){ pdfParams[i] = "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; singleDoc = true; } else{ params += "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; concatenateDoc = true; } nbPdfDoc++; break; case "html": params += "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; nbHtmlDoc++; concatenateDoc = true; break; default: break; } } } } else{ // One checkbox if((form['cbDoc'].checked || allCurrentContent)){ CheckBoxSelect = oCheckBoxes.FindItem(form['cbDoc'].id); switch(CheckBoxSelect.docType){ case "pdf": if(displayContent){ pdfParams[0] = "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; singleDoc = true; } else{ params += "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; concatenateDoc = true; } nbPdfDoc++; break; case "html": params += "selectedDocIds" + "=" + CheckBoxSelect.id + "&"; nbHtmlDoc++; concatenateDoc = true; break; default: break; } } } cpt = nbPdfDoc + nbHtmlDoc; if(cpt==0){ alert(txtAtLeastOne); } else{ if (displayContent && cpt>10){ alert(txtMaxDoc); } else{ if (singleDoc){ //DISPLAY 1 POPUP BY DOCUMENT: PDF CONTENT OF DOCUMENT for (var j=0;j< pdfParams.length;j++){ openPrintPreviewWindow(url + pdfParams[j],'700','700',j); } } if(concatenateDoc){ //DISPLAY CONCATENATE DOCUMENT IN ONE POPUP: PDF LIST OF DOCUMENTS, HTML LIST AND HTML CONTENT OF DOCUMENT url += params; openPrintPreviewWindow(url,'700','700','popup'); } } } } function buildAllListDocUrl(totalHits,printListMaxDoc,txtPrintListMaxDoc,caller){ var ok = true; if (parseInt(totalHits) > parseInt(printListMaxDoc)){ ok = window.confirm(txtPrintListMaxDoc); } if(ok){ var url= "./document.do?method=printAllDocuments&caller=" + caller + "&displayContent=false&"; openPrintPreviewWindow(url,'700','700','popup'); } } function buildSelectedPublishHistory(){ var url= "./preparePublishHistory.do"; var form = document.forms[2]; var keys = new Array(); var values = new Array(); var CheckBoxSelect = null; if(form['cbDoc'].length != null){ // Several checkboxes for (var i=0;i< form['cbDoc'].length;i++){ CheckBoxSelect = oCheckBoxes.FindItem(form['cbDoc'][i].id); if(form['cbDoc'][i].checked){ keys[i] = "selectedDocIds"; values[i] = CheckBoxSelect.id; } else{ keys[i] = "unSelectedDocIds"; values[i] = CheckBoxSelect.id; } } keys[i] = "method"; values[i] = "updateVisbilityPublishHistory"; } else{ // One checkbox CheckBoxSelect = oCheckBoxes.FindItem(form['cbDoc'].id); if(form['cbDoc'].checked){ keys[0] = "selectedDocIds"; values[0] = CheckBoxSelect.id; } else{ keys[0] = "unSelectedDocIds"; values[0] = CheckBoxSelect.id; } keys[1] = "method"; values[1] = "updateVisbilityPublishHistory"; } openWindowWithPost(url,"popupPost",keys,values) } function openWindowWithPost(url,name,keys,values){ var newWindow = window.open(url, name); if (!newWindow) return false; var html = ""; html += "
"; if (keys && values && (keys.length == values.length)){ for (var i=0; i < keys.length; i++){ html += ""; } } html += "
"; newWindow.document.write(html); return newWindow; } function retrieveSubscriptionURL(url,nameOfFormToPost, type) { //Do the Ajax call if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); var methodToCall; if (type == 'validation') { methodToCall = processSubscriptionValidation; } else if (type == 'add') { methodToCall = processSubscriptionCreation; } req.onreadystatechange = methodToCall; try { req.open("GET", url, true); //was get } catch (e) { alert("Problem Communicating with Server\n"+e); } req.send(null); } else if (window.ActiveXObject) { // IE req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = methodToCall; req.open("GET", url, true); req.send(); } } } function processSubscriptionValidation() { if (req.readyState == 4) { // Complete if (req.status == 200) { // OK response var messageFull = req.responseText; //Split the message var returnCode = messageFull.substr(0, messageFull.indexOf('|', 0)); var message = messageFull.substr((messageFull.indexOf('|', 0) + 1), (messageFull.length - (messageFull.indexOf('|', 0) + 1))); if (returnCode == validationNotOkMsg) { //Validation NOT OK //alert to say that there are already X subscription alert(message); } else if (returnCode == validationOkMsg) { //Validation OK //==> ADD SUBSCRIPTION var answer = confirm(message); if (answer) { //Add the subscription if (subscriptionType == 'doc') { retrieveSubscriptionURL(contextPath + '/document.do?method=addSubscription&subscribedId=' + subscriptionId, 0, 'add'); } else if (subscriptionType == 'search') { retrieveSubscriptionURL(contextPath + '/search.do?method=addSubscription&subscribedId=' + subscriptionId, 0, 'add'); } } } } else { alert("Could not subscribe, try again later"); } } } function processSubscriptionCreation() { if (req.readyState == 4) { // Complete if (req.status == 200) { // OK response if (req.responseText != '') { alert(req.responseText); } } else { alert("Could not subscribe, try again later"); } } } function launchSavePushSearch(form) { openModalWindow(contextPath + '/authenticated/managePushSearches.do?method=savePushSearch&savedSearchId=' + form.savedQueryId.value + '&savedSearchName=' + form.savedSearchName.value,'600','75'); }