Minor fixes to statement, services and internal things

Many misc updates
This commit is contained in:
Deon George
2011-10-14 16:44:12 +11:00
parent 7876a16413
commit 56c11507f4
71 changed files with 2192 additions and 677 deletions

View File

@@ -36,7 +36,6 @@ class lnApp_Script extends HTMLRender {
$i = $j = 0;
foreach (static::$_data as $value) {
switch ($value['type']) {
case 'file':
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));

View File

@@ -22,9 +22,9 @@ class lnApp_Sort {
*/
public static function MAsort(&$data,$sortby,$rev=0) {
// if the array to sort is null or empty, or our sortby is bad
if (! preg_match('/^[a-zA-Z0-9_]+(\([a-zA-Z0-9_,]*\))?$/',$sortby) || ! $data)
if (! preg_match('/^([a-zA-Z0-9_]+(\([a-zA-Z0-9_,]*\)(->[a-zA-Z0-9])?)?,?)+$/',$sortby) || ! $data)
return;
$code = '$c=0;';
foreach (explode(',',$sortby) as $key) {
@@ -83,7 +83,7 @@ class lnApp_Sort {
$code .= 'return $c;';
$result = create_function('$a, $b',$code);
uasort($data,$result);
}
}

View File

@@ -30,25 +30,27 @@ class lnApp_Style extends HTMLRender {
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
$foutput = $soutput = '';
$mediapath = Route::get(static::$_media_path);
$i = 0;
$i = $j = 0;
foreach (static::$_data as $value) {
if ($i++)
$output .= static::$_spacer;
switch ($value['type']) {
case 'file':
$output .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
$foutput .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
break;
case 'stdin':
$soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']);
if ($j++)
$soutput .= static::$_spacer;
break;
default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
}
}
return $output;
return $foutput.static::$_spacer.$soutput;
}
}
?>

View File

@@ -31,13 +31,18 @@ class lnApp_Table {
return '';
$pag = NULL;
$view = $output = '';
$view = $output = $button = '';
if (isset($option['type']) AND $option['type'])
switch ($option['type']) {
case 'select':
$view = 'table/select';
if (! empty($option['button']))
$button = implode('',$option['button']);
else
$button = '<input type="submit" name="Submit" value="View/Edit" class="form_button"/>';
Script::add(array(
'type'=>'stdin',
'data'=>'
@@ -156,6 +161,10 @@ $(document).ready(function() {
'));
$output .= Form::open((isset($option['form']) ? $option['form'] : ''));
if (! empty($option['hidden']))
$output .= '<div>'.implode('',$option['hidden']).'</div>';
break;
case 'list':
@@ -226,7 +235,8 @@ $(document).ready(function() {
->set('count',$i-$rows)
->set('other',$other);
$output .= View::factory($view.'_foot');
$output .= View::factory($view.'_foot')
->set('button',$button);
if (isset($option['type']) AND $option['type'])
switch ($option['type']) {