Subversion Repositories oidplus

Rev

Rev 424 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
362 daniel-mar 1
/*
2
 * OIDplus 2.0
511 daniel-mar 3
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
362 daniel-mar 4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
 
18
plugin_combobox_change_callbacks.push(function(strPlugin) {
19
        document.getElementById('DBPLUGIN_PARAMS_SQLite3').style.display = (strPlugin == 'SQLite3') ? "Block" : "None";
20
});
21
 
22
rebuild_callbacks.push(function() {
23
        var e = document.getElementById("db_plugin");
24
        var strPlugin = e.options[e.selectedIndex].value;
25
        if (strPlugin != 'SQLite3') return true;
26
 
27
        document.getElementById('struct_cli_1').innerHTML = '';
28
        document.getElementById('struct_cli_2').innerHTML = '';
29
        document.getElementById('struct_1').href = 'struct_empty.sql.php';
30
        document.getElementById('struct_2').href = 'struct_with_examples.sql.php';
31
 
32
        error = false;
33
 
34
        // Check 1: Filename must not be empty
35
        if (document.getElementById('sqlite3_file').value.length == 0)
36
        {
37
                document.getElementById('sqlite3_file_warn').innerHTML = '<font color="red">'+_L('Please specify a filename!')+'</font>';
38
                document.getElementById('config').innerHTML = '<b>&lt?php</b><br><br><i>// ERROR: Please specify a filename!</i>'; // do not translate
39
                error = true;
40
        } else {
41
                document.getElementById('sqlite3_file_warn').innerHTML = '';
42
        }
43
 
44
        document.getElementById('struct_1').href = setupdir+'struct_empty.sql.php?plugin=sqlite&prefix='+encodeURI(document.getElementById('tablename_prefix').value)+'&slang=sqlite';
45
        document.getElementById('struct_2').href = setupdir+'struct_with_examples.sql.php?plugin=sqlite&prefix='+encodeURI(document.getElementById('tablename_prefix').value)+'&slang=sqlite';
46
        document.getElementById('struct_cli_1').innerHTML = '<br>'+_L('or via command line:')+'<br><code>curl -s "'+document.getElementById('struct_1').href+'" | sqlite3 '+document.getElementById('sqlite3_file').value+'<!-- TODO: encryption key? --></code>';
47
        document.getElementById('struct_cli_2').innerHTML = '<br>'+_L('or via command line:')+'<br><code>curl -s "'+document.getElementById('struct_2').href+'" | sqlite3 '+document.getElementById('sqlite3_file').value+'<!-- TODO: encryption key? --></code>';
48
 
49
        return !error;
50
});
51
 
52
rebuild_config_callbacks.push(function() {
53
        var e = document.getElementById("db_plugin");
54
        var strPlugin = e.options[e.selectedIndex].value;
55
        if (strPlugin != 'SQLite3') return '';
56
 
57
        return 'OIDplus::baseConfig()->setValue(\'SQLITE3_FILE\',      \''+document.getElementById('sqlite3_file').value+'\');<br>' +
58
               'OIDplus::baseConfig()->setValue(\'SQLITE3_ENCRYPTION\',base64_decode(\''+b64EncodeUnicode(document.getElementById('sqlite3_encryption').value)+'\'));<br>';
59
});