Project

General

Profile

« Previous | Next » 

Revision 45252

migrated to dnet45

View differences:

modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/menu/LightUiMenuGroup.java
1
package eu.dnetlib.functionality.modular.ui.lightui.menu;
2

  
3
import java.util.List;
4
import java.util.Set;
5

  
6
import javax.annotation.Resource;
7

  
8
import org.springframework.beans.factory.annotation.Required;
9

  
10
import com.google.common.collect.Sets;
11

  
12
import eu.dnetlib.functionality.modular.ui.AbstractMenu;
13
import eu.dnetlib.functionality.modular.ui.MenuEntry;
14
import eu.dnetlib.functionality.modular.ui.lightui.clients.ISLookupClient;
15
import eu.dnetlib.functionality.modular.ui.users.AccessLimited;
16
import eu.dnetlib.functionality.modular.ui.users.PermissionLevel;
17

  
18
public class LightUiMenuGroup extends AbstractMenu implements AccessLimited {
19

  
20
	private int order;
21

  
22
	@Resource
23
	private ISLookupClient isLookupClient;
24
	
25
	@Override
26
	public Set<PermissionLevel> getPermissionLevels() {
27
		return Sets.newHashSet(PermissionLevel.USER);
28
	}
29

  
30
	@Override
31
	public List<? extends MenuEntry> getEntries() {
32
		return isLookupClient.listMenuEntries();
33
	}
34

  
35
	@Required
36
	public void setOrder(final int order) {
37
		this.order = order;
38
	}
39
	
40
	@Override
41
	public int getOrder() {
42
		return order;
43
	}
44

  
45
}
modules/dnet-modular-lightui-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/lightui/menu/LightUiMenuEntry.java
1
package eu.dnetlib.functionality.modular.ui.lightui.menu;
2

  
3
import java.io.UnsupportedEncodingException;
4
import java.net.URLEncoder;
5

  
6
import eu.dnetlib.functionality.modular.ui.MenuEntry;
7

  
8
public class LightUiMenuEntry extends MenuEntry {
9
		
10
	private String id;
11
	
12
	public LightUiMenuEntry(final String id, final String title, final String menu, final String desc, final int order) {
13
		setId(id);
14
		setTitle(title);
15
		setMenu(menu);
16
		setDescription(desc);
17
		setOrder(order);
18
	}
19
	
20
	@Override
21
	public String getRelativeUrl() {
22
		try {
23
			return "/ui/lightui.do?ui=" + URLEncoder.encode(getId(), "UTF-8");
24
		} catch (UnsupportedEncodingException e) {
25
			return "javascript:void(0)";
26
		}
27
	}
28

  
29
	public String getId() {
30
		return id;
31
	}
32

  
33
	public void setId(String id) {
34
		this.id = id;
35
	}
36

  
37
}
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/dc_2_row.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="2.0" 
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
5

  
6
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
7

  
8
	<xsl:template match="/">
9
		<xsl:variable name="id"   select="//*[local-name() = 'objIdentifier']" />
10
		
11
		<div class="well">
12
			<table>
13
				<tr>
14
					<td style="width: 120px">
15
						<img src="../resources/img/record.png" width="80" height="80" />
16
					</td>
17
					<td>
18
						<strong>Author: </strong><xsl:value-of select="//*[local-name()='creator']" /><br/>
19
						<strong>Title: </strong><xsl:value-of select="//*[local-name()='title']" /><br/>			
20
						<strong>Description: </strong><i><xsl:value-of select="//*[local-name()='description']" /></i><br/>
21
						<br />
22
						<button class="btn btn-primary btn-sm" ng-click="getDocument('objidentifier', '{$id}')">show record</button>
23
					</td>
24
				</tr>
25
			</table>
26
		</div>
27
	</xsl:template>
28
	
29
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/dc_2_document.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<xsl:stylesheet version="2.0" 
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
6

  
7
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
8

  
9
	<xsl:template match="/">
10
		<div class="row">
11
			<div class="col-xs-2">
12
				<img src="../resources/img/record.png" width="80" height="80" />
13
			</div>
14
			<div class="col-xs-10">
15
				<xsl:if test="//*[local-name()='title']">
