WKWebView addEventListener not receiving Calendly events - wkwebview

I'm trying to use Calendly within a WKWebView and receive an event when the user has created an appointment. The app is successfully receiving message events, however Calendly events are not appearing.
Here's the code:
import UIKit
import WebKit
class ViewController: UIViewController, WKScriptMessageHandler {
var webView: WKWebView!
var count = 0
var html = """
<html>
<head>
<meta name='viewport' content='width=device-width' />
</head>
<!-- Calendly inline widget begin -->
<div class="calendly-inline-widget" data-auto-load="false">
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
<script>
Calendly.initInlineWidget({
url: 'https://calendly.com/XXX',
prefill: {
name: "John Doe",
email: "john#joe2.com",
customAnswers: {
a1: "yes"
}
}
});
</script>
</div>
<!-- Calendly inline widget end -->
</html>
"""
override func viewDidLoad() {
let config = WKWebViewConfiguration()
let js =
"""
function isCalendlyEvent(e) {
return e.data.event &&
e.data.event.indexOf('calendly') === 0;
};
window.addEventListener(
'message',
function(e) {
if (isCalendlyEvent(e)) {
console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!");
console.log(e.data);
}
}
);
function isCalendlyEvent(e) {
console.log('testing' + e.name);
return e.data.event &&
e.data.event.indexOf('calendly') === 0;
};
window.addEventListener('message', function(e){
console.log('In listener. Event.type: ' + event.type +
' e.data.event: ' + e.data.event + ' event: ' + JSON.stringify(e.data));
if (isCalendlyEvent(e)) {
console.log('calendly event!!!!');
window.webkit.messageHandlers.clickListener.postMessage('Calendly:' + e.data);
} else {
window.webkit.messageHandlers.clickListener.postMessage('Other:' + e.data);
}
});
"""
let script = WKUserScript(source: js, injectionTime: .atDocumentEnd, forMainFrameOnly: false)
config.userContentController.addUserScript(script)
config.userContentController.add(self, name: "clickListener")
webView = WKWebView(frame: view.bounds, configuration: config)
view.addSubview(webView!)
self.webView.loadHTMLString(self.html, baseURL: nil)
}
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
count = count + 1
print("Msg \(count): \(message.body) ")
}
}

The calendly message is only sent when the url includes the embed_domain query parameter. When Calendly.initInlineWidget is called inside of WKWebView the embed_domain query parameter is set to undefined.
To resolve this issue, you can update the url to include an embed_domain parameter:
Calendly.initInlineWidget({
url: 'https://calendly.com/XXX?embed_domain=example',
prefill: {
name: "John Doe",
email: "john#joe2.com",
customAnswers: {
a1: "yes"
}
}
});

Related

Ajax pagination with class based view

