Permalink
Browse files

Auto-expanding textareas.

  • Loading branch information...
1 parent 2812ecf commit e0ad23eed9993ad94d305d08e13d4dc0a7d33f3d calvinlough committed Sep 2, 2008
Showing with 67 additions and 20 deletions.
  1. +1 −1 ajaximportfile.php
  2. +4 −8 css/common.css
  3. +1 −0 dboverview.php
  4. +5 −4 functions.php
  5. +3 −3 includes/browse.php
  6. +1 −1 includes/sql.php
  7. +2 −1 js/core.js
  8. +43 −0 js/helpers.js
  9. +2 −1 login.php
  10. +5 −1 query.php
View
@@ -168,7 +168,7 @@ function stripCommentLines($in)
if (isset($mysqlErrors))
{
- $message .= __("MySQL reported the following errors") . ":<br />";
+ $message .= __("The following errors were reported") . ":<br />";
foreach ($mysqlErrors as $merr)
{
$message .= " - " . $merr . "<br />";
View
@@ -59,6 +59,10 @@ padding: 2px;
font-size: 13px;
width: 175px;
}
+textarea {
+height: 50px;
+line-height: 15px;
+}
select {
font-size: 12px;
}
@@ -370,7 +374,6 @@ width: 325px;
}
.insert textarea {
width: 325px;
-height: 150px;
}
.insertseperator {
width: 348px;
@@ -451,12 +454,6 @@ width: 475px;
.hometable p {
line-height: 15px;
}
-.hometable textarea {
-width: 425px;
-height: 40px;
-font-size: 12px;
-display: block;
-}
#userprivs td, #adminprivs td {
padding: 1px 0 !important;
@@ -730,7 +727,6 @@ margin-bottom: -1px;
#QUERY {
width: 550px;
-height: 60px;
font-size: 12px;
display: block;
margin: 2px 0 0;
View
@@ -552,6 +552,7 @@
<td colspan="3">
<label><input type="checkbox" name="NOTNULL" onchange="updateFieldName(this)"><?php echo __("Not Null"); ?></label>
<label><input type="checkbox" name="UNIQUE" onchange="updateFieldName(this)"><?php echo __("Unique"); ?></label>
+ <label><input type="checkbox" name="AUTO" onchange="updateFieldName(this)"><?php echo __("Auto Increment"); ?></label>
</td>
</tr>
<?php
View
@@ -216,11 +216,12 @@ function outputPage($title = "")
<head>
<title>SQL Buddy</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/common.css"); ?>" />
- <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/navigation.css"); ?>" />
- <link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/main.css"); ?>" />
+ <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/common.css"); ?>" media="all" />
+ <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/navigation.css"); ?>" media="all" />
+ <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/print.css"); ?>" media="print" />
+ <link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/main.css"); ?>" media="all" />
<!--[if lte IE 7]>
- <link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/ie.css"); ?>" />
+ <link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/ie.css"); ?>" media="all" />
<![endif]-->
<script type="text/javascript" src="<?php echo smartCaching("js/mootools-1.2-core.js"); ?>"></script>
<script type="text/javascript" src="<?php echo smartCaching("js/helpers.js"); ?>"></script>
View
@@ -55,7 +55,7 @@
$queryStartTime = microtime_float();
$dataSql = $conn->query($q) or ($mysqlError[] = $conn->error());
$queryFinishTime = microtime_float();
- $queryTime = round($queryFinishTime - $queryStartTime, 4);
+ $queryTime += round($queryFinishTime - $queryStartTime, 4);
if (@$conn->affectedRows())
{
@@ -111,7 +111,7 @@
if (isset($mysqlError))
{
- echo '<div class="errormessage" style="margin-left: 5px; width: 536px"><strong>' . __("MySQL reported the following errors") . ':</strong>';
+ echo '<div class="errormessage" style="margin-left: 5px; width: 536px"><strong>' . __("The following errors were reported") . ':</strong>';
foreach ($mysqlError as $error)
{
echo $error . "<br />";
@@ -194,7 +194,7 @@
if ($bnav == $currentPage)
echo ' class="selected"';
- echo ' onclick="browseNav(' . (($bnav - 1) * $perPage) . ',' . $view . ')">' . $bnav . '</a>';
+ echo ' onclick="browseNav(' . (($bnav - 1) * $perPage) . ',' . $view . ')">' . number_format($bnav) . '</a>';
}
}
View
@@ -391,7 +391,7 @@ function getMetadata()
{
$output .= '{';
$output .= '"name":"' . $table['TABLE_NAME'] . '",';
- $output .= '"rowcount":' . ($table['TABLE_ROWS'] > 0 ? $table['TABLE_ROWS'] : '0');
+ $output .= '"rowcount":' . ($table['TABLE_ROWS'] > 0) ? $table['TABLE_ROWS'] : '0';
$output .= '},';
}
$output = substr($output, 0, -1);
View
@@ -62,7 +62,8 @@ window.addEvent("domready", function()
viewportSize = [winWidth, winHeight];
sizePage();
}
- }).periodical(150);
+ }).periodical(175);
+ (function(){ autoExpandTextareas(); }).periodical(500);
});
function Page()
View
@@ -977,6 +977,8 @@ function getFieldSummary(elem, withFormatting)
fieldBuild += " not null";
if (f(key))
fieldBuild += " " + key + " key";
+ if (f(auto))
+ fieldBuild += " autoincrement";
if (f(unique))
fieldBuild += " unique";
if (f(defaultval))
@@ -1434,4 +1436,45 @@ function returnQuote()
{
return "`";
}
+}
+
+function autoExpandTextareas()
+{
+ var taList = document.getElementsByTagName("textarea");
+ if (taList.length > 0)
+ {
+ var sizeDiv = new Element('div', {
+ id: "sizeDiv",
+ styles: {
+ visibility: "hidden",
+ position: "absolute",
+ lineHeight: "15px",
+ fontSize: "13px",
+ padding: "2px"
+ }
+ });
+ document.body.appendChild(sizeDiv);
+
+ for (var i=0; i<taList.length; i++)
+ {
+ var theDiv = $("sizeDiv");
+ theDiv.style.width = taList[i].clientWidth + "px";
+ theDiv.set('html', taList[i].value.replace(/\n/g,'<br />') + '&nbsp;');
+
+ var newHeight = theDiv.clientHeight + 5;
+
+ if (newHeight < 50)
+ {
+ newHeight = 50;
+ }
+ else if (newHeight > 300)
+ {
+ newHeight = 300;
+ }
+
+ taList[i].style.height = newHeight + "px";
+ }
+
+ document.body.removeChild(sizeDiv);
+ }
}
View
@@ -72,7 +72,7 @@
$redirect .= "/" . $pathSplit[$i];
}
- if ($_SERVER['HTTPS'] == "on")
+ if (array_key_exists("HTTPS", $_SERVER) && $_SERVER['HTTPS'] == "on")
{
$protocol = "https://";
}
@@ -103,6 +103,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/common.css"); ?>" />
<link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/navigation.css"); ?>" />
+ <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/print.css"); ?>" media="print" />
<link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/main.css"); ?>" />
<!--[if lte IE 7]>
<link type="text/css" rel="stylesheet" href="<?php echo outputThemeFile("css/ie.css"); ?>" />
View
@@ -34,10 +34,14 @@
{
$displayQuery = $query;
}
-else if (isset($db) && isset($table))
+else if (isset($db) && isset($table) && $conn->getAdapter() == "mysql")
{
$displayQuery = "SELECT * FROM `$table` LIMIT 100";
}
+else if (isset($db) && isset($table) && $conn->getAdapter() == "sqlite")
+{
+ $displayQuery = "SELECT * FROM '$table' LIMIT 100";
+}
?>

0 comments on commit e0ad23e

Please sign in to comment.