Fixed table presentations with new bootstrap, added HTML::abbr(), added public access to Database::config(), enabled DB compression to be disabled in database.php
This commit is contained in:
parent
113597f9eb
commit
8f659c50c6
@ -12,7 +12,14 @@
|
|||||||
* @license http://dev.leenooks.net/license.html
|
* @license http://dev.leenooks.net/license.html
|
||||||
*/
|
*/
|
||||||
abstract class lnApp_Database extends Kohana_Database {
|
abstract class lnApp_Database extends Kohana_Database {
|
||||||
public function caching() {
|
/**
|
||||||
return $this->_config['caching'];
|
* Return a database configuration setting
|
||||||
|
*
|
||||||
|
* @param string Configuration value to return
|
||||||
|
* @return string|NULL Value of setting or NULL if it doesnt exist
|
||||||
|
*/
|
||||||
|
public function config($key) {
|
||||||
|
return isset($this->_config[$key]) ? $this->_config[$key] : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
@ -27,11 +27,11 @@ abstract class lnApp_Form extends Kohana_Form {
|
|||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$output .= '<div class="form-group">';
|
$output .= '<div class="input-group">';
|
||||||
|
|
||||||
// Only need col-md for horizonal forms?
|
// Only need col-md for horizonal forms?
|
||||||
if (isset($attributes['label'])) {
|
if (isset($attributes['label'])) {
|
||||||
$output .= Form::label($name,$attributes['label'],array('class'=>'col-md-2 control-label'));
|
$output .= Form::label($name,$attributes['label'],array('class'=>'control-label'));
|
||||||
unset($attributes['label']);
|
unset($attributes['label']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,26 @@
|
|||||||
abstract class lnApp_HTML extends Kohana_HTML {
|
abstract class lnApp_HTML extends Kohana_HTML {
|
||||||
public static $windowed_urls = TRUE;
|
public static $windowed_urls = TRUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limit the number of characters that some text takes up.
|
||||||
|
* If the Text is smaller than the number of characters to display, then it is
|
||||||
|
* displayed normally.
|
||||||
|
*
|
||||||
|
* @param string Text to re-format
|
||||||
|
* @param int Number of characters to display
|
||||||
|
*/
|
||||||
|
public static function abbr($string,$chars=0) {
|
||||||
|
if (! $chars OR strlen($string)<=$chars)
|
||||||
|
return $string;
|
||||||
|
|
||||||
|
return sprintf('<abbr title="%s">%s</abbr>',$string,Text::limit_chars($string,$chars));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the string is blank, then return &nbsp;
|
||||||
|
*
|
||||||
|
* @param string Text to print.
|
||||||
|
*/
|
||||||
public static function nbsp($string) {
|
public static function nbsp($string) {
|
||||||
if (strlen((string)$string))
|
if (strlen((string)$string))
|
||||||
return $string;
|
return $string;
|
||||||
|
@ -95,10 +95,11 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve and Store DB BLOB data in compressed format.
|
* Retrieve and Store DB BLOB data in compressed format.
|
||||||
|
* Compression can be disabled by setting dbcompress in the database config to FALSE
|
||||||
*/
|
*/
|
||||||
private function _blob($data,$set=FALSE) {
|
private function _blob($data,$set=FALSE) {
|
||||||
try {
|
try {
|
||||||
return $set ? gzcompress($this->_serialize($data,$set)) : $this->_serialize(gzuncompress($data));
|
return $set ? ($this->_db->config('compress') ? gzcompress($this->_serialize($data,$set)) : $this->_serialize($data,$set)) : $this->_serialize(gzuncompress($data));
|
||||||
|
|
||||||
// Maybe the data isnt compressed?
|
// Maybe the data isnt compressed?
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -309,138 +309,6 @@ $(document).ready(function() {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @deprecated
|
|
||||||
public static function display($data,$rows,array $cols,array $option) {
|
|
||||||
$prepend = $headers = array();
|
|
||||||
|
|
||||||
foreach ($cols as $k=>$v) {
|
|
||||||
if (isset($v['label']))
|
|
||||||
$headers[$k] = $v['label'];
|
|
||||||
if (isset($v['url']))
|
|
||||||
$prepend[$k] = array('url'=>$v['url']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::factory()
|
|
||||||
->data($data)
|
|
||||||
->jssort(TRUE)
|
|
||||||
->page_items($rows)
|
|
||||||
->columns($headers)
|
|
||||||
->prepend($prepend);
|
|
||||||
|
|
||||||
/*
|
|
||||||
// This JS is failing, any pressing of select all, unselect all, toggle is propaging up and submitting the form
|
|
||||||
|
|
||||||
Script::factory()
|
|
||||||
->type('stdin')
|
|
||||||
->data('
|
|
||||||
(function($) {
|
|
||||||
// Enable Range Selection
|
|
||||||
$.fn.enableCheckboxRangeSelection = function() {
|
|
||||||
var lastCheckbox = null;
|
|
||||||
var followOn = 0;
|
|
||||||
var $spec = this;
|
|
||||||
$spec.bind("click", function(e) {
|
|
||||||
if (lastCheckbox != null && e.shiftKey) {
|
|
||||||
x = y = 0;
|
|
||||||
if (followOn != 0) {
|
|
||||||
if ($spec.index(lastCheckbox) < $spec.index(e.target)) {
|
|
||||||
x = 1 - ((followOn == 1) ? 1 : 0);
|
|
||||||
} else {
|
|
||||||
y = 1 - ((followOn == -1) ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$spec.slice(
|
|
||||||
Math.min($spec.index(lastCheckbox) - x, $spec.index(e.target)) + 1,
|
|
||||||
Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + y
|
|
||||||
).attr("checked",function() { return ! this.checked; })
|
|
||||||
.parent().parent().toggleClass("selected");
|
|
||||||
|
|
||||||
followOn = ($spec.index(lastCheckbox) < $spec.index(e.target)) ? 1 : -1;
|
|
||||||
} else {
|
|
||||||
followOn = 0;
|
|
||||||
}
|
|
||||||
lastCheckbox = e.target;
|
|
||||||
});
|
|
||||||
|
|
||||||
return $spec;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Enable Toggle, (De)Select All
|
|
||||||
$.fn.check = function(mode) {
|
|
||||||
// if mode is undefined, use "on" as default
|
|
||||||
var mode = mode || "on";
|
|
||||||
|
|
||||||
switch(mode) {
|
|
||||||
case "on":
|
|
||||||
$("#select-table tr:not(.head)")
|
|
||||||
.filter(":has(:checkbox:not(checked))")
|
|
||||||
.toggleClass("selected")
|
|
||||||
break;
|
|
||||||
case "off":
|
|
||||||
$("#select-table tr:not(.head)")
|
|
||||||
.filter(":has(:checkbox:checked)")
|
|
||||||
.toggleClass("selected")
|
|
||||||
break;
|
|
||||||
case "toggle":
|
|
||||||
$("#select-table tr:not(.head)")
|
|
||||||
.toggleClass("selected");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.each(function(e) {
|
|
||||||
switch(mode) {
|
|
||||||
case "on":
|
|
||||||
this.checked = true;
|
|
||||||
break;
|
|
||||||
case "off":
|
|
||||||
this.checked = false;
|
|
||||||
break;
|
|
||||||
case "toggle":
|
|
||||||
this.checked = !this.checked;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
// Bind our actions
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#select-table :checkbox").enableCheckboxRangeSelection();
|
|
||||||
$("#select-menu > #toggle").bind("click",function() {
|
|
||||||
$("#select-table :checkbox").check("toggle");
|
|
||||||
});
|
|
||||||
$("#select-menu > #all_on").bind("click",function() {
|
|
||||||
$("#select-table :checkbox").check("on");
|
|
||||||
});
|
|
||||||
$("#select-menu > #all_off").bind("click",function() {
|
|
||||||
$("#select-table :checkbox").check("off");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Click to select Row
|
|
||||||
$("#select-table tr:not(.head)")
|
|
||||||
.filter(":has(:checkbox:checked)")
|
|
||||||
.addClass("selected")
|
|
||||||
.end()
|
|
||||||
.click(function(e) {
|
|
||||||
$(this).toggleClass("selected");
|
|
||||||
if (e.target.type !== "checkbox") {
|
|
||||||
$(":checkbox", this).attr("checked", function() {
|
|
||||||
return !this.checked;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Double click to select a row
|
|
||||||
$("#select-table tr:not(.head)")
|
|
||||||
.dblclick(function(e) {
|
|
||||||
window.location = $("a", this).attr("href");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
');
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// This enables us to page through many selected items
|
// This enables us to page through many selected items
|
||||||
// @todo This is currently not usable, since our JS above needs to be fixed to work with tablesorter
|
// @todo This is currently not usable, since our JS above needs to be fixed to work with tablesorter
|
||||||
public static function page($key) {
|
public static function page($key) {
|
||||||
|
@ -26,7 +26,7 @@ var search = _.debounce(function(url,query,process){
|
|||||||
cache : false,
|
cache : false,
|
||||||
beforeSend : function() {
|
beforeSend : function() {
|
||||||
if (c++ == 0)
|
if (c++ == 0)
|
||||||
$('img[name=searching]').css('visibility', 'visible');
|
$('i[name=searching]').removeClass("hidden");
|
||||||
},
|
},
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
// if json is null, means no match, won't do again.
|
// if json is null, means no match, won't do again.
|
||||||
@ -47,7 +47,7 @@ var search = _.debounce(function(url,query,process){
|
|||||||
},
|
},
|
||||||
complete : function() {
|
complete : function() {
|
||||||
if (--c == 0)
|
if (--c == 0)
|
||||||
$('img[name=searching]').css('visibility', 'hidden');
|
$('i[name=searching]').addClass("hidden");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -1218,27 +1218,6 @@ a.list-group-item.active > .badge,
|
|||||||
/*------------------------------------------------------------------
|
/*------------------------------------------------------------------
|
||||||
[ Pagination / .pagination ]
|
[ Pagination / .pagination ]
|
||||||
*/
|
*/
|
||||||
ul.pagination li a {
|
|
||||||
padding: 0 10px;
|
|
||||||
margin-right: .25em;
|
|
||||||
margin-left: .25em;
|
|
||||||
color: #444;
|
|
||||||
line-height: 32px;
|
|
||||||
border-top-right-radius: 5px;
|
|
||||||
border-top-left-radius: 5px;
|
|
||||||
border-bottom-right-radius: 5px;
|
|
||||||
border-bottom-left-radius: 5px;
|
|
||||||
}
|
|
||||||
ul.pagination li.active a {
|
|
||||||
font-weight: 600;
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
|
||||||
background-color: #F90;
|
|
||||||
border-color: #F90;
|
|
||||||
}
|
|
||||||
ul.pagination li.active a:hover {
|
|
||||||
background-color: #F90;
|
|
||||||
border-color: #F90;
|
|
||||||
}
|
|
||||||
.pager li {
|
.pager li {
|
||||||
margin-right: .25em;
|
margin-right: .25em;
|
||||||
margin-left: .25em;
|
margin-left: .25em;
|
||||||
|
@ -82,18 +82,24 @@ table .text-right {
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
.form-group [class*=" fa-spin"] {
|
||||||
|
margin-left: -35px;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar .navbar-form .navbar-search-addon [class*=" fa-spin"] {
|
||||||
|
padding: 10px 10px;
|
||||||
|
pointer-events: none;
|
||||||
|
right: 0px;
|
||||||
|
margin-top: 0px;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
.navbar .navbar-form .navbar-search-addon i {
|
.navbar .navbar-form .navbar-search-addon i {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.navbar .navbar-form .navbar-search-addon img {
|
|
||||||
position: absolute;
|
|
||||||
padding: 6px 10px;
|
|
||||||
pointer-events: none;
|
|
||||||
right: 0px;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
@ -102,3 +108,13 @@ table .text-right {
|
|||||||
ul.typeahead.dropdown-menu {
|
ul.typeahead.dropdown-menu {
|
||||||
min-width: 560px;
|
min-width: 560px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
legend [class^="fa-"],
|
||||||
|
legend [class*=" fa-"] {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: -3px;
|
||||||
|
width: 25px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #555;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<div class="pager pagination-centered">
|
<nav>
|
||||||
<ul>
|
<div class="text-center">
|
||||||
|
<ul class="pagination">
|
||||||
<li class="<?php echo $x=($page->first_page() !== FALSE) ? '' : 'disabled' ?>">
|
<li class="<?php echo $x=($page->first_page() !== FALSE) ? '' : 'disabled' ?>">
|
||||||
<a href="<?php echo $x ? '#' :HTML::chars($page->url($page->first_page())) ?>" rel="first"><?php echo __('First') ?></a>
|
<a href="<?php echo $x ? '#' :HTML::chars($page->url($page->first_page())) ?>" rel="first"><?php echo __('First') ?></a>
|
||||||
</li>
|
</li>
|
||||||
@ -24,3 +25,4 @@
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</nav>
|
||||||
|
@ -48,8 +48,9 @@ if ($use_n6)
|
|||||||
for ($i = $n7; $i <= $n8; $i++)
|
for ($i = $n7; $i <= $n8; $i++)
|
||||||
$links[$i] = $i;
|
$links[$i] = $i;
|
||||||
?>
|
?>
|
||||||
<div class="pagination pagination-centered">
|
<nav>
|
||||||
<ul>
|
<div class="text-center">
|
||||||
|
<ul class="pagination">
|
||||||
<li class="<?php echo $x=($page->first_page() !== FALSE) ? '' : 'disabled' ?>">
|
<li class="<?php echo $x=($page->first_page() !== FALSE) ? '' : 'disabled' ?>">
|
||||||
<a href="<?php echo $x ? '#' :HTML::chars($page->url($page->first_page())) ?>" rel="first"><?php echo __('First') ?></a>
|
<a href="<?php echo $x ? '#' :HTML::chars($page->url($page->first_page())) ?>" rel="first"><?php echo __('First') ?></a>
|
||||||
</li>
|
</li>
|
||||||
@ -74,3 +75,4 @@ for ($i = $n7; $i <= $n8; $i++)
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</nav>
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
<table class="table table-striped table-condensed table-hover" id="list-table<?php echo $jssort ? '-'.$jssort : ''; ?>">
|
<table class="table table-striped table-condensed table-hover" id="list-table<?php echo $jssort ? '-'.$jssort : ''; ?>">
|
||||||
<thead><tr><th><?php echo implode('</th><th>',$th); ?></th></tr></thead>
|
<thead><tr><th><?php echo implode('</th><th>',$th); ?></th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?php if ($td) : ?>
|
||||||
<?php foreach ($td as $details) : ?>
|
<?php foreach ($td as $details) : ?>
|
||||||
<tr><td><?php echo implode('</td><td>',$details['val']); ?></td></tr>
|
<tr><td><?php echo implode('</td><td>',$details['val']); ?></td></tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php if ($other) : ?>
|
<?php if ($other) : ?>
|
||||||
<tr><td>Other</td><td colspan="<?php #echo count($data)-1; ?>"><?php #printf('(%s) %s',$count,$other); ?></td></tr>
|
<tr><td>Other</td><td colspan="<?php #echo count($data)-1; ?>"><?php #printf('(%s) %s',$count,$other); ?></td></tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<tr><td colspan="<?php echo count($th); ?>">NO records.</td></tr>
|
||||||
|
<?php endif ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?php echo Site::Appname(); ?></title>
|
<title><?php echo Site::Appname(); ?></title>
|
||||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/media/img/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||||
|
|
||||||
@ -51,6 +51,7 @@
|
|||||||
<div class="navbar-search-addon form-group">
|
<div class="navbar-search-addon form-group">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
<input type="text" autocomplete="off" name="search-query" class="form-control input-sm search-query" placeholder="Search" data-provide="typeahead">
|
<input type="text" autocomplete="off" name="search-query" class="form-control input-sm search-query" placeholder="Search" data-provide="typeahead">
|
||||||
|
<i class="fa fa-spinner fa-spin hidden" name="searching"></i>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?php echo Site::Appname(); ?></title>
|
<title><?php echo Site::Appname(); ?></title>
|
||||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/media/img/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user