Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1.  
  2. Ti.include("dbfunctions.js");
  3.  
  4. var testlab = Titanium.UI.createLabel({
  5. color:'#fff',
  6. text:'THIS IS THE CONFIG PAGE',
  7. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  8. top:10,
  9. left:10
  10. });
  11.  
  12. var messageWin = Titanium.UI.createWindow({
  13. height:30,
  14. width:250,
  15. bottom:70,
  16. borderRadius:10,
  17. touchEnabled:false,
  18.  
  19. orientationModes : [
  20. Titanium.UI.PORTRAIT,
  21. Titanium.UI.UPSIDE_PORTRAIT,
  22. Titanium.UI.LANDSCAPE_LEFT,
  23. Titanium.UI.LANDSCAPE_RIGHT
  24. ]
  25. });
  26. var messageView = Titanium.UI.createView({
  27. id:'messageview',
  28. height:30,
  29. width:250,
  30. borderRadius:10,
  31. backgroundColor:'#000',
  32. opacity:0.7,
  33. touchEnabled:false
  34. });
  35.  
  36. var messageLabel = Titanium.UI.createLabel({
  37. id:'messagelabel',
  38. text:'',
  39. color:'#fff',
  40. width:250,
  41. height:'auto',
  42. font:{
  43. fontFamily:'Helvetica Neue',
  44. fontSize:13
  45. },
  46. textAlign:'center'
  47. });
  48. messageWin.add(messageView);
  49. messageWin.add(messageLabel);
  50.  
  51. var db = Ti.Database.install('../database/commercialseal.sqlite','commercialseal');
  52.  
  53. var rows = db.execute('SELECT * from configuration');
  54.  
  55.  
  56. var username = Titanium.UI.createTextField({
  57. value: rows.fieldByName('username'),
  58. backgroundColor: '#ffffff',
  59. borderColor: '#000',
  60. height: 25,
  61. width: 150,
  62. top: 100,
  63. left: 120,
  64. paddingLeft:5,
  65. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  66. borderRadius: 5,
  67. });
  68.  
  69. var password = Titanium.UI.createTextField({
  70. value: rows.fieldByName('password'),
  71. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  72. backgroundColor: '#ffffff',
  73. borderColor: '#000',
  74. height: 25,
  75. width: 150,
  76. top: 130,
  77. left: 120,
  78. paddingLeft:5,
  79. passwordMask: true,
  80. borderRadius: 5,
  81. });
  82.  
  83. var usrlab = Titanium.UI.createLabel({
  84. text: 'User Name:',
  85. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  86. height: 25,
  87. top: 100,
  88. left: 20,
  89. });
  90.  
  91. var psslab = Titanium.UI.createLabel({
  92. text: 'Password:',
  93. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  94. height: 25,
  95. top: 130,
  96. left: 20,
  97. });
  98.  
  99. var trklab = Titanium.UI.createLabel({
  100. text: 'Searches Remaining :',
  101. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  102. height: 25,
  103. top: 160,
  104. left: 20,
  105. });
  106.  
  107. var trkval = Titanium.UI.createLabel({
  108. text: rows.fieldByName('tracking'),
  109. font:{fontSize:12,fontFamily:'Helvetica Neue',fontWeight:'bold'},
  110. height: 25,
  111. top: 160,
  112. left: 160,
  113. });
  114.  
  115. var updatebutton = Titanium.UI.createButton({
  116. title: 'Update Changes',
  117. height: 30,
  118. top: 200,
  119. width: 200
  120.  
  121. });
  122.  
  123. var reducebutton = Titanium.UI.createButton({
  124. title: 'Reduce Count',
  125. height: 30,
  126. top: 250,
  127. width: 200
  128.  
  129. });
  130.  
  131. Titanium.UI.currentWindow.add(updatebutton);
  132.  
  133. Titanium.UI.currentWindow.add(reducebutton);
  134.  
  135.  
  136. Titanium.UI.currentWindow.add(usrlab);
  137. Titanium.UI.currentWindow.add(psslab);
  138.  
  139. Titanium.UI.currentWindow.add(trklab);
  140. Titanium.UI.currentWindow.add(trkval);
  141.  
  142. Titanium.UI.currentWindow.add(username);
  143. Titanium.UI.currentWindow.add(password);
  144.  
  145. rows.close();
  146.  
  147. updatebutton.addEventListener('click', function(e)
  148. {
  149. var db = Ti.Database.install('../database/commercialseal.sqlite','commercialseal');
  150. var rows = db.execute('UPDATE configuration SET username="'+username.value+'",password="'+password.value+'",tracking="'+trkval.text+'"');
  151. messageLabel.text = 'Settings Have Been Updated';
  152. messageWin.open();
  153. setTimeout(function()
  154. {
  155. messageWin.close({opacity:0,duration:500});
  156. },1000);
  157. db.close();
  158. });
  159.  
  160. reducebutton.addEventListener('click', function(e)
  161. {
  162. reduceusecount();
  163. // trkval = getusecount();
  164. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement