response_list.push( responses[i] );
}
var nframe = document.getElementById('patron_survey_frame_'+survey.id());
- nframe.contentWindow.document.body.innerHTML = '<h1>' + survey.name() + ' Complete</h1>';
+ nframe.hidden = true;
+ var complete = document.createElement('description');
+ complete.setAttribute('value',survey.name() + ' Complete');
+ nframe.parentNode.insertBefore( complete, nframe );
+ //nframe.contentWindow.document.body.innerHTML = '<h1>' + survey.name() + ' Complete</h1>';
return true;
};
}
function survey_render(vbox,survey_id,commit_callback,submit_callback) {
+ sdump('D_LEGACY',arg_dump(arguments));
if (typeof(vbox) != 'object') { vbox = document.getElementById(vbox); }
- var frame = document.createElement('iframe');
+ var frame = document.createElement('vbox');
vbox.appendChild(frame);
- frame.setAttribute('flex','1'); frame.setAttribute('src','data:text/html,<html><head><LINK href="http://spacely.georgialibraries.org/css/box.css" rel="stylesheet" type="text/css"><LINK href="http://spacely.georgialibraries.org/css/survey.css" rel="stylesheet" type="text/css"></head><body></body></html>');
+ //frame.setAttribute('flex','1'); frame.setAttribute('src','data:text/html,<html><head><LINK href="http://spacely.georgialibraries.org/css/box.css" rel="stylesheet" type="text/css"><LINK href="http://spacely.georgialibraries.org/css/survey.css" rel="stylesheet" type="text/css"></head><body></body></html>');
setTimeout(function(){
- var doc = frame.contentWindow.document;
- window.createAppElement = function (name) { return doc.createElement(name); }
+ /*var doc = frame.contentWindow.document;*/
+ var doc = document;
+ window.createAppElement = function (name) { return doc.createElementNS('http://www.w3.org/1999/xhtml','html:'+name); }
window.createTextNode = function (value) { return doc.createTextNode(value); }
Survey.retrieveById(
mw.G.auth_ses[0] ,
dump( js2JSON(E) );
}
- doc.body.appendChild( node );
- frame.setAttribute('style','height: ' + (30+doc.height) + 'px;');
+ frame.appendChild( node );
+ /*frame.setAttribute('style','height: ' + (30+doc.height) + 'px;');*/
frame.setAttribute('id','patron_survey_frame_' + sur.survey.id());
}
);
}
function survey_render_with_results(vbox,survey_id,callback) {
+ sdump('D_LEGACY',arg_dump(arguments));
if (typeof(vbox) != 'object') { vbox = document.getElementById(vbox); }
- var frame = document.createElement('iframe');
- frame.setAttribute('id','patron_survey_frame'); vbox.appendChild(frame);
- frame.setAttribute('flex','1'); frame.setAttribute('src','data:text/html,<html><head><LINK href="http://spacely.georgialibraries.org/css/box.css" rel="stylesheet" type="text/css"><LINK href="http://spacely.georgialibraries.org/css/survey.css" rel="stylesheet" type="text/css"></head><body></body></html>');
- var doc = frame.contentWindow.document;
- HTMLdoc = doc;
- window.createAppElement = function (name) { return HTMLdoc.createElement(name); }
- window.createTextNode = function (value) { return HTMLdoc.createTextNode(value); }
+ var frame = document.createElement('vbox');
+ vbox.appendChild(frame);
+ //frame.setAttribute('id','patron_survey_frame');
+ //frame.setAttribute('flex','1'); frame.setAttribute('src','data:text/html,<html><head><LINK href="http://spacely.georgialibraries.org/css/box.css" rel="stylesheet" type="text/css"><LINK href="http://spacely.georgialibraries.org/css/survey.css" rel="stylesheet" type="text/css"></head><body></body></html>');
+ //var doc = frame.contentWindow.document;
+ var doc = document;
+ //HTMLdoc = doc;
+ window.createAppElement = function (name) { return doc.createElementNS('http://www.w3.org/1999/xhtml','html:'+name); }
+ window.createTextNode = function (value) { return doc.createTextNode(value); }
Survey.retrieveById(
mw.G.auth_ses[0] ,
survey_id,
sur.setUser( PATRON.au.id() );
sur.setSubmitCallback( callback );
mw.sdump('D_LEGACY','survey id: ' + sur.survey.id() + '\n');
- doc.body.appendChild( sur.getNode() );
- var span = doc.createElement('blockquote');
+ frame.appendChild( sur.getNode() );
+ var span = doc.createElement('html:blockquote');
span.setAttribute('id','survey_response_' + sur.survey.id());
span.setAttribute('class','survey');
var warning = doc.createTextNode('Retrieving Responses...');
span.appendChild(warning);
- doc.body.appendChild(span);
+ frame.appendChild(span);
mw.user_async_request(
'open-ils.circ',
'open-ils.circ.survey.response.retrieve',
span.removeChild( warning );
if (result.length == 0) { return; }
//span.appendChild( doc.createTextNode('Previous Responses:') );
- //span.appendChild( doc.createElement('br') );
+ //span.appendChild( doc.createElement('html:br') );
//span.setAttribute('style','border: black solid thin;');
var num_of_q = sur.survey.questions().length;
var current_q = 0;
span.appendChild( doc.createTextNode(
'Previous Responses:'
) );
- span.appendChild( doc.createElement('br') );
- span.appendChild( doc.createElement('br') );
+ span.appendChild( doc.createElement('html:br') );
+ span.appendChild( doc.createElement('html:br') );
var block;
for (var i = 0; i < result.length; i++) {
if (++current_q > num_of_q) { current_q = 1; }
mw.sdump('D_LEGACY','current_q = ' + current_q + ' num_of_q = ' + num_of_q + '\n');
if (current_q == 1) {
- block = doc.createElement('blockquote');
+ block = doc.createElement('html:blockquote');
span.appendChild( doc.createTextNode(
'Answer Date: ' +
result[i].answer_date() +
', Effective Date: ' +
result[i].effective_date()
) );
- span.appendChild( doc.createElement('br') );
+ span.appendChild( doc.createElement('html:br') );
span.appendChild(block);
}
block.appendChild(
)
);
}
- span.appendChild( doc.createElement('br') );
- frame.setAttribute('style','height: ' + (30+doc.height) + 'px;');
+ span.appendChild( doc.createElement('html:br') );
+ /*frame.setAttribute('style','height: ' + (30+doc.height) + 'px;');*/
}
);
}