Ejemplo n.º 1
0
<?php 
if (!$this->get('full_screen')) {
    ?>
   <nav class="navbar navbar-inverse">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="navbar-brand" href="index.php">Tattle </a>
          <div class="navbar-collapse collapse">
	          <ul class="nav navbar-nav">
	            <?php 
    $current_url = '?' . fURL::getQueryString();
    echo '<li' . (fURL::is_menu_active('index') ? ' class="active"' : '') . '><a href="index.php">Alerts</a></li>' . "\n";
    $threshold_check_list = Check::makeURL('list', 'threshold');
    echo '<li' . (fURL::is_menu_active('check', 'type=threshold') ? ' class="active"' : '') . '><a href="' . $threshold_check_list . '" >Threshold Checks</a></li>' . "\n";
    $predictive_check_list = Check::makeURL('list', 'predictive');
    echo '<li' . (fURL::is_menu_active('check', 'type=predictive') ? ' class="active"' : '') . '><a href="' . $predictive_check_list . '" >Predictive Checks</a></li>' . "\n";
    $subscription_list = Subscription::makeURL('list');
    echo '<li' . (fURL::is_menu_active('subscription') ? ' class="active"' : '') . '><a href="' . $subscription_list . '" >Subscriptions</a></li>' . "\n";
    $dashboard_list = Dashboard::makeURL('list');
    echo '<li' . (fURL::is_menu_active('dashboard') ? ' class="active"' : '') . '><a href="' . $dashboard_list . '">Dashboards</a></li>';
    $group_list = Group::makeURL('list');
    echo '<li' . (fURL::is_menu_active('group') ? ' class="active"' : '') . '><a href="' . $group_list . '">Groups</a></li>';
    $setting_list = Setting::makeURL('list', 'user');
    echo '<li' . (fURL::is_menu_active('setting', 'type=user') ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n";
    if (fAuthorization::checkAuthLevel('admin')) {
        $setting_list = Setting::makeURL('list', 'system');
        echo '<li' . (fURL::is_menu_active('setting', 'type=system') ? ' class="active"' : '') . '><a href="' . $setting_list . '" >System Settings</a></li>' . "\n";
        $user_list = User::makeURL('list');
        echo '<li' . (fURL::is_menu_active('user') ? ' class="active"' : '') . '><a href="' . User::makeURL('list') . '" >Users</a></li>';
    }
Ejemplo n.º 2
0
  </head>
  <body>

<?php 
if (!$this->get('full_screen')) {
    ?>
   <div class="topbar">
      <div class="topbar-inner">
        <div class="container-fluid">
          <a class="brand" href="index.php">Tattle </a>
          <ul class="nav">
            <?
              
              $current_url = fURL::getWithQueryString();
              echo '<li' . ($current_url == '' ? ' class="active"' : '') . '><a href="index.php">Alerts</a></li>'. "\n";                
              $check_list = Check::makeURL('list');
              echo '<li' . ($current_url == $check_list ? ' class="active"' : '') . '><a href="' . $check_list . '" >Checks</a></li>' . "\n";
              $subscription_list = Subscription::makeURL('list');
              echo '<li' . ($current_url == $subscription_list ? ' class="active"' : '') .'><a href="' . $subscription_list . '" >Subscriptions</a></li>' . "\n";
              $dashboard_list = Dashboard::makeURL('list');
              echo '<li' . ($current_url == $dashboard_list ? ' class="active"' : '') . '><a href="' . $dashboard_list . '">Dashboards</a></li>';
              $setting_list = Setting::makeURL('list');
              echo '<li' . ($current_url == $setting_list ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n";
if (fAuthorization::checkAuthLevel('admin')) {
              $user_list = User::makeURL('list'); 
              echo '<li><a href="' . User::makeURL('list') . '" >Users</a></li>';
}              
?>
          </ul>
 <?php 
    if (is_numeric(fSession::get('user_id'))) {
Ejemplo n.º 3
0
        ?>
">&larr; Previous</a>
          </li>
          <li class="<?php 
        echo $next_class;
        ?>
">
            <a href="<?php 
        echo $next_link;
        ?>
">Next &rarr;</a>
          </li>
        </ul>
      </div>
    <?php 
    }
} catch (fEmptySetException $e) {
    ?>
	<p class="info">There are currently no Tattle check subscriptions for your account. Add a <a href="<?php 
    echo Check::makeURL('list', 'threshold');
    ?>
">threshold</a> based or a <a href="<?php 
    echo Check::makeURL('list', 'predictive');
    ?>
">predictive</a> based subscription now.</p>
	<?php 
}
?>
</div>
<?php 
$tmpl->place('footer');
Ejemplo n.º 4
0
&filter_group_id=<?php 
    echo $filter_group_id;
    ?>
">Add one now</a>
		<p class="pull-right">
			Filter group :
			<select id="list_of_filters">
				<option value="<?php 
    echo Check::makeURL('list', $check_type, -1);
    ?>
">All checks</option>
				<?php 
    foreach (Group::findAll() as $group) {
        ?>
						<option value="<?php 
        echo Check::makeURL('list', $check_type, $group->getGroupId());
        ?>
" <?php 
        echo $filter_group_id == $group->getGroupId() ? 'selected="selected"' : '';
        ?>
><?php 
        echo $group->getName();
        ?>
</option>
				<?php 
    }
    ?>
			</select>
		</p>
	</div>
	<?php 
Ejemplo n.º 5
0
          <th>Method</th>
          <th>Status</th>
          <th>Action</th>
          </tr>    
          </thead>
          <tbody>
	<?php
	$first = TRUE;
	foreach ($subscriptions as $subscription) {
          $check = $subscription->createCheck();      
	?>
    	<tr>
        <td><?php echo $check->prepareName() ?></td>
        <td><?php echo $status_array[$subscription->prepareThreshold()] ?></td>
        <td><?php echo $subscription->prepareMethod() ?></td>
        <td><?php echo ($subscription->getStatus() ? 'Disabled' : 'Enabled') ?></td>
        <td><a href="<?php echo Subscription::makeURL('edit', $subscription) ?>">Edit</a> |
        <a href="<?php echo Subscription::makeURL('delete', $subscription) ?>">Delete</a></td>
        </tr>
    <?php } ?>
    </tbody></table>
    <?
} catch (fEmptySetException $e) {
	?>
	<p class="info">There are currently no Tattle check subscriptions for your account. <a href="<?php echo Check::makeURL('list') ?>">Add one now</a></p>
	<?php
}
?>
</div>
<?php $tmpl->place('footer') ?>
Ejemplo n.º 6
0
      $prev_link = fURL::get() . '?page=' . ($page_num - 1);
      $next_class = 'next';
      $next_link = fURL::get() . '?page=' . ($page_num + 1);
      if ($page_num == 1) {
        $prev_class .= ' disabled';
        $prev_link = '#';
      } elseif ($page_num == $total_pages) {
        $next_class .= ' disabled';
        $next_link = '#';
      }
      ?>
      <div class="pagination">
        <ul class="pager">
          <li class="<?=$prev_class; ?>">
            <a href="<?=$prev_link; ?>">&larr; Previous</a>
          </li>
          <li class="<?=$next_class; ?>">
            <a href="<?=$next_link; ?>">Next &rarr;</a>
          </li>
        </ul>
      </div>
    <?php } 
} catch (fEmptySetException $e) {
	?>
	<p class="info">There are currently no Tattle checks. <a href="<?=Check::makeURL('add'); ?>">Add one now</a></p>
	<?php
}
?>
</div>
<?php $tmpl->place('footer') ?>
Ejemplo n.º 7
0
?>

