source: Dev/branches/rest-dojo-ui/client/rft/pages/surveyAdvanced.js @ 363

Last change on this file since 363 was 355, checked in by tjcschipper, 13 years ago
  • surveyEditor more or less works! Only needed change is addition of "topic" property in question objects (database-side), and the change from "category"(string) to "categories"(string[]).
  • surveyEditor still needs removal function and infofunction to be written properly!
  • Added all files belonging to SurveyAdvanced?. Most do not work properly yet, but at least there will not be a 404 page when you click btnPreview on survey.html.
File size: 2.0 KB
Line 
1define(['dojo/_base/declare',
2    'dojo/_base/lang',
3    'dojo/_base/Deferred',
4    'rft/ui/LineWithActionsWidget',
5    'rft/store',
6    'rft/ui/_Page',
7    'rft/api',
8    'rft/content',
9    'dijit/registry',
10    'dojo/on'],
11    function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on){
12        return declare('rft.pages.surveyAdvanced', [_Page], {
13            object: null,
14            onVisit: function() {
15                if (this.pageArgs.uid) {
16                    Deferred.when(store.get(this.pageArgs.uid))
17                    .then(lang.hitch(this, function(obj) {
18                        this.object = obj;
19                    }));
20                } else {
21                    throw new Error("Error: no reference to object set!");
22                }
23
24                this._setupButtons();
25            },
26            onLeave: function() {
27                this.inherited(arguments);
28            },
29            _confirmSave: function() {
30                return confirm("Do you want to save?");
31            },
32            _saveSurvey: function() {
33            },
34            _restartEditor: function() {
35            },
36            _backToEditor: function() {
37                if (this._confirmSave()) {
38                    this._saveSurvey()
39                    content.goTo('survey', {uid: this.object._id});
40                } else {
41                    content.goTo('survey', {uid: this.object._id});
42                }
43            },
44            _setupButtons: function() {
45                registry.byId("btnSave").on("click", lang.hitch(this, function() {
46                    this._saveSurvey();
47                }));
48                registry.byId("btnDiscard").on("click", lang.hitch(this, function() {
49                    this._restartEditor();
50                }));
51                registry.byId("btnBack").on("click", lang.hitch(this, function() {
52                    this._backToEditor();
53                }));
54            }
55        });
56});
57
Note: See TracBrowser for help on using the repository browser.