16
					<h1 id="overview" ><xsl:value-of select="//*[local-name()='title']" /></h1>
17
				</xsl:if>
18
			</div>
19
		</div>
20
		
21
		<div class="row">
22
			<div class="col-xs-12">
23
				<h6><span class="glyphicon glyphicon-align-left" /> GENERAL INFORMATION</h6>
24
				<table class="table">
25
					<tbody>
26
						<tr>
27
							<td class="col-xs-3"><strong>Author</strong></td>
28
							<td>
29
								<xsl:for-each select="//*[local-name()='creator']">
30
									<xsl:value-of select="." /><br />
31
								</xsl:for-each>
32
							</td>
33
						</tr>
34
						<tr>
35
							<td class="col-xs-3"><strong>Title</strong></td>
36
							<td>
37
								<xsl:for-each select="//*[local-name()='title']">
38
									<xsl:value-of select="." /><br />
39
								</xsl:for-each>
40
							</td>
41
						</tr>
42
						<tr>
43
							<td class="col-xs-3"><strong>Description</strong></td>
44
							<td>
45
								<xsl:for-each select="//*[local-name()='description']">
46
									<xsl:value-of select="." /><br />
47
								</xsl:for-each>
48
							</td>
49
						</tr>
50
						<tr>
51
							<td class="col-xs-3"><strong>Identifier</strong></td>
52
							<td>
53
								<xsl:for-each select="//*[local-name()='identifier']">
54
									<xsl:value-of select="." /><br />
55
								</xsl:for-each>
56
							</td>
57
						</tr>
58
						<tr>
59
							<td class="col-xs-3"><strong>Type</strong></td>
60
							<td>
61
								<xsl:for-each select="//*[local-name()='type']">
62
									<xsl:value-of select="." /><br />
63
								</xsl:for-each>
64
							</td>
65
						</tr>
66
					</tbody>
67
				</table>
68
			</div>
69
		</div>
70
		
71
		<xsl:for-each select="//*[local-name()='record']">
72
			<h6><span class="glyphicon glyphicon-wrench" /> RECORD XML</h6>
73
			<xsl:call-template name="xmlItem">
74
				<xsl:with-param name="indent" select="string('')" />
75
			</xsl:call-template>
76
		</xsl:for-each>
77
	</xsl:template>
78
	
79
	<xsl:template name="xmlItem">
80
		<xsl:param name="indent" />
81

  
82
		<xsl:variable name="tag" select="local-name()" />
83

  
84
		<xsl:variable name="newindent">
85
			<xsl:value-of select="$indent" />
86
			&#160;&#160;&#160;&#160;
87
		</xsl:variable>
88

  
89
		<xsl:variable name="attribs">
90
			<xsl:for-each select="@*">
91
				<xsl:value-of select="concat(' ', local-name(), '=&quot;', ., '&quot;')" />
92
			</xsl:for-each>
93
		</xsl:variable>
94
		<xsl:value-of select="$indent" />
95

  
96
		<b>
97
			<xsl:value-of select="concat('&lt;',$tag)" />
98
		</b>
99
		<i>
100
			<xsl:value-of select="$attribs" />
101
		</i>
102
		<b>&gt;</b>
103

  
104
		<xsl:value-of select="text()" />
105

  
106
		<xsl:choose>
107
			<xsl:when test="count(child::*) &gt; 0">
108
				<br />
109
				<xsl:for-each select="child::*">
110
					<xsl:call-template name="xmlItem">
111
						<xsl:with-param name="indent" select="$newindent" />
112
					</xsl:call-template>
113
					<br />
114
				</xsl:for-each>
115
				<xsl:value-of select="$indent" />
116
			</xsl:when>
117
			<xsl:otherwise>
118

  
119
			</xsl:otherwise>
120
		</xsl:choose>
121

  
122
		<b>
123
			<xsl:value-of select="concat('&lt;/',$tag,'&gt;')" />
124
		</b>
125

  
126
	</xsl:template>
127
	
128
    <xsl:template name="threedimensions">
129
        <xsl:param name="w"/>
130
        <xsl:param name="h"/>
131
        <xsl:param name="d"/>
132
        <xsl:param name="unit"/>
133
        
134
        <xsl:variable name="actualW">