<form action="<?php 
echo Check::makeURL('delete', $check);
?>
" method="post">
	
	<p class="warning">
		Are you sure you want to delete the check
		<strong><?php 
echo $check->prepareTitle();
?>
</strong>?
	</p>
	
	<p>
		<input class="delete" type="submit" value="Yes, delete this check" />
		<a href="<?php 
echo Check::makeURL('list');
?>
">No, please keep it</a>
		<input type="hidden" name="token" value="<?php 
echo fRequest::generateCSRFToken();
?>
" />
	</p>
	
</form>

<?php 
$tmpl->place('footer');
Ejemplo n.º 8
0
               </select>            
             </div>
           </div><!-- /clearfix -->
	   <div class="clearfix">
	     <label for="check-repeat_delay">Repeat Delay<em>*</em></label>
             <div class="input">
               <?php 
               $check_delay = (is_null($check->getRepeatDelay()) ? 30 : $check->encodeRepeatDelay()); ?>
	       <input id="check-repeat_delay" class="span3" type="text" size="20" name="repeat_delay" value="<?=$check_delay; ?>" />
	     </div>		   
           </div><!-- /clearfix -->     
           </fieldset>
           <fieldset>
             <div class="actions">
             <input class="btn primary" type="submit" value="Save" />
	     <? if ($action == 'edit') { ?><a href="<?=Check::makeURL('delete',$check); ?>" class="btn" >Delete</a><?php } ?>
	     <div class="required"><em>*</em> Required field</div>
	     <input type="hidden" name="token" value="<?=fRequest::generateCSRFToken(); ?>" />