I am trying apply ajax with pagination on my app .Using Class based Listview
#views.py
class HomePage(ListView):
model = Video
template_name = 'index.html'
def get_context_data(self, **kwargs):
context = super(HomePage, self).get_context_data(**kwargs)
videos = Video.objects.filter(category='sub')
paginator = Paginator(videos, 5)
page = self.request.GET.get('page2')
try:
videos = paginator.page(page)
except PageNotAnInteger:
videos = paginator.page(1)
except EmptyPage:
videos = paginator.page(paginator.num_pages)
context['videos'] = videos
if self.request.is_ajax():
html = render_to_string('videos/index.html', context, request=self.request)
print(html)
return JsonResponse({'form' : html })
The Home template script
<script type="text/javascript">
$(document).ready(function(event){
$(document).on('click', '.page-link', function(event){
event.preventDefault();
var page = $(this).attr('href');
console.log(page)
$.ajax({
type: 'GET',
url: ,
data: {'page':'{{ page.number }}'},
dataType: 'json',
success: function(response){
$('#ajax_page_template').html(response['form'])
console.log("success")
},
error: function(rs, e){
console.log(rs.responseText);
},
});
});
});
</script>
1.The current error is in views.py local variable 'html' referenced before assignment
2.And what should I put in ajax --url: I tried to put url:page but that return url to 127.0.0.1:8000/?page=2/?page=2.
I had the same problem and got it working:
In views.py add "paginate_by = 4" and def get_template_names:
class HomePage(ListView):
...
paginate_by = 4
def get_template_names(self):
template_name = 'list.html'
if self.request.is_ajax():
template_name = 'list_ajax.html'
return template_name
Use 2 templates:
New list_ajax.html with the for loop:
{% for video in video_list %}
...
{% endfor %}
Existing template list.html:
<div id="image-list">
{% include 'list_ajax.html' %}
</div>
In the script:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie#2.2.1/src/js.cookie.min.js"></script>
<script>
var csrftoken = Cookies.get('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});
$(document).ready(function(){
var page = 1;
var empty_page = false;
var block_request = false;
var num_pages=parseInt('{{ page_obj.paginator.num_pages }}')
$(window).scroll(function() {
var margin = $(document).height() - $(window).height() - 200;
if ($(window).scrollTop() > margin && empty_page == false &&
block_request == false) {
block_request = true;
page += 1;
if(num_pages-page >= 0) {
$.get('?page=' + page, function(data) {
block_request = false;
console.log(data)
$('#image-list').append(data);
}
);
}}
});
});
</script>
You have to declare the html variable before you use it. Like this:
html = ""
if self.request.is_ajax():
html = render_to_string('videos/index.html', context, request=self.request)
And the url you should put in the ajax call is the one corresponding to the relevant view (HomePage).
And change the following line:
return JsonResponse({'form' : html })
To:
render(request,'videos/index.html',JsonResponse(html))

Showing dialog by Dialog API disables cell editing

In my Excel Add-In, I use the Dialog API to show messages to the user. The dialog is shown and closed without any problem or error thrown.
When the dialog is closed, the user cannot edit cells in the sheet by a simple click in the cell and writing.
If the user double click some cell, this functionality is back again (for all cells).
Here is the code controlling the dialog:
var app = (function (app) {
var dialog;
// Show dialog
app.showNotification = function (header, text) {
if (Office.context.requirements.isSetSupported('DialogApi', 1.1)) {
var dialogUrl = window.location.href.substring(0,
window.location.href.lastIndexOf('/') + 1) +
"AppMessage.html?msg=" + text + "&title=" + header;
Office.context.ui.displayDialogAsync(dialogUrl, {
height: 20,
width: 20,
displayInIframe: true
},
function (asyncResult) {
dialog = asyncResult.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived,
processMessage);
});
}
};
function processMessage(arg) {
if (arg.message == "close")
dialog.close();
}
return app;
})(app || {});
and the dialog code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.min.css">
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.components.min.css">
<script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/js/fabric.min.js"></script>
</head>
<body>
<span class="ms-font-xl ms-fontWeight-semibold" id="titleMain"></span>
<p class="ms-font-m" id="body"></p>
<button class="ms-Button ms-Button--primary" style="position:fixed;bottom:10px;right:10px;" onclick="closeDialog();">
<span class="ms-Button-label">OK</span>
</button>
<script src="appMessage.js"></script>
</body>
</html>
and here is the appMessage.js content
var urlParams;
Office.initialize = function () {};
//avoiding the usage of jquery in this small page
window.$ = function (selector) {
return document.querySelector(selector);
};
function closeDialog() {
Office.context.ui.messageParent("close");
}
(window.onpopstate = function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) {
return decodeURIComponent(s.replace(pl, " "));
},
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
$("#titleMain").innerHTML = urlParams["title"];
$("#body").innerHTML = urlParams["msg"];
})();
What can be wrong?
Thanks

Include Data In A Response/Reply From A Primefaces Push

