gui improvements

This commit is contained in:
SJ 2013-08-01 22:28:42 +02:00
parent b563658a37
commit a10040ea1c
16 changed files with 40 additions and 26 deletions

View File

@ -19,7 +19,9 @@ class ControllerSearchRemove extends Controller {
$this->load->model('search/message');
$this->load->model('user/user');
$this->data['terms'] = $this->model_search_search->remove_search_terms();
if(isset($this->request->get['ts'])) {
$this->data['terms'] = $this->model_search_search->remove_search_term($this->request->get['ts']);
}
}
}

View File

@ -90,9 +90,9 @@ class ModelHealthHealth extends Model {
if(isset($p[5]) && in_array($p[5], $partitions)) {
$shortinfo[] = array(
'partition' => $p[5],
'freespace' => nice_size(1000*$p[3]),
'total' => nice_size(1000*$p[1]),
'used' => nice_size(1000*$p[2]),
'freespace' => $p[3],
'total' => $p[1],
'used' => $p[2],
'utilization' => preg_replace("/\%/", "", $p[4])
);
}

View File

@ -142,6 +142,8 @@ class ModelSaasCustomer extends Model
public function get_online_users() {
$query = $this->db->query("DELETE FROM " . TABLE_ONLINE . " WHERE last_activity < ?", array(NOW - 3600));
$query = $this->db->query("SELECT * FROM " . TABLE_ONLINE . " ORDER BY username ASC");
return $query->rows;

View File

@ -269,7 +269,7 @@ class ModelSearchSearch extends Model {
$data['any'] = $this->fixup_sphinx_operators($data['any']);
$data['any'] = $this->fix_email_address_for_sphinx($data['any']);
$fields = '';
if($match) { $match = "($match) & "; $fields = '@subject,@body '; } $match .= "($fields " . $data['any'] . ") ";
if($match) { $match = "($match) & "; } $match .= "(@subject " . $data['any'] . " | @body " . $data['any'] . ") ";
}
@ -759,7 +759,7 @@ class ModelSearchSearch extends Model {
public function get_search_terms() {
$query = $this->db->query("SELECT term FROM " . TABLE_SEARCH . " WHERE email=? ORDER BY ts DESC", array($_SESSION['email']));
$query = $this->db->query("SELECT term, ts FROM " . TABLE_SEARCH . " WHERE email=? ORDER BY ts DESC", array($_SESSION['email']));
if(isset($query->rows)) { return $query->rows; }
return array();
@ -792,8 +792,8 @@ class ModelSearchSearch extends Model {
}
public function remove_search_terms() {
$query = $this->db->query("DELETE FROM " . TABLE_SEARCH . " WHERE email=?", array($_SESSION['email']));
public function remove_search_term($ts = 0) {
$query = $this->db->query("DELETE FROM " . TABLE_SEARCH . " WHERE email=? AND ts=?", array($_SESSION['email'], $ts));
}

View File

@ -221,17 +221,15 @@ var Piler =
},
remove_saved_search_terms:function(msg)
remove_saved_search_term:function(ts)
{
Piler.log("[load_saved_search_terms]");
Piler.log("[remove_saved_search_term]");
jQuery.ajax('/index.php?route=search/remove', {})
.done(function(a) {
$('#mailcontframe').html(a);
})
jQuery.ajax('/index.php?route=search/remove&ts=' + ts, {})
.done(function(a) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
Piler.show_message('messagebox1', msg, 0.85);
Piler.load_saved_search_terms();
},
@ -949,6 +947,19 @@ var Piler =
reload_page: function()
{
location.reload(true);
},
go_to_default_page: function()
{
document.location.href = 'search.php';
},
change_box_colour: function()
{
var colour = $('#colour').val();
$('#cp').css('background', colour);
}

View File

@ -63,7 +63,6 @@
<ul class="dropdown-menu">
<li><a href="#" onclick="Piler.saved_search_terms('<?php print $text_saved; ?>');"><?php print $text_save; ?></a></li>
<li><a href="#" onclick="Piler.load_saved_search_terms();"><?php print $text_load; ?></a></li>
<li><a href="#" onclick="Piler.remove_saved_search_terms('<?php print $text_successfully_removed; ?>');"><?php print $text_remove; ?></a></li>
</ul>
</div>
</div>

View File

@ -47,7 +47,7 @@
<div class="control-group">
<label class="control-label" for="colour"><?php print $text_colour; ?>:</label>
<div class="controls">
<input type="text" class="text" name="colour" id="colour" placeholder="" value="<?php if(isset($a['colour'])) { print $a['colour']; } ?>" /> <?php if(isset($a['colour'])) { ?><span style="background: <?php print $a['colour']; ?>;">&nbsp;&nbsp;&nbsp;</span><?php } ?>
<input type="text" class="text" name="colour" id="colour" placeholder="" value="<?php if(isset($a['colour'])) { print $a['colour']; } ?>" oninput="Piler.change_box_colour();" /> <span id="cp" style="<?php if(isset($a['colour'])) { ?>background: <?php print $a['colour']; ?>;<?php } ?>">&nbsp;&nbsp;&nbsp;</span>
</div>
</div>

View File

@ -45,7 +45,7 @@
<tr>
<th><?php print $text_disk_usage; ?></th>
<td><?php foreach($shortdiskinfo as $partition) { ?><span class="<?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print $partition['used']; ?> / <?php print $partition['total']; ?> (<?php print $partition['utilization']; ?>%</span>)<br /> <?php } ?></td>
<td><?php foreach($shortdiskinfo as $partition) { ?><span class="<?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print nice_size(1000*$partition['used']); ?> / <?php print nice_size($partition['total']); ?> (<?php print $partition['utilization']; ?>%)</span><br /> <?php } ?></td>
</tr>
<tr>

View File

@ -10,7 +10,7 @@
if(isset($s['search'])) {
?>
<tr>
<td><a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urlencode($term['term']); ?>');"><?php print $s['search']; ?></a></td>
<td><a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urlencode($term['term']); ?>');"><?php print $s['search']; ?></a> | <a href="#" class="menulink" onclick="Piler.remove_saved_search_term(<?php print $term['ts']; ?>); return false;"><?php print $text_remove; ?></a></td>
<td>&nbsp;</td>
</tr>
<?php } } ?>

View File

@ -87,7 +87,7 @@
<div class="control-group">
<div class="controls">
<input type="submit" value="<?php print $text_set; ?>" class="btn btn-primary" /> <input type="reset" value="<?php print $text_cancel; ?>" class="btn btn" />
<input type="submit" value="<?php print $text_set; ?>" class="btn btn-primary" /> <input type="reset" value="<?php print $text_cancel; ?>" class="btn btn" onclick="Piler.go_to_default_page();" />
</div>
</div>

View File

@ -70,6 +70,7 @@
.resultrow.odd { background: #f5f5f5; }
.resultrow.new { font-style: normal; }
.resultrow.new a { color: #0072e6; }
.resultrow.center a { color: #0072e6; }
.resultrow.new a.spam { color: #aaa; }
.resultrow.selected { border: 2px solid black; }
.resultrow.spam { color: #aaa; }
@ -93,6 +94,7 @@
.auditcell.header { height: 30px; font: bold 12px Arial, sans-serif; color: black; }
a.auditlink { color: #0072e6; }
.menulink { color: #0072e6; }
#health1 { display: table-cell; margin-top: 10px; margin-bottom: 0; }
#health2 { display: table-cell; text-align: right; }

View File

@ -55,8 +55,6 @@
<button class="btn" onclick="Piler.cancel(); return false;"><?php print $text_cancel; ?></button>
<button class="btn " onclick="Piler.saved_search_terms('<?php print $text_saved; ?>'); return false;"><?php print $text_save; ?></button>
<button class="btn btn-inverse" onclick="Piler.load_saved_search_terms(); return false;"><?php print $text_load; ?></button>
<button class="btn" onclick="Piler.remove_saved_search_terms('<?php print $text_successfully_removed; ?>'); return false;"><?php print $text_remove; ?></button>
</form>
<?php print $popup; ?>

View File

@ -47,7 +47,7 @@
<div class="control-group">
<label class="control-label" for="colour"><?php print $text_colour; ?>:</label>
<div class="controls">
<input type="text" class="text" name="colour" id="colour" placeholder="" value="<?php if(isset($a['colour'])) { print $a['colour']; } ?>" /> <?php if(isset($a['colour'])) { ?><span style="background: <?php print $a['colour']; ?>;">&nbsp;&nbsp;&nbsp;</span><?php } ?>
<input type="text" class="text" name="colour" id="colour" placeholder="" value="<?php if(isset($a['colour'])) { print $a['colour']; } ?>" oninput="Piler.change_box_colour();" /> <span id="cp" style="<?php if(isset($a['colour'])) { ?>background: <?php print $a['colour']; ?>;<?php } ?>">&nbsp;&nbsp;&nbsp;</span>
</div>
</div>

View File

@ -72,7 +72,7 @@
<div class="row">
<div class="cellhealthleft"><?php print $text_disk_usage; ?></div>
<div class="cellhealthright"><?php foreach($shortdiskinfo as $partition) { ?><span class="bold <?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print $partition['used']; ?> / <?php print $partition['total']; ?> (<?php print $partition['utilization']; ?>%</span>)<br /><?php } ?></div>
<div class="cellhealthright"><?php foreach($shortdiskinfo as $partition) { ?><span class="bold <?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print nice_size(1000*$partition['used']); ?> / <?php print nice_size($partition['total']); ?> (<?php print $partition['utilization']; ?>%)</span><br /><?php } ?></div>
</div>
<div class="row">

View File

@ -18,7 +18,7 @@
if(isset($s['search']) && $s['search']) {
?>
<div class="resultrow center">
<a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urlencode($term['term']); ?>');"><?php print $s['search']; ?></a></br />
<a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urlencode($term['term']); ?>');"><?php print $s['search']; ?></a> | <a href="#" class="menulink" onclick="Piler.remove_saved_search_term(<?php print $term['ts']; ?>); return false;"><?php print $text_remove; ?></a></br />
</div>
<?php } } ?>

View File

@ -95,7 +95,7 @@
<div class="row">
<div class="logincell">&nbsp;</div>
<div class="tcell"><input type="submit" value="<?php print $text_set; ?>" class="btn btn-primary" /> <input type="reset" class="btn" value="<?php print $text_cancel; ?>" /></div>
<div class="tcell"><input type="submit" value="<?php print $text_set; ?>" class="btn btn-primary" /> <input type="reset" class="btn" value="<?php print $text_cancel; ?>" onclick="Piler.go_to_default_page();" /></div>
</div>