| 1 | <mt:setvarblock name="page_title"><__trans phrase="Database Configuration"></mt:setvarblock> |
|---|
| 2 | |
|---|
| 3 | <mt:include name="../cms/include/chromeless_header.tmpl"> |
|---|
| 4 | |
|---|
| 5 | <script type="text/javascript"> |
|---|
| 6 | /* <![CDATA[ */ |
|---|
| 7 | var needValidate = true; |
|---|
| 8 | |
|---|
| 9 | function validate (f) { |
|---|
| 10 | if (needValidate) { |
|---|
| 11 | var db = f.dbtype.options[f.dbtype.selectedIndex].value; |
|---|
| 12 | if ((db == "sqlite") || (db == "sqlite2")) { |
|---|
| 13 | if (!f.dbpath.value) { |
|---|
| 14 | alert('<__trans phrase="You must set your Database Path." escape="js">'); |
|---|
| 15 | f.dbpath.focus(); |
|---|
| 16 | return false; |
|---|
| 17 | } |
|---|
| 18 | } else { |
|---|
| 19 | if (!f.dbname.value) { |
|---|
| 20 | alert('<__trans phrase="You must set your Database Name." escape="js">'); |
|---|
| 21 | f.dbname.focus(); |
|---|
| 22 | return false; |
|---|
| 23 | } else if ((!f.dbuser.value) && (db != "mssqlserver") && (db != "umssqlserver")) { |
|---|
| 24 | alert('<__trans phrase="You must set your Username." escape="js">'); |
|---|
| 25 | f.dbuser.focus(); |
|---|
| 26 | return false; |
|---|
| 27 | } else if ((!f.dbserver.value) && (db != "oracle")) { |
|---|
| 28 | alert('<__trans phrase="You must set your Database Server." escape="js">'); |
|---|
| 29 | f.dbserver.focus(); |
|---|
| 30 | return false; |
|---|
| 31 | } |
|---|
| 32 | } |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | return true; |
|---|
| 36 | } |
|---|
| 37 | function go(mode) { |
|---|
| 38 | var f = document.forms[0]; |
|---|
| 39 | f['__mode'].value = mode; |
|---|
| 40 | } |
|---|
| 41 | function db_select(sel) { |
|---|
| 42 | var db = sel.options[sel.selectedIndex].value; |
|---|
| 43 | if ((db == "mysql") || (db == "postgres") || (db == "oracle") || (db == "mssqlserver") || (db == "umssqlserver")) { |
|---|
| 44 | showByID("login"); |
|---|
| 45 | hideByID("goback"); |
|---|
| 46 | showByID("server"); |
|---|
| 47 | hideByID("path"); |
|---|
| 48 | showByID("submit"); |
|---|
| 49 | showByID("params"); |
|---|
| 50 | showByID("use_setnames"); |
|---|
| 51 | if (db == "mssqlserver") { |
|---|
| 52 | showByID("charset"); |
|---|
| 53 | } else { |
|---|
| 54 | hideByID("charset"); |
|---|
| 55 | } |
|---|
| 56 | if (db == "oracle") { |
|---|
| 57 | hideByID("dbserver-field"); |
|---|
| 58 | } else { |
|---|
| 59 | } |
|---|
| 60 | document.forms[0].dbname.focus(); |
|---|
| 61 | } else if ((db == "sqlite") || (db == "sqlite2")) { |
|---|
| 62 | hideByID("login"); hideByID("server"); hideByID("goback"); hideByID("use_setnames"); |
|---|
| 63 | showByID("path"); |
|---|
| 64 | showByID("submit"); |
|---|
| 65 | showByID("params"); |
|---|
| 66 | document.forms[0].dbpath.focus(); |
|---|
| 67 | } else { |
|---|
| 68 | showByID("goback"); |
|---|
| 69 | hideByID("submit"); |
|---|
| 70 | hideByID("params"); |
|---|
| 71 | } |
|---|
| 72 | return true; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | function toggleMore() { |
|---|
| 76 | var more = getByID('error_more'); |
|---|
| 77 | if (more) { |
|---|
| 78 | if (more.style.display == 'none') |
|---|
| 79 | more.style.display = 'block'; |
|---|
| 80 | else |
|---|
| 81 | more.style.display = 'none'; |
|---|
| 82 | } |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | function reTest() { |
|---|
| 86 | needValidate = false; |
|---|
| 87 | go('retry'); |
|---|
| 88 | document.forms[0].submit(); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | <mt:unless name="success"> |
|---|
| 92 | <mt:if one_db> |
|---|
| 93 | window.onload = function() { |
|---|
| 94 | document.forms[0].dbtype.selectedIndex = 0; |
|---|
| 95 | db_select(document.forms[0].dbtype); |
|---|
| 96 | } |
|---|
| 97 | </mt:if> |
|---|
| 98 | </mt:unless> |
|---|
| 99 | |
|---|
| 100 | /* ]]> */ |
|---|
| 101 | </script> |
|---|
| 102 | |
|---|
| 103 | <form method="post" onsubmit="return validate(this)"> |
|---|
| 104 | <input type="hidden" name="__mode" value="" /> |
|---|
| 105 | <input type="hidden" name="step" value="configure" /> |
|---|
| 106 | <input type="hidden" name="set_static_uri_to" id="set_static_uri_to" value="<mt:var name="static_uri">" /> |
|---|
| 107 | <input type="hidden" name="config" value="<mt:var name="config" escape="html">" /> |
|---|
| 108 | |
|---|
| 109 | <mt:if name="connect_error"> |
|---|
| 110 | <mtapp:statusmsg |
|---|
| 111 | id="connect_error" |
|---|
| 112 | class="error"> |
|---|
| 113 | <mt:var name="error"><mt:if name="error_more"> <a href="javascript:void(0)" onclick="return toggleMore()">More</a>.</mt:if> |
|---|
| 114 | </mtapp:statusmsg> |
|---|
| 115 | <div id="error_more" style="display:none"><mt:var name="error_more"></div> |
|---|
| 116 | <mt:else> |
|---|
| 117 | <mt:if name="error"> |
|---|
| 118 | <mtapp:statusmsg |
|---|
| 119 | id="error" |
|---|
| 120 | class="error"> |
|---|
| 121 | <mt:var name="error"> |
|---|
| 122 | </mtapp:statusmsg> |
|---|
| 123 | </mt:if> |
|---|
| 124 | </mt:if> |
|---|
| 125 | |
|---|
| 126 | <mt:if name="success"> |
|---|
| 127 | <div> |
|---|
| 128 | <p class="intro"><span class="ready"><__trans phrase="Your database configuration is complete."></span> <__trans phrase="You may proceed to the next step."></p> |
|---|
| 129 | </div> |
|---|
| 130 | <div id="continue" class="pkg"> |
|---|
| 131 | <div class="left"> |
|---|
| 132 | <input name="back" type="submit" class="sb" value="<__trans phrase="Back">" onclick="needValidate = false; this.form.reset(); go('previous_step');" /> |
|---|
| 133 | </div> |
|---|
| 134 | <div class="right"> |
|---|
| 135 | <input name="continue" type="submit" class="sb" value="<__trans phrase="Continue">" name="continue" onclick="go('next_step')" /> |
|---|
| 136 | </div> |
|---|
| 137 | </div> |
|---|
| 138 | <br /> |
|---|
| 139 | <mt:else> |
|---|
| 140 | <p class="intro"><__trans phrase="Please enter the parameters necessary for connecting to your database."></p> |
|---|
| 141 | </mt:if> |
|---|
| 142 | |
|---|
| 143 | <mt:if name="success"> |
|---|
| 144 | <p id="show_settings"><a href="javascript:void(0)" onclick="showByID('db_settings'); hideByID('show_settings'); return false;"><__trans phrase="Show Current Settings"></a></p> |
|---|
| 145 | </mt:if> |
|---|
| 146 | |
|---|
| 147 | <fieldset id="db_settings" <mt:if name="success"> style="display: none;"</mt:if>> |
|---|
| 148 | |
|---|
| 149 | <mtapp:setting |
|---|
| 150 | id="dbtype" |
|---|
| 151 | label="<__trans phrase="Database Type">" |
|---|
| 152 | label_class="top-label"> |
|---|
| 153 | <select id="dbtype" name="dbtype" onchange="db_select(this); hide('db_hint');"> |
|---|
| 154 | <mt:unless one_db> |
|---|
| 155 | <option value=""><__trans phrase="Select One..."></option> |
|---|
| 156 | </mt:unless> |
|---|
| 157 | <mt:loop name="db_loop"> |
|---|
| 158 | <option value="<mt:var name="id">" <mt:if name="selected">selected="selected"</mt:if>><mt:var name="label"></option> |
|---|
| 159 | </mt:loop> |
|---|
| 160 | </select> |
|---|
| 161 | </mtapp:setting> |
|---|
| 162 | |
|---|
| 163 | <mt:unless name="success"> |
|---|
| 164 | <p id="db_hint" class="hint"><__trans phrase="If your database type is not listed in the menu above, then you need to <a target="help" href="[_1]">install the Perl module necessary to connect to your database</a>. If this is the case, please check your installation and <a href="javascript:void(0)" onclick="[_2]">re-test your installation</a>." params="http://www.sixapart.com/movabletype/kb/installation/database_option.html%%reTest();"></p> |
|---|
| 165 | </mt:unless> |
|---|
| 166 | |
|---|
| 167 | <div id="params" <mt:unless name="dbtype">style="display: none"</mt:unless>> |
|---|
| 168 | |
|---|
| 169 | <!-- database file path --> |
|---|
| 170 | |
|---|
| 171 | <div id="path"<mt:unless name="path_required"> style="display: none"</mt:unless>> |
|---|
| 172 | |
|---|
| 173 | <mtapp:setting |
|---|
| 174 | id="dbpath" |
|---|
| 175 | label="<__trans phrase="Database Path">" |
|---|
| 176 | label_class="top-label"> |
|---|
| 177 | <input type="text" id="dbpath" class="ti" name="dbpath" value="<mt:if name="dbpath"><mt:var name="dbpath" escape="html"><mt:else>./db/mt.db</mt:if>" /><br /> |
|---|
| 178 | <__trans phrase="The physical file path for your SQLite database. "><mt:unless name="dbpath"><__trans phrase="A default location of './db/mt.db' will store the database file underneath your Movable Type directory."></p></mt:unless> |
|---|
| 179 | </mtapp:setting> |
|---|
| 180 | |
|---|
| 181 | </div> |
|---|
| 182 | |
|---|
| 183 | <!-- server configuration parameters --> |
|---|
| 184 | |
|---|
| 185 | <div id="server"<mt:if name="path_required"> style="display: none"</mt:if>> |
|---|
| 186 | |
|---|
| 187 | <mtapp:setting |
|---|
| 188 | id="dbserver" |
|---|
| 189 | label="<__trans phrase="Database Server">" |
|---|
| 190 | label_class="top-label" |
|---|
| 191 | hint="<__trans phrase="This is usually 'localhost'.">" |
|---|
| 192 | show_hint="1"> |
|---|
| 193 | <input type="text" name="dbserver" class="ti" value="<mt:if name="dbserver"><mt:var name="dbserver" escape="html"><mt:else><mt:unless name="dbserver_null">localhost</mt:unless></mt:if>" /> |
|---|
| 194 | </mtapp:setting> |
|---|
| 195 | |
|---|
| 196 | <mtapp:setting |
|---|
| 197 | id="dbname" |
|---|
| 198 | label="<__trans phrase="Database Name">" |
|---|
| 199 | label_class="top-label" |
|---|
| 200 | hint="<__trans phrase="The name of your SQL database (this database must already exist).">"> |
|---|
| 201 | <input type="text" id="dbname" class="ti" name="dbname" value="<mt:var name="dbname" escape="html">" /><br /> |
|---|
| 202 | </mtapp:setting> |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | <!-- database login parameters --> |
|---|
| 206 | |
|---|
| 207 | <div id="login"<mt:unless name="login_required"> style="display: none"</mt:unless>> |
|---|
| 208 | |
|---|
| 209 | <mtapp:setting |
|---|
| 210 | id="dbuser" |
|---|
| 211 | label="<__trans phrase="Username">" |
|---|
| 212 | label_class="top-label" |
|---|
| 213 | hint="<__trans phrase="The username to login to your SQL database.">"> |
|---|
| 214 | <input type="text" name="dbuser" class="ti" value="<mt:var name="dbuser" escape="html">" /><br /> |
|---|
| 215 | </mtapp:setting> |
|---|
| 216 | |
|---|
| 217 | <mtapp:setting |
|---|
| 218 | id="dbpass" |
|---|
| 219 | label="<__trans phrase="Password">" |
|---|
| 220 | label_class="top-label" |
|---|
| 221 | hint="<__trans phrase="The password to login to your SQL database.">"> |
|---|
| 222 | <input type="password" name="dbpass" class="pw" value="<mt:var name="dbpass" escape="html">" /><br /> |
|---|
| 223 | </mtapp:setting> |
|---|
| 224 | |
|---|
| 225 | </div> |
|---|
| 226 | |
|---|
| 227 | <p id="more"><a href="javascript:void(0)" onclick="showByID('db_port_socket'); hideByID('more'); return false;"><__trans phrase="Show Advanced Configuration Options"></a></p> |
|---|
| 228 | <div id="db_port_socket" style="display: none;"> |
|---|
| 229 | <mtapp:setting |
|---|
| 230 | id="dbport" |
|---|
| 231 | label="<__trans phrase="Database Port">" |
|---|
| 232 | label_class="top-label" |
|---|
| 233 | hint="<__trans phrase="This can usually be left blank.">"> |
|---|
| 234 | <input type="text" name="dbport" class="ti" value="<mt:var name="dbport" escape="html">" /><br /> |
|---|
| 235 | </mtapp:setting> |
|---|
| 236 | |
|---|
| 237 | <mtapp:setting |
|---|
| 238 | id="dbsocket" |
|---|
| 239 | label="<__trans phrase="Database Socket">" |
|---|
| 240 | label_class="top-label" |
|---|
| 241 | hint="<__trans phrase="This can usually be left blank.">"> |
|---|
| 242 | <input type="text" name="dbsocket" class="ti" value="<mt:var name="dbsocket" escape="html">" /><br /> |
|---|
| 243 | </mtapp:setting> |
|---|
| 244 | </div> |
|---|
| 245 | |
|---|
| 246 | </div> |
|---|
| 247 | |
|---|
| 248 | <div id="charset" <mt:unless name="publish_charset">style="display: none"</mt:unless>> |
|---|
| 249 | |
|---|
| 250 | <mtapp:setting |
|---|
| 251 | id="publish_charset" |
|---|
| 252 | label="<__trans phrase="Publish Charset">" |
|---|
| 253 | label_class="top-label" |
|---|
| 254 | hint="<__trans phrase="MS SQL Server driver must use either Shift_JIS or ISO-8859-1. MS SQL Server driver does not support UTF-8 or any other character set.">"> |
|---|
| 255 | <input type="text" name="publish_charset" class="ti" value="<mt:var name="publish_charset" escape="html">" /> |
|---|
| 256 | </mtapp:setting> |
|---|
| 257 | |
|---|
| 258 | </div> |
|---|
| 259 | </div> |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | <mt:unless name="success"> |
|---|
| 263 | <div class="left"> |
|---|
| 264 | <div id="goback" <mt:if name="dbtype">style="display: none"</mt:if>> |
|---|
| 265 | <input name="back" type="submit" class="sb" value="<__trans phrase="Back">" onclick="needValidate = false; this.form.reset(); go('previous_step');" /> |
|---|
| 266 | </div> |
|---|
| 267 | </div> |
|---|
| 268 | |
|---|
| 269 | <div id="submit" <mt:unless name="dbtype">style="display: none"</mt:unless>> |
|---|
| 270 | <div class="left"> |
|---|
| 271 | <input name="back" type="submit" class="sb" value="<__trans phrase="Back">" onclick="needValidate = false;this.form.reset(); go('previous_step');" /> |
|---|
| 272 | </div> |
|---|
| 273 | <div class="right"> |
|---|
| 274 | <input name="test" type="submit" class="sb" value="<__trans phrase="Test Connection">" onclick="go('test');" /> |
|---|
| 275 | </div> |
|---|
| 276 | </div> |
|---|
| 277 | </mt:unless> |
|---|
| 278 | |
|---|
| 279 | <mt:if name="success"> |
|---|
| 280 | <div id="continue"> |
|---|
| 281 | <div class="left"> |
|---|
| 282 | <input name="back" type="submit" class="sb" value="<__trans phrase="Back">" onclick="needValidate = false; this.form.reset(); go('previous_step');" /> |
|---|
| 283 | </div> |
|---|
| 284 | <div class="right"> |
|---|
| 285 | <input name="test" type="submit" class="sb" value="<__trans phrase="Test Connection">" onclick="go('test');" /> |
|---|
| 286 | <input name="continue" type="submit" class="sb" value="<__trans phrase="Continue">" name="continue" onclick="go('next_step')" /> |
|---|
| 287 | </div> |
|---|
| 288 | </div> |
|---|
| 289 | </mt:if> |
|---|
| 290 | |
|---|
| 291 | </fieldset> |
|---|
| 292 | </form> |
|---|
| 293 | <mt:include name="../cms/include/chromeless_footer.tmpl"> |
|---|