Is there a way to include data from the front-end to send to the back end, perhaps in the reply.completed argument, such that if a condition was not met, the front end can inform the backend of the status and the backend and do something with that data? And if so, how?
From the back-end:
Reply reply = new Reply() {
#Override
public void completed(String arg0) {
System.out.println("Reply received: " + arg0);
}
};
summary = this.getText("report.ready.view").replace("{0}", reportName);
reportLink = this.getExternalContextRoot() + reportLink + (!reportLink.contains("?") ? "?reportId=" : "&reportId=") + savedReportStatus.getSavedReportStatusId();
detail = "<a href='" + reportLink + "'>" + this.getText("click.to.view") + "</a>";
facesMessage = new FacesMessage(severity, summary, detail);
eventBus.publish(channel, facesMessage, reply);
From the front-end:
<p:socket onMessage="handleMessage" channel="/reports/#{userSessionBean.userID}" autoConnect="true"/>
<script type="text/javascript">
function handleMessage(message) {
if (DO SOME CHECK) {
if (message.severity == 'INFO 0') {
message.severity = 'info';
} else if (message.severity == 'WARN 1') {
message.severity = 'warn';
} else if (message.severity == 'ERROR 2') {
message.severity = 'error';
} else if (message.severity == 'FATAL 3') {
message.severity = 'fatal';
}
PF('reportsGrowl').show([message]);
updateViewedReports();
} else {
SEND THE BACK-END INFORMATION INDICATING THE CHECK FAILED AND THE MESSAGE WAS NOT SHOWN
}
}
$(document).ready(function () {
updateViewedReports();
});
</script>

PhoneGap 3.3.0 / Cordova iOS 7 Audio Record Permission

