home.php 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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: Every person its prospects.</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="index,follow"/>
  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 = "https://<?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. xml = this.responseText
  373. cubes[parseInt(myformalName.substr(4))-1].xml = xml;
  374. //$("#_read_xml_" + myformalName).val(xml);
  375. //alert(this.responseText);
  376. re = new RegExp("\<guid\>(.*)\<\/guid\>", "igsu");
  377. a = re.exec(xml);
  378. if (!a || a.length===0) {
  379. document.write("Data access error (#2)<br><br>");
  380. return;
  381. } else {
  382. //alert(a);
  383. cubes[parseInt(myformalName.substr(4))-1].guid = a[1];
  384. //alert(cubes[parseInt(myformalName.substr(4))-1].guid);
  385. }
  386. re = new RegExp("\<password\>(.*)\<\/password\>", "igsu");
  387. a = re.exec(xml);
  388. if (!a || a.length===0) {
  389. document.write("Data access error (#3)<br><br>");
  390. return;
  391. } else {
  392. //alert(a);
  393. cubes[parseInt(myformalName.substr(4))-1].password = a[1];
  394. //alert(cubes[parseInt(myformalName.substr(4))-1].guid);
  395. }
  396. } else {
  397. if ((this.readyState == 4 && this.status == 0) && (!bConnectionOK)) {
  398. document.write("Data access error (#1)<br><br>");
  399. }
  400. }
  401. }
  402. }
  403. /*
  404. * Get the guid of the cube
  405. *
  406. * @returns string
  407. */
  408. function mygetguid() {
  409. return this.guid;
  410. }
  411. /*
  412. * Get the editor password of the cube
  413. *
  414. * @returns string
  415. */
  416. function mygetpassword() {
  417. return this.password;
  418. }
  419. /*
  420. * Get the xml data associated with the cube
  421. *
  422. * @returns string
  423. */
  424. function mygetxml() {
  425. return this.xml;
  426. }
  427. }
  428. // -- End myCube class
  429. /*
  430. * Select a cube
  431. *
  432. * @param <interfaceEl> tthis selected cube
  433. * @returns void
  434. */
  435. function _selCube(tthis) {
  436. //alert($(tthis).attr("order"));
  437. var _cubeorder = parseInt($(tthis).attr("order"));
  438. _selectedcube = _cubeorder-1;
  439. curcube = cubes[_selectedcube];
  440. // Debug info..
  441. $("#curcube").val(curcube.getname());
  442. //alert("curcube="+_selectedcube);
  443. }
  444. /*
  445. function _fetchData() {
  446. data1_exists = $("#_read_xml_cube1").val() !== "";
  447. data2_exists = $("#_read_xml_cube2").val() !== "";
  448. data3_exists = $("#_read_xml_cube3").val() !== "";
  449. data4_exists = true;
  450. data5_exists = true;
  451. //data4_exists = $("#_read_xml_cube4").val() !== "";
  452. //data5_exists = $("#_read_xml_cube5").val() !== "";
  453. if (data1_exists &&
  454. data2_exists &&
  455. data3_exists &&
  456. data4_exists &&
  457. data5_exists ) {
  458. cubes[0].xml = $("#_read_xml_cube1").val();
  459. cubes[1].xml = $("#_read_xml_cube2").val();
  460. cubes[2].xml = $("#_read_xml_cube3").val();
  461. cubes[3].xml = $("#_read_xml_cube4").val();
  462. cubes[4].xml = $("#_read_xml_cube5").val();
  463. clearInterval(fetchDataIntervalId);
  464. } else {
  465. fetchDataIntervalId = setInterval("_fetchData()", 2000);
  466. }
  467. }*/
  468. // -- End CUBE CODE
  469. </script>
  470. <script>
  471. /*
  472. * Interaction / Interface code
  473. */
  474. timeoutId=0;
  475. var oldtthis; // Old cube
  476. var lineOldVal = ""; // Old value for a detail line
  477. var lineNewVal = ""; // New value for a detail line
  478. var dataChanged = false;
  479. /*
  480. function zoominCube_old(tthis) {
  481. $(tthis).css("width","396px");
  482. $(tthis).css("height","477px");
  483. $(tthis).css("margin","0px");
  484. }
  485. function zoomoffCube_old(tthis) {
  486. $(tthis).css("width","130px");
  487. $(tthis).css("height","159px");
  488. $(tthis).css("margin","50px");
  489. }
  490. /*
  491. /*
  492. * Select the given cube
  493. *
  494. * @param <interfaceEl> selected cube
  495. * @returns void
  496. */
  497. function selCube(tthis) {
  498. if (password === 1) {
  499. _selCube(tthis);
  500. // Clean the old selected..
  501. $(oldtthis).css("color","#d4b0dc");
  502. $(oldtthis).css("text-decoration","none");
  503. oldtthis = tthis;
  504. // Decore the selected one..
  505. $(tthis).css("color","#bd006e");
  506. $(tthis).css("text-decoration","underline");
  507. $("#cubezvname").html(curcube.getname());
  508. // Reset the detail view
  509. $("#detailtitle").html("");
  510. $("#detaildata").html("");
  511. $("#datadetail").hide();
  512. // Update ZOOMED VIEW interface..
  513. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  514. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  515. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  516. $("#face1").attr("target", curcube.getFace('h0'));
  517. $("#face2").attr("target", curcube.getFace('v1'));
  518. $("#face3").attr("target", curcube.getFace('h1'));
  519. clearTimeout(timeoutId);
  520. // Update body background..
  521. $(document.body).css("background","url('../res/bg.jpg')");
  522. $(document.body).css("background-size","cover");
  523. // Display ZOOMED VIEW interface and controls
  524. $("#cubeList").css("width", "700px");
  525. $("#cubectrls").show();
  526. $("#zoomedview").show();
  527. $("#cubelinks").show();
  528. }
  529. }
  530. /*
  531. * Turn the current cube to the left
  532. *
  533. * @returns void
  534. */
  535. function turnLeft() {
  536. curcube.turnLeft();
  537. // Update ZOOMED VIEW interface..
  538. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  539. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  540. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  541. $("#face1").attr("target", curcube.getFace('h0'));
  542. $("#face2").attr("target", curcube.getFace('v1'));
  543. $("#face3").attr("target", curcube.getFace('h1'));
  544. // Display the debug info..
  545. visInfo();
  546. }
  547. /*
  548. * Turn the current cube to the right
  549. *
  550. * @returns void
  551. */
  552. function turnRight() {
  553. curcube.turnRight();
  554. // Update ZOOMED VIEW interface..
  555. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  556. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  557. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  558. $("#face1").attr("target", curcube.getFace('h0'));
  559. $("#face2").attr("target", curcube.getFace('v1'));
  560. $("#face3").attr("target", curcube.getFace('h1'));
  561. // Display the debug info..
  562. visInfo();
  563. }
  564. /*
  565. * Turn the current cube to upward
  566. *
  567. * @returns void
  568. */
  569. function turnUp() {
  570. curcube.turnUp();
  571. // Update ZOOMED VIEW interface..
  572. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  573. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  574. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  575. $("#face1").attr("target", curcube.getFace('h0'));
  576. $("#face2").attr("target", curcube.getFace('v1'));
  577. $("#face3").attr("target", curcube.getFace('h1'));
  578. // Display the debug info..
  579. visInfo();
  580. }
  581. /*
  582. * Turn the current cube to downward
  583. *
  584. * @returns void
  585. */
  586. function turnDown() {
  587. curcube.turnDown();
  588. // Update ZOOMED VIEW interface..
  589. $("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  590. $("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  591. $("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  592. $("#face1").attr("target", curcube.getFace('h0'));
  593. $("#face2").attr("target", curcube.getFace('v1'));
  594. $("#face3").attr("target", curcube.getFace('h1'));
  595. // Display the debug info..
  596. visInfo();
  597. }
  598. /*
  599. * Hide the ZOOMED VIEW
  600. *
  601. * @returns void
  602. */
  603. function hideZoomedview() {
  604. // Clean the old selected..
  605. $(oldtthis).css("color","#d4b0dc");
  606. $(oldtthis).css("text-decoration","none");
  607. oldtthis = null;
  608. // Reset the detail view
  609. $("#detailtitle").html("");
  610. $("#detaildata").html("");
  611. $("#datadetail").hide();
  612. // Hide ZOOMED VIEW interface and controls
  613. $("#cubeList").css("width", "100%");
  614. $("#cubelinks").hide();
  615. $("#zoomedview").hide();
  616. $("#cubectrls").hide();
  617. // Reset body background..
  618. $(document.body).css("background","#0d0d0d");
  619. }
  620. /*
  621. * Mouse over handle for ZOOMED VIEW
  622. *
  623. * @returns void
  624. */
  625. function zoomviewOver() {
  626. clearTimeout(timeoutId);
  627. }
  628. /*
  629. * Mouse out handle for ZOOMED VIEW
  630. *
  631. * @returns void
  632. */
  633. function zoomviewOut() {
  634. timeoutId = setTimeout(hideZoomedview,1500);
  635. }
  636. /*
  637. * Display the debug info
  638. *
  639. * @returns void
  640. */
  641. function visInfo() {
  642. $("#hcube").val(curcube.gethcube());
  643. $("#vcube").val(curcube.getvcube());
  644. $("#hcur").val(curcube.gethcur());
  645. $("#vcur").val(curcube.getvcur());
  646. $("#curcube").val(curcube.getname());
  647. }
  648. /*
  649. function eachNode(rootNode, callback) {
  650. if (!callback) {
  651. const nodes = []
  652. eachNode(rootNode, function(node) {
  653. nodes.push(node.nodeName)
  654. //nodes.push(node)
  655. })
  656. return nodes
  657. }
  658. if (false === callback(rootNode)) {
  659. return false
  660. }
  661. if (rootNode.hasChildNodes()) {
  662. const nodes = rootNode.childNodes
  663. for (let i = 0, l = nodes.length; i < l; ++i) {
  664. if (false === eachNode(nodes[i], callback)) {
  665. return
  666. }
  667. }
  668. }
  669. }
  670. */
  671. /*
  672. * Get the data for the given detail / face
  673. *
  674. * @param string xmlStr, the current cube xml data
  675. * @param string detail, the requested detail
  676. * @returns string, the detail data
  677. */
  678. function getDetailData(xmlStr, detail) {
  679. var ret = "";
  680. var re;
  681. detail = detail.toLowerCase();
  682. xmlStr = xmlStr.replace('<?xml version="1.0" encoding="UTF-8"?>',"");
  683. xmlStr = xmlStr.replace('<details>',"");
  684. xmlStr = xmlStr.replace('</details>',"");
  685. xmlStr = xmlStr.replaceAll('\n',"");
  686. xmlStr = xmlStr.replaceAll(String.fromCharCode(9), "");
  687. xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "");
  688. xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "");
  689. xmlStr = xmlStr.replaceAll(" ", "");
  690. xmlStr = xmlStr.replaceAll(" ", "");
  691. xmlStr = escape(xmlStr);
  692. xmlStr = xmlStr.replaceAll("%0A", "");
  693. xmlStr = xmlStr.replaceAll("%20%20%20%20%20", "");
  694. xmlStr = xmlStr.replaceAll("%20%20%20%20%", "");
  695. xmlStr = xmlStr.replaceAll("%20%20%", "");
  696. //xmlStr = unescape(xmlStr);
  697. //alert(xmlStr);
  698. switch (detail) {
  699. case "address":
  700. re = new RegExp("detail%20face%3D%22address%22.+/country", "igsu");
  701. break;
  702. case "contacts":
  703. re = new RegExp("detail%20face%3D%22contacts%22.+/cell", "igsu");
  704. break;
  705. case "other info":
  706. re = new RegExp("detail%20face%3D%22other%20info%22.+/description", "igsu");
  707. break;
  708. case "menu":
  709. re = new RegExp("detail%20face%3D%22menu%22.+/menu3", "igsu");
  710. break;
  711. case "pictures":
  712. re = new RegExp("detail%20face%3D%22pictures%22.+/pic5", "igsu");
  713. break;
  714. case "password":
  715. re = new RegExp("detail%20face%3D%22password%22.+/password", "igsu");
  716. break;
  717. }
  718. s = re.exec(xmlStr);
  719. if (!s || s.length===0) {
  720. ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error! #1";
  721. return ret;
  722. }
  723. xmlStr = s[0];
  724. xmlStr = "<"+xmlStr+"></detail>";
  725. xmlStr = unescape(xmlStr);
  726. //alert(xmlStr);
  727. const parser = new DOMParser();
  728. const doc = parser.parseFromString(xmlStr, "text/xml");
  729. x = doc.getElementsByTagName("detail");
  730. if (x.length===0) {
  731. ret = "Error! #2";
  732. return ret;
  733. }
  734. ret += "<div style='padding:10px'>";
  735. for (i = 0; i < x[0].childNodes.length; i++) {
  736. if (x[0].childNodes[i].nodeType === 1) {
  737. if (x[0].childNodes[i].getAttributeNode("type")) {
  738. mytype = x[0].childNodes[i].getAttributeNode("type");
  739. if (mytype.value==="pic") {
  740. 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>";
  741. } else {
  742. 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>";
  743. }
  744. } else {
  745. if (x[0].childNodes[i].nodeName === "business-type") {
  746. 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>";
  747. } else if (x[0].childNodes[i].nodeName === "guid") {
  748. 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>";
  749. } else if (x[0].childNodes[i].nodeName === "password") {
  750. if (password===1) {
  751. 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>";
  752. }
  753. } else if (x[0].childNodes[i].nodeName === "city-zip-prov") {
  754. 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>";
  755. } else if (x[0].childNodes[i].nodeName === "country") {
  756. 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>";
  757. } else {
  758. 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>";
  759. }
  760. }
  761. }
  762. }
  763. if ((detail==="pictures") || (detail==="menu")) {
  764. ret += "<div style='padding-left:80px;clear:both;'><br>you can use eg. Goolge Drive or Microsoft OneDrive to host your pictures.</div>"
  765. }
  766. ret += "</div>";
  767. return ret;
  768. }
  769. /*
  770. * Store the old data of the text control
  771. *
  772. * @param {InterfaceEl} tthis, the text control under editing
  773. * @returns void
  774. */
  775. /*function storeOldData(tthis) {
  776. //alert("keypress");
  777. lineOldVal = $(tthis).val();
  778. }*/
  779. /*
  780. * Store in the cube object the new data of the text control
  781. *
  782. * @param {InterfaceEl} tthis, the text control under editing
  783. * @returns void
  784. */
  785. function storeData(tthis) {
  786. //alert("keyup");
  787. lineNewVal = $(tthis).val();
  788. //alert(lineNewVal);
  789. nodeName = tthis.id;
  790. nodeName = nodeName.replace("cube-detail-","");
  791. //alert(nodeName);
  792. xmlStr = curcube.getxml();
  793. //$("#log").html($("#log").html() + "old=" + "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs" + "\n");
  794. //$("#log").html($("#log").html() + "new=" + lineNewVal + "\n");
  795. //alert("<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  796. //re = "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs";
  797. switch (nodeName) {
  798. case "name":
  799. re = /(\<name>).*(\<\/name>)/gs;
  800. break;
  801. case "address-line1":
  802. re = /(\<address-line1>).*(\<\/address-line1>)/gs;
  803. break;
  804. case "address-line2":
  805. re = /(\<address-line2>).*(\<\/address-line2>)/gs;
  806. break;
  807. case "address-line3":
  808. re = /(\<address-line3>).*(\<\/address-line3>)/gs;
  809. break;
  810. case "city-zip-prov":
  811. re = /(\<city-zip-prov>).*(\<\/city-zip-prov>)/gs;
  812. break;
  813. case "country":
  814. re = /(\<country>).*(\<\/country>)/gs;
  815. break;
  816. case "tel":
  817. re = /(\<tel>).*(\<\/tel>)/gs;
  818. break;
  819. case "fax":
  820. re = /(\<fax>).*(\<\/fax>)/gs;
  821. break;
  822. case "cell":
  823. re = /(\<cell>).*(\<\/cell>)/gs;
  824. break;
  825. case "description":
  826. re = /(\<description>).*(\<\/description>)/gs;
  827. break;
  828. }
  829. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2");
  830. //xmlStr = xmlStr.replace("<" + nodeName + ">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  831. //alert(xmlStr);
  832. curcube.xml = xmlStr;
  833. dataChanged = true;
  834. }
  835. /*
  836. * Store in the cube object the new pic data
  837. *
  838. * @param {InterfaceEl} tthis, the text control under editing
  839. * @returns void
  840. */
  841. function storePicData(tthis) {
  842. //alert("keyup");
  843. lineNewVal = $(tthis).val();
  844. nodeName = tthis.id;
  845. nodeName = nodeName.replace("cube-detail-","");
  846. //alert(nodeName);
  847. xmlStr = curcube.getxml();
  848. switch (nodeName) {
  849. case "menu1":
  850. re = /(\<menu1\stype\=\"pic\">).*(\<\/menu1>)/gs;
  851. break;
  852. case "menu2":
  853. re = /(\<menu2\stype\=\"pic\">).*(\<\/menu2>)/gs;
  854. break;
  855. case "menu3":
  856. re = /(\<menu3\stype\=\"pic\">).*(\<\/menu3>)/gs;
  857. break;
  858. case "pic1":
  859. re = /(\<pic1\stype\=\"pic\">).*(\<\/pic1>)/gs;
  860. break;
  861. case "pic2":
  862. re = /(\<pic2\stype\=\"pic\">).*(\<\/pic2>)/gs;
  863. break;
  864. case "pic3":
  865. re = /(\<pic3\stype\=\"pic\">).*(\<\/pic3>)/gs;
  866. break;
  867. case "pic4":
  868. re = /(\<pic4\stype\=\"pic\">).*(\<\/pic4>)/gs;
  869. break;
  870. case "pic5":
  871. re = /(\<pic5\stype\=\"pic\">).*(\<\/pic5>)/gs;
  872. break;
  873. }
  874. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2")
  875. //xmlStr = xmlStr.replace("<" + nodeName + " type=\"pic\">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + " type=\"pic\">" + lineNewVal + "</" + nodeName + ">");
  876. //alert(xmlStr);
  877. curcube.xml = xmlStr;
  878. dataChanged = true;
  879. }
  880. function _saveData() {
  881. if (dataChanged) {
  882. curcube.savedata();
  883. //saveData();
  884. dataChanged = false;
  885. }
  886. }
  887. setInterval("_saveData()", 1500);
  888. /*
  889. * Display the given data detail
  890. *
  891. * @param <interfaceEl> selected cube
  892. * @returns void
  893. */
  894. function openDetail(tthis) {
  895. myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  896. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  897. $("#detaildata").html(myhtml);
  898. $("#datadetail").show();
  899. //alert(curcube.getxml());
  900. }
  901. // -- End Interaction / Interface code
  902. </script>
  903. <script>
  904. /*
  905. * Boot app code
  906. */
  907. //var fetchDataIntervalId;
  908. /*
  909. * App starting proc
  910. *
  911. * @returns void
  912. */
  913. function startApp() {
  914. // Init document background..
  915. //$(document.body).css("background","#0d0d0d");
  916. // Cubes initialization..
  917. //mymap = ["Address", "Contacts", "Other Info", "Menu", "Pictures", "Password"];
  918. //cubes[0] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#1", mymap, "cube1");
  919. //cubes[0].start();
  920. //cubes[1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#2", mymap, "cube2");
  921. //cubes[1].start();
  922. //cubes[2] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#3", mymap, "cube3");
  923. //cubes[2].start();
  924. //cubes[3] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#4", mymap, "cube4");
  925. //cubes[3].start();
  926. //cubes[4] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#5", mymap, "cube5");
  927. //cubes[4].start();
  928. <?php
  929. chdir(APP_DATA_PATH);
  930. foreach (glob("*.xml") as $filename) { ?>
  931. i = parseInt("<?php echo(substr(substr($filename, 0, strlen($filename)-4),4));?>");
  932. $("#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>");
  933. $("#cube" + i + "name").html("<?PHP echo(BUSINESS_TYPE)?>#" + i);
  934. if (i<10) {
  935. newFormalName = "cube" + "00" + i;
  936. } else if (i<100) {
  937. newFormalName = "cube" + "0" + i;
  938. } else {
  939. newFormalName = "cube" + i;
  940. }
  941. cubes[i-1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#" + i, newFormalName);
  942. cubes[i-1].start();
  943. totcubes = i;
  944. <?php
  945. }
  946. ?>
  947. //$("#cube1name").html(cubes[0].getname());
  948. //$("#cube2name").html(cubes[1].getname());
  949. //$("#cube3name").html(cubes[2].getname());
  950. //$("#cube4name").html(cubes[3].getname());
  951. //$("#cube5name").html(cubes[4].getname());
  952. $("#cubeList").show();
  953. if (password===1) {
  954. ///$("#cubeList").show();
  955. //$("#datadetail").show();
  956. //$("#debugdisplay").show();
  957. //alert(cubes.length);
  958. //$("#passworddisplay").hide();
  959. }
  960. $("#vplayer").get(0).pause();
  961. $("#HCsplash").css("display","none");
  962. $(".header").show();
  963. //fetchDataIntervalId = setInterval("_fetchData()", 2000);
  964. }
  965. /*
  966. * call to startApp
  967. *
  968. * @returns void
  969. */
  970. function _startApp() {
  971. setTimeout("startApp()", 1000);
  972. }
  973. /*
  974. * Set the elements position
  975. */
  976. function setContentPos() {
  977. mytop = parseInt((window.innerHeight - $("#cubectrls").height()) / 2);
  978. mytop = mytop + parseInt($("#cubectrls").height() / 4);
  979. myleft = parseInt((window.innerWidth - $("#cubectrls").width()) / 2);
  980. myleft = myleft + parseInt($("#cubectrls").width() / 5);
  981. $("#cubectrls").css("top", mytop+"px");
  982. $("#cubectrls").css("left", (myleft+40)+"px");
  983. mytop = parseInt((window.innerHeight - $("#zoomedview").height()) / 2);
  984. myleft = parseInt((window.innerWidth - $("#zoomedview").width()) / 2);
  985. $("#zoomedview").css("top", mytop+"px");
  986. $("#zoomedview").css("left", (myleft+40)+"px");
  987. mytop = parseInt((window.innerHeight - $("#cubelinks").height()) / 2);
  988. myleft = parseInt((window.innerWidth - $("#cubelinks").width()) / 2);
  989. $("#cubelinks").css("top", (mytop-170)+"px");
  990. $("#cubelinks").css("left", (myleft+240)+"px");
  991. }
  992. window.addEventListener("load", function() {
  993. //Resetting secrets..
  994. //$("#_read_xml_cube1").val("");
  995. //$("#_read_xml_cube2").val("");
  996. //$("#_read_xml_cube3").val("");
  997. //$("#_read_xml_cube4").val("");
  998. //$("#_read_xml_cube5").val("");
  999. //Debug
  1000. $("#hcube").val("");
  1001. $("#vcube").val("");
  1002. $("#hcur").val("");
  1003. $("#vcur").val("");
  1004. $("#curcube").val("");
  1005. //Splash
  1006. $("#HCsplash").show();
  1007. $("#vplayer").get(0).play();
  1008. }, true);
  1009. window.addEventListener("load", function() {
  1010. // Fisnished the Intro load the app..
  1011. document.getElementById("vplayer").onended=_startApp;
  1012. // A bit of preload..
  1013. bgimg = new Image();
  1014. bgimg.src = "../res/bg.jpg";
  1015. });
  1016. // -- End Boot app code
  1017. </script>
  1018. <script>
  1019. /*
  1020. * Drag-n-drop code
  1021. */
  1022. function onDragStart(tthis, e) {
  1023. //e.preventDefault();
  1024. tthisorder = parseInt($(tthis).attr("order"));
  1025. //objName = document.getElementById("objName").value;
  1026. //alert(objName);
  1027. jsonData = serialize( cubes[tthisorder-1] );
  1028. //alert(jsonData);
  1029. e.dataTransfer.setData('text/plain', jsonData);
  1030. document.body.style.cursor="move";
  1031. }
  1032. function onDragOver(e) {
  1033. e.preventDefault();
  1034. const id = e.dataTransfer.getData('text/plain');
  1035. document.body.style.cursor="pointer";
  1036. }
  1037. function onDragOverOff(e) {
  1038. e.preventDefault();
  1039. document.body.style.cursor="not-allowed";
  1040. }
  1041. function onDrop(e) {
  1042. e.preventDefault();
  1043. mys=e.dataTransfer.getData('text/plain');
  1044. //alert(mys);
  1045. newcube = deserialize(mys);
  1046. bfound=false;
  1047. for (i=0;i<totcubes;i++) {
  1048. if (cubes[i].getguid() === newcube.getguid()) {
  1049. bfound=i;
  1050. break;
  1051. }
  1052. }
  1053. if (bfound===false) {
  1054. n=totcubes+1;
  1055. cubes[n-1] = newcube;
  1056. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1057. if (n<10) {
  1058. newFormalName = "cube" + "00" + n;
  1059. } else if (n<100) {
  1060. newFormalName = "cube" + "0" + n;
  1061. } else {
  1062. newFormalName = "cube" + n;
  1063. }
  1064. cubes[n-1].formalName = newFormalName;
  1065. $("#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>");
  1066. $("#cube"+n+"name").html(cubes[n-1].getname());
  1067. totcubes=n;
  1068. } else {
  1069. if (cubes[i].getpassword() === newcube.getpassword()) {
  1070. pwd2 = prompt("password confirmation:");
  1071. if (cubes[i].getpassword() != pwd2) {
  1072. $("#cubeList").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Permission denied.");
  1073. return;
  1074. }
  1075. } else {
  1076. $("#cubeList").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Permission denied.");
  1077. return;
  1078. }
  1079. n=bfound+1;
  1080. cubes[n-1] = newcube;
  1081. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1082. if (n<10) {
  1083. newFormalName = "cube" + "00" + n;
  1084. } else if (n<100) {
  1085. newFormalName = "cube" + "0" + n;
  1086. } else {
  1087. newFormalName = "cube" + n;
  1088. }
  1089. cubes[n-1].formalName = newFormalName;
  1090. //$("#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>");
  1091. $("#cube"+n+"name").html(cubes[n-1].getname());
  1092. }
  1093. cubes[n-1].savedata();
  1094. document.body.style.cursor="normal";
  1095. /*
  1096. n=totcubes+1;
  1097. $("#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>");
  1098. //cubes[n-1] = new myCube("<?PHP echo(BUSINESS_TYPE)?>#"+n, "cube"+n);
  1099. cubes[n-1] = deserialize(mys);
  1100. cubes[n-1].name = "<?PHP echo(BUSINESS_TYPE)?>#" + n;
  1101. newFormalName = "cube" + n;
  1102. cubes[n-1].formalName = newFormalName;
  1103. $("#cube"+n+"name").html(cubes[n-1].getname());
  1104. totcubes=n;
  1105. //newObj.start();
  1106. cubes[n-1].savedata();
  1107. document.body.style.cursor="normal";
  1108. */
  1109. }
  1110. function onDropOff(e) {
  1111. e.preventDefault();
  1112. document.body.style.cursor="not-allowed";
  1113. e.stopPropagation();
  1114. }
  1115. function onMouseOver() {
  1116. document.body.style.cursor="pointer";
  1117. }
  1118. // -- End drag-n-drop code
  1119. </script>
  1120. </head>
  1121. <body>
  1122. <div id="HCsplash" style="padding-top: 40px; text-align:center;color:#d4b0dc;font-family:'Rampart One';display:none;">
  1123. <div id="myh1" style="position:relative; top:80px;"><H1>5 CUBE</H1></div><br><br>
  1124. <video id="vplayer">
  1125. <source src="../res/cube.mp4" type="video/mp4">
  1126. </video>
  1127. </div>
  1128. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data">
  1129. <div class="header" style="margin-top:18px; display:none;">
  1130. &nbsp;&nbsp;<a href="http://5cube.org" target="_self" style="color:#d4b0dc; text-decoration: none;"><img src="/res/1cube.png" style="width:25px;">&nbsp;5 Cube</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/5cube" style="color:#d4b0dc;"><span style="color:#d4b0dc;">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:info@5cube.org" style="color:#d4b0dc;"><span style="color:#d4b0dc;">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-331-4029415" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  1131. </div>
  1132. <div id="debugdisplay" style="float:left;position:absolute;top:680px;left:50px;width:255px;display:none;">
  1133. <input id="hcube" type="text"><br>
  1134. <input id="vcube" type="text"><br>
  1135. <input id="hcur" type="text"><br>
  1136. <input id="vcur" type="text">
  1137. <input id="curcube" type="text">
  1138. </div>
  1139. <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;">
  1140. <br>
  1141. &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>
  1142. &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>
  1143. <div style="text-align:center;">
  1144. <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>
  1145. </div>
  1146. <!--<textarea id="log"></textarea>-->
  1147. </div>
  1148. <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);">
  1149. &nbsp;
  1150. </div>
  1151. <map name="ctrls-map">
  1152. <area target="" alt="" title="" href="#" onclick="turnLeft();" onmouseover="zoomviewOver()" coords="408,122,120,3" shape="rect">
  1153. <area target="" alt="" title="" href="#" onclick="turnUp();" onmouseover="zoomviewOver()" coords="411,272,525,3" shape="rect">
  1154. <area target="" alt="" title="" href="#" onclick="turnRight();" onmouseover="zoomviewOver()" coords="407,497,115,383,407,495" shape="rect">
  1155. <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">
  1156. </map>
  1157. <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()">
  1158. <img src="../res/ctrlbg.png" style="width:527px;height:497px;" usemap="#ctrls-map">
  1159. </div>
  1160. <div id="zoomedview" style="position:absolute;width:396px;height:477px;display:none;border:0px solid red; z-index:99997">
  1161. <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>
  1162. <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;">
  1163. </div>
  1164. </div>
  1165. <div id="cubelinks" style="position:absolute;width:496px;height:7px;display:none;border:0px solid red; z-index:99999">
  1166. <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>
  1167. <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>
  1168. <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>
  1169. </div>
  1170. <div id="datadetail" style="float:right;background:#0d0d0d;border-left:1px solid white;width:380px;height:900px;display:none;color:#44ff00;" onmouseover="zoomviewOver()">
  1171. <span id="detailtitle" style="color:#bd006e;font-size:20px;font-weight:900;"></span><br><br>
  1172. <span id="detaildata"></span>
  1173. </div>
  1174. <!--
  1175. <input type="hidden" id="_read_xml_cube1">
  1176. <input type="hidden" id="_read_xml_cube2">
  1177. <input type="hidden" id="_read_xml_cube3">
  1178. <input type="hidden" id="_read_xml_cube4">
  1179. <input type="hidden" id="_read_xml_cube5">
  1180. -->
  1181. </form>
  1182. <div class="footer">
  1183. <div id="footerCont">&nbsp;</div>
  1184. <div id="footer"><span style="background:#0d0d0d;color:#d4b0dc;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com" style="color:#d4b0dc; text-decoration:underline;">5 Mode</a> project and <a href="http://demo.5mode.com" style="color:#d4b0dc; text-decoration:underline;">WYSIWYG</a> system. Some rights reserved.</span></div>
  1185. </div>
  1186. <script>
  1187. setContentPos();
  1188. </script>
  1189. </body>
  1190. </html>