surveys, licked
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 24 Jul 2005 15:09:24 +0000 (15:09 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 24 Jul 2005 15:09:24 +0000 (15:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1377 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/patron/patron_edit_legacy.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_edit_legacy.xul

index c955fac..d6217b5 100644 (file)
@@ -1341,21 +1341,27 @@ function populate_patron_edit_surveys_build_callback( survey ) {
                        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] , 
@@ -1374,8 +1380,8 @@ function survey_render(vbox,survey_id,commit_callback,submit_callback) {
                                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());
                } 
        );
@@ -1383,14 +1389,17 @@ function survey_render(vbox,survey_id,commit_callback,submit_callback) {
 }
 
 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,
@@ -1398,13 +1407,13 @@ function survey_render_with_results(vbox,survey_id,callback) {
                        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',
@@ -1414,28 +1423,28 @@ function survey_render_with_results(vbox,survey_id,callback) {
                                        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(
@@ -1451,8 +1460,8 @@ function survey_render_with_results(vbox,survey_id,callback) {
                                                        )
                                                );
                                        }
-                                       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;');*/
                                }
                        );
                } 
index 795d0e9..fdf6e1d 100644 (file)
@@ -8,6 +8,7 @@
 
 <page id="patron_new_win" orient="vertical" style="overflow: auto;" persist="width height"
        onload="patron_init(); patron_edit_init();"
+       xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
        <script>