I am new to PhoneGap / Cordova development. Recently there was an update on iOS, and it requires users to grant permission to applications before they can use the microphone.
I had tried to update the "package" - Media and Media Capture, but it still not working.
I've also tried a plugin called cordova-phonegap-audio-encode, but it isn't working too.
The following are my code:
Record.html (This is a page / interface for users to interact and trigger the permission/recording audio)
<html>
<head>
<title>System</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../js/cordova-2.3.0.js"></script>
<script src="../js/config.js"></script>
<script src="../js/languages.js"></script>
<script src="beJS.js"></script>
<link rel="stylesheet" href="../js/jquery.mobile-1.3.0.min.css" />
<script src="../js/jquery-1.8.2.min.js"></script>
<script src="../js/jquery.mobile-1.3.0.min.js"></script>
<script scr="../js/RecordPermission.js"></script>
</head>
<body >
<div data-role="page" id="beRecordPage">
<div data-role="header" data-theme="c" data-position="fixed">
<a href="index.html" id="btnMenu" target="_self" data-icon="home" data-ajax='false'></a>
<h1 id="be_header_record"></h1>
</div><!-- /header -->
<div data-role="content" >
<div class="content-primary" id='programContent' >
<label for="length" id="be_reocrd_lbl_scriptName"></label>
<input type="text" name='scriptName' id="scriptName" value="" data-clear-btn="true" maxlength="30"/>
<hr/>
<div data-role="controlgroup" >
<button type="button" data-theme="c" id="be_reocrd_btn_record" onclick='record();'></button>
<button type="button" data-theme="c" id="be_reocrd_btn_play" onclick='playRecord();'></button>
<button type="button" data-theme="c" id="be_reocrd_btn_delete" onclick='deleteRecord();'></button>
</div>
<div><!-- /content-primary -->
<div><!-- /content -->
</div><!-- /page -->
<script>
var isRecorded = false;
var isRecording = false;
var isPlaying = false;
var recordResult =false;
var lastSrc = "";
var src = "";
var mediaRec;
function playRecord(){
if(isRecorded && !isRecording){
if(isPlaying){
stopPlaying();
}else{
mediaRec = new Media(lastSrc, stopPlaying,null);
mediaRec.play();
isPlaying = true;
$('#be_reocrd_btn_record').button('disable');
$('#be_reocrd_btn_delete').button('disable');
$('#be_reocrd_btn_play').text(language[langCode].be_reocrd_btn_stop);
$('#be_reocrd_btn_play').button('refresh');
}
}else{
alert(language[langCode].be_reocrd_msg_pleaseRecord);
}
}
function deleteRecord(){
if(isRecorded && !isRecording && !isPlaying){
var confirmation=confirm(language[langCode].be_reocrd_msg_deleteConfirmation);
if(confirmation){
performDeleteRecord()
}
}else{
alert(language[langCode].be_reocrd_msg_deleteError);
}
}
var fileRoot;
function onFileSystemSuccess(fileSystem) {
fileRoot = fileSystem.root;
fileRoot.getFile(lastSrc, {create: false}, onGetFileSuccess, onError);
}
function onGetFileSuccess(entry){
entry.remove(function() {
var idx = --localStorage.SYS_RECORDFILEINDEX;
localStorage.removeItem("SYS_RECORD_NAME"+idx);
localStorage.removeItem("SYS_RECORD_PATH"+idx);
alert(language[langCode].be_reocrd_msg_deleteSuccessful);
}, onError
);
}
function onError() {
alert(language[langCode].be_reocrd_msg_deleteFailure);
}
function onRequestFileSystemSuccess(fileSystem) {
src = fileSystem.root.fullPath + '/' + src;
fileSystem.root.getFile(src, {create: true}, function() {
mediaRec = new Media(src, successRecord,failRecord);
mediaRec.startRecord();
}, function(err) {
alert(err.message);
}
);
/*
var entry=fileSystem.root;
entry.getDirectory(recordFileFolder, {create: true, exclusive: false}, onGetDirectorySuccess, onGetDirectoryFail);
*/
}
function onGetDirectorySuccess(dir) {
alert("Created dir "+dir.name);
mediaRec = new Media(src, successRecord,failRecord);
mediaRec.startRecord();
}
function onGetDirectoryFail(error) {
alert("Error creating directory "+error.code);
}
function performDeleteRecord(){
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onError);
return true;
}
function successRecord(){
isRecorded = true;
recordResult = true;
lastSrc = src;
var idx = localStorage.SYS_RECORDFILEINDEX;
localStorage["SYS_RECORD_NAME"+idx] = $('#scriptName').attr('value');
localStorage["SYS_RECORD_PATH"+idx] = lastSrc;
localStorage.SYS_RECORDFILEINDEX++;
}
function stopPlaying(){
if(mediaRec != null){
mediaRec.stop();
mediaRec = null;
}
isPlaying = false;
$('#be_reocrd_btn_record').button('enable');
$('#be_reocrd_btn_delete').button('enable');
$('#be_reocrd_btn_play').text(language[langCode].be_reocrd_btn_play);
$('#be_reocrd_btn_play').button('refresh');
}
function failRecord(err){
alert(err.message);
alert(language[langCode].be_reocrd_msg_recordFailure);
$('#be_reocrd_btn_record').text(language[langCode].be_reocrd_btn_start);
recordResult = false;
}
function performRecord(){
var result = false;
src = recordFileFolder+new Date().getTime()+".wav";
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onRequestFileSystemSuccess, null);
// mediaRec = new Media(src, successRecord,failRecord);
// mediaRec.startRecord();
}
function record(){
if($('#scriptName').attr('value') == ''){
alert(language[langCode].be_reocrd_msg_pleaseInputName);
return;
}
if(!isPlaying){
if(!isRecording){
$('#be_reocrd_btn_record').text(language[langCode].be_reocrd_btn_stop);
$('#be_reocrd_btn_play').button('disable');
$('#be_reocrd_btn_delete').button('disable');
isRecording = true;
performRecord();
}else{
mediaRec.stopRecord();
isRecording = false;
$('#be_reocrd_btn_record').text(language[langCode].be_reocrd_btn_start);
$('#be_reocrd_btn_play').button('enable');
$('#be_reocrd_btn_delete').button('enable');
}
$('#be_reocrd_btn_record').button('refresh');
}else{
alert(language[langCode].be_reocrd_msg_pleaseStopPlaying);
}
}
$('#beRecordPage').live('pagecreate',function(event){
checkLoggedIn();
$('#be_header_record').text(language[langCode].be_header_record);
$('#btnMenu').text(language[langCode].menu);
$('#be_reocrd_lbl_scriptName').text(language[langCode].be_reocrd_lbl_scriptName);
$('#be_reocrd_btn_record').text(language[langCode].be_reocrd_btn_start);
$('#be_reocrd_btn_play').text(language[langCode].be_reocrd_btn_play);
$('#be_reocrd_btn_delete').text(language[langCode].be_reocrd_btn_delete);
});
</script>
</body>
</html>
This is the RecordPermission.js
window.recordPermission = function(params) {
cordova.exec(function(answer){
if (answer === "True") params.success(true);
else if (answer === "False") params.success(false);
else params.error('success called with "'+answer+'". Must be "True" or "False" strings');
}, params.error,"RecordPermission", "recordPermission");
};
The following is RecordPermission.m
#import "RecordPermission.h"
#implementation RecordPermission
#synthesize callbackId;
- (void)recordPermission:(CDVInvokedUrlCommand*)command
{
self.callbackId = command.callbackId;
// First check to see if we are in ios 7.
NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:#"."];
if ([[vComp objectAtIndex:0] intValue] < 7) {
// before iOS7 when this permission was not required or setable by the user
[self performSelectorOnMainThread:#selector(doSuccessCallback:) withObject:#"True" waitUntilDone:NO];
} else {
// run this in a try just in case
#try {
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
// cast this to a string bc I don't know if you can or how to pass a boolean back to javascript.
// This is converted back to a javascript boolean in RecordPermission.h.js file
NSString * grantedString = (granted) ? #"True" : #"False";
// talking back to javascript must be done in main thread.
[self performSelectorOnMainThread:#selector(doSuccessCallback:) withObject:grantedString waitUntilDone:NO];
}];
} #catch (id exception) {
NSLog(#"recordPermission try error");
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]];
NSString* javaScript = [pluginResult toErrorCallbackString:command.callbackId];
[self writeJavascript:javaScript];
}
}
}
-(void) doSuccessCallback:(NSString*)granted {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:granted];
NSString* javaScript = [pluginResult toSuccessCallbackString:self.callbackId];
[self writeJavascript:javaScript];
}
#end
This is the RecordPermission.h
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <Cordova/CDV.h>
#interface RecordPermission : CDVPlugin{
NSString* callbackId;
}
#property (nonatomic, retain) NSString* callbackId;
- (void)recordPermission:(NSArray*)arguments ;
#end
So far I cannot trigger the permission and I checked "Settings" where the app does not appear at the "Microphone" page.
Please help! Thank you.