135
            <xsl:choose>
136
                <xsl:when test="normalize-space($w) != ''">
137
                    <xsl:value-of select="normalize-space($w)"/>
138
                </xsl:when>
139
                <xsl:otherwise>??</xsl:otherwise>
140
            </xsl:choose>
141
        </xsl:variable>
142
        <xsl:variable name="actualH">
143
            <xsl:choose>
144
                <xsl:when test="normalize-space($h) != ''">
145
                    <xsl:value-of select="normalize-space($h)"/>
146
                </xsl:when>
147
                <xsl:otherwise>??</xsl:otherwise>
148
            </xsl:choose>
149
        </xsl:variable>
150
        <xsl:variable name="actualD">
151
            <xsl:choose>
152
                <xsl:when test="normalize-space($d) != ''">
153
                    <xsl:value-of select="normalize-space($d)"/>
154
                </xsl:when>
155
                <xsl:otherwise>??</xsl:otherwise>
156
            </xsl:choose>
157
        </xsl:variable>
158

  
159
        <xsl:value-of select="concat($actualW,' x ', $actualH,' x ', $actualD, ' (', $unit, ')')"/>
160
    </xsl:template>
161
    
162
    <xsl:template name="twodimensions">
163
        <xsl:param name="w"/>
164
        <xsl:param name="h"/>
165
        <xsl:param name="d"/>
166
        <xsl:param name="unit"/>
167
        
168
        <xsl:variable name="actualW">
169
            <xsl:choose>
170
                <xsl:when test="normalize-space($w) != ''">
171
                    <xsl:value-of select="normalize-space($w)"/>
172
                </xsl:when>
173
                <xsl:otherwise>??</xsl:otherwise>
174
            </xsl:choose>
175
        </xsl:variable>
176
        <xsl:variable name="actualH">
177
            <xsl:choose>
178
                <xsl:when test="normalize-space($h) != ''">
179
                    <xsl:value-of select="normalize-space($h)"/>
180
                </xsl:when>
181
                <xsl:otherwise>??</xsl:otherwise>
182
            </xsl:choose>
183
        </xsl:variable>
184

  
185
        <xsl:value-of select="concat($actualW,' x ', $actualH, ' (', $unit, ')')"/>
186
    </xsl:template>
187
	
188
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/accordion_browse.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<xsl:stylesheet version="2.0"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
	xmlns:fn="http://www.w3.org/2005/xpath-functions">
6

  
7
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" />
8

  
9
	<xsl:template match="/">
10
		<xsl:for-each select="//field">
11
			<xsl:variable name="field" select="@name" />
12
			<xsl:variable name="label" select="@label" />
13
			<div class="panel-group" id="accordion_{$field}">
14
				<div class="panel panel-default">
15
					<div class="panel-heading">
16
						<h4 class="panel-title">
17
							<a href="javascript:void(0)" ng-click="browse_one('{$field}', '{$label}')" data-toggle="modal" data-target="#browseOneModal"><xsl:value-of select="$label" /></a>
18
							<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion_{$field}" data-target="#collapse_{$field}" />
19
						</h4>
20
					</div>
21
					<div id="collapse_{$field}" class="panel-collapse collapse in">
22
						<table class="table" ng-hide="browse_{$field}_showAll">
23
							<xsl:for-each select="./value">
24
								<tr>
25
									<td>
26
										<a href="javascript:void(0)" ng-click="updateQueryWithValue('{$field}', '{@name}', 0)">
27
											<xsl:value-of select="@name" />
28
										</a>
29
									</td>
30
									<td class="text-right">
31
										<xsl:value-of select="@size" />
32
									</td>
33
								</tr>
34
							</xsl:for-each>
35
						</table>
36
					</div>
37
				</div>
38
			</div>
39
		</xsl:for-each>
40

  
41
	</xsl:template>
42
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/default_browse.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<xsl:stylesheet version="2.0" 
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
6

  
7
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
8

  
9
	<xsl:template match="/">
10
		<xsl:for-each select="//field">
11
			<xsl:variable name="field" select="@name" />
12
			<xsl:variable name="label" select="@label" />
13
			<div class="panel panel-default">
