Skip to content

Commit

Permalink
Modified logs "Delete" button and behaviour to be extensible via plug…
Browse files Browse the repository at this point in the history
…ins and consistent with that seen with deleting posts and comments. Now a plugin can add a "Delete all logs" option, or maybe we should include this by default?

git-svn-id: https://svn.habariproject.org/habari/trunk/htdocs/system@4296 653ae4dd-d31e-0410-96ef-6bf7bf53c507
  • Loading branch information
lildude committed Aug 25, 2010
1 parent 626731f commit 868aa47
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 16 deletions.
54 changes: 38 additions & 16 deletions admin/logs.php
Expand Up @@ -27,6 +27,28 @@

</div>

<div class="container transparent item controls">

<input type="hidden" name="nonce" id="nonce" value="<?php echo $wsse['nonce']; ?>">
<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $wsse['timestamp']; ?>">
<input type="hidden" name="PasswordDigest" id="PasswordDigest" value="<?php echo $wsse['digest']; ?>">
<span class="checkboxandselected pct30">
<input type="checkbox" id="master_checkbox" name="master_checkbox">
<label class="selectedtext minor none" for="master_checkbox"><?php _e('None selected'); ?></label>
</span>
<?php /* This works excecpt it deletes all entries when you select none */ ?>
<ul class="dropbutton">
<?php $page_actions = array(
'delete' => array('action' => 'itemManage.update(\'delete\');return false;', 'title' => _t('Delete Selected'), 'label' => _t('Delete Selected') ),
);
$page_actions = Plugins::filter('logs_manage_actions', $page_actions);
foreach( $page_actions as $page_action ) : ?>
<li><a href="*" onclick="<?php echo $page_action['action']; ?>" title="<?php echo $page_action['title']; ?>"><?php echo $page_action['label']; ?></a></li>
<?php endforeach; ?>
</ul>

</div>

<div class="container">

<div class="head clear">
Expand Down Expand Up @@ -71,23 +93,23 @@

</div>

<div class="container transparent item controls">

<span class="checkboxandselected pct30">
<input type="checkbox" id="master_checkbox_2" name="master_checkbox_2">
<label class="selectedtext minor none" for="master_checkbox_2"><?php _e('None selected'); ?></label>
</span>
<ul class="dropbutton">
<?php $page_actions = array(
'delete' => array('action' => 'itemManage.update(\'delete\');return false;', 'title' => _t('Delete Selected'), 'label' => _t('Delete Selected') ),
);
$page_actions = Plugins::filter('logs_manage_actions', $page_actions);
foreach( $page_actions as $page_action ) : ?>
<li><a href="*" onclick="<?php echo $page_action['action']; ?>" title="<?php echo $page_action['title']; ?>"><?php echo $page_action['label']; ?></a></li>
<?php endforeach; ?>
</ul>

<?php if ( isset($years) ) { ?><div class="container transparent">

<div class="item controls">
<span class="checkboxandselected pct40">
<input type="checkbox" id="master_checkbox" name="master_checkbox">
<label class="selectedtext minor none" for="master_checkbox"><?php _e('None selected'); ?></label>
</span>
<input type="hidden" name="nonce" id="nonce" value="<?php echo $wsse['nonce']; ?>">
<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $wsse['timestamp']; ?>">
<input type="hidden" name="PasswordDigest" id="PasswordDigest" value="<?php echo $wsse['digest']; ?>">

<input type="button" value="<?php _e('Delete'); ?>" class="button delete">
</div>

</div><?php } ?>

</div>

</form>

Expand Down
5 changes: 5 additions & 0 deletions classes/adminhandler.php
Expand Up @@ -2341,6 +2341,11 @@ public function ajax_delete_logs($handler_vars)

}
}
if ( ! isset( $ids ) || empty( $ids ) ) {
Session::notice( _t('No logs selected.') );
echo Session::messages_get( true, array( 'Format', 'json_messages' ) );
return;
}

$to_delete = EventLog::get( array( 'date' => 'any', 'where' => $ids, 'nolimit' => 1 ) );

Expand Down

0 comments on commit 868aa47

Please sign in to comment.