Permalink
Browse files

Merge commit 'Wedge/v2.2_dev'

  • Loading branch information...
jdpurdyvi committed Apr 28, 2010
2 parents 9479a43 + a78adc7 commit 06744489ad221af66455db7c8be12ac56285a73e
View
@@ -1,12 +1,8 @@
-
-
Installing the software
----------------------------------------
TODO: Someone else should really write this section...
-
-
Installing the database
----------------------------------------
Binary file not shown.
@@ -0,0 +1,31 @@
+<?php
+ require_once($_SERVER["DOCUMENT_ROOT"]."/define.conf");
+
+ require_once($_SERVER["DOCUMENT_ROOT"].'/src/htmlparts.php');
+
+ $html='<!DOCTYPE HTML>
+<html>
+ <head>';
+
+ $html.=head();
+
+ $html.='
+ <title>IS4C - Labels</title>
+ </head>
+ <body>';
+
+ $html.=body();
+
+ $html.='
+ <div id="page_panel">
+ <img src="Screenshot.png" alt="Screenshot of Wedge Label Maker"/>
+ </div>';
+
+ $html.=foot();
+
+ $html.='
+ </body>
+</html>';
+
+ print_r($html);
+?>
@@ -11,6 +11,7 @@ function body() {
<ul>
<li><a href="/item">Item Maintenance</a></li>
<li><a href="/batch">Sale Batches</a></li>
+ <li><a href="/label">Label Maker</a></li>
<li>Reports</li>
<li>Dayend Balancing</li>
<li><a href="/sync">Synchronization</a></li>
View
@@ -0,0 +1,5 @@
+database: mysql
+server: 127.0.0.1
+schemas: opdata
+username: is4clane
+password: is4clane
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-import MySQLdb
import warnings
from installers import *
def install_lane_db(username, password, sample_data=False):
+ import MySQLdb
connection = MySQLdb.connect("localhost", username, password)
exec_script(connection, "script/create_lane_db.sql")
@@ -33,6 +33,8 @@ def install_lane_db(username, password, sample_data=False):
exec_script(connection, "script/create_lane_acct.sql")
+ remove_bind_restriction_prompt()
+
if __name__ == "__main__":
user_input = get_user_input()
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-import MySQLdb
import warnings
from installers import *
def install_server_db(username, password, sample_data=False):
+ import MySQLdb
connection = MySQLdb.connect("localhost", username, password)
exec_script(connection, "script/create_server_db.sql")
@@ -31,6 +31,8 @@ def install_server_db(username, password, sample_data=False):
exec_script(connection, "script/create_server_acct.sql")
+ remove_bind_restriction_prompt()
+
if __name__ == "__main__":
user_input = get_user_input()
@@ -3,6 +3,11 @@
from getpass import getpass
import os
from glob import glob
+import sys
+import re
+
+
+bind_pattern = re.compile(r'^\s*bind-address\s*=\s*(\S+)\s*$')
def abspath(path):
@@ -42,6 +47,15 @@ def exec_scripts(connection, script_pattern, first_paths=[], ignore_paths=[]):
def get_user_input():
+ try:
+ import MySQLdb
+ except ImportError:
+ print "Unable to import MySQLdb. You might try installing it with the command:"
+ print ""
+ print " sudo easy_install MySQL-Python"
+ print ""
+ return None
+
try:
username = raw_input("MySQL user account [default root]: ")
except KeyboardInterrupt:
@@ -63,9 +77,70 @@ def get_user_input():
return username, password, sample_data
+def remove_bind_restriction_prompt():
+ if not sys.platform.startswith('linux'):
+ return
+
+ conf_path = '/etc/mysql/my.cnf'
+ if not os.path.exists(conf_path):
+ return
+
+ bound_to = None
+ conf_file = open(conf_path)
+ for line in conf_file:
+ match = bind_pattern.match(line)
+ if match:
+ # Don't break here, since MySQL uses the last occurrence of
+ # bind-address when determining its own configuration...
+ bound_to = match.group(1)
+ conf_file.close()
+ if bound_to is None:
+ return
+
+ print ""
+ print "According to the config file at: %s" % conf_path
+ print "your MySQL server is currently bound to: %s." % bound_to
+ print ""
+ try:
+ remove_bind = raw_input("Would you like me to unbind it (Y/N)? [default N]: ")
+ except KeyboardInterrupt:
+ return
+ if not remove_bind.strip().upper().startswith("Y"):
+ return
+
+ remove_bind_restriction(conf_path)
+
+
+def remove_bind_restriction(conf_path):
+ conf_path_old = conf_path + '.is4c_backup'
+ try:
+ os.rename(conf_path, conf_path_old)
+ except OSError, error:
+ print error
+ return
+
+ conf_file_old = open(conf_path_old)
+ conf_file = open(conf_path, 'w')
+ for line in conf_file_old:
+ line = line.strip()
+ if bind_pattern.match(line):
+ line = '# ' + line
+ print >> conf_file, line
+ conf_file.close()
+ conf_file_old.close()
+
+ import subprocess
+ try:
+ subprocess.call(['/etc/init.d/mysql', 'restart'])
+ except OSError, error:
+ print "I modified the config file, but couldn't restart the MySQL server:"
+ print error
+
+
__all__ = [
'abspath',
'exec_script',
'exec_scripts',
'get_user_input',
+ 'remove_bind_restriction_prompt',
]
@@ -1,4 +1,4 @@
-use is4c_op;
+use opdata;
INSERT INTO configuration
VALUES
@@ -1,11 +1,7 @@
-use is4c_op;
+use opdata;
INSERT INTO configurationGroups
VALUES
- (
- 0,
- 'setup'
- ),
(
1,
'General'
@@ -39,4 +35,8 @@ INSERT INTO configurationGroups
'Miscellaneous Settings'
);
+UPDATE configurationGroups
+ SET group_id = 0
+ WHERE group_name = 'setup';
+
UNLOCK TABLES;
@@ -1,11 +1,11 @@
-use is4c_op;
-
-DROP TABLE IF EXISTS `configuration`;
+use opdata;
+
+DROP TABLE IF EXISTS `configuration`;
CREATE TABLE `configuration` (
`conf_id` smallint(6) NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
`key` varchar(20) NOT NULL COMMENT 'The configuration key',
- `value` varchar(20) NOT NULL COMMENT 'The configuration value',
+ `value` varchar(60) NOT NULL COMMENT 'The configuration value',
`type` varchar(20) NOT NULL COMMENT 'The type of configuration; text, flag',
`group_id` smallint(6) NOT NULL COMMENT 'The group this configuration item belongs to. A foreign key to the configurationGroups table.',
- KEY `conf_id` (`conf_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ KEY `conf_id` (`conf_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -1,4 +1,4 @@
-use is4c_op;
+use opdata;
DROP TABLE IF EXISTS `configurationGroups`;
CREATE TABLE `configurationGroups` (
@@ -20,9 +20,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*********************************************************************************/
-
-include("ini/ini.php");
+if (!function_exists("get_config_auto")) {
+ include_once("/pos/is4c/lib/conf.php");
+ apply_configurations();
+}
if(!function_exists("pconnect")) include("connect.php");
if(!function_exists("addactivity")) include("additem.php");
Oops, something went wrong.

0 comments on commit 0674448

Please sign in to comment.