14
				<div class="panel-heading text-center"><strong><a ng-click="browse_one('{$field}', '{$label}')" data-toggle="modal" data-target="#browseOneModal"><xsl:value-of select="$label" /></a></strong></div>
15
				<table class="table" ng-hide="browse_{$field}_showAll">
16
					<xsl:for-each select="./value">
17
						<tr>
18
							<td><a href="javascript:void(0)" ng-click="updateQueryWithValue('{$field}', '{@name}', 0)"><xsl:value-of select="@name" /></a></td>
19
							<td class="text-right"><xsl:value-of select="@size" /></td>
20
						</tr>
21
					</xsl:for-each>
22
				</table>
23
			</div>
24
		</xsl:for-each>
25
	
26
	</xsl:template>
27
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/xslt/default_browse_single_field.xslt
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<xsl:stylesheet version="2.0" 
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
6

  
7
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
8

  
9
	<xsl:template match="/">
10
		<xsl:for-each select="//field">
11
			<xsl:variable name="field" select="@name"></xsl:variable>
12
			<xsl:variable name="label" select="@label"></xsl:variable>
13
				<table class="table table-striped" ng-hide="browse_{$field}_showAll">
14
					<xsl:for-each select="./value">
15
						<tr ng-hide="browse_{$field}_showAll">
16
							<th><a href="javascript:void(0)" data-dismiss="modal" ng-click="updateQueryWithValue('{$field}', '{@name}', 1500)"><xsl:value-of select="@name" /></a></th>
17
							<td class="text-right"><xsl:value-of select="@size" /></td>
18
						</tr>
19
					</xsl:for-each>
20
				</table>
21
		</xsl:for-each>
22
	</xsl:template>
23
</xsl:stylesheet>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/lightui.st
1
$common/master( header={
2
	<script type="text/javascript" src="../resources/js/angular.min.js" ></script>
3
	<script type="text/javascript" src="../resources/js/angular-route.min.js"></script>
4
	<script type="text/javascript" src="../resources/js/dnet_lightui.js"></script>
5
	<script type="text/javascript" src="../resources/js/dnet_lightui_controllers.js"></script>
6
	
7
	<script type="text/javascript">
8
		function getFormFields() {
9
			return $fieldsJson$;				
10
		}
11
		
12
		function getOperators() {
13
			return { $fields:{f|'$f.field$' : '$f.operator$'};separator=", "$ }				
14
		}
15
		
16
		function getLightUiId() {
17
			return '$uiId$';		
18
		}
19
	</script>
20
	
21
	
22
}, body={
23
	<div ng-app="lightUI">
24
		<div ng-view></div>
25
	</div>
26
} )$
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/html/lightUiResults.html
1
<div class="row" ng-show="query && !documentHTML">
2
	<div class="col-md-4 col-lg-2">
3
		<div ng-bind-html="to_trusted(browseResultsHtml)" compile-template></div>
4
	</div>
5
	<div class="col-md-8 col-lg-10">
6
		<div>
7
			<ul class="pagination">
8
				<li ng-class="{'disabled' : searchResults.currPage == 1 }"><a href="javascript:void(0)" ng-click="gotoPage(1)">&laquo; first</a></li>
9
				<li class="disabled" ng-show="searchResults.currPage > 5"><a href="javascript:void(0)">...</a></li>
10
			
11
				<li ng-repeat="n in pageList(searchResults)" ng-class="{'active' : searchResults.currPage == n }">
12
					<a href="javascript:void(0)" ng-click="gotoPage(n)">{{n}}</a>
13
				</li>
14
						
15
				<li class="disabled" ng-show="searchResults.currPage < searchResults.totalPages - 4"><a href="javascript:void(0)">...</a></li>
16
				<li ng-class="{'disabled' : searchResults.currPage == searchResults.totalPages }"><a href="javascript:void(0)" ng-click="gotoPage(searchResults.totalPages)">last &raquo;</a></li>
17
			</ul>
18
		</div>
19
		
20
				
21
		<div style="margin-bottom: 12px; height: 36px;">
22
			<button class="btn btn-default btn-sm pull-right" type="button" onclick="history.go(-1);"><span class="glyphicon glyphicon glyphicon-chevron-left"></span> back</button>
