Skip to content

Commit 00e7b62

Browse files
committed
cleanup of all the tabs/incorrect indentation that has built up over time.
git-svn-id: https://share-extras.googlecode.com/svn/trunk/Audit Dashlet@1223 a3f5c567-fd0f-3a89-9b71-a290c5a5f590
1 parent 80c4243 commit 00e7b62

File tree

10 files changed

+1358
-1353
lines changed

10 files changed

+1358
-1353
lines changed

README.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ The dashlet has been developed to install on top of an existing Alfresco 3.4 ins
2828
To build the JAR file, run the following command from the base project
2929
directory.
3030

31-
ant clean dist-jar
31+
ant clean dist-jar
3232

3333
The command should build a JAR file named sample-audit-dashlet.jar in the 'dist' directory within your project.
3434

3535
To deploy the dashlet files into a local Tomcat instance for testing, you can
3636
use the hotcopy-tomcat-jar task. You will need to set the tomcat.home
3737
property in Ant.
3838

39-
ant -Dtomcat.home=C:/Alfresco/tomcat clean hotcopy-tomcat-jar
39+
ant -Dtomcat.home=C:/Alfresco/tomcat clean hotcopy-tomcat-jar
4040

4141
Once you have run this you will need to restart Tomcat so that the classpath resources in the JAR file are picked up.
4242

@@ -61,11 +61,11 @@ of the dashboard and drag the dashlet into one of the columns from the list of d
6161
The number of data rows (audit events) displayed per page is configurable by the 'Entries per page' parameter.
6262

6363
Additional server side filters are configurable :
64-
UI Name Description Audit API corresponding parameter
65-
-----------------------------------------------------------------------------------------------------------
66-
- value filter filter on the audit value (exact match, optional) 'value'
67-
- limit maximum number of audit entries retrieved (optional) 'limit' (default 100)
68-
- Additional Query params other possible query parameters (optional) from/to time, from/to id, user
64+
UI Name Description Audit API corresponding parameter
65+
------------------------------------------------------------------------------------------------------------------------------
66+
- value filter filter on the audit value (exact match, optional) 'value'
67+
- limit maximum number of audit entries retrieved (optional) 'limit' (default 100)
68+
- Additional Query params other possible query parameters (optional) from/to time, from/to id, user
6969

