summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_publiclink/js/admin.js2
-rwxr-xr-x[-rw-r--r--]config/.gitignore0
-rw-r--r--css/styles.css1
-rw-r--r--lib/log.php14
-rw-r--r--log/index.php18
-rw-r--r--log/js/log.js5
-rw-r--r--log/templates/index.php14
7 files changed, 48 insertions, 6 deletions
diff --git a/apps/files_publiclink/js/admin.js b/apps/files_publiclink/js/admin.js
index 017c62cb42a..9a0bad604a2 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
index d09f42a2389..d09f42a2389 100644..100755
--- a/config/.gitignore
+++ b/config/.gitignore
diff --git a/css/styles.css b/css/styles.css
index 2790c5c0492..5027a6b6fe9 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 aebeba7d4b3..894575ef059 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 675396a4d10..db476b85605 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 47c20b3e860..5ec75b94f4b 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 1e294091e3f..efd32ca057a 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'/>&nbsp;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'];?>