23
			<span><strong>Results:</strong> {{searchResults.total}}</span>
24
			<span><strong>Query:</strong> {{query}}</span>
25
		</div>
26
				
27
		<div ng-bind-html="to_trusted(searchResults.html)" compile-template></div>
28
	</div>
29
	
30
	<div class="modal fade" id="browseOneModal" tabindex="-1" role="dialog">
31
		<div class="modal-dialog">
32
			<div class="modal-content">
33
				<div class="modal-header">
34
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
35
					<h4 class="modal-title">{{browseOneLabel}}</h4>
36
				</div>
37
				<div class="modal-body" style="height: 300px; overflow-y: auto">
38
					<div class="well" ng-bind-html="to_trusted(browseOneHtml)" compile-template></div>
39
				</div>
40
				<div class="modal-footer">
41
					<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Close</button>
42
				</div>
43
 			</div>
44
		</div>
45
	
46
	</div>
47
</div>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/html/lightUiForm.html
1
<div class="row">
2
	<div class="col-md-offset-3 col-md-6 well">
3
		<form class="form-horizontal" role="form">
4
			<div class="form-group" ng-repeat="f in formFields">
5
				<label for="input_{{f.field}}" class="col-sm-4 control-label">{{f.label}}</label>
6
				<div class="col-sm-8">
7
					<select class="form-control" id="input_{{f.field}}" ng-model="queryParams[f.field]" ng-show="f.predefinedValues">
8
						<option value="">ALL</option>
9
						<option value="{{v.value}}" ng-repeat="v in f.predefinedValues">{{v.label}}</option>
10
					</select>								
11
					<input type="text" class="form-control" id="input_{{$f.field$}}" ng-model="queryParams[f.field]" ng-hide="f.predefinedValues" />
12
				</div>
13
				
14
			</div>
15
 
16
			<div class="form-group">
17
				<div class="col-sm-offset-4 col-sm-8">
18
					<button type="submit" class="btn btn-default" ng-click="search()">Search</button>
19
				</div>
20
			</div>
21
		</form>
22
	</div>
23
</div>
modules/dnet-modular-lightui-ui/trunk/src/main/resources/eu/dnetlib/web/resources/html/lightUiDoc.html
1
<div class="row">
2
	<div class="col-md-offset-2 col-md-8 well">
3
		
4
		<button class="btn btn-default btn-sm pull-right" type="button" onclick="history.go(-1);"><span class="glyphicon glyphicon glyphicon-chevron-left"></span> back</button>
5
		<br /><br />
6
		
7
		<div ng-bind-html="to_trusted(documentHTML)" compile-template></div>
8
	</div>
9
</div>
modules/dnet-modular-lightui-ui/trunk/pom.xml
1
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2 2
	<parent>
3 3
		<groupId>eu.dnetlib</groupId>
4
		<artifactId>dnet-parent</artifactId>
5
		<version>1.0.0</version>
6
		<relativePath/>
4
		<artifactId>dnet45-parent</artifactId>
5
		<version>1.0.0-SNAPSHOT</version>
6
		<relativePath />
7 7
	</parent>
8 8
	<modelVersion>4.0.0</modelVersion>
9 9
	<groupId>eu.dnetlib</groupId>
......
11 11
	<packaging>jar</packaging>
12 12
	<version>2.0.3-SNAPSHOT</version>
13 13
	<scm>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-modular-lightui-ui/trunk</developerConnection>
15
	</scm>
14
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-lightui-ui/trunk</developerConnection>
15
	</scm>	
16 16
	<dependencies>
17 17
		<dependency>
18 18
			<groupId>eu.dnetlib</groupId>
......
30 30
			<artifactId>dnet-data-provision-rmi</artifactId>
31 31
			<version>[1.0.0,2.0.0)</version>
32 32
		</dependency>
33

  
33
		
34 34
		<dependency>
35 35
			<groupId>eu.dnetlib</groupId>
36 36
			<artifactId>dnet-index-solr-client</artifactId>
37 37
			<version>[2.0.1,2.9.9)</version>
38 38
		</dependency>
39

  
39
		
40 40
		<dependency>
41 41
			<groupId>junit</groupId>
42 42
			<artifactId>junit</artifactId>

Also available in: Unified diff