7070
(See http://wiki.alfresco.com/wiki/Auditing_(from_V3.4)#Advanced_Query). This filtering is done server-side.
7171

@@ -78,24 +78,24 @@ of the dashboard and drag the dashlet into one of the columns from the list of d
7878

7979
The dashlet search box allows more search capabilities than the server side filter, ie :
8080
- field to search on (regex or not), e.g :
81-
id:14
82-
id:1.95$
83-
name:romain
84-
etc...
81+
id:14
82+
id:1.95$
83+
name:romain
84+
etc...
8585

8686
- negation, e.g
87-
-name:ro
88-
-values:pro
87+
-name:ro
88+
-values:pro
8989

9090
- mutliline matches are enabled, ^ and $ will match beginning of lines for audit values,
9191
useful since there can be more than one line per audit entry
9292

9393
- query can match anywhere in the field by default. queries can be any valid javascript regular expression.
9494
examples :
95-
^romain
96-
values:r.m...$
97-
id:\d\d8
98-
-time:21
95+
^romain
96+
values:r.m...$
97+
id:\d\d8
98+
-time:21
9999

100100
The search box will turn green or red if the regex is valid or invalid, respectively
101101
query can be restricted to the beginning by using ^romain (standard regex) for example.

build.xml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -190,36 +190,36 @@
190190
</target>
191191

192192
<target name="copy-en-l10n-bundles" description="Copy the default l10n bundles to the _en locale suffix">
193-
<delete>
194-
<fileset dir="${config.dir}/alfresco/site-webscripts">
195-
<include name="**/*_en.properties" />
196-
</fileset>
197-
</delete>
198-
<copy todir="${config.dir}/alfresco/site-webscripts/org/sharextras/components/dashlets">
199-
<fileset dir="${config.dir}/alfresco/site-webscripts/org/sharextras/components/dashlets"/>
200-
<mapper type="regexp"
201-
from="^([^_]*).properties$"
202-
to="\1_en.properties"/>
203-
</copy>
204-
<copy todir="${config.dir}/alfresco/site-webscripts/org/sharextras/modules/dashlets">
205-
<fileset dir="${config.dir}/alfresco/site-webscripts/org/sharextras/modules/dashlets"/>
206-
<mapper type="regexp"
207-
from="^([^_]*).properties$"
208-
to="\1_en.properties"/>
209-
</copy>
193+
<delete>
194+
<fileset dir="${config.dir}/alfresco/site-webscripts">
195+
<include name="**/*_en.properties" />
196+
</fileset>
197+
</delete>
198+
<copy todir="${config.dir}/alfresco/site-webscripts/org/sharextras/components/dashlets">
199+
<fileset dir="${config.dir}/alfresco/site-webscripts/org/sharextras/components/dashlets"/>
200+
<mapper type="regexp"
201+
from="^([^_]*).properties$"
202+
to="\1_en.properties"/>
203+
</copy>
204+
<copy todir="${config.dir}/alfresco/site-webscripts/org/sharextras/modules/dashlets">
205+
<fileset dir="${config.dir}/alfresco/site-webscripts/org/sharextras/modules/dashlets"/>
206+
<mapper type="regexp"
207+
from="^([^_]*).properties$"
208+
to="\1_en.properties"/>
209+
</copy>
210210
</target>
211211

212212
<target name="write-sha1sums">
213-
<delete file="${dist.dir}/SHA1SUM" quiet="true"/>
214-
<tstamp>
215-
<format property="current.time" pattern="MM/dd/yyyy hh:mm aa"/>
216-
</tstamp>
213+
<delete file="${dist.dir}/SHA1SUM" quiet="true"/>
214+
<tstamp>
215+
<format property="current.time" pattern="MM/dd/yyyy hh:mm aa"/>
216+
</tstamp>
217217

218-
<checksum file="${dist.dir}/${jar.name}" format="MD5SUM" algorithm="sha1" property="sha1.jar" readbuffersize="65536"/>
219-
<!--Note : we use a readbuffersize of 65536 to generate the same checksums as GNU coreutils (sha1sum, md5sum...) -->
218+
<!--Note : we use a readbuffersize of 65536 to generate the same checksums as GNU coreutils (sha1sum, md5sum...) -->
219+
<checksum file="${dist.dir}/${jar.name}" format="MD5SUM" algorithm="sha1" property="sha1.jar" readbuffersize="65536"/>
220220

221-
<echo message="# Generated on ${current.time}${line.separator}" file="${dist.dir}/SHA1SUM" append="true"/>
222-
<echo message="${sha1.jar} ${jar.name}${line.separator}" file="${dist.dir}/SHA1SUM" append="true"/>
221+
<echo message="# Generated on ${current.time}${line.separator}" file="${dist.dir}/SHA1SUM" append="true"/>
222+
<echo message="${sha1.jar} ${jar.name}${line.separator}" file="${dist.dir}/SHA1SUM" append="true"/>
223223
</target>
224224

225225
<!--

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application-data.get.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
function main()
22
{
3-
var application = args.application; // audit application name (as reported by /api/audit/control
4-
var valueFilter = args.valueFilter; // optional : "value" filter on the audit entries. match all
5-
var limit = args.limit; // optional : max entry count retrieved by the repo query
3+
var application = args.application; // audit application name (as reported by /api/audit/control
4+
var valueFilter = args.valueFilter; // optional : "value" filter on the audit entries. match all
5+
var limit = args.limit; // optional : max entry count retrieved by the repo query
66

77
// optional : free field to add in other server-side filters (e.g fromTime... )
88
var additionalQueryParams = args.additionalQueryParams;
99

1010
if (application != null)
1111
{
1212
var valueFilterQuery = valueFilter ? "&value=" + stringUtils.urlEncode(valueFilter) : "";
13-
if(logger.isLoggingEnabled())
14-
logger.log(" application:" +application+ " - " + "valueFilter:" +valueFilter);
13+
if (logger.isLoggingEnabled())
14+
logger.log(" application:" +application+ " - " + "valueFilter:" +valueFilter);
1515

1616
var maxEntryCount = limit ? "&limit=" + stringUtils.urlEncode(limit) : "";
1717

1818
// decode the '&' param separators from the optional additional params passed in by the dashlet.
1919
var optionalAdditionalQueryParams = additionalQueryParams ? ("&" + additionalQueryParams.replace(/\uFFFF/g,'&')) : "";
2020

21-
if(logger.isLoggingEnabled())
22-
logger.log(" optionalAdditionalQueryParams: '" +optionalAdditionalQueryParams+ "'");
21+
if (logger.isLoggingEnabled())
22+
logger.log(" optionalAdditionalQueryParams: '" +optionalAdditionalQueryParams+ "'");
2323

2424
var sortOrder = "&forward=" + false; // most recent first
2525

2626
var uri = "/api/audit/query/"+stringUtils.urlEncode(application)+"?verbose=true"
27-
+ optionalAdditionalQueryParams + valueFilterQuery + maxEntryCount + sortOrder;
27+
+ optionalAdditionalQueryParams + valueFilterQuery + maxEntryCount + sortOrder;
2828

2929
var connector = remote.connect("alfresco");
3030
var result = connector.get(uri);
31-
if(logger.isLoggingEnabled())
32-
logger.log("called URI:'"+uri+"'");
31+
if (logger.isLoggingEnabled())
32+
logger.log("called URI:'"+uri+"'");
3333

3434
if (result.status == status.STATUS_OK)
3535
{
36-
var rawresponse = result.response+""; // cast rawresponse back into a js string
37-
//if(logger.isLoggingEnabled()) logger.log("rawresponse:\n"+rawresponse);
36+
var rawresponse = result.response+""; // cast rawresponse back into a js string
37+
//if (logger.isLoggingEnabled()) logger.log("rawresponse:\n"+rawresponse);
3838

3939
// the json outputted by the audit template does not quote user and application keys in the ouput
40-
// pending ALF-8307, working around it by adding the quotes with a regex replace
41-
var requoting_regex = /:([\w-@.]+)\,/g;
42-
var requoted_response = rawresponse.replace(requoting_regex, ":\"$1\",");
43-
//if(logger.isLoggingEnabled()) logger.log("requoted_response:\n"+requoted_response);
40+
// pending ALF-8307, working around it by adding the quotes with a regex replace
41+
var requoting_regex = /:([\w-@.]+)\,/g;
42+
var requoted_response = rawresponse.replace(requoting_regex, ":\"$1\",");
43+
//if(logger.isLoggingEnabled()) logger.log("requoted_response:\n"+requoted_response);
4444

45-
// replace with as space spurious newlines that could have been stored in a json item, before the feed gets eval'd. see also ALF-11190.
45+
// replace with a space spurious newlines that could have been stored in a json item, before the feed gets eval'd. see also ALF-11190.
4646
var escaped_response = requoted_response.replace(/(\n|\r\n|\r)/g, " ");
47-
//if(logger.isLoggingEnabled()) logger.log("escaped_response:\n"+escaped_response);
47+
if (logger.isLoggingEnabled()) logger.log("escaped_response:\n"+escaped_response);
4848

4949
var auditresponse = eval("(" + escaped_response + ")");
5050
model.auditresponse = auditresponse;
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"count": "${auditresponse.count}",
3-
"entries":
4-
[
5-
<#list auditresponse.entries as e>
6-
{
7-
"id": ${e.id},
8-
"application": "${e.application}",
9-
"user": "${e.user}",
10-
"time": "${e.time}",
11-
"values":
12-
{
13-
<#list e.values?keys as key>
14-
<#-- keep only the audit key for readability -->
15-
<#-- and remove spurious/invalid linebreaks (see ALF-11190) -->
16-
"${key?replace('.*/', '', 'r')}":"${e.values[key]?replace('(\n|\r\n|\r)',' ','r')}"
17-
<#if key_has_next>,</#if>
18-
</#list>
19-
}
20-
}<#if e_has_next>,</#if>
21-
</#list>
22-
]
2+
"count": "${auditresponse.count}",
3+
"entries":
4+
[
5+
<#list auditresponse.entries as e>
6+
{
7+
"id": ${e.id},
8+
"application": "${e.application}",
9+
"user": "${e.user}",
10+
"time": "${e.time}",
11+
"values":
12+
{
13+
<#list e.values?keys as key>
14+
<#-- keep only the audit key for readability -->
15+
<#-- and remove spurious/invalid linebreaks (see ALF-11190) -->
16+
"${key?replace('.*/', '', 'r')}":"${e.values[key]?replace('(\n|\r\n|\r)',' ','r')}"
17+
<#if key_has_next>,</#if>
18+
</#list>
19+
}
20+
}<#if e_has_next>,</#if>
21+
</#list>
22+
]
2323
}

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application.get.html.ftl

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
<#assign el=args.htmlid?js_string>
33
<script type="text/javascript">//<![CDATA[
44
new Extras.dashlet.AuditApplication("${el}").setOptions(
5-
{
6-
"componentId": "${instance.object.id}",
7-
"application": "${args.application!''}",
8-
"valueFilter": "${args.valueFilter!''}",
9-
"limit": "${args.limit!''}",
10-
"rowsPerPage" : "${args.rowsPerPage!'10'}",
11-
"additionalQueryParams" : "${args.additionalQueryParams!''}",
12-
"show_id_column" : "${args.show_id_column!'show'}",
13-
"show_user_column" : "${args.show_user_column!'show'}",
14-
"show_time_column" : "${args.show_time_column!'show'}",
15-
"show_values_column" : "${args.show_values_column!'show'}"
16-
}).setMessages(${messages});
5+
{
6+
"componentId": "${instance.object.id}",
7+
"application": "${args.application!''}",
8+
"valueFilter": "${args.valueFilter!''}",
9+
"limit": "${args.limit!''}",
10+
"rowsPerPage" : "${args.rowsPerPage!'10'}",
11+
"additionalQueryParams" : "${args.additionalQueryParams!''}",
12+
"show_id_column" : "${args.show_id_column!'show'}",
13+
"show_user_column" : "${args.show_user_column!'show'}",
14+
"show_time_column" : "${args.show_time_column!'show'}",
15+
"show_values_column" : "${args.show_values_column!'show'}"
16+
}).setMessages(${messages});
1717
18-
<#-- dashlet resizer does not dynamically adjust the number of rows displayed on the page re: pagination -->
19-
<#-- the number of rows can be configured in the dialog though, sufficient for now -->
20-
<#-- future research : subscribe to rowsPerPageChange, "" etc... -->
21-
new Alfresco.widget.DashletResizer("${el}", "${instance.object.id}").setOptions(
22-
{
23-
<#-- IE (as usual) needs apparently a default height, otherwise resizing may not work in some situations -->
24-
"minDashletHeight": ${default_height}
25-
});
18+
<#-- dashlet resizer does not dynamically adjust the number of rows displayed on the page re: pagination -->
19+
<#-- the number of rows can be configured in the dialog though, sufficient for now -->
20+
<#-- future research : subscribe to rowsPerPageChange, "" etc... -->
21+
new Alfresco.widget.DashletResizer("${el}", "${instance.object.id}").setOptions(
22+
{
23+
<#-- IE (as usual) needs apparently a default height, otherwise resizing may not work in some situations -->
24+
"minDashletHeight": ${default_height}
25+
});
2626
2727
//]]></script>
2828

@@ -31,43 +31,42 @@
3131
<div class="refresh"><a id="${el}-refresh" href="#">&nbsp;</a></div>
3232

3333

34-
<div class="toolbar yui-toolbar" id="${el}-toolbar">
35-
<div class="links spaced-height" id="${el}-links">
36-
<#-- ie7 float bug : the align-right floated element must be declared before the non-floated (left) one... -->
37-
<span class="custom-align-right">
38-
<a class="theme-color-1" href="${msg("audit.dashlet.link.help.url")}" id="${el}-help-link" target="_blank">${msg("audit.dashlet.link.help")}</a>
39-
</span>
34+
<div class="toolbar yui-toolbar" id="${el}-toolbar">
35+
<div class="links spaced-height" id="${el}-links">
36+
<#-- ie7 float bug : the align-right floated element must be declared before the non-floated (left) one... -->
37+
<span class="custom-align-right">
38+
<a class="theme-color-1" href="${msg("audit.dashlet.link.help.url")}" id="${el}-help-link" target="_blank">${msg("audit.dashlet.link.help")}</a>
39+
</span>
4040

41-
<#if userHasConfigPermission && userIsAdmin>
42-
<#-- for some reason, ie6 ignores the inherited left padding of the link -- wrap in a specific span if on ie6 -->
43-
<!--[if IE 6]> <span class="spaced-left"> <![endif]-->
44-
<span>
45-
<a class="theme-color-1" href="#" id="${el}-configure-link">${msg("audit.dashlet.link.configure")}</a>
46-
</span>
47-
<!--[if IE 6]> </span> <![endif]-->
48-
</#if>
49-
</div>
50-
</div>
41+
<#if userHasConfigPermission && userIsAdmin>
42+
<#-- for some reason, ie6 ignores the inherited left padding of the link -- wrap in a specific span if on ie6 -->
43+
<!--[if IE 6]> <span class="spaced-left"> <![endif]-->
44+
<span>
45+
<a class="theme-color-1" href="#" id="${el}-configure-link">${msg("audit.dashlet.link.configure")}</a>
46+
</span>
47+
<!--[if IE 6]> </span> <![endif]-->
48+
</#if>
49+
</div>
50+
</div>
5151

52-
<#-- audit only allows admin to query audit entries. therefore the dashlet is only usable by admin users. -->
53-
<#if userIsAdmin>
54-
<#assign currentHeight=default_height>
55-
<#if args.height??><#assign currentHeight=args.height></#if>
56-
<div class="body" style="height: ${currentHeight}px;" id="${el}-body">
57-
<div class="message spaced-left" id="${el}-message"></div>
52+
<#-- audit only allows admin to query audit entries. therefore the dashlet is only usable by admin users. -->
53+
<#if userIsAdmin>
54+
<#assign currentHeight=default_height>
55+
<#if args.height??><#assign currentHeight=args.height></#if>
56+
<div class="body" style="height: ${currentHeight}px;" id="${el}-body">
57+
<div class="message spaced-left" id="${el}-message"></div>
5858

59-
<div class="spaced-left" id="${el}-searchbox">
60-
<#-- search box to filter audit values from YUI -->
61-
<label id="${el}-searchWithinResultsFilterLabel" for="${el}-searchWithinResultsFilter">${msg("audit.dashlet.searchWithinResults",0)} :</label>
62-
<input type="text" id="${el}-searchWithinResultsFilter">
63-
</div>
59+
<div class="spaced-left" id="${el}-searchbox">
60+
<#-- search box to filter audit values from YUI -->
61+
<label id="${el}-searchWithinResultsFilterLabel" for="${el}-searchWithinResultsFilter">${msg("audit.dashlet.searchWithinResults",0)} :</label>
62+
<input type="text" id="${el}-searchWithinResultsFilter">
63+
</div>
6464

65-
<div class="entries custom-scrollable-list" id="${el}-entries"></div>
66-
</div>
67-
68-
<#else>
69-
<div class="body spaced-left" id="${el}-body">
70-
${msg("audit.dashlet.adminPrivilegesRequired")}
71-
</div>
72-
</#if>
65+
<div class="entries custom-scrollable-list" id="${el}-entries"></div>
66+
</div>
67+
<#else>
68+
<div class="body spaced-left" id="${el}-body">
69+
${msg("audit.dashlet.adminPrivilegesRequired")}
70+
</div>
71+
</#if>
7372
</div>

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application.get.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ function getUserHasConfigPermission(username)
3030
}
3131
function main()
3232
{
33-
model.userHasConfigPermission = getUserHasConfigPermission(user.name);
34-
model.userIsAdmin = user.isAdmin;
35-
33+
model.userHasConfigPermission = getUserHasConfigPermission(user.name);
34+
model.userIsAdmin = user.isAdmin;
3635
}
3736
main();

0 commit comments

Comments
 (0)