aboutsummaryrefslogtreecommitdiff
path: root/js/io/workflow/new-project-manager.js
blob: 814d6d0e3221bbd20303232886e52b088589a3b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
</copyright> */

var Montage = require("montage/core/core").Montage;
var modalDialogModule = require("js/components/ui/modalDialog/modal-dialog-manager");
var newProjectChoicesModule = require("js/io/workflow/newProjectNavigator");

var newProjectManager = exports.NewProjectManager = Montage.create(Montage, {

    /**
     * will be used for any expensive init operation like loading a setting.xml
     */
    init:{
        writable:false,
        enumerable:true,
        value: function(){}
    },

    /***
     * for list mode every entry has an icon
     * this object should be build at runtime with the data returned from io api
     * this will be bound to the iconList Repetition
     */
    resource_data_listMode:{
        writable: true,
        enumerable:false,
        value:{
            "root":{
                "name":"Project Type",
                "uri":null,
                "fileType":null,//for file type filter
                "hasChilden":true,
                "children":["newProject", "newFile", "newTemplate"],
                "hasIcon": false,
                "iconUrl":null
            },
            "newProject":{
                "name":"New Project",
                "uri":null,
                "fileType":null,
                "hasChilden":true,
                "children":["animation", "bannerAd", "montageComponent", "androidApp"],
                "hasIcon": false,
                "iconUrl":null
            },
            "newFile":{
                "name":"New File",
                "uri":null,
                "fileType":null,
                "hasChilden":true,
                "children":["html", "javascript", "css"],
                "hasIcon": false,
                "iconUrl":null
            },
            "newTemplate":{
                "name":"New Template",
                "uri":null,
                "fileType":null,
                "hasChilden":true,
                "children":["xoomApp", "website", "iosApp"],
                "hasIcon": false,
                "iconUrl":null
            },
            "bannerAd":{
                "name":"Banner Ad",
                "uri":null,
                "fileType":null,
                "hasChilden":true,
                "children":["176x208", "176x220", "208x320", "230x240"],
                "hasIcon": false,
                "iconUrl":null
            },
            "176x208":{
                "name":"176x208",
                "uri":null,
                "fileType":null,
                "hasChilden":false,
                "hasIcon": false,
                "iconUrl":null
            },
            "176x220":{
                "name":"176x220",
                "uri":null,
                "fileType":null,
                "hasChilden":false,
                "hasIcon": false,
                "iconUrl":null
            },
            "208x320":{
                "name":"208x320",
                "uri":null,
                "fileType":null,
                "hasChilden":false,
                "hasIcon": false,
                "iconUrl":null
            }
        }

    },

    /***
     *
     * Load project type selection component and populate a new modal dialog instance
     */
    showNewProjectDialog:{
        writable:false,
        enumerable:true,
        value: function(){
            var newProjectContent = document.createElement("div");
            newProjectContent.id = "newProject";

            //temporary width/height setting
            newProjectContent.style.width = newProjectContent.style.height= "500px";// remove this hard code width/height
            newProjectContent.style.color = "#fff";

            //hack (elements needs to be on DOM to be drawn)
            document.getElementById('modalContainer').appendChild(newProjectContent);

            var newProjectChoices = newProjectChoicesModule.NewProjectNavigator.create();
            newProjectChoices.element = newProjectContent;
            newProjectChoices.needsDraw = true;

            //hack - remove after rendering and add in modal dialog
            document.getElementById('modalContainer').removeChild(newProjectContent);

            modalDialogModule.ModalDialogMananger.init(document.getElementById('blockScreen'), document.getElementById('modalContainer'));
            modalDialogModule.ModalDialogMananger.showModalDialog(null, "#2c2c2c", newProjectContent);//add content as input

        }
    }


});