<?php if ($action == 'add') { ?>
             <input type="hidden" name="user_id" value="<?=fSession::get('user_id'); ?>" />
<?php } ?>
           </div>
         </fieldset>
       </div>       
     </form>
    </div>
    <div class="span10">   
      <?php if ($action == 'edit') { ?>
        <div class="sidebar" id="sidebar">
          <fieldset>
            <p>Check : <?=$check->prepareName(); ?></p>
Ejemplo n.º 9
0
                <td><?php 
    echo $check->prepareSample();
    ?>
</td>
                <td><?php 
    echo $check->prepareBaseline();
    ?>
</td>
                <td><?php 
    echo $over_under_array[$check->getOver_Under()];
    ?>
</td>
                <td><?php 
    echo $visibility_array[$check->getVisibility()];
    ?>
</td>
                <td><?php 
    if (fSession::get('user_id') == $check->getUserId()) {
        echo '<a href="' . Check::makeURL('edit', $check_type, $check) . '">Edit</a> |';
    }
    ?>
                    <a href="<?php 
    echo Subscription::makeURL('add', $check);
    ?>
">Subscribe</a></td>
            </tr>
        <?php 
}
?>
    </tbody>
</table>
Ejemplo n.º 10
0
    fHTML::printOption($group->getName(), $group->getGroupId(), $action == 'add' ? $filter_group_id : $check->getGroupId());
}
?>
            	</select>
             </div>
           </div>
           </fieldset>
           <fieldset>
             <div class="form-group actions">
             <div class="controls">
             <input class="btn btn-primary" type="submit" value="Save" />
             <?php 
if ($action == 'edit') {
    ?>
             	<a href="<?php 
    echo Check::makeURL('delete', $check_type, $check);
    ?>
" class="btn btn-default" >Delete</a>
             	<a href="<?php 
    echo CheckResult::makeURL("list", $check);
    ?>
" class="btn btn-default">View</a>
             	<a href="<?php 
    echo Subscription::makeURL('add', $check);
    ?>
" class="btn btn-default">Subscribe</a>
             <?php 
}
?>
             <div class="required"><em>*</em> Required field</div>
             <input type="hidden" name="token" value="<?php 
Ejemplo n.º 11
0
<?php

$tmpl->set('title', 'Acknowledge All Check Results');
$tmpl->place('header');
?>
<h1><?php 
echo $tmpl->prepare('title');
?>
</h1>
<form method="post">
  <p class="warning">Are you sure you want to acknowledge all alerts for this check
    <strong><?php 
echo $check->prepareName();
?>
</strong>?
  </p>
  <p>
    <input class="btn btn-danger" type="submit" value="Yes, acknowledge all" />
    <a class="btn btn-default" href="<?php 
echo Check::makeURL('list', $check->prepareType());
?>
">No, please keep it</a>
    <input type="hidden" name="token" value="<?php 
echo fRequest::generateCSRFToken();
?>
" />
  </p>
</form>
<?php 
$tmpl->place('footer');
Ejemplo n.º 12
0
" />
				<div class="form-group actions">
					<div>
						<input type="submit" 
						value="Send this mail" 
						class="btn btn-primary" 
						onclick="if(($('#subject').val() == '') || ($('#content').val() == '')) {alert('You have to set a subject and a content before sending the mail.');return false;}"/>
						<div class="required"><em>*</em> Required field</div>
					</div>
				</div>
			</fieldset>
		</form>
	</div>
