@@ -114,86 +114,183 @@ exports.printFolder = function (objects, dirnameO, debug, objectInterfaceName, o
114114 tempFiles . splice ( 0 , 1 ) ;
115115 }
116116
117+ var allFilesOn = false ;
118+
117119 for ( var i = 0 ; i < tempFiles . length ; i ++ ) {
118- resText += "<li class='list-group-item'>" +
119- "<div class='row'>" +
120- "<div class='col-xs-4'>" +
121- "<font size='5'>" + tempFiles [ i ] + "</font>" +
122- "</div>" +
123- "<div class='col-xs-8 text-right' style='' >" ;
124-
125- if ( objects . hasOwnProperty ( utilities . readObject ( objectLookup , tempFiles [ i ] ) ) && fs . existsSync ( objectPath + "/" + tempFiles [ i ] + "/target/target.xml" ) ) {
120+ if ( tempFiles [ i ] === "allTargetsPlaceholder" ) {
121+
122+ resText += "<li class='list-group-item'>" +
123+ "<div class='row'>" +
124+ "<div class='col-xs-4'>" +
125+ "<font size='5'>single Targets File</font>" +
126+ "</div>" +
127+ "<div class='col-xs-8 text-right' style='' >" ;
128+
129+ if ( objects . hasOwnProperty ( utilities . readObject ( objectLookup , tempFiles [ i ] ) ) && fs . existsSync ( objectPath + "/" + tempFiles [ i ] + "/target/target.xml" ) ) {
130+ resText +=
131+ "<button class='btn btn-info' onclick=\"window.location.href='/info/" + tempFiles [ i ] + "'\" > Info</button> " ;
132+ } else {
133+ resText +=
134+ "<button style='display: none;' class='btn btn-info' disabled='disabled'>Info</button> " ;
135+ }
136+
137+ resText += "<button style='width:120px; position: relative; right: 262px;' class='pull-right " ;
138+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
139+ resText += "btn btn-success" ;
140+ } else {
141+ resText += "btn btn-primary" ;
142+ }
143+
144+ resText += "' onclick=\"window.location.href='/target/" + tempFiles [ i ] + "'\">Target</button> " +
145+ "<button style='visibility: hidden;' class='" ;
146+
147+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.htm" ) || fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.html" ) ) {
148+
149+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
150+ resText += "btn btn-success" ;
151+ }
152+ else {
153+ resText += "btn btn-warning" ;
154+ }
155+ } else {
156+ resText += "btn btn-primary" ;
157+ }
158+
159+ resText += "' onclick=\"window.location.href='/content/" + tempFiles [ i ] + "'\">Interface</button> " ;
160+
161+ var thisObject = utilities . readObject ( objectLookup , tempFiles [ i ] ) ;
162+
163+ if ( objects . hasOwnProperty ( thisObject ) ) {
164+
165+ if ( objects [ thisObject ] . deactivated !== true ) {
166+ allFilesOn = true ;
167+ resText += " <button style='width:125px; position: relative; right: 13px;' class='btn btn-success pull-right'" ;
168+ resText += "' onclick=\"window.location.href='/object/" + thisObject + "/deactivate/'\">on</button> " ;
169+ }
170+ else {
171+ allFilesOn = false ;
172+ resText += " <button style='width:125px; position: relative; right: 13px;' class='btn btn-warning pull-right'" ;
173+ resText += "' onclick=\"window.location.href='/object/" + thisObject + "/activate/'\">off</button> " ;
174+ }
175+
176+ } else {
177+ resText += " <button style='width:125px; position: relative; right: 13px;' class='btn btn-default pull-right' disabled='disabled'>off</button>" ;
178+ }
179+
126180 resText +=
127- "<button class='btn btn-info' onclick=\"window.location.href='/info/" + tempFiles [ i ] + "'\" > Info</button> " ;
128- } else {
181+
182+ // "</div>"+
183+ // "<div class='col-xs-3'>"+
184+
185+ // " <div>" +
186+ ' <button style="display: none;" class="btn btn-default" onclick="window.location.href=\'/object/' + tempFiles [ i ] + '/zipBackup/\'"' + tempFiles [ i ] + '\'" > ' +
187+
188+ 'Download' +
189+ '</button> ' +
190+ " <form style='display: none; id='delete" + i + "' action='" + objectInterfaceName + "' method='post' style='margin: 0px; padding: 0px'>" +
191+ "<input type='hidden' style='display: none;' name='name' value='" + tempFiles [ i ] + "'>" +
192+ "<input type='hidden' style='display: none;' name='action' value='delete'>" +
193+ " <input type='submit' style='display: none;' class='btn btn-danger' value='X' onclick=\"return confirm('Do you really want to delete the object " + tempFiles [ i ] + "?')\">" +
194+ "</form>" ;
195+
129196 resText +=
130- "<button class='btn btn-info' disabled='disabled'>Info</button> " ;
197+ //" </div>"+
198+ "</div>" +
199+ "</div></li>" ;
200+
131201 }
132202
203+ }
133204
134- resText += "<button class='" ;
135- if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
136- resText += "btn btn-success" ;
137- } else {
138- resText += "btn btn-primary" ;
139- }
205+ resText += "</ul><ul class='list-group'>" ;
140206
207+ for ( var i = 0 ; i < tempFiles . length ; i ++ ) {
141208
142- resText += "' onclick=\"window.location.href='/target/" + tempFiles [ i ] + "'\">Target</button> " +
143- "<button class='" ;
209+ if ( tempFiles [ i ] !== "allTargetsPlaceholder" ) {
144210
145- if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.htm" ) || fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.html" ) ) {
211+ resText += "<li class='list-group-item'>" +
212+ "<div class='row'>" +
213+ "<div class='col-xs-4'>" +
214+ "<font size='5'>" + tempFiles [ i ] + "</font>" +
215+ "</div>" +
216+ "<div class='col-xs-8 text-right' style='' >" ;
146217
147- if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
148- resText += "btn btn-success" ;
149- }
150- else {
151- resText += "btn btn-warning" ;
218+ if ( objects . hasOwnProperty ( utilities . readObject ( objectLookup , tempFiles [ i ] ) ) && fs . existsSync ( objectPath + "/" + tempFiles [ i ] + "/target/target.xml" ) ) {
219+ resText +=
220+ "<button class='btn btn-info' onclick=\"window.location.href='/info/" + tempFiles [ i ] + "'\" > Info</button> " ;
221+ } else {
222+ resText +=
223+ "<button class='btn btn-info' disabled='disabled'>Info</button> " ;
152224 }
153- } else {
154- resText += "btn btn-primary" ;
155- }
156225
157- resText += "' onclick=\"window.location.href='/content/" + tempFiles [ i ] + "'\">Interface</button> " ;
226+ resText += "<button class='" ;
227+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
228+ resText += "btn btn-success'" ;
229+ } else {
230+ resText += "btn btn-primary'" ;
231+ }
158232
159- var thisObject = utilities . readObject ( objectLookup , tempFiles [ i ] ) ;
160233
161- if ( objects . hasOwnProperty ( thisObject ) ) {
162- if ( objects [ thisObject ] . deactivated !== true ) {
163- resText += " <button class='btn btn-success'" ;
164- resText += "' onclick=\"window.location.href='/object/" + thisObject + "/deactivate/'\">on</button> " ;
234+ if ( allFilesOn ) {
235+ // resText += " disabled='disabled'";
165236 }
166- else {
167- resText += " <button class='btn btn-warning'" ;
168- resText += "' onclick=\"window.location.href='/object/" + thisObject + "/activate/'\">off</button> " ;
237+
238+
239+ resText += " onclick=\"window.location.href='/target/" + tempFiles [ i ] + "'\">Target</button> " +
240+ "<button class='" ;
241+
242+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.htm" ) || fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/index.html" ) ) {
243+
244+ if ( fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.dat" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.xml" ) && fs . existsSync ( objectPath + '/' + tempFiles [ i ] + "/target/target.jpg" ) ) {
245+ resText += "btn btn-success" ;
246+ }
247+ else {
248+ resText += "btn btn-warning" ;
249+ }
250+ } else {
251+ resText += "btn btn-primary" ;
169252 }
170253
171- } else {
172- resText += " <button class='btn btn-default' disabled='disabled'>off</button>" ;
173- }
254+ resText += "' onclick=\"window.location.href='/content/" + tempFiles [ i ] + "'\">Interface</button> " ;
255+
256+ var thisObject = utilities . readObject ( objectLookup , tempFiles [ i ] ) ;
174257
175- resText +=
258+ if ( objects . hasOwnProperty ( thisObject ) ) {
259+ if ( objects [ thisObject ] . deactivated !== true ) {
260+ resText += " <button class='btn btn-success'" ;
261+ resText += "' onclick=\"window.location.href='/object/" + thisObject + "/deactivate/'\">on</button> " ;
262+ }
263+ else {
264+ resText += " <button class='btn btn-warning'" ;
265+ resText += "' onclick=\"window.location.href='/object/" + thisObject + "/activate/'\">off</button> " ;
266+ }
176267
177- // "</div>"+
268+ } else {
269+ resText += " <button class='btn btn-default' disabled='disabled'>off</button>" ;
270+ }
271+
272+ resText +=
273+
274+ // "</div>"+
178275 // "<div class='col-xs-3'>"+
179276
180277 // " <div>" +
181- ' <button class="btn btn-default" onclick="window.location.href=\'/object/' + tempFiles [ i ] + '/zipBackup/\'"' + tempFiles [ i ] + '\'" > ' +
278+ ' <button class="btn btn-default" onclick="window.location.href=\'/object/' + tempFiles [ i ] + '/zipBackup/\'"' + tempFiles [ i ] + '\'" > ' +
182279
183- 'Download' +
184- '</button> ' +
185- " <form style='display: inline; background-color: #bde9ba;' id='delete" + i + "' action='" + objectInterfaceName + "' method='post' style='margin: 0px; padding: 0px'>" +
186- "<input type='hidden' name='name' value='" + tempFiles [ i ] + "'>" +
187- "<input type='hidden' name='action' value='delete'>" +
188- " <input type='submit' class='btn btn-danger' value='X' onclick=\"return confirm('Do you really want to delete the object " + tempFiles [ i ] + "?')\">" +
189- "</form>" ;
280+ 'Download' +
281+ '</button> ' +
282+ " <form style='display: inline; background-color: #bde9ba;' id='delete" + i + "' action='" + objectInterfaceName + "' method='post' style='margin: 0px; padding: 0px'>" +
283+ "<input type='hidden' name='name' value='" + tempFiles [ i ] + "'>" +
284+ "<input type='hidden' name='action' value='delete'>" +
285+ " <input type='submit' class='btn btn-danger' value='X' onclick=\"return confirm('Do you really want to delete the object " + tempFiles [ i ] + "?')\">" +
286+ "</form>" ;
190287
191- resText +=
288+ resText +=
192289 //" </div>"+
193- "</div>" +
194- "</div></li>" ;
195-
290+ "</div>" +
291+ "</div></li>" ;
196292
293+ }
197294 }
198295
199296 }
@@ -580,19 +677,40 @@ exports.uploadTargetText = function (parm, objectLookup, objects) {
580677 '<body style="height:100vh; weight: 100%; background-color: #ffffff; background:repeating-linear-gradient(-45deg, #e4f6ff, #e4f6ff 5px, white 5px, white 10px);" >\n' +
581678 '<div class="container" id="container" style="width: 750px;">\n' +
582679 ' <div class="panel panel-primary">\n' +
583- ' <div class="panel-heading">\n' +
584- ' <h3 class="panel-title"><font size="6">Hybrid Object - ' + parm + ' - Target <a href="../" style=" color: #ffffff; text-decoration: underline;">back</a></font></h3>\n' +
680+ ' <div class="panel-heading">\n' ;
681+
682+ if ( parm !== "allTargetsPlaceholder" ) {
683+ text +=
684+ ' <h3 class="panel-title"><font size="6">Hybrid Object - ' + parm + ' - Target <a href="../" style=" color: #ffffff; text-decoration: underline;">back</a></font></h3>\n' ;
685+ } else {
686+ text +=
687+ ' <h3 class="panel-title"><font size="6">Hybrid Object - single Targets File <a href="../" style=" color: #ffffff; text-decoration: underline;">back</a></font></h3>\n' ;
688+ }
689+ text +=
585690 ' </div>\n' +
586691 ' </div>\n' +
587692 ' <div id="actions" class="row">\n' +
588- ' <div class="col-xs-7">\n' +
693+ ' <div class="col-xs-7">\n' ;
694+
695+ if ( parm !== "allTargetsPlaceholder" ) {
696+ text +=
589697 ' <b>1. Upload your target source image (jpg only, < 0.5 MB)</b><br>' +
590- ' 2. Login to the Vuforia Target Manager.<br>' +
591- ' 3. Create a new or open a Device Databases.<br>' +
592- ' 4. Create a target for your Object and name it exactly:<br><b> ' + objectName + '</b><br>' +
593- ' 5. Make sure that only this one Target is Activated.<br>' +
594- ' 6. Download the database and then upload it here:<br>' +
595- ' (You can just drag and drop the files anywhere in the striped area)' +
698+ ' 2. Login to the Vuforia Target Manager.<br>' +
699+ ' 3. Create a new or open a Device Databases.<br>' +
700+ ' 4. Create a target for your Object and name it exactly:<br><b> ' + objectName + '</b><br>' +
701+ ' 5. Make sure that only this one Target is Activated.<br>' +
702+ ' 6. Download the database and then upload it here:<br>' +
703+ ' (You can just drag and drop the files anywhere in the striped area)' ;
704+ } else {
705+ text +=
706+ ' <b>1. Upload a random jpg image (jpg only, < 0.5 MB)</b><br>' +
707+ ' 2. Login to the Vuforia Target Manager.<br>' +
708+ ' 3. Download a device database that includes all targets generated for your objects.<br>' +
709+ ' 6. Download the database and then upload it here:<br>' +
710+ ' (You can just drag and drop the files anywhere in the striped area)' ;
711+ }
712+
713+ text +=
596714 ' </div>' +
597715 ' <div class="col-xs-5">' +
598716 ' ' +
0 commit comments