setuppage.class.inc.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. require_once("../application/nicewebpage.class.inc.php");
  3. define('INSTALL_LOG_FILE', '../setup.log');
  4. /**
  5. * Web page used for displaying the login form
  6. */
  7. class setup_web_page extends nice_web_page
  8. {
  9. public function __construct($sTitle)
  10. {
  11. parent::__construct($sTitle);
  12. $this->add_linked_script("../js/jquery.blockUI.js");
  13. $this->add_linked_script("./setup.js");
  14. $this->add_style("
  15. body {
  16. background-color: #eee;
  17. margin: 0;
  18. padding: 0;
  19. font-size: 10pt;
  20. }
  21. #setup {
  22. width: 600px;
  23. margin-left: auto;
  24. margin-right: auto;
  25. margin-top: 50px;
  26. padding: 20px;
  27. background-color: #fff;
  28. border: 1px solid #000;
  29. }
  30. .center {
  31. text-align: center;
  32. }
  33. h1 {
  34. color: #83b217;
  35. font-size: 16pt;
  36. }
  37. h2 {
  38. color: #000;
  39. font-size: 14pt;
  40. }
  41. .v-spacer {
  42. padding-top: 1em;
  43. }
  44. button {
  45. margin-top: 1em;
  46. padding-left: 1em;
  47. padding-right: 1em;
  48. }
  49. p.info {
  50. padding-left: 50px;
  51. background: url(../images/info-mid.png) no-repeat top left;
  52. height: 48px;
  53. line-height: 48px;
  54. }
  55. p.ok {
  56. padding-left: 50px;
  57. background: url(../images/clean-mid.png) no-repeat top left;
  58. height: 48px;
  59. line-height: 48px;
  60. }
  61. p.warning {
  62. padding-left: 50px;
  63. background: url(../images/messagebox_warning-mid.png) no-repeat top left;
  64. height: 48px;
  65. line-height: 48px;
  66. }
  67. p.error {
  68. padding-left: 50px;
  69. background: url(../images/stop-mid.png) no-repeat top left;
  70. height: 48px;
  71. line-height: 48px;
  72. }
  73. td.label {
  74. text-align: left;
  75. }
  76. td.input {
  77. text-align: left;
  78. }
  79. table.formTable {
  80. border: 0;
  81. cellpadding: 2px;
  82. cellspacing: 0;
  83. }
  84. .wizlabel, .wizinput {
  85. color: #000;
  86. font-size: 10pt;
  87. }
  88. .wizhelp {
  89. color: #333;
  90. font-size: 8pt;
  91. }
  92. #progress {
  93. border:1px solid #000000;
  94. width: 180px;
  95. height: 20px;
  96. line-height: 20px;
  97. text-align: center;
  98. margin: 5px;
  99. }
  100. ");
  101. }
  102. public function info($sText)
  103. {
  104. $this->add("<p class=\"info\">$sText</p>\n");
  105. $this->log("Info - ".$sText);
  106. }
  107. public function ok($sText)
  108. {
  109. $this->add("<p class=\"ok\">$sText</p>\n");
  110. $this->log("Ok - ".$sText);
  111. }
  112. public function warning($sText)
  113. {
  114. $this->add("<p class=\"warning\">$sText</p>\n");
  115. $this->log("Warning - ".$sText);
  116. }
  117. public function error($sText)
  118. {
  119. $this->add("<p class=\"error\">$sText</p>\n");
  120. $this->log("Error - ".$sText);
  121. }
  122. public function form($aData)
  123. {
  124. $this->add("<table class=\"formTable\">\n");
  125. foreach($aData as $aRow)
  126. {
  127. $this->add("<tr>\n");
  128. if (isset($aRow['label']) && isset($aRow['label']) && isset($aRow['help']))
  129. {
  130. $this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
  131. $this->add("<td class=\"wizinput\">{$aRow['input']}</td>\n");
  132. $this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
  133. }
  134. else if (isset($aRow['label']) && isset($aRow['help']))
  135. {
  136. $this->add("<td colspan=\"2\" class=\"wizlabel\">{$aRow['label']}</td>\n");
  137. $this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
  138. }
  139. else if (isset($aRow['label']) && isset($aRow['input']))
  140. {
  141. $this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
  142. $this->add("<td colspan=\"2\" class=\"wizinput\">{$aRow['input']}</td>\n");
  143. }
  144. else if (isset($aRow['label']))
  145. {
  146. $this->add("<td colspan=\"3\" class=\"wizlabel\">{$aRow['label']}</td>\n");
  147. }
  148. $this->add("</tr>\n");
  149. }
  150. $this->add("</table>\n");
  151. }
  152. public function output()
  153. {
  154. $this->s_content = "<div id=\"setup\">{$this->s_content}\n</div>\n";
  155. return parent::output();
  156. }
  157. public static function log($sText)
  158. {
  159. $hLogFile = @fopen(INSTALL_LOG_FILE, 'a');
  160. if ($hLogFile !== false)
  161. {
  162. $sDate = date('Y-m-d H:i:s');
  163. fwrite($hLogFile, "$sDate - $sText\n");
  164. fclose($hLogFile);
  165. }
  166. }
  167. } // End of class
  168. ?>