</div>
<a class="btn btn-default" href="<?php 
echo Check::makeURL('edit', $check->getType(), $check);
?>
">Edit check</a>
<a href="<?php 
echo Subscription::makeURL('add', $check);
?>
" class="btn btn-default">Subscribe</a>
<?php 
try {
    $check_results->tossIfEmpty();
    $affectd = fMessaging::retrieve('affected', fURL::get());
    ?>
        <a class="btn small btn-primary" href="<?php 
    echo CheckResult::makeURL('ackAll', $check = new Check($check_id));
    ?>
">Clear All</a>
Ejemplo n.º 13
0
<?php

include 'inc/init.php';
fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$breadcrumbs[] = array('name' => 'Checks', 'url' => Check::makeUrl('list'), 'active' => false);
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$sort = fCRUD::getSortColumn(array('name', 'target', 'warn', 'error', 'status', 'timestamp', 'count'));
$sort_dir = fCRUD::getSortDirection('asc');
$check_id = fRequest::get('check_id', 'integer');
$check_list_url = Check::makeURL('list');
// --------------------------------- //
if ('delete' == $action) {
    try {
        $obj = new Check($check_id);
        $delete_text = 'Are you sure you want to delete the check : <strong>' . $obj->getName() . '</strong>?';
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $obj->delete();
            // Do our own Subscription and CheckResult cleanup instead of using ORM
            $subscriptions = Subscription::findAll($check_id);
            foreach ($subscriptions as $subscription) {
                $subscription->delete();
            }
            $check_results = CheckResult::findAll($check_id);
            foreach ($check_results as $check_result) {
                $check_result->delete();
            }
            fMessaging::create('success', fURL::get(), 'The check ' . $obj->getName() . ' was successfully deleted');
            fURL::redirect($check_list_url);
        }
Ejemplo n.º 14
0
<?php

$page_title = $action == 'add' ? 'Add a Subscription' : 'Edit Subscription';
$tmpl->set('title', $page_title);
$breadcrumbs[] = array('name' => ucfirst($check->getType()) . ' Checks', 'url' => Check::makeURL('list', $check->prepareType()), 'active' => false);
$breadcrumbs[] = array('name' => $check->getName(), 'url' => Check::makeURL('edit', $check->prepareType(), $check), 'active' => false);
$breadcrumbs[] = array('name' => $page_title, 'url' => '?' . fURL::getQueryString(), 'active' => false);
$tmpl->set('breadcrumbs', $breadcrumbs);
$tmpl->place('header');
$query_string = '';
if (isset($check_id)) {
    $query_string .= "&check_id={$check_id}";
}
if (isset($subscription_id)) {
    $query_string .= "&subscription_id={$subscription_id}";
}
?>
<script type="text/javascript">
  $(document).ready(function() {
    reloadGraphiteGraph();
  });

  function reloadGraphiteGraph() {
    var imageURL = document.images['renderedGraphImage'].src;
    document.images['renderedGraphImage'].src = "";
    if(imageURL.indexOf("?preventCaching=") === -1 && imageURL.indexOf("&preventCaching=") === -1) {
      imageURL = imageURL + "&preventCaching=" + (new Date()).getTime();
    }
    else {
      preventCachingRegex = /([?|&]preventCaching=)[^\&]+/;
      imageURL = imageURL.replace(preventCachingRegex, '$1' + (new Date()).getTime());
Ejemplo n.º 15
0
<?php

include 'inc/init.php';
fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$check_type = fRequest::getValid('type', array('predictive', 'threshold'));
$sort = fCRUD::getSortColumn(array('name', 'target', 'warn', 'error', 'status', 'timestamp', 'count', 'regression_type', 'sample', 'baseline', 'over_under', 'visibility', 'number_of_regressions'));
$sort_dir = fCRUD::getSortDirection('asc');
$check_id = fRequest::get('check_id', 'integer');
$check_list_url = Check::makeURL('list', $check_type);
$filter_group_id = fRequest::get('filter_group_id', 'integer');
if (empty($filter_group_id) || $filter_group_id < 0) {
    $filter_group_id = -1;
}
$breadcrumbs[] = array('name' => ucfirst($check_type) . ' Checks', 'url' => Check::makeURL('list', $check_type), 'active' => false);
// --------------------------------- //
if ('delete' == $action) {
    try {
        $obj = new Check($check_id);
        $delete_text = 'Are you sure you want to delete the check : <strong>' . $obj->getName() . '</strong>?';
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $obj->delete();
            // Do our own Subscription and CheckResult cleanup instead of using ORM
            $subscriptions = Subscription::findAll($check_id);
            foreach ($subscriptions as $subscription) {
                $subscription->delete();
            }
            $check_results = CheckResult::findAll($check_id);
            foreach ($check_results as $check_result) {