Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
bd034da8
Commit
bd034da8
authored
14 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
log viewer
parent
cf76cad9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
log/index.php
+56
-7
56 additions, 7 deletions
log/index.php
log/js/log.js
+21
-0
21 additions, 0 deletions
log/js/log.js
log/templates/index.php
+11
-14
11 additions, 14 deletions
log/templates/index.php
with
88 additions
and
21 deletions
log/index.php
+
56
−
7
View file @
bd034da8
...
...
@@ -25,21 +25,70 @@
//require_once('../../config/config.php');
require_once
(
'../lib/base.php'
);
require
(
'template.php'
);
if
(
!
OC_USER
::
isLoggedIn
()){
header
(
"
Location:
"
.
OC_HELPER
::
linkTo
(
"
index.php
"
));
header
(
'
Location:
'
.
OC_HELPER
::
linkTo
(
'
index.php
'
));
exit
();
}
OC_APP
::
setActiveNavigationEntry
(
"log"
);
$logs
=
OC_LOG
::
get
(
$dir
);
//load the script
OC_UTIL
::
addScript
(
"log"
,
"log"
);
$allActions
=
array
(
'login'
,
'logout'
,
'read'
,
'write'
,
'create'
,
'delete'
);
//check for a submited config
if
(
isset
(
$_POST
[
'size'
])){
$selectedActions
=
array
();
foreach
(
$allActions
as
$action
){
if
(
isset
(
$_POST
[
$action
])
and
$_POST
[
$action
]
==
'on'
){
$selectedActions
[]
=
$action
;
}
}
OC_APPCONFIG
::
setValue
(
'log'
,
'actions'
,
implode
(
','
,
$selectedActions
));
OC_APPCONFIG
::
setValue
(
'log'
,
'pagesize'
,
$_POST
[
'size'
]);
}
OC_APP
::
setActiveNavigationEntry
(
'log'
);
$logs
=
OC_LOG
::
get
();
$selectedActions
=
explode
(
','
,
OC_APPCONFIG
::
getValue
(
'log'
,
'actions'
,
implode
(
','
,
$allActions
)));
$logs
=
OC_LOG
::
filterAction
(
$logs
,
$selectedActions
);
$pageSize
=
OC_APPCONFIG
::
getValue
(
'log'
,
'pagesize'
,
20
);
$pageCount
=
ceil
(
count
(
$logs
)
/
$pageSize
);
$page
=
isset
(
$_GET
[
'page'
])
?
$_GET
[
'page'
]
:
0
;
if
(
$page
>=
$pageCount
){
$page
=
$pageCount
-
1
;
}
$logs
=
array_slice
(
$logs
,
$page
*
$pageSize
,
$pageSize
);
foreach
(
$logs
as
&
$i
){
$i
[
"date"
]
=
date
(
$CONFIG_DATEFORMAT
,
$i
[
'timestamp'
]
);
$i
[
"action"
]
=
OC_LOG
::
$TYPE
[
$i
[
'type'
]];
$i
[
'date'
]
=
$i
[
'timestamp'
];
}
$url
=
OC_HELPER
::
linkTo
(
'log'
,
'index.php'
)
.
'?page='
;
$pager
=
OC_UTIL
::
getPageNavi
(
$pageCount
,
$page
,
$url
);
if
(
$pager
){
$pagerHTML
=
$pager
->
fetchPage
();
}
else
{
$pagerHTML
=
''
;
}
$showActions
=
array
();
foreach
(
$allActions
as
$action
){
if
(
array_search
(
$action
,
$selectedActions
)
!==
false
){
$showActions
[
$action
]
=
'checked="checked"'
;
}
else
{
$showActions
[
$action
]
=
''
;
}
}
$tmpl
=
new
OC_TEMPLATE
(
"log"
,
"index"
,
"admin"
);
$tmpl
->
assign
(
"logs"
,
$logs
);
$tmpl
=
new
OC_TEMPLATE
(
'log'
,
'index'
,
'admin'
);
$tmpl
->
assign
(
'logs'
,
$logs
);
$tmpl
->
assign
(
'pager'
,
$pagerHTML
);
$tmpl
->
assign
(
'size'
,
$pageSize
);
$tmpl
->
assign
(
'showActions'
,
$showActions
);
$tmpl
->
printPage
();
?>
This diff is collapsed.
Click to expand it.
log/js/log.js
0 → 100644
+
21
−
0
View file @
bd034da8
$
(
document
).
ready
(
function
()
{
// Sets the select_all checkbox behaviour :
$
(
'
#all
'
).
click
(
function
()
{
if
(
$
(
this
).
attr
(
'
checked
'
)){
// Check all
$
(
'
input.action:checkbox
'
).
attr
(
'
checked
'
,
true
);
}
else
{
// Uncheck all
$
(
'
input.action:checkbox
'
).
attr
(
'
checked
'
,
false
);
}
});
$
(
'
input.action:checkbox
'
).
click
(
function
()
{
if
(
!
$
(
this
).
attr
(
'
checked
'
)){
$
(
'
#all
'
).
attr
(
'
checked
'
,
false
);
}
else
{
if
(
$
(
'
input.action:checkbox:checked
'
).
length
==
$
(
'
input.action:checkbox
'
).
length
){
$
(
'
#all
'
).
attr
(
'
checked
'
,
true
);
}
}
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
log/templates/index.php
+
11
−
14
View file @
bd034da8
<div
class=
"controls"
>
<form
id=
"logs_options"
>
<form
id=
"logs_options"
method=
'post'
>
<p>
<span>
Filter :
</span>
<input
type=
"checkbox"
checked=
"checked"
name=
"all"
id=
"all"
/>
<label
for=
"all"
>
All
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"logins"
id=
"logins"
/>
<label
for=
"logins"
>
Logins
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"logouts"
id=
"logouts"
/>
<label
for=
"logouts"
>
Logouts
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"downloads"
id=
"downloads"
/>
<label
for=
"downloads"
>
Downloads
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"uploads"
id=
"uploads"
/>
<label
for=
"uploads"
>
Uploads
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"creations"
id=
"creations"
/>
<label
for=
"creations"
>
Creations
</label>
<input
type=
"checkbox"
checked=
"checked"
name=
"deletions"
id=
"deletions"
/>
<label
for=
"deletions"
>
Deletions
</label>
<input
type=
"checkbox"
checked=
""
name=
"all"
id=
"all"
/>
<label
for=
"all"
>
All
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'login'
]
?>
name=
"login"
id=
"logins"
/>
<label
for=
"logins"
>
Logins
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'logout'
]
?>
name=
"logout"
id=
"logouts"
/>
<label
for=
"logouts"
>
Logouts
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'read'
]
?>
name=
"read"
id=
"downloads"
/>
<label
for=
"downloads"
>
Downloads
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'write'
]
?>
name=
"write"
id=
"uploads"
/>
<label
for=
"uploads"
>
Uploads
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'create'
]
?>
name=
"create"
id=
"creations"
/>
<label
for=
"creations"
>
Creations
</label>
<input
type=
"checkbox"
class=
'action'
<?php
echo
$_
[
'showActions'
][
'delete'
]
?>
name=
"delete"
id=
"deletions"
/>
<label
for=
"deletions"
>
Deletions
</label>
</p>
<p>
<span>
Show :
</span>
<input
type=
"text"
maxlength=
"3"
size=
"3"
value=
"
10"
/>
entries per page.
<input
type=
"text"
maxlength=
"3"
size=
"3"
value=
"
<?php
echo
$_
[
'size'
]
?>
"
name=
'size'
/>
entries per page.
<input
class=
"prettybutton"
type=
"submit"
value=
"Save"
/>
</p>
...
...
@@ -31,13 +30,11 @@
<tbody>
<?php
foreach
(
$_
[
"logs"
]
as
$entry
)
:
?>
<tr>
<td
class=
"
login"
><em>
<?php
echo
$entry
[
"user"
];
?>
</em>
<?php
echo
$entry
[
"
message
"
];
?>
</td>
<td
class=
"
<?php
echo
$entry
[
"action"
];
?>
"
><em>
<?php
echo
$entry
[
"action"
];
?>
<?php
echo
$entry
[
"user"
];
?>
</em>
<?php
echo
$entry
[
"
info
"
];
?>
</td>
<td
class=
"date"
>
<?php
echo
$entry
[
"date"
];
?>
</td>
</tr>
<?php
endforeach
;
?>
</tbody>
</table>
<div
class=
"controls"
>
<p
class=
"center"
><a
href=
""
title=
"Previous page"
>
←
</a>
3/5
<a
href=
""
title=
"Next page"
>
→
</a></p>
</div>
<?php
echo
$_
[
'pager'
];
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment