diff --git a/apps/files_publiclink/js/admin.js b/apps/files_publiclink/js/admin.js index 017c62cb42ae23d2692a13bfac0fd97b58ca73e9..9a0bad604a230608bd0ad8823108c61b70327afa 100644 --- a/apps/files_publiclink/js/admin.js +++ b/apps/files_publiclink/js/admin.js @@ -48,5 +48,5 @@ $(document).ready(function() { } } }); - }) + }); }); \ No newline at end of file diff --git a/config/.gitignore b/config/.gitignore old mode 100644 new mode 100755 diff --git a/css/styles.css b/css/styles.css index 2790c5c04923e500811f82abb28924a3539bfc24..5027a6b6fe96780fd67e4c20ce1f1e60cadb1cec 100644 --- a/css/styles.css +++ b/css/styles.css @@ -269,6 +269,7 @@ p.actions a.delete, div.actions a.delete { background-image:url('../img/delete.p #logs_options span { margin:0 2em 0 0.5em; font-weight:bold; } #logs_options label { margin:0 1em 0 0; } #logs_options input[type="submit"] { float:right; margin:0 2em 0 0; } +#logs_options input[type="submit"].nofloat { float:none; margin:0 2em 0 0; } #logs_options input[type="text"] { margin:0; padding:0; border:1px solid #ccc; text-align:right; } li.error{ list-style:none; width:640px; margin:4em auto; padding:1em 1em 1em 4em; background-color:#fee; background-image:url('../img/task-attention.png'); background-position:0.8em 0.8em; background-repeat:no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } diff --git a/lib/log.php b/lib/log.php index aebeba7d4b354bc84140af6bbb71163dfadbb49d..894575ef059b516a161ac515ead774e40b1bee87 100644 --- a/lib/log.php +++ b/lib/log.php @@ -79,7 +79,7 @@ class OC_LOG { * - app: only entries for this app */ public static function get( $filter = array()){ - $queryString='SELECT * FROM *PREFIX*log WHERE 1=1 '; + $queryString='SELECT * FROM *PREFIX*log WHERE 1=1 ORDER BY moment DESC'; $params=array(); if(isset($filter['from'])){ $queryString.='AND moment>? '; @@ -120,6 +120,18 @@ class OC_LOG { $query->execute(array($date)); return true; } + + /** + * @brief removes all log entries + * @returns true/false + * + * This function deletes all log entries. + */ + public static function deleteAll(){ + $query=OC_DB::prepare("DELETE FROM *PREFIX*log"); + $query->execute(); + return true; + } /** * @brief filter an array of log entries on action diff --git a/log/index.php b/log/index.php index 675396a4d100a4ebb09041bca8e57f1ad9fee724..db476b856058aaafd8259e22d614c06964be58f0 100644 --- a/log/index.php +++ b/log/index.php @@ -37,8 +37,10 @@ OC_UTIL::addScript( "log", "log" ); $allActions=array('login','logout','read','write','create','delete'); -//check for a submited config -if(isset($_POST['size'])){ +$removeBeforeDate = 0; + +//check for a submitted config +if(isset($_POST['save'])){ $selectedActions=array(); foreach($allActions as $action){ if(isset($_POST[$action]) and $_POST[$action]=='on'){ @@ -48,10 +50,22 @@ if(isset($_POST['size'])){ OC_PREFERENCES::setValue($_SESSION['user_id'],'log','actions',implode(',',$selectedActions)); OC_PREFERENCES::setValue($_SESSION['user_id'],'log','pagesize',$_POST['size']); } +//clear log entries +else if(isset($_POST['clear'])){ + $removeBeforeDate=(isset($_POST['removeBeforeDate']))?$_POST['removeBeforeDate']:0; + if($removeBeforeDate!==0){ + $removeBeforeDate=strtotime($removeBeforeDate); + OC_LOG::deleteBefore($removeBeforeDate); + } +} +else if(isset($_POST['clearall'])){ + OC_LOG::deleteAll(); +} OC_APP::setActiveNavigationEntry( 'log' ); $logs=OC_LOG::get(); + $selectedActions=explode(',',OC_PREFERENCES::getValue($_SESSION['user_id'],'log','actions',implode(',',$allActions))); $logs=OC_LOG::filterAction($logs,$selectedActions); diff --git a/log/js/log.js b/log/js/log.js index 47c20b3e8603d7f2f648a8521a76847cb727bb51..5ec75b94f4b8708e83a5a4cced132ed0e8df1c7c 100644 --- a/log/js/log.js +++ b/log/js/log.js @@ -18,4 +18,7 @@ $(document).ready(function() { } } }); -}); \ No newline at end of file + $('#removeBeforeDate').datepicker({ + dateFormat:'MM d, yy', + }); +}); diff --git a/log/templates/index.php b/log/templates/index.php index 1e294091e3fa11803d99bc7f30c4beb16c915ed5..efd32ca057af150a98d9d1c1ff3309d23b4580c7 100644 --- a/log/templates/index.php +++ b/log/templates/index.php @@ -14,7 +14,7 @@ <p> <span>Show :</span> <input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/> entries per page. - <input class="prettybutton" type="submit" value="Save" /> + <input class="prettybutton" type="submit" name="save" value="Save" /> </p> </form> @@ -37,4 +37,16 @@ </tbody> </table> +<div class="controls"> + <form id="logs_options" method='post'> + <p> + <span>Clear log entries before </span> + <input type="date" id="removeBeforeDate" name="removeBeforeDate"/> + <input class="prettybutton nofloat" type="submit" name="clear" value="Clear" /> + <input class="prettybutton" type="submit" name="clearall" value="Clear All" /> + + </p> + </form> +</div> + <?php echo $_['pager'];?>