@@ -30,6 +30,9 @@ define(function (require, exports, module) {
3030 _versionNumber : '' ,
3131 _authorName : '' ,
3232 _nameOfWidget : '' ,
33+ _packageOfWidget : '' ,
34+ _licenseName : '' ,
35+ _copyrightName : '' ,
3336 _directoryOfWidget : '' ,
3437 _gitHubDialog : null ,
3538 _progressBar : null ,
@@ -65,7 +68,7 @@ define(function (require, exports, module) {
6568 htmlJ = null ;
6669
6770 html = html . split ( '{{title}}' ) . join ( 'Create a new Custom Widget!' ) ;
68- html = html . split ( '{{body}}' ) . join ( '<div class="form-group"><label for="authorName">Author</label><input type="text" class="form-control" id="authorName" placeholder="Name of the author." value="' + MendixGitHubManager . _authorName + '"></div><div class="form-group"><label for="versionNumber">Version</label><input type="text" class="form-control" id="versionNumber" placeholder="Version number of the widget." value="' + MendixGitHubManager . _versionNumber + '"></div><div class="form-group"><label for="nameOfWidget">Name</label><input type="text" class="form-control" id="nameOfWidget" placeholder="Name of the custom widget." value="' + MendixGitHubManager . _nameOfWidget + '"></div><div class="form-group"><label for="directoryOfWidget">Location</label><div class="form-inline"><input type="text" class="form-control" id="directoryOfWidget" placeholder="Directory of the custom widget." value="' + MendixGitHubManager . _directoryOfWidget + '"> <button class="btn primary" id="btnSelectDir">browse</button></div></div>' ) ;
71+ html = html . split ( '{{body}}' ) . join ( '<table><tr><td style="vertical-align: top;padding-right: 10px;"><div class="form-group"><label for="authorName">Author</label><input type="text" class="form-control" id="authorName" placeholder="Name of the author." value="' + MendixGitHubManager . _authorName + '"></div><div class="form-group"><label for="licenseName">License name</label><input type="text" class="form-control" id="licenseName" placeholder="License used, example (Apache 2, MIT, etc...)." value="' + MendixGitHubManager . _licenseName + '"></div><div class="form-group"><label for="copyrightName">Copyright</label><input type="text" class="form-control" id="copyrightName" placeholder="Copyright used." value="' + MendixGitHubManager . _copyrightName + '"></div></td><td><div class="form-group"><label for="versionNumber">Version</label><input type="text" class="form-control" id="versionNumber" placeholder="Version number of the widget." value="' + MendixGitHubManager . _versionNumber + '"></div><div class="form-group"><label for="packageOfWidget">PackageName</label><input type="text" class="form-control" id="packageOfWidget" placeholder="PackageName of the custom widget." value="' + MendixGitHubManager . _packageOfWidget + '"></div><label for="nameOfWidget">Name</label><input type="text" class="form-control" id="nameOfWidget" placeholder="Name of the custom widget." value="' + MendixGitHubManager . _nameOfWidget + '"></div></td></tr><tr><td colspan="2"><div class="form-group"><label for="directoryOfWidget">Location</label><div class="form-inline"><input type="text" class="form-control" id="directoryOfWidget" placeholder="Directory of the custom widget." value="' + MendixGitHubManager . _directoryOfWidget + '"> <button class="btn primary" id="btnSelectDir">browse</button></div></div></td></tr></table>' ) ;
6972
7073 MendixGitHubManager . showDialog ( html ) ;
7174
@@ -80,19 +83,31 @@ define(function (require, exports, module) {
8083 htmlJ . find ( '#authorName' ) . on ( 'keyup' , function ( ) {
8184 MendixGitHubManager . _authorName = $ ( '#authorName' ) . val ( ) ;
8285 } ) ;
83-
86+
8487 htmlJ . find ( '#versionNumber' ) . on ( 'keyup' , function ( ) {
8588 MendixGitHubManager . _versionNumber = $ ( '#versionNumber' ) . val ( ) ;
8689 } ) ;
87-
90+
8891 htmlJ . find ( '#nameOfWidget' ) . on ( 'keyup' , function ( ) {
8992 MendixGitHubManager . _nameOfWidget = $ ( '#nameOfWidget' ) . val ( ) ;
9093 } ) ;
91-
94+
9295 htmlJ . find ( '#directoryOfWidget' ) . on ( 'change' , function ( ) {
9396 MendixGitHubManager . _directoryOfWidget = $ ( '#directoryOfWidget' ) . val ( ) ;
9497 } ) ;
9598
99+ htmlJ . find ( '#licenseName' ) . on ( 'change' , function ( ) {
100+ MendixGitHubManager . _licenseName = $ ( '#licenseName' ) . val ( ) ;
101+ } ) ;
102+
103+ htmlJ . find ( '#copyrightName' ) . on ( 'change' , function ( ) {
104+ MendixGitHubManager . _copyrightName = $ ( '#copyrightName' ) . val ( ) ;
105+ } ) ;
106+
107+ htmlJ . find ( '#packageOfWidget' ) . on ( 'change' , function ( ) {
108+ MendixGitHubManager . _packageOfWidget = $ ( '#packageOfWidget' ) . val ( ) ;
109+ } ) ;
110+
96111 htmlJ . find ( '#btnSelectDir' ) . on ( 'click' , function ( ) {
97112
98113 FileSystem . showOpenDialog ( false , true , 'Where to download and save the new Custom Widget?' , null , null , function ( err , path ) {
@@ -121,17 +136,25 @@ define(function (require, exports, module) {
121136 } ) ;
122137 } else {
123138
124- tmpDir = FileSystem . getDirectoryForPath ( MendixGitHubManager . _directoryOfWidget + '/' ) ;
125- tmpDir . getContents ( function ( err , array ) {
126- console . log ( array ) ;
127- if ( array . length > 0 ) {
128- Dialogs . showModalDialog ( null , 'Error' , 'The directory for cloning the "AppStoreWidgetBoilerplate" is not empty.' ) . done ( function ( ) {
129- } ) ;
130- } else {
131- $ ( MendixGitHubManager . _progressBarContainer ) . removeClass ( 'mx-hidden' ) ;
132- MendixGitHubManager . createClone ( ) ;
133- }
134- } ) ;
139+ if ( MendixGitHubManager . _packageOfWidget === '' ) {
140+ Dialogs . showModalDialog ( null , 'Warning' , 'You need to have a packagename for the widget.' ) . done ( function ( ) {
141+ } ) ;
142+ } else {
143+
144+ tmpDir = FileSystem . getDirectoryForPath ( MendixGitHubManager . _directoryOfWidget + '/' + MendixGitHubManager . _packageOfWidget + '/' ) ;
145+ tmpDir . getContents ( function ( err , array ) {
146+ console . log ( array ) ;
147+ if ( array . length > 0 ) {
148+ Dialogs . showModalDialog ( null , 'Error' , 'The directory for cloning the "AppStoreWidgetBoilerplate" is not empty.' ) . done ( function ( ) {
149+ } ) ;
150+ } else {
151+ $ ( MendixGitHubManager . _progressBarContainer ) . removeClass ( 'mx-hidden' ) ;
152+ MendixGitHubManager . createClone ( ) ;
153+ }
154+ } ) ;
155+
156+
157+ }
135158
136159 }
137160 }
@@ -178,13 +201,27 @@ define(function (require, exports, module) {
178201
179202 console . log ( '[mendix.wdpforbrackets-github-repourl]' + ( repoName + '-' + tagName ) . split ( '.' ) . join ( '_' ) + '.zip' ) ;
180203 console . log ( '[mendix.wdpforbrackets-github-repourl]' + repoUrl ) ;
181-
182- var externalIO = ExternalIODomain . exec ( 'getRemoteFile' , repoUrl , MendixGitHubManager . _directoryOfWidget , ( repoName + '-' + tagName ) . split ( '.' ) . join ( '_' ) + '.zip' , MendixGitHubManager . _nameOfWidget , MendixGitHubManager . _authorName , MendixGitHubManager . _versionNumber ) ;
204+ console . log ( '[mendix.wdpforbrackets-github-_nameOfWidget]' + MendixGitHubManager . _nameOfWidget ) ;
205+ console . log ( '[mendix.wdpforbrackets-github-_authorName]' + MendixGitHubManager . _authorName ) ;
206+ console . log ( '[mendix.wdpforbrackets-github-_versionNumber]' + MendixGitHubManager . _versionNumber ) ;
207+ console . log ( '[mendix.wdpforbrackets-github-_copyrightName]' + MendixGitHubManager . _copyrightName ) ;
208+ console . log ( '[mendix.wdpforbrackets-github-_licenseName]' + MendixGitHubManager . _licenseName ) ;
209+ console . log ( '[mendix.wdpforbrackets-github-_packageOfWidget]' + MendixGitHubManager . _packageOfWidget ) ;
210+
211+ var externalIO = ExternalIODomain . exec ( 'getRemoteFile' , repoUrl ,
212+ MendixGitHubManager . _directoryOfWidget ,
213+ ( repoName + '-' + tagName ) . split ( '.' ) . join ( '_' ) + '.zip' ,
214+ MendixGitHubManager . _nameOfWidget ,
215+ MendixGitHubManager . _authorName ,
216+ MendixGitHubManager . _versionNumber ,
217+ MendixGitHubManager . _copyrightName ,
218+ MendixGitHubManager . _licenseName ,
219+ MendixGitHubManager . _packageOfWidget ) ;
183220 externalIO . done ( function ( ) {
184221 MendixGitHubManager . setProgressBar ( 100 ) ;
185222 Dialogs . showModalDialog ( null , 'Information' , 'We succesfully cloned the "AppStoreBoilerplate" to the new Custom Widget: "' + MendixGitHubManager . _nameOfWidget + '".' ) . done ( function ( ) {
186223 MendixGitHubManager . _gitHubDialog . close ( ) ;
187- ProjectManager . openProject ( MendixGitHubManager . _directoryOfWidget + '/src/' ) . done ( function ( ) {
224+ ProjectManager . openProject ( MendixGitHubManager . _directoryOfWidget + '/' + MendixGitHubManager . _packageOfWidget + '/ src/') . done ( function ( ) {
188225 } ) ;
189226 } ) ;
190227 console . log ( '[mendix.wdpforbrackets-github] cloned to ' + repoUrl ) ;
0 commit comments