How to make a Sharepoint Survey window open on page load

I've been working on looking for an answer to this issue for several days. I've created a survey on a Sharepoint 2010 site, and the person who I made it for wants it to open in a modal window on page load, instead of having to click "Respond to Survey" for this to happen.
I've tried multiple javascript based solutions, and so far I've gotten nothing. Is there any way to do this? And, if there is, is it possible that this solution could be ported to other pages, so that I can make other surveys or other sharepoint pages open in a modal window (on page load) instead of on a separate page?
Use .../yoursite/lists/yoursurvey/NewForm.aspx - It seems the Advanced setting "use open forms in dialog" doesn't work.
I have made this for a policy window. I made the whole thing inside of a content editor webpart which basically in invisible because the code has no appearence and I set the chrome type to none.
The other option is a feature which would replace the masterpage which is also not hard but requires a developement system for VS2010.
For the first method mentioned. You may have to strip the cookie stuff if you want it to load every time.
Create a new Content Editor Web Part with this:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="disclaimer.js"></script>
Then create disclaimer.js:
_spBodyOnLoadFunctionNames.push("initialDisclaimerSetup");
var dialogTitle = "";
var dialogBody = "";
var dialogReturn = "";
var userID = _spUserId;
function initialDisclaimerSetup() {
if(getCookie("DisclaimerShown" + userID) == "Yes") {
return;
} else {
setCookie("DisclaimerShown" + userID, "No", 365);
}
getDisclaimerListItems();
}
function setCookie(cookieName, cookieValue, numExpireDays) {
var expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + numExpireDays);
document.cookie = cookieName + "=" + cookieValue + ";" +
"expires=" + ((numExpireDays == null) ? "" : expirationDate.toUTCString());
}
function getCookie(cookieName) {
if(document.cookie.length > 0) {
return document.cookie.split(";")[0].split("=")[1];
} else {
return "";
}
}
function getDisclaimerListItems() {
var listName = "Disclaimer";
var soapEnv = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+ "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope\/\">"
+ "<soap:Body>"
+ "<GetListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">"
+ "<listName>" + listName + "</listName>"
+ "<query><Query><Where><IsNotNull><FieldRef Name=\"Title\" /></IsNotNull></Where></Query></query>"
+ "<ViewFields><ViewFields>"
+ "<FieldRef Name=\"Title\"/><FieldRef Name=\"Disclaimer\"/>"
+ "</ViewFields></ViewFields>"
+ "</GetListItems>"
+ "</soap:Body>"
+ "</soap:Envelope>";
$.ajax({
url: "_vti_bin/Lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
contentType: "text/xml; charset=\"utf-8\"",
complete: processResult
});
}
function processResult(xData, status) {
$(xData.responseXML).find("z\\:row").each(function() {
dialogTitle = $(this).attr("ows_Title");
dialogBody = $(this).attr("ows_Disclaimer");
launchModelessDialog();
if(dialogReturn == 0) {
return false;
} else if(dialogReturn == 1) {
} else if(dialogReturn == 2) {
return false;
}
});
if(dialogReturn == 0) {
getDisclaimerListItems();
} else if(dialogReturn == 1) {
setCookie("DisclaimerShown" + userID, "Yes", 365);
} else if(dialogReturn == 2) {
window.close();
}
}
function GetRootUrl() {
var urlParts = document.location.pathname.split("/");
urlParts[urlParts.length - 1] = "";
return "https://" + document.location.hostname + urlParts.join("/");
}
function launchModelessDialog(){
if (window.showModalDialog) {
window.showModalDialog("./disclaimer.htm", window, "dialogWidth:700px;dialogHeight:700px");
} else {
objPopup = window.open("./disclaimer.htm", "popup1", "left=100,top=100,width=800,height=800,location=no,status=yes,scrollbars=yes,resizable=yes, modal=yes");
objPopup.focus();
}
}
Then create disclaimer.htm:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript">
function initialRun() {
//var allArgs = dialogArguments;
var dialogTitle = dialogArguments.dialogTitle;
var dialogBody = dialogArguments.dialogBody;
dialogArguments.dialogReturn = "0";
document.getElementById('mainWrapper').innerHTML = "<h1>" + dialogTitle + "</h1>"
+ "<br/>" + dialogBody + "<br/><br/>";
}
function returnYes() {
dialogArguments.dialogReturn = 1;
window.close();
}
function returnNo() {
dialogArguments.dialogReturn = 0;
window.close();
}
function returnClose() {
dialogArguments.dialogReturn = 2;
window.close();
}
</script>
</head>
<body onload="initialRun()">
<div id="mainWrapper">
</div>
<div align="center">
<input name="acceptTOS" type="button" value="I Accept" onClick="returnYes();" />
<input name="acceptTOS" type="button" value="I Do NOT Accept" onClick="returnNo();" />
<input name="acceptTOS" type="button" value="Close" onClick="returnClose();" />
</div>
</body>
</html>
Then create a new Custom List called 'Disclaimer' and add a new column called 'Disclaimer' which allows for free text.

Resources