Changeset 487 for Dev/trunk/src/client


Ignore:
Timestamp:
03/05/14 22:44:48 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Completed migration to API, without CouchDB proxy.

Move to API is now completed. The full API is password protected, a very
limited API is exposed for respondents, which works with secrets that
are passed in URLs.

Serverside the HTTPResult class was introduced, which is similar to
Promises, but specifically for HTTP. It carries a status code and
response and makes it easier to extract parts of async handling in
separate functions.

Fixed a bug in our schema (it seems optional attributes don't exist but
a required list does). Verification of our schema by grunt-tv4 didn't
work yet. Our schema is organized the wrong way (this is fixable),
but the json-schema schema has problems with simple types and $refs.

Location:
Dev/trunk/src/client/qed-client
Files:
5 added
3 deleted
20 edited
5 moved

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/app/Router.js

    r457 r487  
    7878                        route.callback(params);
    7979                    } catch(err) {
    80                         console.error("Page change failed with",err.toString());
     80                        console.error("Page change failed with",err,err.toString());
    8181                    }
    8282                    return;
  • Dev/trunk/src/client/qed-client/model/classes

    • Property svn:ignore set to

      ### begin grunt-svn-ignore managed ignores
      ### edits will be overwritten when grunt svn-ignore is run
      Question.js
      Response.js
      Survey.js
      SurveyRun.js
      ### end grunt-svn-ignore managed ignores
  • Dev/trunk/src/client/qed-client/model/classes/questions.js

    r486 r487  
    1 define(function(){
    2     return {
    3         create: function(){
    4             return { type:'Question' };
     1define([
     2    "./_Class",
     3    "dojo/_base/declare",
     4    "dojo/date/stamp"
     5], function(_Class, declare, stamp) {
     6
     7    var Questions = declare([_Class],{
     8        _collection: 'questions',
     9        _type: 'Question',
     10        create: function() {
     11            var obj = {
     12                type: this._type,
     13                categories: [],
     14                code: "",
     15                content: [],
     16                title: ""
     17            };
     18            return obj;
    519        },
    6         DisplayTitle: {
    7             get: function(q) {
    8                 return q.title || '';
     20        _deserialize: function(obj) {
     21            if (obj.publicationDate) {
     22                obj.publicationDate = stamp.fromISOString(obj.publicationDate);
    923            }
    1024        },
    11         Content: {
    12             get: function(q) {
    13                 return q.content || [];
    14             },
    15             set: function(q,content) {
    16                 q.content = content;
     25        _serialize: function(obj) {
     26            if (obj.publicationDate) {
     27                obj.publicationDate = stamp.toISOString(obj.publicationDate);
    1728            }
    1829        }
    19     };
     30    });
     31
     32    return new Questions();
     33
    2034});
  • Dev/trunk/src/client/qed-client/model/classes/responses.js

    r486 r487  
    1 define([],function(){
    2     var SurveyRun = {
    3         create: function(){
    4             return { type:'Response' };
     1define([
     2    "./_Class",
     3    "./surveyRuns",
     4    "dojo/Deferred",
     5    "dojo/_base/declare",
     6    "dojo/_base/json",
     7    "dojo/_base/lang",
     8    "dojo/_base/xhr",
     9    "dojo/date/stamp"
     10], function(_Class, surveyRuns, Deferred, declare, json, lang, xhr, stamp) {
     11
     12    var Responses = declare([_Class],{
     13        _collection: 'responses',
     14        _type: 'Response',
     15        create: function() {
     16            var obj = {
     17                type: this._type,
     18                answers: {},
     19                surveyRunId: null
     20            };
     21            return obj;
    522        },
    6         SurveyRun: {
    7             get: function(r) {
    8                 return r.surveyRunId || null;
    9             },
    10             set: function(r,sr) {
    11                 r.surveyRunId = sr;
    12                 return r;
     23        _deserialize: function(obj) {
     24            if (obj._surveyRun) {
     25                obj._surveyRun = surveyRuns._doDeserialize(obj._surveyRun);
    1326            }
     27            if (obj.publicationDate) {
     28                obj.publicationDate = stamp.fromISOString(obj.publicationDate);
     29            }
     30        },
     31        _serialize: function(obj) {
     32            if (obj._surveyRun) {
     33                obj._surveyRun = surveyRuns._doSerialize(obj._surveyRun);
     34            }
     35            if (obj.publicationDate) {
     36                obj.publicationDate = stamp.toISOString(obj.publicationDate);
     37            }
     38        },
     39        getWithSecret: function(id,secret) {
     40            var query = xhr.objectToQuery({secret:secret});
     41            return xhr('GET',{
     42                url: '/api/open/responses/' + id + '?' + query,
     43                handleAs: 'json',
     44                contentType: false
     45            }).then(lang.hitch(this,'_doDeserialize'),function(err){
     46                return new Deferred().reject(json.fromJson(err.responseText));
     47            });
     48        },
     49        postWithSecret: function(response,secret) {
     50            var query = xhr.objectToQuery({secret:secret});
     51            var body = json.toJson(this._doSerialize(response));
     52            return xhr('POST',{
     53                url: '/api/open/responses?' + query,
     54                handleAs: 'json',
     55                contentType: 'application/json',
     56                rawBody: body
     57            }).then(lang.hitch(this,'_doDeserialize'),function(err){
     58                return new Deferred().reject(json.fromJson(err.responseText));
     59            });
     60        },
     61        putWithSecret: function(response,secret) {
     62            var query = xhr.objectToQuery({secret:secret});
     63            var body = json.toJson(this._doSerialize(response));
     64            return xhr('PUT',{
     65                url: '/api/open/responses/' + this.getId(response) + '?' + query,
     66                handleAs: 'json',
     67                contentType: 'application/json',
     68                rawBody: body
     69            }).then(lang.hitch(this,'_doDeserialize'),function(err){
     70                return new Deferred().reject(json.fromJson(err.responseText));
     71            });
     72        },
     73        removeWithSecret: function(response,secret) {
     74            var query = xhr.objectToQuery({secret:secret});
     75            var rev = this.getRev(response);
     76            var body = json.toJson(this._doSerialize(response));
     77            var headers = {};
     78            if ( rev ) {
     79                headers['If-Match'] = '"'+rev+'"';
     80            }
     81            return xhr('DELETE',{
     82                url: '/api/open/responses/' + this.getId(response) + '?' + query,
     83                headers: headers,
     84                handleAs: 'json',
     85                contentType: 'application/json',
     86                rawBody: body
     87            });
    1488        }
    15     };
    16     return SurveyRun;
     89    });
     90
     91    return new Responses();
     92
    1793});
  • Dev/trunk/src/client/qed-client/model/classes/surveyRuns.js

    r486 r487  
    1 define(['dojo/_base/lang','dojo/date/locale','dojo/date/stamp'],function(lang,locale,stamp){
    2     var SurveyRun = {
    3         create: function(){
    4             return { type:'SurveyRun' };
     1define([
     2    "./_Class",
     3    "./surveys",
     4    "dojo/_base/declare",
     5    "dojo/date/stamp"
     6], function(_Class, surveys, declare, stamp) {
     7
     8    var SurveyRuns = declare([_Class],{
     9        _collection: 'surveyRuns',
     10        _type: 'SurveyRun',
     11        create: function() {
     12            var obj = {
     13                type: this._type,
     14                description: "",
     15                mode: "open",
     16                survey: null,
     17                title: ""
     18            };
     19            return obj;
    520        },
    6         StartDate: {
    7             get: function(sr) {
    8                 var d;
    9                 if ( sr.startDate ) {
    10                     d = lang.isString(sr.startDate) ? stamp.fromISOString(sr.startDate) : sr.startDate;
    11                 }
    12                 return d;
    13             },
    14             set: function(sr,d) {
    15                 if ( d ) {
    16                     sr.startDate = lang.isString(d) ? stamp.toISOString(d) : d;
    17                 }
     21        _deserialize: function(obj) {
     22            if (obj.endDate) {
     23                obj.endDate = stamp.fromISOString(obj.endDate);
     24            }
     25            if (obj.startDate) {
     26                obj.startDate = stamp.fromISOString(obj.startDate);
     27            }
     28            if (obj.survey) {
     29                obj.survey = surveys._doDeserialize(obj.survey);
    1830            }
    1931        },
    20         EndDate: {
    21             get: function(sr) {
    22                 var d;
    23                 if ( sr.endDate ) {
    24                     d = lang.isString(sr.endDate) ? stamp.fromISOString(sr.endDate) : sr.endDate;
    25                 }
    26                 return d;
    27             },
    28             set: function(sr,d) {
    29                 if ( d ) {
    30                     sr.endDate = lang.isString(d) ? stamp.toISOString(d) : d;
    31                 }
     32        _serialize: function(obj) {
     33            if (obj.endDate) {
     34                obj.endDate = stamp.toISOString(obj.endDate);
    3235            }
    33         },
    34         DisplayTitle: {
    35             get: function(sr) {
    36                 var t = "Run of '"+sr.survey.title+"'";
    37                 if ( sr.startDate ) {
    38                     t += " from "+locale.format(SurveyRun.StartDate.get(sr));
    39                 }
    40                 if ( sr.endDate ) {
    41                     t += " until "+locale.format(SurveyRun.EndDate.get(sr));
    42                 }
    43                 return t;
     36            if (obj.startDate) {
     37                obj.startDate = stamp.toISOString(obj.startDate);
    4438            }
    45         },
    46         Survey: {
    47             get: function(sr) {
    48                 return sr.survey || null;
    49             },
    50             set: function(sr,s) {
    51                 sr.survey = s;
    52                 return sr;
     39            if (obj.survey) {
     40                obj.survey = surveys._doSerialize(obj.survey);
    5341            }
    5442        }
    55     };
    56     return SurveyRun;
     43    });
     44
     45    return new SurveyRuns();
     46
    5747});
  • Dev/trunk/src/client/qed-client/model/classes/surveys.js

    r486 r487  
    1 define(function(){
    2     return {
    3         create: function(){
    4             return { type:'Survey' };
     1define([
     2    "./_Class",
     3    "dojo/_base/declare",
     4    "dojo/date/stamp",
     5    "dojo/store/JsonRest"
     6], function(_Class, declare, stamp, JsonRest) {
     7
     8    var Surveys = declare([_Class],{
     9        _collection: 'surveys',
     10        _type: 'Survey',
     11        create: function() {
     12            var obj = {
     13                type: this._type,
     14                questions: [],
     15                title: ""
     16            };
     17            return obj;
    518        },
    6         DisplayTitle: {
    7             get: function(s) {
    8                 return s.title || '';
     19        _deserialize: function(obj) {
     20            if (obj.publicationDate) {
     21                obj.publicationDate = stamp.fromISOString(obj.publicationDate);
    922            }
    1023        },
    11         Questions: {
    12             get: function(s) {
    13                 return s.questions || [];
    14             },
    15             set: function(s,questions) {
    16                 s.questions = questions;
     24        _serialize: function(obj) {
     25            if (obj.publicationDate) {
     26                obj.publicationDate = stamp.toISOString(obj.publicationDate);
    1727            }
    1828        }
    19     };
     29    });
     30
     31    return new Surveys();
     32
    2033});
  • Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorToolkit.js

    r443 r487  
    11define([
    2     "../../store",
     2    "../classes/categories",
     3    "../classes/topics",
    34    "./CategoryListView",
    45    "dijit/_Container",
     
    1516    "require",
    1617    "dojo/text!./templates/QuestionEditorToolkit.html"
    17 ], function(store, CategoryListView, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, Button, ComboBox, declare, lang, Source, domConstruct, Memory, require, template) {
     18], function(categories, topics, CategoryListView, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, Button, ComboBox, declare, lang, Source, domConstruct, Memory, require, template) {
    1819    return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container], {
    1920
     
    107108            this.inherited(arguments);
    108109
    109             store.query("_design/questions/_view/all", {reduce:true, group:false, group_level:1})
    110             .forPairs(lang.hitch(this, function(value, key) {
    111                 this._categoryStore.put({ id: key[0] });
     110            categories.query().forEach(lang.hitch(this,function(cat){
     111                this._categoryStore.put({ id: cat });
    112112            }));
    113113
    114             store.query("_design/questions/_view/all_topics", {reduce:true, group:true})
    115             .forPairs(lang.hitch(this, function(value, key) {
    116                 this._topicStore.put({ id: key });
     114            topics.query().forEach(lang.hitch(this,function(topic){
     115                this._categoryStore.put({ id: topic });
    117116            }));
    118117        },
  • Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js

    r461 r487  
    11define([
    22    "../../widgets/_ComplexValueWidget",
    3     "../classes/Survey",
    43    "./questions/Factory",
    54    "dojo/_base/array",
     
    76    "dojo/dom-construct",
    87    "dojo/text!./templates/SurveyRenderWidget.html"
    9 ], function(_ComplexValueWidget, Survey, QuestionWidgetFactory, array, declare, domConstruct, template) {
     8], function(_ComplexValueWidget, QuestionWidgetFactory, array, declare, domConstruct, template) {
    109    return declare([_ComplexValueWidget],{
    1110        templateString: template,
     
    2221            this.survey = survey;
    2322            var f = new QuestionWidgetFactory();
    24             array.forEach(Survey.Questions.get(this.survey),function(question,question_index){
     23            array.forEach(this.survey.questions,function(question,question_index){
    2524                array.forEach(question.content || [], function(item,item_index){
    2625                    // The dot causes values to be grouped in an object!
  • Dev/trunk/src/client/qed-client/model/widgets/SurveySummary.js

    r457 r487  
    11define([
    2     "../../store",
    3     "../classes/Survey",
    42    "dijit/_TemplatedMixin",
    53    "dijit/_WidgetBase",
     
    75    "dojo/dom-attr",
    86    "dojo/text!./templates/SurveySummary.html"
    9 ], function(store, Survey, _TemplatedMixin, _WidgetBase, declare, domAttr, template) {
     7], function(_TemplatedMixin, _WidgetBase, declare, domAttr, template) {
    108    return declare([_WidgetBase,_TemplatedMixin],{
    119        templateString: template,
     
    1816        },
    1917        _setValueAttr: function(survey) {
    20             this.titleNode.innerHTML = Survey.DisplayTitle.get(survey);
    21             var id = store.getIdentity(survey);
    22             domAttr.set(this.titleNode, "href", id && ("#!/survey/"+id));
     18            this.titleNode.innerHTML = survey.title || "";
     19            domAttr.set(this.titleNode, "href", survey._id && ("#!/survey/"+survey._id));
    2320            this.descriptionNode.innerHTML = survey.description;
    24             this.questionsNode.innerHTML = (survey.questions || []).length;
     21            this.questionsNode.innerHTML = survey.questions.length;
    2522        }
    2623    });
  • Dev/trunk/src/client/qed-client/model/widgets/TabbedQuestionBrowser.js

    r477 r487  
    11define([
    2     'dojo/_base/declare',
    3     'dojo/_base/lang',
    4     'dojo/_base/window',
    5     'dijit/layout/ContentPane',
    6     'dijit/layout/TabContainer',
    7     'dojox/widget/Standby',
    8     '../../store',
    9     '../../widgets/Selector'
    10 ],function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){
     2    "../../widgets/Selector",
     3    "../classes/categories",
     4    "../classes/questions",
     5    "../classes/topics",
     6    "dijit/layout/ContentPane",
     7    "dijit/layout/TabContainer",
     8    "dojo/_base/declare",
     9    "dojo/_base/lang",
     10    "dojo/_base/window",
     11    "dojox/widget/Standby"
     12], function(Selector, categories, questions, topics, ContentPane, TabContainer, declare, lang, win, Standby) {
    1113    return declare([TabContainer],{
    1214        tabPosition: 'left-h',
     
    3840                this._fillCategoryTab(newTab.__category);
    3941            }));
    40             store.query(this._query, {reduce:true,group:true,group_level:1})
    41             .forPairs(lang.hitch(this,function(value,key){
    42                 this._createCategoryTab(key[0],value);
     42            categories.query()
     43            .forEach(lang.hitch(this,function(cat){
     44                this._createCategoryTab(cat.name,cat.count);
    4345            }));
    4446        },
     
    6163                this._busy();
    6264                categoryMap._filled = true;
    63                 store.query(this._query, {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]})
    64                 .forPairs(lang.hitch(this,function(value,key){
    65                     this._createTopicSelector(key[1],category,value);
     65                topics.query({category:category})
     66                .forEach(lang.hitch(this,function(topic){
     67                    this._createTopicSelector(topic.name,category,topic.count);
    6668                })).then(lang.hitch(this,function(){
    6769                    this._done();
     
    101103                topicMap._filled = true;
    102104                this._busy();
    103                 store.query(this._query, {
    104                     reduce:false,
    105                     include_docs:true,
    106                     key:[category,topic]
    107                 }).forEach(lang.hitch(this,function(value){
     105                questions.query({category:category,topic:topic})
     106                .forEach(lang.hitch(this,function(value){
    108107                    topicMap._widget.addItem(value);
    109108                })).then(lang.hitch(this,function(){
  • Dev/trunk/src/client/qed-client/pages/previewSurvey.js

    r443 r487  
    11define([
    22    "../app/Page",
    3     "../store",
     3    "../model/classes/surveys",
    44    "dojo/_base/array",
    55    "dojo/_base/declare",
     
    88    "require",
    99    "dojo/text!./templates/previewSurvey.html"
    10 ], function(Page, store, array, declare, lang, when, require, template) {
     10], function(Page, surveys, array, declare, lang, when, require, template) {
    1111    return declare([Page],{
    1212        contextRequire: require,
     
    1616            this.inherited(arguments);
    1717            if ( this.surveyId ) {
    18                 when(store.get(this.surveyId))
     18                when(surveys.load(this.surveyId))
    1919                .then(lang.hitch(this,function(survey){
    20                     this.titleNode.innerHTML = survey.title;
     20                    this.titleNode.innerHTML = survey.title || "";
    2121                    this.surveyWidget.set('survey',survey);
    2222                }));
  • Dev/trunk/src/client/qed-client/pages/question.js

    r443 r487  
    33    "../app/Page",
    44    "../app/Router",
    5     "../model/classes/Question",
     5    "../model/classes/questions",
    66    "../model/widgets/QuestionEditorPreview",
    77    "../model/widgets/QuestionEditorToolkit",
    8     "../store",
    98    "../widgets/_ComplexValueMixin",
    109    "dojo/_base/declare",
     
    1312    "dojo/when",
    1413    "dojo/text!./templates/question.html"
    15 ], function(Content, Page, Router, Question, QuestionEditorPreview, QuestionEditorToolkit, store, _ComplexValueMixin, declare, event, lang, when, template) {
     14], function(Content, Page, Router, questions, QuestionEditorPreview, QuestionEditorToolkit, _ComplexValueMixin, declare, event, lang, when, template) {
    1615    return declare([Page,_ComplexValueMixin], {
    1716        templateString: template,
     
    4342            }
    4443            if (this.questionId === "new") {
    45                 this.set('value', Question.create());
     44                this.set('value', questions.create());
    4645            } else {
    47                 when(store.get(this.questionId))
     46                when(questions.load(this.questionId))
    4847                .then(lang.hitch(this, function(value) {
    4948                    this.set('value', value);
     
    5453            this.value = value;
    5554            this.inherited(arguments);
    56             this.titleNode.innerHTML = Question.DisplayTitle.get(value);
     55            this.titleNode.innerHTML = value.title || "";
    5756        },
    5857        _getValueAttr: function() {
     
    6362        _onSave: function(evt) {
    6463            if ( this.validate() ) {
    65                 var value = this.get('value');
    66                 store.put(value)
     64                questions.save(this.get('value'))
    6765                .then(function() {
    6866                    Router.go('/questions');
  • Dev/trunk/src/client/qed-client/pages/questions.js

    r443 r487  
    11define([
    2     'dojo/_base/declare',
    3     'dojo/_base/Deferred',
    4     'dojo/_base/event',
    5     'dojo/_base/lang',
    6     '../store',
    7     '../app/Content',
    8     '../app/Router',
    9     '../app/Page',
    10     '../model/widgets/TabbedQuestionBrowser',
    11     'dojo/text!./templates/questions.html'
    12 ],function(declare,Deferred,event,lang,store,Content,Router,Page,TabbedQuestionBrowser,template) {
     2    "../app/Content",
     3    "../app/Page",
     4    "../app/Router",
     5    "../model/classes/questions",
     6    "../model/widgets/TabbedQuestionBrowser",
     7    "dojo/_base/Deferred",
     8    "dojo/_base/declare",
     9    "dojo/_base/event",
     10    "dojo/_base/lang",
     11    "dojo/text!./templates/questions.html"
     12], function(Content, Page, Router, questions, TabbedQuestionBrowser, Deferred, declare, event, lang, template) {
    1313    return declare([Page],{
    1414        templateString: template,
     
    4444        },
    4545        onDeleteQuestion: function(question) {
    46             store.remove(store.getIdentity(question),store.getRevision(question))
     46            questions.remove(question)
    4747            .then(function(){
    4848                Content.notify("Question deleted.");
     
    5555        },
    5656        onPublishQuestion: function(question) {
    57             question.publicationDate = store.timestamp();
    58             store.put(question)
     57            question.publicationDate = new Date();
     58            questions.save(question)
    5959            .then(function(){
    6060                Content.notify("Question published.");
  • Dev/trunk/src/client/qed-client/pages/response.js

    r478 r487  
    33    "../app/Page",
    44    "../lib/async",
    5     "../model/classes/Response",
    6     "../model/classes/Survey",
    7     "../model/classes/SurveyRun",
    8     "../store",
     5    "../model/classes/responses",
    96    "dojo/_base/declare",
    107    "dojo/_base/event",
     
    1613    "require",
    1714    "dojo/text!./templates/response.html"
    18 ], function(Content, Page, async, Response, Survey, SurveyRun, store, declare, event, json, lang, all, request, when, require, template) {
     15], function(Content, Page, async, responses, declare, event, json, lang, all, request, when, require, template) {
    1916    return declare([Page],{
    2017        contextRequire: require,
     
    2825            this.inherited(arguments);
    2926            this._disableSubmit();
    30             var surveyRunId = this.surveyRunId;
    31             var responseId = this.options && this.options.id;
    32             if ( surveyRunId && responseId ) {
    33                 this._loadSurveyAndResponse(surveyRunId,responseId)
    34                 .then(lang.hitch(this, function() {
    35                     if ( this.response.publicationDate ) {
    36                         this._showInfo("<div>You already submitted your survey and cannot change it anymore. You can still view your answers here.</div>");
    37                         this._disableSubmit();
    38                     } else {
    39                         this._enableSubmit();
    40                     }
    41                 }), lang.hitch(this,function() {
    42                     this._showInfo("<div>The url seems to be incorrect, no survey found.</div>");
    43                 }));
     27            if ( !this.response ) {
     28                this._showInfo("<div>The url seems to be incorrect, no response found.</div>");
    4429            } else {
    45                 throw new Error("No valid uid or survey passed!");
     30                this.titleNode.innerHTML = this.response._surveyRun.survey.title || "";
     31                this.surveyWidget.set('survey', this.response._surveyRun.survey);
     32                this.surveyWidget.set('value', this.response.answers || {});
     33                if ( this.response.publicationDate ) {
     34                    this._showInfo("<div>You already submitted your survey and cannot change it anymore. You can still view your answers here.</div>");
     35                    this._disableSubmit();
     36                } else {
     37                    this._enableSubmit();
     38                }
    4639            }
    47         },
    48         _loadSurveyAndResponse: function(surveyRunId,responseId){
    49             return all([request.get('/api/surveyRuns/'+surveyRunId,{handleAs:'json'}),
    50                         request.get('/api/responses/'+responseId,{handleAs:'json'})])
    51             .then(lang.hitch(this,function(surveyAndResponse){
    52                 var surveyRun = surveyAndResponse[0];
    53                 this.response = surveyAndResponse[1];
    54                 if ( this.response.surveyRunId !== surveyRunId ) {
    55                     throw "Survey does not match the response...";
    56                 }
    57                 this.titleNode.innerHTML = Survey.DisplayTitle.get(surveyRun.survey);
    58                 this.surveyWidget.set('survey', surveyRun.survey);
    59                 this.surveyWidget.set('value', this.response.answers || {});
    60             }));
    6140        },
    6241        _enableSubmit: function() {
     
    7857            var answers = this.surveyWidget.get('value');
    7958            this.response.answers = answers;
    80             return request.put('/api/responses/'+store.getIdentity(this.response),{
    81                 handleAs:'json',
    82                 data:json.toJson(this.response),
    83                 headers:{"Content-Type": "application/json"}
    84             }).then(lang.hitch(this,function(res){
    85                 this.response._rev = res.rev;
     59            return responses.putWithSecret(this.response,this.response.secret)
     60            .then(lang.hitch(this,function(response){
     61                this.response = response;
    8662                Content.notify("Your response is saved.");
    8763            }), function(err){
     
    9066        },
    9167        _onSubmit: function(e) {
    92             this.response.publicationDate = store.timestamp();
     68            this.response.publicationDate = new Date();
    9369            this._getAnswersAndSaveResponse()
    9470            .then(lang.hitch(this,function(){
     
    11086            this._disableSubmit();
    11187            this.surveyWidget.destroy();
    112             request('/api/responses/'+store.getIdentity(this.response)+'?rev='+store.getRevision(this.response),{
    113                 method: 'DELETE',
    114                 handleAs:'json',
    115                 data:json.toJson(this.response),
    116                 headers:{"Content-Type": "application/json"}
    117             }).then(lang.hitch(this,function(res){
     88            responses.removeWithSecret(this.response,this.response.secret)
     89            .then(lang.hitch(this,function(res){
    11890                this._showInfo("<div>Your response has been deleted, no answers have been saved.</div>");
    11991                Content.notify("Your response is deleted.");
  • Dev/trunk/src/client/qed-client/pages/session.js

    r443 r487  
    11define([
    2     'dojo/_base/array',
     2    /*'dojo/_base/array',
    33    'dojo/_base/declare',
    44    'dojo/_base/event',
     
    1212    '../model/classes/SessionTemplate',
    1313    '../model/widgets/AccountListView',
    14     'dojo/text!./templates/session.html'
     14    'dojo/text!./templates/session.html'*/
    1515],function(array,declare,event,lang,when,search,store,Page,Router,ThresholdFilteringSelect,SessionTemplate,AccountListView,template){
    16     return declare([Page],{
     16    /*return declare([Page],{
    1717        templateString: template,
    1818        session: null,
     
    9292
    9393
    94     });
     94    });*/
    9595});
    9696
  • Dev/trunk/src/client/qed-client/pages/sessions.js

    r443 r487  
    11define([
    2     'dojo/_base/declare',
     2    /*'dojo/_base/declare',
    33    'dojo/_base/lang',
    44    'dojo/date/stamp',
     
    77    '../app/Page',
    88    '../widgets/ObjectBox',
    9     'dojo/text!./templates/sessions.html'
     9    'dojo/text!./templates/sessions.html'*/
    1010],function(declare,lang,dateStamp,store,Router,Page,ObjectBox,template){
    11     return declare([Page],{
     11    /*return declare([Page],{
    1212        templateString: template,
    1313        templateActions: null,
     
    1818            this.templateActions = {
    1919                "Edit": function(obj){
    20                     Router.go('/session/'+store.getIdentity(obj));
     20                    Router.go('/session/'+obj.get('id'));
    2121                },
    2222                "Delete": lang.hitch(this,function(obj){
    23                     store.remove(store.getIdentity(obj),store.getRevision(obj))
     23                    obj.remove()
    2424                    .then(lang.hitch(this,function(){
    2525                        this._refresh();
     
    3030            this.sessionActions = {
    3131                "Facilitate": function(obj){
    32                     Router.go('run',{uid:store.getIdentity(obj)});
     32                    Router.go('run',{uid: obj.get('id')});
    3333                },
    3434                "Delete": lang.hitch(this,function(obj){
    35                     store.remove(store.getIdentity(obj),store.getRevision(obj))
     35                    obj.remove()
    3636                    .then(lang.hitch(this,function(){
    3737                        this._refresh();
     
    4848        },
    4949        _refreshByType: function(type,container,actions) {
     50            // FIXME
    5051            store.query("_design/default/_view/by_type",{key:type})
    5152            .forEach(lang.hitch(this,function(obj){
     
    6162        },
    6263        _publishSession: function(sessionTemplate) {
     64            // FIXME
    6365            var session = lang.clone(sessionTemplate);
    6466            delete session[store.idProperty];
     
    7375            }));
    7476        }
    75     });
     77    });*/
    7678});
  • Dev/trunk/src/client/qed-client/pages/survey.js

    r443 r487  
    22    "../app/Page",
    33    "../app/Router",
    4     "../model/classes/Survey",
     4    "../model/classes/surveys",
    55    "../model/widgets/QuestionListView",
    66    "../model/widgets/TabbedQuestionBrowser",
    7     "../store",
    87    "dojo/_base/array",
    98    "dojo/_base/declare",
     
    1312    "require",
    1413    "dojo/text!./templates/survey.html"
    15 ], function(Page, Router, Survey, QuestionListView, TabbedQuestionBrowser, store, array, declare, event, lang, when, require, template) {
     14], function(Page, Router, surveys, QuestionListView, TabbedQuestionBrowser, array, declare, event, lang, when, require, template) {
    1615    return declare([Page],{
    1716        contextRequire: require,
     
    6362        _loadSurvey: function() {
    6463            if ( this.surveyId === "new" ) {
    65                 this.survey = Survey.create();
     64                this.survey = surveys.create();
    6665                this.refresh();
    6766            } else {
    68                 when(store.get(this.surveyId))
     67                when(surveys.load(this.surveyId))
    6968                .then(lang.hitch(this,function(survey){
    7069                    this.survey = survey;
    7170                    this.questionList.set('value',
    72                                           Survey.Questions.get(this.survey));
     71                                          this.survey.questions);
    7372                    this.refresh();
    7473                }));
     
    7978        },
    8079        refresh: function() {
    81             this.titleNode.innerHTML = Survey.DisplayTitle.get(this.survey) || "(set title in properties)";
     80            this.titleNode.innerHTML = this.survey.title || "(set title in properties)";
    8281            this.propertiesDialog.set('value',this.survey);
    8382        },
     
    10099        _onSave: function(evt) {
    101100            this.survey.questions = this.questionList.get('value');
    102             store.put(this.survey)
     101            surveys.save(this.survey)
    103102            .then(function() {
    104103                Router.go('/surveys');
     
    111110        },
    112111        _onShowPreview: function() {
    113             Router.go('/previewSurvey/'+store.getIdentity(this.survey),{
     112            Router.go('/previewSurvey/'+this.survey._id,{
    114113                preview: true
    115114            });
  • Dev/trunk/src/client/qed-client/pages/surveyRun.js

    r466 r487  
    44    "../app/Router",
    55    "../lib/func",
    6     "../model/classes/SurveyRun",
    7     "../store",
     6    "../model/classes/responses",
     7    "../model/classes/surveyRuns",
    88    "../widgets/LineWithActionsWidget",
     9    "dojo/_base/array",
    910    "dojo/_base/declare",
    1011    "dojo/_base/event",
     
    1314    "require",
    1415    "dojo/text!./templates/surveyRun.html"
    15 ], function(Content, Page, Router, func, SurveyRun, store, LineWithActionsWidget, declare, event, lang, when, require, template) {
     16], function(Content, Page, Router, func, responses, surveyRuns, LineWithActionsWidget, array, declare, event, lang, when, require, template) {
    1617    return declare([Page],{
    1718        contextRequire: require,
     
    2425            if ( this.surveyRunId ) {
    2526                this._loadSurveyRun();
    26                 this._loadResponses();
    2727            } else {
    2828                throw "No valid uid or survey passed!";
     
    3030        },
    3131        _loadSurveyRun: function() {
    32             when(store.get(this.surveyRunId))
     32            when(surveyRuns.load(this.surveyRunId))
    3333            .then(lang.hitch(this,function(surveyRun){
    3434                this.surveyRun = surveyRun;
    3535                this.refreshSurveyRun();
     36                this._loadResponses();
    3637            }));
    3738        },
    3839        refreshSurveyRun: function() {
    39             this.titleNode.innerHTML = SurveyRun.DisplayTitle.get(this.surveyRun);
    40             this.surveySummaryWidget.set('value',SurveyRun.Survey.get(this.surveyRun));
     40            this.titleNode.innerHTML = this.surveyRun.title || "";
     41            this.surveySummaryWidget.set('value',this.surveyRun.survey);
    4142            this.surveyRunWidget.set('value',this.surveyRun);
    4243            this._onPropChange();
    4344        },
    4445        _loadResponses: function() {
    45             when(store.query("_design/responses/_view/by_surveyrun",{key:this.surveyRunId}))
    46             .forEach(lang.hitch(this,function(response){
    47                 var actions = {
    48                     view: {
    49                         callback: function(){},
    50                         properties: {
    51                             title: "View response"
    52                         }
    53                     }
    54                 };
    55                 if ( !response.publicationDate ) {
    56                     actions.remove = {
    57                         callback: function(){},
    58                         properties: {
    59                             title: "Remove response"
     46            responses.query({surveyRunId:surveyRuns.getId(this.surveyRun)})
     47            .then(lang.hitch(this,function(allResponses){
     48                array.forEach(allResponses, function(response){
     49                    var actions = {
     50                        view: {
     51                            callback: function(){},
     52                            properties: {
     53                                title: "View response"
     54                            }
    6055                        }
    6156                    };
    62                 }
    63                 var w = new LineWithActionsWidget({
    64                     actions: actions
    65                 });
    66                 var responseId = store.getIdentity(response);
    67                 w.set('title',this._link(this._getResponseURL(this.surveyRunId,responseId),responseId));
    68                 w.placeAt(this.responsesNode);
     57                    if ( !response.publicationDate ) {
     58                        actions.remove = {
     59                            callback: function(){},
     60                            properties: {
     61                                title: "Remove response"
     62                            }
     63                        };
     64                    }
     65                    var w = new LineWithActionsWidget({
     66                        actions: actions
     67                    });
     68                    var rid = responses.getId(response);
     69                    w.set('title',this._link(this._buildResponseURL(response),rid),rid);
     70                    w.placeAt(this.responsesNode);
     71                }, this);
    6972            }));
    7073        },
     
    7376            if ( surveyRun.mode === "open" ) {
    7477                this.runURLNode.innerHTML =
    75                     this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
     78                    this._link(this._buildGeneralURL(this.surveyRun));
    7679            } else {
    7780                this.runURLNode.innerHTML =
     
    7982            }
    8083        },
    81         _getGeneralURL: function(surveyRunId) {
    82             return 'response.html#!/'+surveyRunId;
     84        _buildGeneralURL: function(surveyRun) {
     85            return 'response.html#!/surveyRuns/'+surveyRuns.getId(surveyRun)+'!secret='+surveyRun.secret;
    8386        },
    84         _getResponseURL: function(surveyRunId,responseId) {
    85             return 'response.html#!/'+surveyRunId+'!id='+responseId;
     87        _buildResponseURL: function(response) {
     88            return 'response.html#!/responses/'+responses.getId(response)+'!secret='+response.secret;
    8689        },
    8790        _link: function(url,label) {
     
    9295                lang.mixin(this.surveyRun,this.surveyRunWidget.get('value'));
    9396
    94                 var SD = SurveyRun.StartDate;
    95                 var ED = SurveyRun.EndDate;
    96                 SD.set(this.surveyRun, SD.get(this.surveyRun));
    97                 ED.set(this.surveyRun, ED.get(this.surveyRun));
    98 
    99                 store.put(this.surveyRun)
     97                surveyRuns.save(this.surveyRun)
    10098                .then(function() {
    10199                    Router.go('/surveys');
  • Dev/trunk/src/client/qed-client/pages/surveys.js

    r443 r487  
    11define([
    2     'dojo/_base/array',
    3     'dojo/_base/declare',
    4     'dojo/_base/lang',
    5     'dojo/when',
    6     '../store',
    7     '../app/Content',
    8     '../app/Page',
    9     '../app/Router',
    10     '../model/classes/Survey',
    11     '../model/classes/SurveyRun',
    12     '../widgets/LineWithActionsWidget',
    13     'dojo/text!./templates/surveys.html'
    14 ],function(array,declare,lang,when,store,Content,Page,Router,Survey,SurveyRun,LineWithActionsWidget,template){
     2    "../app/Content",
     3    "../app/Page",
     4    "../app/Router",
     5    "../model/classes/surveys",
     6    "../model/classes/surveyRuns",
     7    "../widgets/LineWithActionsWidget",
     8    "dojo/_base/array",
     9    "dojo/_base/declare",
     10    "dojo/_base/lang",
     11    "dojo/when",
     12    "dojo/text!./templates/surveys.html"
     13], function(Content, Page, Router, surveys, surveyRuns, LineWithActionsWidget, array, declare, lang, when, template) {
    1514    return declare([Page],{
    1615        templateString: template,
     
    2524        _onPublishSurvey:function(survey){
    2625            var self = this;
    27             survey.publicationDate = store.timestamp();
    28             store.put(survey).then(function(){
     26            survey.publicationDate = new Date();
     27            surveys.save(survey)
     28            .then(function(){
    2929                self.refreshDrafts();
    3030                self.refreshPublished();
     
    3535        _onDeleteSurvey:function(survey){
    3636            var self = this;
    37             store.remove(store.getIdentity(survey),store.getRevision(survey))
     37            surveys.remove(survey)
    3838            .then(function(){
    3939                self.refreshDrafts();
     
    4343        },
    4444        _onEditSurvey:function(survey){
    45             Router.go('/survey/'+store.getIdentity(survey));
     45            Router.go('/survey/'+survey._id);
    4646        },
    4747        _onPreviewSurvey:function(survey){
    48             Router.go('/previewSurvey/'+store.getIdentity(survey));
     48            Router.go('/previewSurvey/'+survey._id);
    4949        },
    5050        _onRunSurvey:function(survey){
    51             var surveyRun = SurveyRun.create();
    52             SurveyRun.Survey.set(surveyRun,survey);
    53             store.put(surveyRun)
     51            var surveyRun = surveyRuns.create();
     52            surveyRun.survey = survey;
     53            surveyRuns.save(surveyRun)
    5454            .then(lang.hitch(this,function(surveyRun){
    5555                this._onRunDetails(surveyRun);
     
    5959        },
    6060        _onRunDetails: function(surveyRun) {
    61             Router.go('/surveyRun/'+store.getIdentity(surveyRun));
     61            Router.go('/surveyRun/'+surveyRun._id);
    6262        },
    6363        refresh: function() {
     
    6868        refreshDrafts: function() {
    6969            this.draftsContainer.set('content','');
    70             when(store.query("_design/surveys/_view/drafts"),
    71                     lang.hitch(this,function(surveys) {
     70            when(surveys.query({drafts:true}), lang.hitch(this,function(surveys) {
    7271                this.draftsTab.set('title','Drafts ('+surveys.length+')');
    7372                array.forEach(surveys,function(survey){
    7473                    var w = new LineWithActionsWidget({
    75                         title: Survey.DisplayTitle.get(survey) || '(unnamed)',
     74                        title: survey.title || '(unnamed)',
    7675                        actions: [{
    7776                            callback: lang.hitch(this,'_onPublishSurvey',survey),
     
    110109        refreshPublished: function() {
    111110            this.publishedContainer.set('content','');
    112             when(store.query("_design/surveys/_view/published"),
    113                     lang.hitch(this, function(surveys) {
     111            when(surveys.query({published:true}), lang.hitch(this, function(surveys) {
    114112                this.publishedTab.set('title','Published ('+surveys.length+')');
    115113                array.forEach(surveys,function(survey){
    116114                    var w = new LineWithActionsWidget({
    117                         title: Survey.DisplayTitle.get(survey),
     115                        title: survey.title || "",
    118116                        actions:[{
    119117                            callback: lang.hitch(this,'_onPreviewSurvey',survey),
     
    138136        refreshRuns: function() {
    139137            this.runsContainer.set('content','');
    140             when(store.query("_design/default/_view/by_type",{key:'SurveyRun'}),
    141                     lang.hitch(this,function(surveyRuns){
     138            when(surveyRuns.query(), lang.hitch(this,function(surveyRuns){
    142139                this.runsTab.set('title','Runs ('+surveyRuns.length+')');
    143140                array.forEach(surveyRuns,function(surveyRun){
    144141                    var w = new LineWithActionsWidget({
    145                         title: SurveyRun.DisplayTitle.get(surveyRun),
     142                        title: surveyRun.title || "",
    146143                        actions:[{
    147144                            callback: lang.hitch(this,'_onRunDetails',surveyRun),
  • Dev/trunk/src/client/qed-client/response.js

    r477 r487  
    44    "./app/Path",
    55    "./lib/async",
    6     "./model/classes/Response",
    7     "./model/classes/SurveyRun",
     6    "./model/classes/responses",
     7    "./model/classes/surveyRuns",
    88    "./pages/response",
    9     "./store",
    109    "dojo/_base/json",
    1110    "dojo/date",
     
    1615    "./stddeps",
    1716    "dojo/domReady!"
    18 ], function(Content, Page, Path, async, Response, SurveyRun, ResponsePage, store, json, date, locale, hash, parser, request) {
     17], function(Content, Page, Path, async, responses, surveyRuns, ResponsePage, json, date, locale, hash, parser, request) {
    1918    parser.parse();
    2019    Content.startup();
     
    2625    }
    2726
    28     var path = new Path('/:surveyRunId');
     27    var path = new Path('/:type/:id');
    2928    var params = path.match(hash());
    3029    params.options = params.options || {};
    31 
    32     if ( !params || !params.surveyRunId ) {
     30   
     31    if ( params && params.type === 'surveyRuns' ) {
     32        var response = responses.create();
     33        response.surveyRunId = params.id;
     34        responses.postWithSecret(response,params.options.secret)
     35        .then(setContent,function(err){ error(err.error); });
     36    } else if ( params && params.type === 'responses' ) {
     37        responses.getWithSecret(params.id,params.options.secret)
     38        .then(setContent,function(err){ error(err.error); });
     39    } else {
    3340        error("Something is wrong with the URL, don't know what survey to show you. Sorry.");
    34         return;
    3541    }
    3642
    37     var surveyRunId = params.surveyRunId;
    38 
    39     function checkDates(surveyRun) {
    40         var now = new Date();
    41         var startDate = SurveyRun.StartDate.get(surveyRun);
    42         var endDate = SurveyRun.EndDate.get(surveyRun);
    43         if ( startDate && date.compare(startDate,now) > 0 ) {
    44             error("This survey will start on "+locale.format(startDate,'date'));
    45             throw false;
    46         }
    47         if ( endDate && date.compare(now,endDate) > 0 ) {
    48             error("This survey ended on "+locale.format(endDate,'date'));
    49             throw false;
    50         }
     43    function setContent(response) {
     44        hash(Path.format("/responses/"+responses.getId(response),
     45                         {secret:response.secret}));
     46        Content.set(new ResponsePage({
     47            response: response
     48        }));
    5149    }
    5250
    53     request.get('/api/surveyRuns/'+surveyRunId,{handleAs:'json'})
    54     .then(function(surveyRun){
    55         checkDates(surveyRun);
    56         if ( params.options.id ) {
    57             return params.options.id;
    58         } else {
    59             if ( surveyRun.mode === "open") {
    60                 var response = Response.create();
    61                 response.surveyRunId = surveyRunId;
    62                 return request.post('/api/responses',{
    63                     handleAs:'json',
    64                     data:json.toJson(response),
    65                     headers:{"Content-Type": "application/json"}
    66                 }).then(function(res){
    67                     return res.id;
    68                 });
    69             } else {
    70                 error("Cannot respond to closed survey without response id. Sorry.");
    71                 throw false;
    72             }
    73         }
    74         return surveyRun;
    75     },function(){
    76         error("No running survey found for the given id. Sorry.");
    77         throw false;
    78     })
    79     .then(function(responseId){
    80         hash(Path.format("/"+surveyRunId,{ id: responseId }));
    81         Content.set(new ResponsePage({
    82             surveyRunId: surveyRunId,
    83             options: {
    84                 id: responseId
    85             }
    86         }));
    87     });
    8851});
  • Dev/trunk/src/client/qed-client/routes.js

    r443 r487  
    11define([
    2     './pages/index',
    3     './pages/questions',
    4     './pages/question',
    5     './pages/surveys',
    6     './pages/survey',
    7     './pages/surveyRun',
    8     './pages/sessions',
    9     './pages/session',
    10     './pages/previewSurvey'
    11 ],function(index,questions,question,surveys,survey,surveyRun,sessions,session,previewSurvey){
     2    "./pages/index",
     3    "./pages/previewSurvey",
     4    "./pages/question",
     5    "./pages/questions",
     6    "./pages/survey",
     7    "./pages/surveyRun",
     8    "./pages/surveys"
     9], function(index, previewSurvey, question, questions, survey, surveyRun, surveys) {
    1210
    1311    return [
  • Dev/trunk/src/client/qed-client/session.coffee

    r468 r487  
    22    "dojo/_base/declare",
    33    "dojo/_base/json",
     4    "dojo/Deferred",
    45    "dojo/Evented",
    56    "dojo/request"
    6 ], (declare, json, Evented, request) ->
     7], (declare, json, Deferred, Evented, request) ->
    78    Session = declare [Evented],
    89        info: null
     
    1819                @_set res
    1920            , () =>
    20                 throw (@_set null)
     21                new Deferred().reject (@_set null)
    2122
    2223        login: (username, password) ->
     
    3031                @_set res
    3132            , () =>
    32                 throw (@_set null)
     33                new Deferred().reject (@_set null)
    3334
    3435        logout: () ->
     
    4546                @info = newInfo
    4647                @emit 'change', @info
    47                 @info
     48            @info
    4849
    4950    new Session()
  • Dev/trunk/src/client/qed-client/stddeps.js

    r468 r487  
    11define([
     2
    23    // dijit & rft widgets used declaratively in templates
    34    'dijit/Dialog',
     
    4344    './widgets/Selector',
    4445    './widgets/TitleGroup'
     46
    4547],function(){});
  • Dev/trunk/src/client/qed-client/ui/LoginDialogWrapper.coffee

    r468 r487  
    1717            if @_started then return
    1818            @inherited arguments
    19             _on session, 'change', (lang.hitch @, @onUserChange)
     19            _on session, 'change', (lang.hitch @, 'onUserChange')
    2020            @onUserChange session.get()
    2121        onLogin: (evt) ->
     
    3535            else
    3636                @loginDialog.show()
     37            null
  • Dev/trunk/src/client/qed-client/xhr.js

    r486 r487  
    22    "./session",
    33    "dojo/Deferred",
     4    "dojo/_base/lang",
    45    "dojo/on",
    5     "dojo/request"
    6 ], function(session, Deferred, on, request) {
     6    "dojo/_base/xhr"
     7], function(session, Deferred, lang, on, xhr) {
    78
    89    var user = session.get();
    910    var queue = [];
    1011   
    11     on(session, 'change', function(newUser) {
     12    on(session, 'change', function(newUser){
    1213        user = newUser;
    13         if ( user ) {
    14             retry();
    15         }
     14        retry();
    1615    });
    17    
     16
    1817    function retry() {
    19         if (queue.length > 0) {
     18        if (user && queue.length > 0) {
    2019            var item = queue.shift();
    21             console.log("Retry",item.url);
     20            console.log("Retry",item.options.url);
    2221            real_request(item);
    2322        }
     
    2524   
    2625    function real_request(item) {
    27         var req = request(item.url,item.options);
     26        var req = xhr(item.method,lang.mixin(item.options||{},{
     27            failOk: true
     28        }));
     29        item.promise.ioArgs = req.ioArgs;
    2830
    29         // forward successfull response
    30         req.then(function(body){
    31             item.dfd.resolve(body);
    32         });
    33 
    34         // handle unauthenticated and queued requests
    35         req.response.then(function(response){
     31        req.then(function(result){
     32            item.dfd.resolve(result);
    3633            retry();
    37         }, function(error) {
     34        }, function(error){
    3835            if ( error.response.status === 401 ) {
    3936                queue.unshift(item);
    4037                session.restore();
    4138            } else {
    42                 item.dfd.reject(error); // this should be error body
    43                                         // not, the request?
     39                item.dfd.reject(error);
    4440                retry();
    4541            }
     
    4743    }
    4844   
    49     var _request = function(url, options) {
     45    var _request = function(method, options) {
    5046        var item = {
    51             url: url,
     47            method: method,
    5248            options: options,
    5349            dfd: new Deferred()
    5450        };
     51        item.promise = lang.delegate(item.dfd.promise);
    5552        // only do the request directly if we are authenticated and
    5653        // there are no earlier requests queued.
    5754        if ( user && queue.length === 0 ) {
    58             console.log("Request",url);
     55            console.log("Request",options.url);
    5956            real_request(item);
    6057        } else {
    61             console.log("Push",url);
     58            console.log("Push",options.url);
    6259            queue.push(item);
    6360        }
    64         return item.dfd.promise;
     61        return item.promise;
    6562    };
    6663
Note: See TracChangeset for help on using the changeset viewer.