diff --git a/sys/windows/widgets/connection_sidebar.php b/sys/windows/widgets/connection_sidebar.php index 7302dce..33bf5d9 100644 --- a/sys/windows/widgets/connection_sidebar.php +++ b/sys/windows/widgets/connection_sidebar.php @@ -7,11 +7,14 @@ * @author Timothy J. Warren * @copyright Copyright (c) 2012 * @link https://github.com/aviat4ion/OpenSQLManager - * @license http://philsturgeon.co.uk/code/dbad-license + * @license http://philsturgeon.co.uk/code/dbad-license */ // -------------------------------------------------------------------------- +/** + * Widget managing saved database connections + */ class Connection_Sidebar extends GtkVBox { protected $settings, $menu, $treeview, $model; @@ -61,7 +64,7 @@ class Connection_Sidebar extends GtkVBox { $this->model = new GtkListStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING); // Render the treeview - $this->_render(); + $this->_render(); // Set up context menu event $this->treeview->connect('button-press-event', array($this, 'on_button')); @@ -70,7 +73,7 @@ class Connection_Sidebar extends GtkVBox { $selection = $this->treeview->get_selection(); $selection->set_mode(GTK::SELECTION_SINGLE); } - + $this->pack_start($this->treeview); $this->pack_start($add_button, FALSE); @@ -96,7 +99,7 @@ class Connection_Sidebar extends GtkVBox { $this->model->set($iter, 0, $db); } } - + // Initialize the treeview with the data $this->treeview = new GtkTreeView($this->model); @@ -113,8 +116,8 @@ class Connection_Sidebar extends GtkVBox { /** * Sets the icon for the current db type - * - * @param GtkTreeView Column $col + * + * @param GtkTreeView Column $col * @param GtkCellRenderer $cell * @param GtkTreeModel $this->model * @param GtkTreeIter $iter @@ -142,7 +145,7 @@ class Connection_Sidebar extends GtkVBox { /** * Sets the label of the current db connection - * + * * @param GtkTreeViewColumn $col * @param GtkCellRenderer $cell * @param GtkTreeModel $this->model @@ -159,7 +162,7 @@ class Connection_Sidebar extends GtkVBox { /** * Returns window for creating a new database connection - * + * * @return Add_DB object */ public function new_conn() @@ -171,7 +174,7 @@ class Connection_Sidebar extends GtkVBox { /** * Event for mouse clicks on connection sidebar - * + * * @param GtkTreeView $view * @param $event * @return void @@ -207,8 +210,8 @@ class Connection_Sidebar extends GtkVBox { /** * Creates and displays a context menu for the selected connection - * - * @param array $pos + * + * @param array $pos * @param object $event * @return void */ @@ -224,7 +227,7 @@ class Connection_Sidebar extends GtkVBox { $this->menu->append($remove); } - + // Popup the menu $this->menu->show_all(); $this->menu->popup(); @@ -240,11 +243,11 @@ class Connection_Sidebar extends GtkVBox { //@todo implement } - // -------------------------------------------------------------------------- + // -------------------------------------------------------------------------- /** * Remove a connection from the connection manager - * + * * @return void */ public function remove_connection($col) @@ -262,7 +265,7 @@ class Connection_Sidebar extends GtkVBox { /** * Add a connection to the connection manager - * + * * @param string $key * @param array $vals * @return void diff --git a/sys/windows/widgets/db_info_widget.php b/sys/windows/widgets/db_info_widget.php index a21eb79..14f2dc4 100644 --- a/sys/windows/widgets/db_info_widget.php +++ b/sys/windows/widgets/db_info_widget.php @@ -7,7 +7,7 @@ * @author Timothy J. Warren * @copyright Copyright (c) 2012 * @link https://github.com/aviat4ion/OpenSQLManager - * @license http://philsturgeon.co.uk/code/dbad-license + * @license http://philsturgeon.co.uk/code/dbad-license */ // -------------------------------------------------------------------------- @@ -19,8 +19,8 @@ class DB_Info_Widget extends GtkTable { protected $conn, $dbtype, $host, $user, $pass, $database, $settings, $db_file, $port; - public function __construct($conn='', $dbtype='', $host='localhost', - $user='', $pass='', $database='', $db_file=NULL, $port='', $conn_db='') + public function __construct($conn='', $dbtype='', $host='localhost', + $user='', $pass='', $db_file=NULL, $port='', $conn_db='') { parent::__construct(); @@ -38,6 +38,7 @@ class DB_Info_Widget extends GtkTable { Gtk::FILE_CHOOSER_ACTION_OPEN); // Populate the available database types + // @todo Select type based on dbtype passed $db_types = $this->get_available_dbs(); foreach($db_types as $t) { @@ -51,6 +52,7 @@ class DB_Info_Widget extends GtkTable { $this->pass->set_text($pass); $this->conn_db->set_text($conn_db); $this->db_file->set_filename($db_file); + $this->port->set_text($port); // Layout the table $this->layout(); @@ -64,7 +66,7 @@ class DB_Info_Widget extends GtkTable { // Reset defaults when changing db types $this->dbtype->connect_simple("changed", array($this, "change_db")); - //Table attach + //Table attach //$tbl->attach(left_start, right_stop, top_start, bottom_stop) // Placeholder vars for y values, so that rows can be @@ -120,10 +122,10 @@ class DB_Info_Widget extends GtkTable { { $add_button = new GtkButton(); $add_button->set_label("Add Connnection"); - $add_button->set_image(GTKImage::new_from_stock(GTK::STOCK_ADD, - Gtk::ICON_SIZE_SMALL_TOOLBAR)); + $add_button->set_image(GTKImage::new_from_stock(GTK::STOCK_ADD, + Gtk::ICON_SIZE_SMALL_TOOLBAR)); $this->attach($add_button, 0, 1, ++$y1, ++$y2); - $add_button->connect_simple("clicked", array($this, 'db_add')); + $add_button->connect_simple("clicked", array($this, 'db_add')); } // Test connection button @@ -137,7 +139,7 @@ class DB_Info_Widget extends GtkTable { /** * Set defaults for new database type - * + * * @return void */ public function change_db() @@ -219,7 +221,7 @@ class DB_Info_Widget extends GtkTable { $this->settings->add_db($this->conn->get_text(), $data); // Pass to connection sidebar to update - + // Destroy the parent window $parent_window =& $this->get_parent_window(); @@ -249,9 +251,9 @@ class DB_Info_Widget extends GtkTable { return; } - // Catch connection exceptions, and + // Catch connection exceptions, and // display the error message to the - // user so they can edit the db + // user so they can edit the db // parameters try { @@ -262,7 +264,7 @@ class DB_Info_Widget extends GtkTable { error("Error connecting to database: \n\n" . $e->getMessage()); return; } - + // Successful Connection? // Tell the user! alert("Successfully Connected."); @@ -270,7 +272,7 @@ class DB_Info_Widget extends GtkTable { /** * Checks what database drivers are available - * + * * @return array */ public function get_available_dbs() @@ -322,7 +324,7 @@ class DB_Info_Widget extends GtkTable { /** * Simple helper function for adding a row to the GtkTable - * + * * @param GtkTable &$table * @param string $label * @param string $vname @@ -345,7 +347,7 @@ class DB_Info_Widget extends GtkTable { /** * Filter input based on the requirements of the specified database - * + * * @return bool */ private function _validate()