home.php 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of 5 Cube.
  6. *
  7. * 5 Cube is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * 5 Cube is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * 5 Cube home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $curLocale = APP_LOCALE;
  28. $password = filter_input(INPUT_POST, "Password");
  29. if ($password==PHP_STR) {
  30. $password = filter_input(INPUT_POST, "Password2");
  31. }
  32. if ($password !== PHP_STR) {
  33. $hash = hash("sha256", $password . APP_SALT, false);
  34. if ($hash !== APP_HASH) {
  35. $password=PHP_STR;
  36. }
  37. }
  38. if ($password != PHP_STR): ?>
  39. <script>
  40. password = 1;
  41. </script>
  42. <?PHP else: ?>
  43. <script>
  44. password = 0;
  45. </script>
  46. <?PHP endif ?>
  47. <!DOCTYPE html>
  48. <head>
  49. <meta charset="UTF-8"/>
  50. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  51. <!--
  52. Copyright 2021, 2024 5 Mode
  53. This file is part of 5 Cube.
  54. 5 Cube is free software: you can redistribute it and/or modify
  55. it under the terms of the GNU General Public License as published by
  56. the Free Software Foundation, either version 3 of the License, or
  57. (at your option) any later version.
  58. 5 Cube is distributed in the hope that it will be useful,
  59. but WITHOUT ANY WARRANTY; without even the implied warranty of
  60. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  61. GNU General Public License for more details.
  62. You should have received a copy of the GNU General Public License
  63. along with 5 Cube. If not, see <https://www.gnu.org/licenses/>.
  64. -->
  65. <title>5 Cube: 1 cube, all your info..</title>
  66. <link rel="shortcut icon" href="/favicon.ico?v=<?php echo(time()); ?>" />
  67. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  68. <meta name="author" content="5 Mode"/>
  69. <meta name="robots" content="noindex"/>
  70. <script src="/js/jquery-3.1.0.min.js" type="text/javascript"></script>
  71. <script src="/js/common.js" type="text/javascript"></script>
  72. <script src="/js/bootstrap.min.js" type="text/javascript"></script>
  73. <script src="/js/sha.js" type="text/javascript"></script>
  74. <script src="/js/serialize-javascript.js" type="text/javascript"></script>
  75. <script src="/js/home.js?v=<?php echo(time()); ?>" type="text/javascript" defer></script>
  76. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  77. <link href="/css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  78. <script>
  79. /*
  80. * CUBE CODE
  81. */
  82. var cubes = []; // Cube array
  83. var curcube; // Current cube
  84. var _selectedcube = 0; // Selected cube
  85. var totcubes = 0;
  86. /*
  87. * myCube Class
  88. *
  89. * @param string myname Current name of the cube
  90. * @param array mymap Face map
  91. * @param string myformalName Formal name of the cube
  92. * @returns myCube
  93. */
  94. function myCube(myname, myformalName) {
  95. // Examples of cube moves:
  96. // 0, 0, 1, 0, 0
  97. // 0, 0, 5, 0, 0 hcur = [3, 4]
  98. // 1, 2, 3, 4, 1 vcur = [3, 5] shift(hlist[1,4]); set jolly = hlist[4];
  99. // 0, 0, 6, 0, 0 jolly = 1
  100. // 0, 0, 1, 0, 0
  101. // 1 turn 1 face up
  102. // 0, 0, 5, 0, 0
  103. // 0, 0, 3, 0, 0 hcur = [6, 4]
  104. // 5, 2, 6, 4, 5 vcur = [6, 3] shift(vlist[1,4]); set jolly = vlist[4];
  105. // 0, 0, 1, 0, 0 jolly = 5
  106. // 0, 0, 5, 0, 0
  107. // 1 turn 1 face left
  108. // 0, 0, 4, 0, 0
  109. // 0, 0, 5, 0, 0 hcur = [2, 3]
  110. // 4, 1, 2, 3, 4 vcur = [2, 5] shift(hlist[1,4]); set jolly = hlist[4];
  111. // 0, 0, 6, 0, 0 jolly = 4
  112. // 0, 0, 4, 0, 0
  113. // 1 turn 1 face left
  114. // 0, 0, 3, 0, 0
  115. // 0, 0, 5, 0, 0 hcur = [1, 2]
  116. // 3, 4, 1, 2, 3 vcur = [1, 5] shift(hlist[1,4]); set jolly = hlist[4];
  117. // 0, 0, 6, 0, 0 jolly = 3
  118. // 0, 0, 3, 0, 0
  119. // 1 turn 1 face rght
  120. // 0, 0, 4, 0, 0
  121. // 0, 0, 5, 0, 0 hcur = [1, 2]
  122. // 4, 1, 2, 3, 4 vcur = [1, 5] shift(hlist[1,4]); set jolly = hlist[4];
  123. // 0, 0, 6, 0, 0 jolly = 3
  124. // 0, 0, 4, 0, 0
  125. // Properties
  126. this.name = myname;
  127. this.map = ["Address", "Contacts", "Other Info", "Menu", "Pictures", "Password"];
  128. this.formalName = myformalName;
  129. this.guid = "";
  130. this.password = "";
  131. this.xml = "";
  132. this.hcube = [0,1,2,3,0];
  133. this.vcube = [0,5,2,4,0];
  134. this.hlist = [1,2,3,0];
  135. this.vlist = [5,2,4,0];
  136. this.jolly = 0;
  137. this.hcur = [this.hcube[2], this.hcube[3]];
  138. this.vcur = [this.vcube[2], this.vcube[3]];
  139. // Methods
  140. this.turnLeft = myturnLeft;
  141. this.turnRight = myturnRight;
  142. this.turnUp = myturnUp;
  143. this.turnDown = myturnDown;
  144. this.getFace = mygetFace;
  145. this.gethcube = mygethcube;
  146. this.getvcube = mygetvcube;
  147. this.gethcur = mygethcur;
  148. this.getvcur = mygetvcur;
  149. this.getname = mygetname;
  150. this.getguid = mygetguid;
  151. this.getpassword = mygetpassword;
  152. this.getxml = mygetxml;
  153. this.savedata = mysavedata;
  154. this.start = mystart;
  155. // -- Methods End
  156. /*
  157. * Execute horizontal / vertical movement of the cube
  158. *
  159. * @param char Update direction
  160. * @returns void
  161. */
  162. function _updateCube(tthis, upddir) {
  163. if (upddir=='h') {
  164. tthis.hcube[0] = tthis.jolly;
  165. for(i=1;i<=tthis.hlist.length;i++) {
  166. tthis.hcube[i] = tthis.hlist[i-1];
  167. }
  168. tthis.vcube[2] = tthis.hcube[2];
  169. tthis.vcube[0] = tthis.jolly;
  170. tthis.vcube[4] = tthis.jolly;
  171. } else {
  172. tthis.vcube[0] = tthis.jolly;
  173. for(i=1;i<=tthis.vlist.length;i++) {
  174. tthis.vcube[i] = tthis.vlist[i-1];
  175. }
  176. tthis.hcube[2] = tthis.vcube[2];
  177. tthis.hcube[0] = tthis.jolly;
  178. tthis.hcube[4] = tthis.jolly;
  179. }
  180. tthis.hcur = [tthis.hcube[2], tthis.hcube[3]];
  181. tthis.vcur = [tthis.vcube[2], tthis.vcube[3]];
  182. }
  183. /*
  184. * Move the current cube to the left
  185. *
  186. * @returns void
  187. */
  188. function myturnLeft() {
  189. var newhlist = [];
  190. newfirst = this.hlist.pop();
  191. newhlist[0] = newfirst;
  192. newhlist[1] = this.hlist[0];
  193. newhlist[2] = this.hlist[1];
  194. newhlist[3] = this.hlist[2];
  195. this.hlist = newhlist;
  196. this.jolly = this.hlist[3];
  197. // Save the horizzontal movement..
  198. _updateCube(this, 'h');
  199. }
  200. /*
  201. * Move the current cube to the right
  202. *
  203. * @returns void
  204. */
  205. function myturnRight() {
  206. var newhlist = [];
  207. newlast = this.hlist.shift();
  208. newhlist[0] = this.hlist[0];
  209. newhlist[1] = this.hlist[1];
  210. newhlist[2] = this.hlist[2];
  211. newhlist[3] = newlast;
  212. this.hlist = newhlist;
  213. this.jolly = this.hlist[3];
  214. // Save the horizzontal movement..
  215. _updateCube(this, 'h');
  216. }
  217. /*
  218. * Move the current cube upward
  219. *
  220. * @returns void
  221. */
  222. function myturnUp() {
  223. var newvlist = [];
  224. newfirst = this.vlist.pop();
  225. newvlist[0] = newfirst;
  226. newvlist[1] = this.vlist[0];
  227. newvlist[2] = this.vlist[1];
  228. newvlist[3] = this.vlist[2];
  229. this.vlist = newvlist;
  230. this.jolly = this.vlist[3];
  231. // Save the vertical movement..
  232. _updateCube(this, 'v');
  233. }
  234. /*
  235. * Move the current cube downward
  236. *
  237. * @returns void
  238. */
  239. function myturnDown() {
  240. var newvlist = [];
  241. newlast = this.vlist.shift();
  242. newvlist[0] = this.vlist[0];
  243. newvlist[1] = this.vlist[1];
  244. newvlist[2] = this.vlist[2];
  245. newvlist[3] = newlast;
  246. this.vlist = newvlist;
  247. this.jolly = this.vlist[3];
  248. // Save the vertical movement..
  249. _updateCube(this, 'v');
  250. }
  251. /*
  252. * Get the cube face associated to the given coordinates [v0|v1|h0|h1]
  253. *
  254. * @returns string
  255. */
  256. function mygetFace(iface) {
  257. // v0 = front
  258. // v1 = up
  259. // h0 = front
  260. // h2 = right
  261. switch (iface) {
  262. case "h0":
  263. return this.map[this.hcur[0]];
  264. break;
  265. case "h1":
  266. return this.map[this.hcur[1]];
  267. break;
  268. case "v0":
  269. return this.map[this.vcur[0]];
  270. break;
  271. case "v1":
  272. return this.map[this.vcur[1]];
  273. break;
  274. }
  275. }
  276. /*
  277. * Expose the current horizontal list of the cube, for debug purpose
  278. *
  279. * @returns string
  280. */
  281. function mygethcube() {
  282. return this.hcube.toString();
  283. }
  284. /*
  285. * Expose the current vertical list of the cube, for debug purpose
  286. *
  287. * @returns string
  288. */
  289. function mygetvcube() {
  290. return this.vcube.toString();
  291. }
  292. /*
  293. * Expose the current horizontal position of the cube, for debug purpose
  294. *
  295. * @returns string
  296. */
  297. function mygethcur() {
  298. return this.hcur.toString();
  299. }
  300. /*
  301. * Expose the current vertical position of the cube, for debug purpose
  302. *
  303. * @returns string
  304. */
  305. function mygetvcur() {
  306. return this.vcur.toString();
  307. }
  308. /*
  309. * Get the cube name
  310. *
  311. * @returns string
  312. */
  313. function mygetname() {
  314. return this.name;
  315. }
  316. /*
  317. * Save the cube data locally
  318. *
  319. * @returns void
  320. */
  321. function mysavedata() {
  322. //fileName = myformalName;
  323. var ffileName = this.formalName;
  324. var xxml = this.xml;
  325. $.ajax({
  326. method: "POST",
  327. async: false,
  328. url: "/putxml",
  329. dataType: "json",
  330. jsonp: false,
  331. data: {
  332. f: ffileName,
  333. xml: xxml
  334. },
  335. success: function( data ) {
  336. // Handle 'no match' indicated by [ "" ] response
  337. //response( data.length === 1 && data[0].length === 0 ? [] : data );
  338. if (data.length < 1 || data.length === 1) {
  339. alert("An error happened saving the data (#1)!");
  340. } else if (data.length === 2 && data[0] === 200) {
  341. //alert("Data saved successfully!");
  342. } else {
  343. alert("An error happened saving the data (#2)!");
  344. //alert(data[0]);
  345. //alert(data[1]);
  346. //alert(data[2]);
  347. //alert(data[3]);
  348. //alert(data[4]);
  349. }
  350. },
  351. error: function (responseData, textStatus, errorThrown) {
  352. alert("POST failed: " + errorThrown + " data: " + responseData.responseText);
  353. }
  354. });
  355. }
  356. /*
  357. * Cube init procedure:
  358. * - read the xml data associated with the cube
  359. *
  360. * @returns void
  361. */
  362. function mystart() {
  363. bConnectionOK = false;
  364. var xhttp = new XMLHttpRequest();
  365. var xmluri = "http://<?PHP echo(APP_HOST);?>/getxml?f=" + this.formalName;
  366. //alert(xmluri);
  367. xhttp.open("GET", xmluri, true);
  368. xhttp.send();
  369. xhttp.onreadystatechange = function () {
  370. if (this.readyState == 4 && this.status == 200) {
  371. bConnectionOK = true;
  372. cubes[parseInt(myformalName.substr(4))-1].xml = this.responseText;
  373. //$("#_read_xml_" + myformalName).val(xml);
  374. //alert(this.responseText);
  375. re = new RegExp("\<guid\>(.*)\<\/guid\>", "igsu");
  376. a = re.exec(this.responseText);
  377. if (!a || a.length===0) {
  378. document.write("Data access error (#2)<br><br>");
  379. return;
  380. } else {
  381. //alert(a);
  382. cubes[parseInt(myformalName.substr(4))-1].guid = a[1];
  383. //alert(cubes[parseInt(myformalName.substr(4))-1].guid);
  384. }
  385. re = new RegExp("\<password\>(.*)\<\/password\>", "igsu");
  386. a = re.exec(this.responseText);
  387. if (!a || a.length===0) {
  388. document.write("Data access error (#3)<br><br>");
  389. return;
  390. } else {
  391. //alert(a);
  392. cubes[parseInt(myformalName.substr(4))-1].password = a[1];
  393. //alert(cubes[parseInt(myformalName.substr(4))-1].guid);
  394. }
  395. } else {
  396. if ((this.readyState == 4 && this.status == 0) && (!bConnectionOK)) {
  397. document.write("Data access error (#1)<br><br>");
  398. }
  399. }
  400. }
  401. }
  402. /*
  403. * Get the guid of the cube
  404. *
  405. * @returns string
  406. */
  407. function mygetguid() {
  408. return this.guid;
  409. }
  410. /*
  411. * Get the editor password of the cube
  412. *
  413. * @returns string
  414. */
  415. function mygetpassword() {
  416. return this.password;
  417. }
  418. /*
  419. * Get the xml data associated with the cube
  420. *
  421. * @returns string
  422. */
  423. function mygetxml() {
  424. return this.xml;
  425. }
  426. }
  427. // -- End myCube class
  428. /*
  429. * Select a cube
  430. *
  431. * @param <interfaceEl> tthis selected cube
  432. * @returns void
  433. */
  434. function _selCube(tthis) {
  435. //alert($(tthis).attr("order"));
  436. var _cubeorder = parseInt($(tthis).attr("order"));
  437. _selectedcube = _cubeorder-1;
  438. curcube = cubes[_selectedcube];
  439. // Debug info..
  440. $("#curcube").val(curcube.getname());
  441. //alert("curcube="+_selectedcube);
  442. }
  443. /*
  444. function _fetchData() {
  445. data1_exists = $("#_read_xml_cube1").val() !== "";
  446. data2_exists = $("#_read_xml_cube2").val() !== "";
  447. data3_exists = $("#_read_xml_cube3").val() !== "";
  448. data4_exists = true;
  449. data5_exists = true;
  450. //data4_exists = $("#_read_xml_cube4").val() !== "";
  451. //data5_exists = $("#_read_xml_cube5").val() !== "";
  452. if (data1_exists &&
  453. data2_exists &&
  454. data3_exists &&
  455. data4_exists &&
  456. data5_exists ) {
  457. cubes[0].xml = $("#_read_xml_cube1").val();
  458. cubes[1].xml = $("#_read_xml_cube2").val();
  459. cubes[2].xml = $("#_read_xml_cube3").val();
  460. cubes[3].xml = $("#_read_xml_cube4").val();
  461. cubes[4].xml = $("#_read_xml_cube5").val();
  462. clearInterval(fetchDataIntervalId);
  463. } else {
  464. fetchDataIntervalId = setInterval("_fetchData()", 2000);
  465. }
  466. }*/
  467. // -- End CUBE CODE
  468. </script>
  469. <script>
  470. /*
  471. * Interaction / Interface code
  472. */
  473. timeoutId=0;
  474. var oldtthis; // Old cube
  475. var lineOldVal = ""; // Old value for a detail line
  476. var lineNewVal = ""; // New value for a detail line
  477. var dataChanged = false;
  478. /*
  479. function zoominCube_old(tthis) {
  480. $(tthis).css("width","396px");
  481. $(tthis).css("height","477px");
  482. $(tthis).css("margin","0px");
  483. }
  484. function zoomoffCube_old(tthis) {
  485. $(tthis).css("width","130px");
  486. $(tthis).css("height","159px");
  487. $(tthis).css("margin","50px");
  488. }
  489. /*
  490. /*
  491. * Select the given cube
  492. *
  493. * @param <interfaceEl> selected cube
  494. * @returns void
  495. */
  496. function selCube(tthis) {
  497. if (password === 1) {
  498. _selCube(tthis);
  499. // Clean the old selected..
  500. $(oldtthis).css("color","#d4b0dc");
  501. $(oldtthis).css("text-decoration","none");
  502. oldtthis = tthis;
  503. // Decore the selected one..
  504. $(tthis).css("color","#bd006e");
  505. $(tthis).css("text-decoration","underline");
  506. $("#cubezvname").html(curcube.getname());
  507. // Reset the detail view
  508. $("#detailtitle").html("");
  509. $("#detaildata").html("");
  510. $("#datadetail").hide();
  511. // Update ZOOMED VIEW interface..
  512. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  513. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  514. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  515. $("#face1").attr("target", curcube.getFace('h0'));
  516. $("#face2").attr("target", curcube.getFace('v1'));
  517. $("#face3").attr("target", curcube.getFace('h1'));
  518. clearTimeout(timeoutId);
  519. // Update body background..
  520. $(document.body).css("background","url('../res/bg.jpg')");
  521. $(document.body).css("background-size","cover");
  522. // Display ZOOMED VIEW interface and controls
  523. $("#cubeList").css("width", "700px");
  524. $("#cubectrls").show();
  525. $("#zoomedview").show();
  526. $("#cubelinks").show();
  527. }
  528. }
  529. /*
  530. * Turn the current cube to the left
  531. *
  532. * @returns void
  533. */
  534. function turnLeft() {
  535. curcube.turnLeft();
  536. // Update ZOOMED VIEW interface..
  537. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  538. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  539. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  540. $("#face1").attr("target", curcube.getFace('h0'));
  541. $("#face2").attr("target", curcube.getFace('v1'));
  542. $("#face3").attr("target", curcube.getFace('h1'));
  543. // Display the debug info..
  544. visInfo();
  545. }
  546. /*
  547. * Turn the current cube to the right
  548. *
  549. * @returns void
  550. */
  551. function turnRight() {
  552. curcube.turnRight();
  553. // Update ZOOMED VIEW interface..
  554. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  555. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  556. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  557. $("#face1").attr("target", curcube.getFace('h0'));
  558. $("#face2").attr("target", curcube.getFace('v1'));
  559. $("#face3").attr("target", curcube.getFace('h1'));
  560. // Display the debug info..
  561. visInfo();
  562. }
  563. /*
  564. * Turn the current cube to upward
  565. *
  566. * @returns void
  567. */
  568. function turnUp() {
  569. curcube.turnUp();
  570. // Update ZOOMED VIEW interface..
  571. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  572. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  573. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  574. $("#face1").attr("target", curcube.getFace('h0'));
  575. $("#face2").attr("target", curcube.getFace('v1'));
  576. $("#face3").attr("target", curcube.getFace('h1'));
  577. // Display the debug info..
  578. visInfo();
  579. }
  580. /*
  581. * Turn the current cube to downward
  582. *
  583. * @returns void
  584. */
  585. function turnDown() {
  586. curcube.turnDown();
  587. // Update ZOOMED VIEW interface..
  588. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  589. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  590. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  591. $("#face1").attr("target", curcube.getFace('h0'));
  592. $("#face2").attr("target", curcube.getFace('v1'));
  593. $("#face3").attr("target", curcube.getFace('h1'));
  594. // Display the debug info..
  595. visInfo();
  596. }
  597. /*
  598. * Hide the ZOOMED VIEW
  599. *
  600. * @returns void
  601. */
  602. function hideZoomedview() {
  603. // Clean the old selected..
  604. $(oldtthis).css("color","#d4b0dc");
  605. $(oldtthis).css("text-decoration","none");
  606. oldtthis = null;
  607. // Reset the detail view
  608. $("#detailtitle").html("");
  609. $("#detaildata").html("");
  610. $("#datadetail").hide();
  611. // Hide ZOOMED VIEW interface and controls
  612. $("#cubeList").css("width", "100%");
  613. $("#cubelinks").hide();
  614. $("#zoomedview").hide();
  615. $("#cubectrls").hide();
  616. // Reset body background..
  617. $(document.body).css("background","#0d0d0d");
  618. }
  619. /*
  620. * Mouse over handle for ZOOMED VIEW
  621. *
  622. * @returns void
  623. */
  624. function zoomviewOver() {
  625. clearTimeout(timeoutId);
  626. }
  627. /*
  628. * Mouse out handle for ZOOMED VIEW
  629. *
  630. * @returns void
  631. */
  632. function zoomviewOut() {
  633. timeoutId = setTimeout(hideZoomedview,1500);
  634. }
  635. /*
  636. * Display the debug info
  637. *
  638. * @returns void
  639. */
  640. function visInfo() {
  641. $("#hcube").val(curcube.gethcube());
  642. $("#vcube").val(curcube.getvcube());
  643. $("#hcur").val(curcube.gethcur());
  644. $("#vcur").val(curcube.getvcur());
  645. $("#curcube").val(curcube.getname());
  646. }
  647. /*
  648. function eachNode(rootNode, callback) {
  649. if (!callback) {
  650. const nodes = []
  651. eachNode(rootNode, function(node) {
  652. nodes.push(node.nodeName)
  653. //nodes.push(node)
  654. })
  655. return nodes
  656. }
  657. if (false === callback(rootNode)) {
  658. return false
  659. }
  660. if (rootNode.hasChildNodes()) {
  661. const nodes = rootNode.childNodes
  662. for (let i = 0, l = nodes.length; i < l; ++i) {
  663. if (false === eachNode(nodes[i], callback)) {
  664. return
  665. }
  666. }
  667. }
  668. }
  669. */
  670. /*
  671. * Get the data for the given detail / face
  672. *
  673. * @param string xmlStr, the current cube xml data
  674. * @param string detail, the requested detail
  675. * @returns string, the detail data
  676. */
  677. function getDetailData(xmlStr, detail) {
  678. var ret = "";
  679. var re;
  680. detail = detail.toLowerCase();
  681. xmlStr = xmlStr.replace('<?xml version="1.0" encoding="UTF-8"?>',"");
  682. xmlStr = xmlStr.replace('<details>',"");
  683. xmlStr = xmlStr.replace('</details>',"");
  684. xmlStr = xmlStr.replaceAll('\n',"");
  685. xmlStr = xmlStr.replaceAll(String.fromCharCode(9), "");
  686. xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "");
  687. xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "");
  688. xmlStr = xmlStr.replaceAll(" ", "");
  689. xmlStr = xmlStr.replaceAll(" ", "");
  690. xmlStr = escape(xmlStr);
  691. xmlStr = xmlStr.replaceAll("%0A", "");
  692. xmlStr = xmlStr.replaceAll("%20%20%20%20%20", "");
  693. xmlStr = xmlStr.replaceAll("%20%20%20%20%", "");
  694. xmlStr = xmlStr.replaceAll("%20%20%", "");
  695. //xmlStr = unescape(xmlStr);
  696. //alert(xmlStr);
  697. switch (detail) {
  698. case "address":
  699. re = new RegExp("detail%20face%3D%22address%22.+/country", "igsu");
  700. break;
  701. case "contacts":
  702. re = new RegExp("detail%20face%3D%22contacts%22.+/cell", "igsu");
  703. break;
  704. case "other info":
  705. re = new RegExp("detail%20face%3D%22other%20info%22.+/description", "igsu");
  706. break;
  707. case "menu":
  708. re = new RegExp("detail%20face%3D%22menu%22.+/menu3", "igsu");
  709. break;
  710. case "pictures":
  711. re = new RegExp("detail%20face%3D%22pictures%22.+/pic5", "igsu");
  712. break;
  713. case "password":
  714. re = new RegExp("detail%20face%3D%22password%22.+/password", "igsu");
  715. break;
  716. }
  717. s = re.exec(xmlStr);
  718. if (!s || s.length===0) {
  719. ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error! #1";
  720. return ret;
  721. }
  722. xmlStr = s[0];
  723. xmlStr = "<"+xmlStr+"></detail>";
  724. xmlStr = unescape(xmlStr);
  725. //alert(xmlStr);
  726. const parser = new DOMParser();
  727. const doc = parser.parseFromString(xmlStr, "text/xml");
  728. x = doc.getElementsByTagName("detail");
  729. if (x.length===0) {
  730. ret = "Error! #2";
  731. return ret;
  732. }
  733. ret += "<div style='padding:10px'>";
  734. for (i = 0; i < x[0].childNodes.length; i++) {
  735. if (x[0].childNodes[i].nodeType === 1) {
  736. if (x[0].childNodes[i].getAttributeNode("type")) {
  737. mytype = x[0].childNodes[i].getAttributeNode("type");
  738. if (mytype.value==="pic") {
  739. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' placeholder='https://' onkeyup='storePicData(this)'></div>";
  740. } else {
  741. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)'></div>";
  742. }
  743. } else {
  744. if (x[0].childNodes[i].nodeName === "business-type") {
  745. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)' style='color:green' readonly></div>";
  746. } else if (x[0].childNodes[i].nodeName === "guid") {
  747. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)' style='color:green' readonly></div>";
  748. } else if (x[0].childNodes[i].nodeName === "password") {
  749. if (password===1) {
  750. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)' style='color:green' readonly></div>";
  751. }
  752. } else if (x[0].childNodes[i].nodeName === "city-zip-prov") {
  753. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)' style='color:green' readonly></div>";
  754. } else if (x[0].childNodes[i].nodeName === "country") {
  755. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)' style='color:green' readonly></div>";
  756. } else {
  757. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' onkeyup='storeData(this)'></div>";
  758. }
  759. }
  760. }
  761. }
  762. if ((detail==="pictures") || (detail==="menu")) {
  763. ret += "<div style='padding-left:80px;clear:both;'><br>you can use eg. Goolge Drive or Microsoft OneDrive to host your pictures.</div>"
  764. }
  765. ret += "</div>";
  766. return ret;
  767. }
  768. /*
  769. * Store the old data of the text control
  770. *
  771. * @param {InterfaceEl} tthis, the text control under editing
  772. * @returns void
  773. */
  774. /*function storeOldData(tthis) {
  775. //alert("keypress");
  776. lineOldVal = $(tthis).val();
  777. }*/
  778. /*
  779. * Store in the cube object the new data of the text control
  780. *
  781. * @param {InterfaceEl} tthis, the text control under editing
  782. * @returns void
  783. */
  784. function storeData(tthis) {
  785. //alert("keyup");
  786. lineNewVal = $(tthis).val();
  787. //alert(lineNewVal);
  788. nodeName = tthis.id;
  789. nodeName = nodeName.replace("cube-detail-","");
  790. //alert(nodeName);
  791. xmlStr = curcube.getxml();
  792. //$("#log").html($("#log").html() + "old=" + "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs" + "\n");
  793. //$("#log").html($("#log").html() + "new=" + lineNewVal + "\n");
  794. //alert("<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  795. //re = "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs";
  796. switch (nodeName) {
  797. case "name":
  798. re = /(\<name>).*(\<\/name>)/gs;
  799. break;
  800. case "address-line1":
  801. re = /(\<address-line1>).*(\<\/address-line1>)/gs;
  802. break;
  803. case "address-line2":
  804. re = /(\<address-line2>).*(\<\/address-line2>)/gs;
  805. break;
  806. case "address-line3":
  807. re = /(\<address-line3>).*(\<\/address-line3>)/gs;
  808. break;
  809. case "city-zip-prov":
  810. re = /(\<city-zip-prov>).*(\<\/city-zip-prov>)/gs;
  811. break;
  812. case "country":
  813. re = /(\<country>).*(\<\/country>)/gs;
  814. break;
  815. case "tel":
  816. re = /(\<tel>).*(\<\/tel>)/gs;
  817. break;
  818. case "fax":
  819. re = /(\<fax>).*(\<\/fax>)/gs;
  820. break;
  821. case "cell":
  822. re = /(\<cell>).*(\<\/cell>)/gs;
  823. break;
  824. case "description":
  825. re = /(\<description>).*(\<\/description>)/gs;
  826. break;
  827. }
  828. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2");
  829. //xmlStr = xmlStr.replace("<" + nodeName + ">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  830. //alert(xmlStr);
  831. curcube.xml = xmlStr;
  832. dataChanged = true;
  833. }
  834. /*
  835. * Store in the cube object the new pic data
  836. *
  837. * @param {InterfaceEl} tthis, the text control under editing
  838. * @returns void
  839. */
  840. function storePicData(tthis) {
  841. //alert("keyup");
  842. lineNewVal = $(tthis).val();
  843. nodeName = tthis.id;
  844. nodeName = nodeName.replace("cube-detail-","");
  845. //alert(nodeName);
  846. xmlStr = curcube.getxml();
  847. switch (nodeName) {
  848. case "menu1":
  849. re = /(\<menu1\stype\=\"pic\">).*(\<\/menu1>)/gs;
  850. break;
  851. case "menu2":
  852. re = /(\<menu2\stype\=\"pic\">).*(\<\/menu2>)/gs;
  853. break;
  854. case "menu3":
  855. re = /(\<menu3\stype\=\"pic\">).*(\<\/menu3>)/gs;
  856. break;
  857. case "pic1":
  858. re = /(\<pic1\stype\=\"pic\">).*(\<\/pic1>)/gs;
  859. break;
  860. case "pic2":
  861. re = /(\<pic2\stype\=\"pic\">).*(\<\/pic2>)/gs;
  862. break;
  863. case "pic3":
  864. re = /(\<pic3\stype\=\"pic\">).*(\<\/pic3>)/gs;
  865. break;
  866. case "pic4":
  867. re = /(\<pic4\stype\=\"pic\">).*(\<\/pic4>)/gs;
  868. break;
  869. case "pic5":
  870. re = /(\<pic5\stype\=\"pic\">).*(\<\/pic5>)/gs;
  871. break;
  872. }
  873. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2")
  874. //xmlStr = xmlStr.replace("<" + nodeName + " type=\"pic\">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + " type=\"pic\">" + lineNewVal + "</" + nodeName + ">");
  875. //alert(xmlStr);
  876. curcube.xml = xmlStr;
  877. dataChanged = true;
  878. }
  879. function _saveData() {
  880. if (dataChanged) {
  881. curcube.savedata();
  882. //saveData();
  883. dataChanged = false;
  884. }
  885. }
  886. setInterval("_saveData()", 1500);
  887. /*
  888. * Display the given data detail
  889. *
  890. * @param <interfaceEl> selected cube
  891. * @returns void
  892. */
  893. function openDetail(tthis) {
  894. myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  895. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  896. $("#detaildata").html(myhtml);
  897. $("#datadetail").show();
  898. //alert(curcube.getxml());
  899. }
  900. // -- End Interaction / Interface code
  901. </script>
  902. <script>
  903. /*
  904. * Boot app code
  905. */
  906. //var fetchDataIntervalId;
  907. /*
  908. * App starting proc
  909. *
  910. * @returns void
  911. */
  912. function startApp() {
  913. // Init document background..
  914. //$(document.body).css("background","#0d0d0d");
  915. // Cubes initialization..
  916. //mymap = ["Address", "Contacts", "Other Info", "Menu", "Pictures", "Password"];
  917. //cubes[0] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#1", mymap, "cube1");
  918. //cubes[0].start();
  919. //cubes[1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#2", mymap, "cube2");
  920. //cubes[1].start();
  921. //cubes[2] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#3", mymap, "cube3");
  922. //cubes[2].start();
  923. //cubes[3] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#4", mymap, "cube4");
  924. //cubes[3].start();
  925. //cubes[4] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#5", mymap, "cube5");
  926. //cubes[4].start();
  927. <?php
  928. chdir(APP_DATA_PATH);
  929. foreach (glob("*.xml") as $filename) { ?>
  930. i = parseInt("<?php echo(substr(substr($filename, 0, strlen($filename)-4),4));?>");
  931. $("#cubeList").html($("#cubeList").html()+"<div id='cube" + i + "' class='cube' order='" + i + "' onclick='selCube(this)' draggable='true' ondragstart='onDragStart(this, event);' onmouseover='onMouseOver();'><div id='cube" + i + "name' class='cubename'>cube#" + i + "</div></div>");
  932. $("#cube" + i + "name").html("<?PHP echo(BUSINESS_TYPE)?>#" + i);
  933. if (i<10) {
  934. newFormalName = "cube" + "00" + i;
  935. } else if (i<100) {
  936. newFormalName = "cube" + "0" + i;
  937. } else {
  938. newFormalName = "cube" + i;
  939. }
  940. cubes[i-1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#" + i, newFormalName);
  941. cubes[i-1].start();
  942. totcubes = i;
  943. <?php
  944. }
  945. ?>
  946. //$("#cube1name").html(cubes[0].getname());
  947. //$("#cube2name").html(cubes[1].getname());
  948. //$("#cube3name").html(cubes[2].getname());
  949. //$("#cube4name").html(cubes[3].getname());
  950. //$("#cube5name").html(cubes[4].getname());
  951. $("#cubeList").show();
  952. if (password===1) {
  953. ///$("#cubeList").show();
  954. //$("#datadetail").show();
  955. //$("#debugdisplay").show();
  956. //alert(cubes.length);
  957. //$("#passworddisplay").hide();
  958. }
  959. $("#vplayer").get(0).pause();
  960. $("#HCsplash").css("display","none");
  961. //fetchDataIntervalId = setInterval("_fetchData()", 2000);
  962. }
  963. /*
  964. * call to startApp
  965. *
  966. * @returns void
  967. */
  968. function _startApp() {
  969. setTimeout("startApp()", 1000);
  970. }
  971. /*
  972. * Set the elements position
  973. */
  974. function setContentPos() {
  975. mytop = parseInt((window.innerHeight - $("#cubectrls").height()) / 2);
  976. mytop = mytop + parseInt($("#cubectrls").height() / 4);
  977. myleft = parseInt((window.innerWidth - $("#cubectrls").width()) / 2);
  978. myleft = myleft + parseInt($("#cubectrls").width() / 5);
  979. $("#cubectrls").css("top", mytop+"px");
  980. $("#cubectrls").css("left", (myleft+40)+"px");
  981. mytop = parseInt((window.innerHeight - $("#zoomedview").height()) / 2);
  982. myleft = parseInt((window.innerWidth - $("#zoomedview").width()) / 2);
  983. $("#zoomedview").css("top", mytop+"px");
  984. $("#zoomedview").css("left", (myleft+40)+"px");
  985. mytop = parseInt((window.innerHeight - $("#cubelinks").height()) / 2);
  986. myleft = parseInt((window.innerWidth - $("#cubelinks").width()) / 2);
  987. $("#cubelinks").css("top", (mytop-170)+"px");
  988. $("#cubelinks").css("left", (myleft+240)+"px");
  989. }
  990. window.addEventListener("load", function() {
  991. //Resetting secrets..
  992. //$("#_read_xml_cube1").val("");
  993. //$("#_read_xml_cube2").val("");
  994. //$("#_read_xml_cube3").val("");
  995. //$("#_read_xml_cube4").val("");
  996. //$("#_read_xml_cube5").val("");
  997. //Debug
  998. $("#hcube").val("");
  999. $("#vcube").val("");
  1000. $("#hcur").val("");
  1001. $("#vcur").val("");
  1002. $("#curcube").val("");
  1003. //Splash
  1004. $("#HCsplash").show();
  1005. $("#vplayer").get(0).play();
  1006. }, true);
  1007. window.addEventListener("load", function() {
  1008. // Fisnished the Intro load the app..
  1009. document.getElementById("vplayer").onended=_startApp;
  1010. // A bit of preload..
  1011. bgimg = new Image();
  1012. bgimg.src = "../res/bg.jpg";
  1013. });
  1014. // -- End Boot app code
  1015. </script>
  1016. <script>
  1017. /*
  1018. * Drag-n-drop code
  1019. */
  1020. function onDragStart(tthis, e) {
  1021. //e.preventDefault();
  1022. tthisorder = parseInt($(tthis).attr("order"));
  1023. //objName = document.getElementById("objName").value;
  1024. //alert(objName);
  1025. jsonData = serialize( cubes[tthisorder-1] );
  1026. //alert(jsonData);
  1027. e.dataTransfer.setData('text/plain', jsonData);
  1028. document.body.style.cursor="move";
  1029. }
  1030. function onDragOver(e) {
  1031. e.preventDefault();
  1032. const id = e.dataTransfer.getData('text/plain');
  1033. document.body.style.cursor="pointer";
  1034. }
  1035. function onDragOverOff(e) {
  1036. e.preventDefault();
  1037. document.body.style.cursor="not-allowed";
  1038. }
  1039. function onDrop(e) {
  1040. e.preventDefault();
  1041. mys=e.dataTransfer.getData('text/plain');
  1042. //alert(mys);
  1043. newcube = deserialize(mys);
  1044. bfound=false;
  1045. for (i=0;i<totcubes;i++) {
  1046. if (cubes[i].getguid() === newcube.getguid()) {
  1047. bfound=i;
  1048. break;
  1049. }
  1050. }
  1051. if (bfound===false) {
  1052. n=totcubes+1;
  1053. cubes[n-1] = newcube;
  1054. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1055. if (n<10) {
  1056. newFormalName = "cube" + "00" + n;
  1057. } else if (n<100) {
  1058. newFormalName = "cube" + "0" + n;
  1059. } else {
  1060. newFormalName = "cube" + n;
  1061. }
  1062. cubes[n-1].formalName = newFormalName;
  1063. $("#cubeList").html($("#cubeList").html()+"<div id='cube" + n + "' class='cube' order='" + n + "' onclick='selCube(this)' draggable='true' ondragstart='onDragStart(this, event);' onmouseover='onMouseOver();'><div id='cube" + n + "name' class='cubename'>cube#" + n + "</div></div>");
  1064. $("#cube"+n+"name").html(cubes[n-1].getname());
  1065. totcubes=n;
  1066. } else {
  1067. if (cubes[i].getpassword() === newcube.getpassword()) {
  1068. pwd2 = prompt("password confirmation:");
  1069. if (cubes[i].getpassword() != pwd2) {
  1070. $("#cubeList").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Permission denied.");
  1071. return;
  1072. }
  1073. } else {
  1074. $("#cubeList").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Permission denied.");
  1075. return;
  1076. }
  1077. n=bfound+1;
  1078. cubes[n-1] = newcube;
  1079. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1080. if (n<10) {
  1081. newFormalName = "cube" + "00" + n;
  1082. } else if (n<100) {
  1083. newFormalName = "cube" + "0" + n;
  1084. } else {
  1085. newFormalName = "cube" + n;
  1086. }
  1087. cubes[n-1].formalName = newFormalName;
  1088. //$("#cubeList").html($("#cubeList").html()+"<div id='cube" + n + "' class='cube' order='" + n + "' onclick='selCube(this)'><div id='cube" + n + "name' class='cubename'>cube#" + n + "</div></div>");
  1089. $("#cube"+n+"name").html(cubes[n-1].getname());
  1090. }
  1091. cubes[n-1].savedata();
  1092. document.body.style.cursor="normal";
  1093. /*
  1094. n=totcubes+1;
  1095. $("#cubeList").html($("#cubeList").html()+"<div id='cube" + n + "' class='cube' order='" + n + "' onclick='selCube(this)'><div id='cube" + n + "name' class='cubename'>cube#" + n + "</div></div>");
  1096. //cubes[n-1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#"+n, "cube"+n);
  1097. cubes[n-1] = deserialize(mys);
  1098. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1099. newFormalName = "cube" + n;
  1100. cubes[n-1].formalName = newFormalName;
  1101. $("#cube"+n+"name").html(cubes[n-1].getname());
  1102. totcubes=n;
  1103. //newObj.start();
  1104. cubes[n-1].savedata();
  1105. document.body.style.cursor="normal";
  1106. */
  1107. }
  1108. function onDropOff(e) {
  1109. e.preventDefault();
  1110. document.body.style.cursor="not-allowed";
  1111. e.stopPropagation();
  1112. }
  1113. function onMouseOver() {
  1114. document.body.style.cursor="pointer";
  1115. }
  1116. // -- End drag-n-drop code
  1117. </script>
  1118. </head>
  1119. <body>
  1120. <div id="HCsplash" style="padding-top: 160px; text-align:center;color:#d4b0dc;font-family:'Rampart One';display:none;">
  1121. <div id="myh1" style="position:relative; top:80px;"><H1>5 CUBE</H1></div><br><br>
  1122. <video id="vplayer">
  1123. <source src="../res/cube.mp4" type="video/mp4">
  1124. </video>
  1125. </div>
  1126. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data">
  1127. <div id="debugdisplay" style="float:left;position:absolute;top:680px;left:50px;width:255px;display:none;">
  1128. <input id="hcube" type="text"><br>
  1129. <input id="vcube" type="text"><br>
  1130. <input id="hcur" type="text"><br>
  1131. <input id="vcur" type="text">
  1132. <input id="curcube" type="text">
  1133. </div>
  1134. <div id="passworddisplay" style="float:left;position:fixed;top:680px;left:50px;width:255px;height:120px;background:black;text-align:left;white-space:nowrap; font-family:'Bungee Hairline'; color:#d4b0dc; font-weight:900;z-index:99999;">
  1135. <br>
  1136. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" style="font-size:18px; background:transparent; width: 60%; border-radius:3px; font-weight:900;" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="<?php echo(getResource("Go", $curLocale));?>" style="text-align:left;width:25%;"><br>
  1137. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:18px; background:transparent; width: 90%; border-radius:3px; font-weight:900;" autocomplete="off"><br>
  1138. <div style="text-align:center;">
  1139. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; font-size:18px; font-weight:900; color:#d4b0dc;"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
  1140. </div>
  1141. <!--<textarea id="log"></textarea>-->
  1142. </div>
  1143. <div id="cubeList" style="position:absolute; width:100%; min-height: 500px; display:none; color:#d4b0dc; border: 0px solid red;" ondragover="onDragOver(event);" ondrop="onDrop(event);">
  1144. &nbsp;
  1145. </div>
  1146. <map name="ctrls-map">
  1147. <area target="" alt="" title="" href="#" onclick="turnLeft();" onmouseover="zoomviewOver()" coords="408,122,120,3" shape="rect">
  1148. <area target="" alt="" title="" href="#" onclick="turnUp();" onmouseover="zoomviewOver()" coords="411,272,525,3" shape="rect">
  1149. <area target="" alt="" title="" href="#" onclick="turnRight();" onmouseover="zoomviewOver()" coords="407,497,115,383,407,495" shape="rect">
  1150. <area target="" alt="" title="" href="#" onclick="turnDown();" onmouseover="zoomviewOver()" coords="176,347,66,411,2,295,0,144,62,142,106,238,105,243,63,144,109,237" shape="poly">
  1151. </map>
  1152. <div id="cubectrls" style="position:absolute;width:527px;height:497px;display:none;border:0px solid green; z-index:99998; transform: rotate(-63deg);" onmouseover="zoomviewOver()" onmouseout="zoomviewOut()">
  1153. <img src="../res/ctrlbg.png" style="width:527px;height:497px;" usemap="#ctrls-map">
  1154. </div>
  1155. <div id="zoomedview" style="position:absolute;width:396px;height:477px;display:none;border:0px solid red; z-index:99997">
  1156. <div id="cubezvname" style="position:relative; top:+30px;font-size:54px;color:#bd006e;width:400px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;"></div>
  1157. <div id="cubezv" style="float:left;background:url(../res/1cube.png);background-size:cover;width:396px;height:477px;margin:50px;vertical-align:middle;text-align:center;">
  1158. </div>
  1159. </div>
  1160. <div id="cubelinks" style="position:absolute;width:496px;height:7px;display:none;border:0px solid red; z-index:99999">
  1161. <span id="face2" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:160px;left:10px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  1162. <span id="face1" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+280px;left:-270px;background:transparent;border:0px solid red;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  1163. <span id="face3" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+160px;left:+240px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:80px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;transform: rotate(0deg); white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  1164. </div>
  1165. <div id="datadetail" style="float:right;background:#0d0d0d;border-left:1px solid white;width:380px;height:900px;display:none;color:#44ff00;" onmouseover="zoomviewOver()">
  1166. <span id="detailtitle" style="color:#bd006e;font-size:20px;font-weight:900;"></span><br><br>
  1167. <span id="detaildata"></span>
  1168. </div>
  1169. <!--
  1170. <input type="hidden" id="_read_xml_cube1">
  1171. <input type="hidden" id="_read_xml_cube2">
  1172. <input type="hidden" id="_read_xml_cube3">
  1173. <input type="hidden" id="_read_xml_cube4">
  1174. <input type="hidden" id="_read_xml_cube5">
  1175. -->
  1176. </form>
  1177. <div class="footer">
  1178. <div id="footerCont">&nbsp;</div>
  1179. <div id="footer"><span style="background:#E1E1E1;color:black;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com">5 Mode</a> project and <a href="http://demo.5mode.com">WYSIWYG</a> system. Some rights reserved.</span></div>
  1180. </div>
  1181. <script>
  1182. setContentPos();
  1183. </script>
  1184. </body>
  1185. </html>