Initial import (partially)

This commit is contained in:
2013-11-23 15:54:25 +01:00
parent 852e1e619c
commit 2082b0bba6
40 changed files with 9015 additions and 1496 deletions

View File

@@ -13,28 +13,28 @@
<artifactId>org.migor.core</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependencies>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.migor.server</groupId>
<artifactId>org.migor.shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.migor.server</groupId>
<artifactId>org.migor.shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -25,11 +25,11 @@ public class BeanUtils {
* This method does NOT work on interfaces.
*
* @param instanceClass the bean class.
* @param <T> generic type of the bean.
* @param <T> generic type of the bean.
* @return injected bean.
* @throws javax.naming.NamingException if lookup for the BeanManager fails
*/
@SuppressWarnings( "unchecked" )
@SuppressWarnings("unchecked")
public static <T> T get(@NotNull final Class<T> instanceClass) throws NamingException {
BeanManager beanManager = getBeanManager();
@@ -38,13 +38,12 @@ public class BeanUtils {
CreationalContext<Object> context = beanManager.createCreationalContext(null);
Object instance = injectionTarget.produce(context);
injectionTarget.inject(instance, context);
injectionTarget.postConstruct( instance );
injectionTarget.postConstruct(instance);
return (T) instance;
}
/**
*
* @return BeanManager
* @throws javax.naming.NamingException
*/

View File

@@ -8,6 +8,7 @@ import java.util.zip.GZIPOutputStream;
/**
* The type Zip utils.
*
* @author Daniel Scheidle
* daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH
@@ -34,8 +35,7 @@ public class ZipUtils {
outputStream = new ByteArrayOutputStream();
compress(inputStream, outputStream);
return outputStream.toByteArray();
}
catch(Exception e) {
} catch (Exception e) {
throw new Exception(e.getMessage(), e);
} finally {
if (outputStream != null) outputStream.close();
@@ -60,8 +60,7 @@ public class ZipUtils {
outputStream = new ByteArrayOutputStream();
decompress(inputStream, outputStream);
return outputStream.toByteArray();
}
catch(Exception e) {
} catch (Exception e) {
throw new Exception(e.getMessage(), e);
} finally {
if (outputStream != null) outputStream.close();
@@ -73,7 +72,7 @@ public class ZipUtils {
/**
* Compress void.
*
* @param inputStream the input stream
* @param inputStream the input stream
* @param outputStream the output stream
* @throws java.io.IOException the iO exception
*/
@@ -98,7 +97,7 @@ public class ZipUtils {
/**
* Decompress void.
*
* @param inputStream the input stream
* @param inputStream the input stream
* @param outputStream the output stream
* @throws java.io.IOException the iO exception
*/

View File

@@ -15,13 +15,11 @@ import java.text.SimpleDateFormat;
*/
@Provider
@Produces(MediaType.APPLICATION_JSON)
public class JsonConfiguration implements ContextResolver<ObjectMapper>
{
public class JsonConfiguration implements ContextResolver<ObjectMapper> {
private final ObjectMapper objectMapper;
public JsonConfiguration() throws Exception
{
public JsonConfiguration() throws Exception {
this.objectMapper = new ObjectMapper();
this.objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
@@ -29,8 +27,7 @@ public class JsonConfiguration implements ContextResolver<ObjectMapper>
}
public ObjectMapper getContext(Class<?> objectType)
{
public ObjectMapper getContext(Class<?> objectType) {
return objectMapper;
}
}

View File

@@ -12,5 +12,4 @@ import javax.ws.rs.core.Application;
public class ServiceApplication extends Application {
}

View File

@@ -4,7 +4,7 @@
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<interceptors>
</interceptors>
</interceptors>
</beans>

View File

@@ -16,7 +16,6 @@
</listener>
<!-- RESTeasy Servlet for generating js client stubs -->
<servlet>
<servlet-name>RESTEasy JSAPI</servlet-name>

View File

@@ -1,8 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
</head>
<body>
</body>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
</head>
<body>
</body>
</html>

View File

@@ -54,7 +54,7 @@ public class McctxId {
removeUUIDFromThreadName();
}
thread.setName(thread.getName() +"|"+ u);
thread.setName(thread.getName() + "|" + u);
}
/**
@@ -63,7 +63,7 @@ public class McctxId {
public static void removeUUIDFromThreadName() {
final Thread temp = Thread.currentThread();
final String currentName = temp.getName();
temp.setName(currentName.substring(0, currentName.length()-37));
temp.setName(currentName.substring(0, currentName.length() - 37));
}
@@ -120,7 +120,7 @@ public class McctxId {
path += getBindAddress() + "," + new Date().getTime();
try {
while (path.length() > MAX_HEADER_LEN) {
path = StringUtils.substring(path, path.indexOf(";") + 1, path.length()-1);
path = StringUtils.substring(path, path.indexOf(";") + 1, path.length() - 1);
if (logger.isDebugEnabled())
logger.debug("Host removed - new path: " + path);

View File

@@ -27,29 +27,29 @@ public class GenericParser {
return null;
} else if (clazz.isPrimitive()) {
if (clazz.toString().equals("float")) {
return (T)Float.valueOf(value);
return (T) Float.valueOf(value);
} else if (clazz.toString().equals("double")) {
return (T)Double.valueOf(value);
return (T) Double.valueOf(value);
} else if (clazz.toString().equals("long")) {
return (T)Long.valueOf(value);
return (T) Long.valueOf(value);
} else if (clazz.toString().equals("int")) {
return (T)Integer.valueOf(value);
return (T) Integer.valueOf(value);
} else if (clazz.toString().equals("boolean")) {
return (T)Boolean.valueOf(value);
return (T) Boolean.valueOf(value);
}
} else if (clazz.equals(Boolean.class)) {
return (T)Boolean.valueOf(value);
return (T) Boolean.valueOf(value);
} else if (clazz.equals(Long.class)) {
return (T)Long.valueOf(value);
return (T) Long.valueOf(value);
} else if (clazz.equals(Integer.class)) {
return (T)Integer.valueOf(value);
return (T) Integer.valueOf(value);
} else if (clazz.equals(Double.class)) {
return (T)Double.valueOf(value);
} else if (clazz.equals( Float.class )) {
return (T)Float.valueOf(value);
} else if (clazz.equals( Date.class )) {
return (T) Double.valueOf(value);
} else if (clazz.equals(Float.class)) {
return (T) Float.valueOf(value);
} else if (clazz.equals(Date.class)) {
try {
return (T)(new SimpleDateFormat(getDateFormatPattern()).parse(value));
return (T) (new SimpleDateFormat(getDateFormatPattern()).parse(value));
} catch (Exception t) {
throw new RuntimeException("Failed to parse date: " + t.getMessage());
}
@@ -57,17 +57,17 @@ public class GenericParser {
Object[] defined_values = clazz.getEnumConstants();
for (Object t : defined_values) {
if (t.toString().equalsIgnoreCase(value)) {
return (T)t;
return (T) t;
}
}
throw new RuntimeException("Unable to convert: Defined value "+value+" is not an option of "+clazz.toString());
throw new RuntimeException("Unable to convert: Defined value " + value + " is not an option of " + clazz.toString());
} else if (clazz.isAssignableFrom(Parsable.class)) {
return (T) ((Parsable) clazz.newInstance()).parse(value);
} else if (clazz.isAssignableFrom(String.class)) {
return (T)value;
return (T) value;
}
throw new ParseException("Type can not by cast by this method: "+clazz.toString());
throw new ParseException("Type can not by cast by this method: " + clazz.toString());
} catch (ParseException e) {
throw e;
} catch (Exception t) {
@@ -75,7 +75,7 @@ public class GenericParser {
}
}
@SuppressWarnings( "unchecked" )
@SuppressWarnings("unchecked")
public static <T> T[] parseArray(Class<T> clazz, String value) throws ParseException {
try {
String[] values = value.split(getArrayDelimiter());
@@ -95,7 +95,7 @@ public class GenericParser {
return dateFormatPattern;
}
public static void setDateFormatPattern( final String newDateFormatPattern ) {
public static void setDateFormatPattern(final String newDateFormatPattern) {
dateFormatPattern = newDateFormatPattern;
}
@@ -103,7 +103,7 @@ public class GenericParser {
return arrayDelimiter;
}
public static void setArrayDelimiter( final String newArrayDelimiter ) {
public static void setArrayDelimiter(final String newArrayDelimiter) {
arrayDelimiter = newArrayDelimiter;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,13 +1,69 @@
.cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white}
.cleditorMain iframe {border:none; margin:0; padding:0}
.cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */}
.cleditorToolbar {background: url('images/toolbar.gif') repeat}
.cleditorGroup {float:left; height:26px}
.cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('images/buttons.gif')}
.cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}
.cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}
.cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}
.cleditorList div {padding:2px 4px 2px 4px}
.cleditorMain {
border: 1px solid #999;
padding: 0 1px 1px;
background-color: white
}
.cleditorMain iframe {
border: none;
margin: 0;
padding: 0
}
.cleditorMain textarea {
border: none;
margin: 0;
padding: 0;
overflow-y: scroll;
font: 10pt Arial, Verdana;
resize: none;
outline: none /* webkit grip focus */
}
.cleditorToolbar {
background: url('images/toolbar.gif') repeat
}
.cleditorGroup {
float: left;
height: 26px
}
.cleditorButton {
float: left;
width: 24px;
height: 24px;
margin: 1px 0 1px 0;
background: url('images/buttons.gif')
}
.cleditorDisabled {
opacity: 0.3;
filter: alpha(opacity=30)
}
.cleditorDivider {
float: left;
width: 1px;
height: 23px;
margin: 1px 0 1px 0;
background: #CCC
}
.cleditorPopup {
border: solid 1px #999;
background-color: white;
color: #333333;
position: absolute;
font: 10pt Arial, Verdana;
cursor: default;
z-index: 10000
}
.cleditorList div {
padding: 2px 4px 2px 4px
}
.cleditorList p,
.cleditorList h1,
.cleditorList h2,
@@ -15,10 +71,38 @@
.cleditorList h4,
.cleditorList h5,
.cleditorList h6,
.cleditorList font {padding:0; margin:0; background-color:Transparent}
.cleditorColor {width:150px; padding:1px 0 0 1px}
.cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0}
.cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt}
.cleditorList font {
padding: 0;
margin: 0;
background-color: Transparent
}
.cleditorColor {
width: 150px;
padding: 1px 0 0 1px
}
.cleditorColor div {
float: left;
width: 14px;
height: 14px;
margin: 0 1px 1px 0
}
.cleditorPrompt {
background-color: #F6F7F9;
padding: 4px;
font-size: 8.5pt
}
.cleditorPrompt input,
.cleditorPrompt textarea {font:8.5pt Arial,Verdana;}
.cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}
.cleditorPrompt textarea {
font: 8.5pt Arial, Verdana;
}
.cleditorMsg {
background-color: #FDFCEE;
width: 150px;
padding: 4px;
font-size: 8.5pt
}

View File

@@ -1,112 +1,129 @@
/*
* Table
*/
table.dataTable {
margin: 0 auto;
clear: both;
width: 100%;
border-collapse: collapse;
margin: 0 auto;
clear: both;
width: 100%;
border-collapse: collapse;
}
table.dataTable thead th {
padding: 3px 0px 3px 10px;
cursor: pointer;
*cursor: hand;
padding: 3px 0px 3px 10px;
cursor: pointer;
*cursor: hand;
}
table.dataTable tfoot th {
padding: 3px 10px;
padding: 3px 10px;
}
table.dataTable td {
padding: 3px 10px;
padding: 3px 10px;
}
table.dataTable td.center,
table.dataTable td.dataTables_empty {
text-align: center;
text-align: center;
}
table.dataTable tr.odd { background-color: #E2E4FF; }
table.dataTable tr.even { background-color: white; }
table.dataTable tr.odd {
background-color: #E2E4FF;
}
table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
table.dataTable tr.even {
background-color: white;
}
table.dataTable tr.odd td.sorting_1 {
background-color: #D3D6FF;
}
table.dataTable tr.odd td.sorting_2 {
background-color: #DADCFF;
}
table.dataTable tr.odd td.sorting_3 {
background-color: #E0E2FF;
}
table.dataTable tr.even td.sorting_1 {
background-color: #EAEBFF;
}
table.dataTable tr.even td.sorting_2 {
background-color: #F2F3FF;
}
table.dataTable tr.even td.sorting_3 {
background-color: #F9F9FF;
}
/*
* Table wrapper
*/
.dataTables_wrapper {
position: relative;
clear: both;
*zoom: 1;
}
.dataTables_wrapper .ui-widget-header {
font-weight: normal;
}
.dataTables_wrapper .ui-toolbar {
padding: 5px;
position: relative;
clear: both;
*zoom: 1;
}
.dataTables_wrapper .ui-widget-header {
font-weight: normal;
}
.dataTables_wrapper .ui-toolbar {
padding: 5px;
}
/*
* Page length menu
*/
.dataTables_length {
float: left;
float: left;
}
/*
* Filter
*/
.dataTables_filter {
float: right;
text-align: right;
float: right;
text-align: right;
}
/*
* Table information
*/
.dataTables_info {
padding-top: 3px;
clear: both;
float: left;
padding-top: 3px;
clear: both;
float: left;
}
/*
* Pagination
*/
.dataTables_paginate {
float: right;
text-align: right;
float: right;
text-align: right;
}
.dataTables_paginate .ui-button {
margin-right: -0.1em !important;
margin-right: -0.1em !important;
}
.paging_two_button .ui-button {
float: left;
cursor: pointer;
* cursor: hand;
float: left;
cursor: pointer;
*cursor: hand;
}
.paging_full_numbers .ui-button {
padding: 2px 6px;
margin: 0;
cursor: pointer;
* cursor: hand;
color: #333 !important;
padding: 2px 6px;
margin: 0;
cursor: pointer;
*cursor: hand;
color: #333 !important;
}
/* Two button pagination - previous / next */
@@ -114,131 +131,149 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
.paginate_enabled_previous,
.paginate_disabled_next,
.paginate_enabled_next {
height: 19px;
float: left;
cursor: pointer;
*cursor: hand;
color: #111 !important;
height: 19px;
float: left;
cursor: pointer;
*cursor: hand;
color: #111 !important;
}
.paginate_disabled_previous:hover,
.paginate_enabled_previous:hover,
.paginate_disabled_next:hover,
.paginate_enabled_next:hover {
text-decoration: none !important;
text-decoration: none !important;
}
.paginate_disabled_previous:active,
.paginate_enabled_previous:active,
.paginate_disabled_next:active,
.paginate_enabled_next:active {
outline: none;
outline: none;
}
.paginate_disabled_previous,
.paginate_disabled_next {
color: #666 !important;
color: #666 !important;
}
.paginate_disabled_previous,
.paginate_enabled_previous {
padding-left: 23px;
padding-left: 23px;
}
.paginate_disabled_next,
.paginate_enabled_next {
padding-right: 23px;
margin-left: 10px;
padding-right: 23px;
margin-left: 10px;
}
.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
.paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }
.paginate_enabled_previous {
background: url('../images/back_enabled.png') no-repeat top left;
}
.paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }
.paginate_enabled_previous:hover {
background: url('../images/back_enabled_hover.png') no-repeat top left;
}
.paginate_disabled_previous {
background: url('../images/back_disabled.png') no-repeat top left;
}
.paginate_enabled_next {
background: url('../images/forward_enabled.png') no-repeat top right;
}
.paginate_enabled_next:hover {
background: url('../images/forward_enabled_hover.png') no-repeat top right;
}
.paginate_disabled_next {
background: url('../images/forward_disabled.png') no-repeat top right;
}
/* Full number pagination */
.paging_full_numbers a:active {
outline: none
outline: none
}
.paging_full_numbers a:hover {
text-decoration: none;
text-decoration: none;
}
.paging_full_numbers a.paginate_button,
.paging_full_numbers a.paginate_active {
border: 1px solid #aaa;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
*cursor: hand;
color: #333 !important;
border: 1px solid #aaa;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
*cursor: hand;
color: #333 !important;
}
.paging_full_numbers a.paginate_button {
background-color: #ddd;
background-color: #ddd;
}
.paging_full_numbers a.paginate_button:hover {
background-color: #ccc;
text-decoration: none !important;
background-color: #ccc;
text-decoration: none !important;
}
.paging_full_numbers a.paginate_active {
background-color: #99B3FF;
background-color: #99B3FF;
}
/*
* Processing indicator
*/
.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 14px;
background-color: white;
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 14px;
background-color: white;
}
/*
* Sorting
*/
table.dataTable thead th div.DataTables_sort_wrapper {
position: relative;
padding-right: 20px;
position: relative;
padding-right: 20px;
}
table.dataTable thead th div.DataTables_sort_wrapper span {
position: absolute;
top: 50%;
margin-top: -8px;
right: 0;
position: absolute;
top: 50%;
margin-top: -8px;
right: 0;
}
table.dataTable th:active {
outline: none;
outline: none;
}
/*
* Scrolling
*/
.dataTables_scroll {
clear: both;
clear: both;
}
.dataTables_scrollBody {
*margin-top: -1px;
-webkit-overflow-scrolling: touch;
*margin-top: -1px;
-webkit-overflow-scrolling: touch;
}

View File

@@ -1,36 +1,39 @@
/*
* Table
*/
table.dataTable {
margin: 0 auto;
clear: both;
width: 100%;
border-collapse: collapse;
margin: 0 auto;
clear: both;
width: 100%;
border-collapse: collapse;
}
table.dataTable thead th {
padding: 3px 0px 3px 10px;
cursor: pointer;
*cursor: hand;
padding: 3px 0px 3px 10px;
cursor: pointer;
*cursor: hand;
}
table.dataTable tfoot th {
padding: 3px 10px;
padding: 3px 10px;
}
table.dataTable td {
padding: 3px 10px;
padding: 3px 10px;
}
table.dataTable td.center,
table.dataTable td.dataTables_empty {
text-align: center;
text-align: center;
}
table.dataTable tr.odd { background-color: #f0fff0; }
table.dataTable tr.even { background-color: #ffffff; }
table.dataTable tr.odd {
background-color: #f0fff0;
}
table.dataTable tr.even {
background-color: #ffffff;
}
/*table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }*/
/*table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }*/
@@ -39,74 +42,71 @@ table.dataTable tr.even { background-color: #ffffff; }
/*table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }*/
/*table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }*/
/*
* Table wrapper
*/
.dataTables_wrapper {
position: relative;
clear: both;
*zoom: 1;
}
.dataTables_wrapper .ui-widget-header {
font-weight: normal;
}
.dataTables_wrapper .ui-toolbar {
padding: 5px;
position: relative;
clear: both;
*zoom: 1;
}
.dataTables_wrapper .ui-widget-header {
font-weight: normal;
}
.dataTables_wrapper .ui-toolbar {
padding: 5px;
}
/*
* Page length menu
*/
.dataTables_length {
float: left;
float: left;
}
/*
* Filter
*/
.dataTables_filter {
float: right;
text-align: right;
float: right;
text-align: right;
}
/*
* Table information
*/
.dataTables_info {
padding-top: 3px;
clear: both;
float: left;
padding-top: 3px;
clear: both;
float: left;
}
/*
* Pagination
*/
.dataTables_paginate {
float: right;
text-align: right;
float: right;
text-align: right;
}
.dataTables_paginate .ui-button {
margin-right: -0.1em !important;
margin-right: -0.1em !important;
}
.paging_two_button .ui-button {
float: left;
cursor: pointer;
* cursor: hand;
float: left;
cursor: pointer;
*cursor: hand;
}
.paging_full_numbers .ui-button {
padding: 2px 6px;
margin: 0;
cursor: pointer;
* cursor: hand;
color: #333 !important;
padding: 2px 6px;
margin: 0;
cursor: pointer;
*cursor: hand;
color: #333 !important;
}
/* Two button pagination - previous / next */
@@ -114,131 +114,149 @@ table.dataTable tr.even { background-color: #ffffff; }
.paginate_enabled_previous,
.paginate_disabled_next,
.paginate_enabled_next {
height: 19px;
float: left;
cursor: pointer;
*cursor: hand;
color: #111 !important;
height: 19px;
float: left;
cursor: pointer;
*cursor: hand;
color: #111 !important;
}
.paginate_disabled_previous:hover,
.paginate_enabled_previous:hover,
.paginate_disabled_next:hover,
.paginate_enabled_next:hover {
text-decoration: none !important;
text-decoration: none !important;
}
.paginate_disabled_previous:active,
.paginate_enabled_previous:active,
.paginate_disabled_next:active,
.paginate_enabled_next:active {
outline: none;
outline: none;
}
.paginate_disabled_previous,
.paginate_disabled_next {
color: #666 !important;
color: #666 !important;
}
.paginate_disabled_previous,
.paginate_enabled_previous {
padding-left: 23px;
padding-left: 23px;
}
.paginate_disabled_next,
.paginate_enabled_next {
padding-right: 23px;
margin-left: 10px;
padding-right: 23px;
margin-left: 10px;
}
.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
.paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }
.paginate_enabled_previous {
background: url('../images/back_enabled.png') no-repeat top left;
}
.paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }
.paginate_enabled_previous:hover {
background: url('../images/back_enabled_hover.png') no-repeat top left;
}
.paginate_disabled_previous {
background: url('../images/back_disabled.png') no-repeat top left;
}
.paginate_enabled_next {
background: url('../images/forward_enabled.png') no-repeat top right;
}
.paginate_enabled_next:hover {
background: url('../images/forward_enabled_hover.png') no-repeat top right;
}
.paginate_disabled_next {
background: url('../images/forward_disabled.png') no-repeat top right;
}
/* Full number pagination */
.paging_full_numbers a:active {
outline: none
outline: none
}
.paging_full_numbers a:hover {
text-decoration: none;
text-decoration: none;
}
.paging_full_numbers a.paginate_button,
.paging_full_numbers a.paginate_active {
border: 1px solid #aaa;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
*cursor: hand;
color: #333 !important;
border: 1px solid #aaa;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
*cursor: hand;
color: #333 !important;
}
.paging_full_numbers a.paginate_button {
background-color: #ddd;
background-color: #ddd;
}
.paging_full_numbers a.paginate_button:hover {
background-color: #ccc;
text-decoration: none !important;
background-color: #ccc;
text-decoration: none !important;
}
.paging_full_numbers a.paginate_active {
background-color: #99B3FF;
background-color: #99B3FF;
}
/*
* Processing indicator
*/
.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 14px;
background-color: white;
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 14px;
background-color: white;
}
/*
* Sorting
*/
table.dataTable thead th div.DataTables_sort_wrapper {
position: relative;
padding-right: 20px;
position: relative;
padding-right: 20px;
}
table.dataTable thead th div.DataTables_sort_wrapper span {
position: absolute;
top: 50%;
margin-top: -8px;
right: 0;
position: absolute;
top: 50%;
margin-top: -8px;
right: 0;
}
table.dataTable th:active {
outline: none;
outline: none;
}
/*
* Scrolling
*/
.dataTables_scroll {
clear: both;
clear: both;
}
.dataTables_scrollBody {
*margin-top: -1px;
-webkit-overflow-scrolling: touch;
*margin-top: -1px;
-webkit-overflow-scrolling: touch;
}

View File

@@ -1,9 +1,6 @@
/* G L O B A L */
html, body {
font-family: Verdana,serif;
font-family: Verdana, serif;
font-size: 12px;
color: #433F38;
line-height: 16px;
@@ -17,13 +14,14 @@ html, body {
}
h1 {
}
/* H E A D E R */
#migor-titleBar .logo {
float: left;
}
#migor-titleBar .headline {
color: #649C21;
float: left;
@@ -35,6 +33,7 @@ h1 {
position: relative;
width: 600px;
}
#migor-titleBar .headline .subHeadline {
color: #333333;
font-size: 16px;
@@ -42,6 +41,7 @@ h1 {
position: relative;
top: 10px;
}
#migor-titleBar .company {
font-size: 11px;
font-weight: bold;
@@ -51,7 +51,6 @@ h1 {
white-space: nowrap;
}
/* M E N U */
#migor-menuBar {
background: url("images/ui-bg_highlight-hard_75_e6e6e6_1x100.png") repeat-x scroll 50% 50% #EEEEEE;
@@ -60,7 +59,6 @@ h1 {
/* D I A L O G */
ul.service-config {
list-style-type: none;
margin: 0;
@@ -73,7 +71,6 @@ li.service-config {
padding: 5px;
}
/* W I D G E T S */
/* Form */
@@ -136,10 +133,10 @@ img.form-element {
hr.dialogDivider {
border: 0;
height: 1px;
background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
background-image: -ms-linear-gradient(left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
input[type=text].form-element,
@@ -162,7 +159,6 @@ p.form-element-error-message {
padding: 0 0 5px 0;
}
div.from-error-message {
margin: 0 0 10px 115px;
}
@@ -179,7 +175,6 @@ a.ui-tabs-anchor.closable span.ui-icon {
top: 7px;
}
/*Button*/
.migor-button {
display: block;
@@ -235,15 +230,49 @@ a.ui-tabs-anchor.closable span.ui-icon {
font-weight: normal;
}
.ui-timepicker-div .ui-widget-header {
margin-bottom: 8px;
}
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-div dl {
text-align: left;
}
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
.ui-timepicker-div dl dt {
float: left;
clear: left;
padding: 0 0 0 5px;
}
.ui-timepicker-div dl dd {
margin: 0 10px 10px 40%;
}
.ui-timepicker-div td {
font-size: 90%;
}
.ui-tpicker-grid-label {
background: none;
border: none;
margin: 0;
padding: 0;
}
.ui-timepicker-rtl {
direction: rtl;
}
.ui-timepicker-rtl dl {
text-align: right;
padding: 0 5px 0 0;
}
.ui-timepicker-rtl dl dt {
float: right;
clear: right;
}
.ui-timepicker-rtl dl dd {
margin: 0 40% 10px 10px;
}

View File

@@ -1 +1 @@
<meta http-equiv="refresh" content="0;url=./index.jsp" />
<meta http-equiv="refresh" content="0;url=./index.jsp"/>

View File

@@ -1,7 +1,7 @@
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="org.migor.shared.enums.CacheArea" %>
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -22,7 +22,7 @@
<link href="css/jquery.cleditor.css" rel="stylesheet" type="text/css"/>
<% } else { %>
<link href="css/migor-comb.min.css" rel="stylesheet" type="text/css"/>
<% } %>
<% } %>
<%-- ############### JS ############### --%>
@@ -43,8 +43,7 @@
<script type="text/javascript" src="js/plugins/khtml_all.js"></script>
<% if (debug) { %>
<% if (debug) { %>
<script type="text/javascript" src="js/widgets/widget-geoLocation.js"></script>
<script type="text/javascript" src="js/widgets/widget-components.js"></script>
<script type="text/javascript" src="js/widgets/widget-titleBar.js"></script>
@@ -65,7 +64,7 @@
<script type="text/javascript" src="js/pages/page-locationEntries.js"></script>
<% } else { %>
<script type="text/javascript" src="js/migor-comb.min.js"></script>
<% } %>
<% } %>
<%-- Widgets --%>
<script type="text/javascript ">
@@ -75,7 +74,7 @@
<!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function () {
migor.bootstrap.init();
});
@@ -88,7 +87,7 @@
// ignore
}
cacheAreas = ['<%= CacheArea.USERS %>','<%= CacheArea.LOCATIONS %>','<%= CacheArea.NODE_STATUS %>'];
cacheAreas = ['<%= CacheArea.USERS %>', '<%= CacheArea.LOCATIONS %>', '<%= CacheArea.NODE_STATUS %>'];
</script>
</head>
<body>

View File

@@ -6,7 +6,7 @@
migor = {};
migor.configuration = {
dataTable: {
aLengthMenu : [100,500,1000],
aLengthMenu: [100, 500, 1000],
iDisplayLength: 100,
oLanguage: {
"sInfo": "_START_ to _END_ (Total: _TOTAL_ entries)",

View File

@@ -4,22 +4,22 @@
* daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH
*/
migor.dialog = new function() {
migor.dialog = new function () {
var _defaultDialogWidth = 420;
this.openEditor = function(dlgTitle, dlgContent, dlgWidth, okCallback, cancelCallback) {
this.openEditor = function (dlgTitle, dlgContent, dlgWidth, okCallback, cancelCallback) {
_showDialog(
dlgTitle,
dlgContent,
{
"Cancel": function() {
"Cancel": function () {
if (typeof(cancelCallback) === 'function') {
cancelCallback.call(this);
}
$( this ).dialog( "close" );
$(this).dialog("close");
},
"Save": function() {
"Save": function () {
if (typeof(okCallback) === 'function') {
okCallback.call(this);
}
@@ -28,60 +28,60 @@ migor.dialog = new function() {
};
this.openWarnDialog = function(message, okCallback, cancelCallback) {
this.openWarnDialog = function (message, okCallback, cancelCallback) {
var messageContent = $('<p style="text-align: center;"></p>').append(message);
_showDialog(
"Warning",
messageContent,
{
"Cancel": function() {
"Cancel": function () {
if (typeof(cancelCallback) === 'function') {
cancelCallback.call(this);
}
$( this ).dialog( "close" );
$(this).dialog("close");
},
"Ok": function() {
"Ok": function () {
if (typeof(okCallback) === 'function') {
okCallback.call(this);
}
$( this ).dialog( "close" );
$(this).dialog("close");
}
}, null, "ui-state-highlight", '<span style="float: left; margin-right: .3em; position: relative;" class="ui-icon ui-icon-info"></span>');
};
this.openMessageDialog = function(title, message, closeCallback, width) {
this.openMessageDialog = function (title, message, closeCallback, width) {
var messageContent = $('<p style="text-align: center;"></p>').append(message);
_showDialog(
title,
messageContent,
{
"Ok": function() {
"Ok": function () {
if (typeof(closeCallback) === 'function') {
closeCallback.call(this);
}
$( this ).dialog( "close" );
$(this).dialog("close");
}
}, width, '', '<span style="float: left; margin-right: .3em; position: relative;" class="ui-icon ui-icon-info"></span>');
};
this.openErrorDialog = function(message, closeCallback) {
this.openErrorDialog = function (message, closeCallback) {
var messageContent = $('<p style="text-align: center;"></p>').text(message);
_showDialog(
'Error',
messageContent,
{
"Ok": function() {
"Ok": function () {
if (typeof(closeCallback) === 'function') {
closeCallback.call(this);
}
$( this ).dialog( "close" );
$(this).dialog("close");
}
}, null, "ui-state-error", '<span style="float: left; margin-right: .3em; position: relative;" class="ui-icon ui-icon-alert"></span>');
};
this.openDialog = function(dlgTitle, dlgContent, buttonCfg, dlgWidth, dialogClass, dialogIcon) {
this.openDialog = function (dlgTitle, dlgContent, buttonCfg, dlgWidth, dialogClass, dialogIcon) {
_showDialog(dlgTitle, dlgContent, buttonCfg, dlgWidth, dialogClass, dialogIcon);
};
@@ -89,10 +89,10 @@ migor.dialog = new function() {
var dwidth = dialogWidth ? dialogWidth : _defaultDialogWidth;
var dialog = _createDialogDiv(dlgTitle );
var dialog = _createDialogDiv(dlgTitle);
dialog.append(content);
var pos = position?position:'center';
var pos = position ? position : 'center';
dialog.dialog(
{
@@ -101,16 +101,16 @@ migor.dialog = new function() {
maxHeight: $("body").height() - 10,
autoOpen: true,
modal: true,
position:pos,
position: pos,
buttons: buttonCfg,
stack: false,
// resizable: false,
//add custom style classes to dialog container
// dialogClass: dialogClass,
open: function() {
open: function () {
dialog.parent().find('.ui-dialog-titlebar').prepend(dialogIcon).addClass(dialogClass);
},
close: function() {
close: function () {
$(this).dialog('destroy');
$(this).remove();
}
@@ -129,6 +129,6 @@ migor.dialog = new function() {
function _createDialogDiv(dialogTitle) {
return $("<div title=\""+dialogTitle+"\" class='ui_dialog_content ui_widget_content' style='width: auto; min_height: 50px; height: auto; max-height:"+400+"px;'></div>");
return $("<div title=\"" + dialogTitle + "\" class='ui_dialog_content ui_widget_content' style='width: auto; min_height: 50px; height: auto; max-height:" + 400 + "px;'></div>");
}
};

View File

@@ -1,6 +1,6 @@
migor.bootstrap = new function () {
this.init = function() {
this.init = function () {
var self = this;
// $('body').addClass('ui-widget');
@@ -11,25 +11,23 @@ migor.bootstrap = new function () {
$('#migor-titleBar').titleBar({
headline: "Migor - Administration",
subHeadline: '> Version ' + version + ' Revision ' + buildNumber,
info:$('<span></span>').geoLocation()
info: $('<span></span>').geoLocation()
});
var menuSettings = [
{
"label": 'System',
"menus":
[
{page: migor.pageNodeStatus},
{page: migor.pageCacheEntries}
]
"menus": [
{page: migor.pageNodeStatus},
{page: migor.pageCacheEntries}
]
},
{
"label": 'Location',
"menus":
[
{page: migor.pageLocationEntries}
]
"menus": [
{page: migor.pageLocationEntries}
]
}
];
@@ -41,7 +39,7 @@ migor.bootstrap = new function () {
var menuItem = $('<li></li>');
var menuItemLink = $('<a href="#">About</a>');
menuItemLink.click(function() {
menuItemLink.click(function () {
migor.dialog.openMessageDialog('About', '<span style="color: #649C21; font-size: 20px; font-family: A1TelekomMedium;">Migor</span></br><span style="margin-top: 10px; font-family: A1TelekomMedium;">Version ' + version + ' Revision ' + buildNumber + '</span></br></br><span style="font-size: 8px;">build on</span></br><span>' + timestamp + '</span>');
});
@@ -59,23 +57,23 @@ migor.bootstrap = new function () {
};
this.appendMenus = function(container, settings) {
this.appendMenus = function (container, settings) {
var self = this;
$.each(settings, function(index, m){
$.each(settings, function (index, m) {
var item;
var itemContainer;
if (m.menus != null) {
item = $('<a href="#">'+m.label+'</a>');
item = $('<a href="#">' + m.label + '</a>');
var subMenu = $('<ul></ul>');
self.appendMenus(subMenu, m.menus);
itemContainer = $('<li></li>');
itemContainer.append(item);
itemContainer.append(subMenu);
} else if (m.page != null ) {
item = $('<a href="#">'+m.page.options.label+'</a>');
item.click(function() {
} else if (m.page != null) {
item = $('<a href="#">' + m.page.options.label + '</a>');
item.click(function () {
migor.bootstrap.open(m.page);
});
@@ -86,24 +84,24 @@ migor.bootstrap = new function () {
});
};
this.open = function(page, argument) {
this.open = function (page, argument) {
var id = page.options.id;
var tab = $('#migor-content');
var content = tab.find('#'+id);
var content = tab.find('#' + id);
if (content.length == 0) {
// create new tab
var header = $('<a href="#'+id+'">'+page.options.label+'</a>');
var newContent = $('<div id="'+id+'" class="ui-tabs-panel ui-widget-content ui-corner-bottom"></div>');
var header = $('<a href="#' + id + '">' + page.options.label + '</a>');
var newContent = $('<div id="' + id + '" class="ui-tabs-panel ui-widget-content ui-corner-bottom"></div>');
if (page.options.closable) {
var closeButton = $('<span class="ui-icon ui-icon-close"></span>');
//noinspection JSUnusedLocalSymbols
closeButton.click(function(event) {
closeButton.click(function (event) {
header.parent().remove();
newContent.remove();
tab.tabs( "refresh" );
tab.tabs("refresh");
});
header.append(closeButton);
header.addClass('closable');
@@ -116,13 +114,13 @@ migor.bootstrap = new function () {
page.init(newContent, argument);
// refresh
tab.tabs( "refresh" );
tab.tabs("refresh");
} else {
// refresh tab content
page.refresh(content, argument);
}
// Activate current tab
var index = tab.find('a[href="#'+id+'"]').parent().index();
var index = tab.find('a[href="#' + id + '"]').parent().index();
tab.tabs('option', 'active', index);
};
};

View File

@@ -6,8 +6,8 @@
migor.pageCacheEntries = new function () {
this.options = {
"id":'cacheEntries',
"closable":true,
"id": 'cacheEntries',
"closable": true,
"label": 'Cache Entries',
// function defined in the js client stub
@@ -31,7 +31,7 @@ migor.pageCacheEntries = new function () {
}
}
);
refreshButton.on('click', function() {
refreshButton.on('click', function () {
self.refresh();
});
content.append(refreshButton);
@@ -40,10 +40,10 @@ migor.pageCacheEntries = new function () {
cacheSelection = $('<select></select>');
for (var i=0; i<cacheAreas.length; i++) {
cacheSelection.append('<option value="'+cacheAreas[i]+'">'+cacheAreas[i]+'</option> ');
for (var i = 0; i < cacheAreas.length; i++) {
cacheSelection.append('<option value="' + cacheAreas[i] + '">' + cacheAreas[i] + '</option> ');
}
cacheSelection.on('change', function() {
cacheSelection.on('change', function () {
self.refresh();
});
@@ -59,7 +59,7 @@ migor.pageCacheEntries = new function () {
};
this.displayDataTable = function(content, data) {
this.displayDataTable = function (content, data) {
var self = this;
table = $('<table width="100%"></table>');
@@ -67,8 +67,8 @@ migor.pageCacheEntries = new function () {
table.dataTable({
"bServerSide": true,
"fnServerData": function(aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {"area": cacheSelection.val()}, function(data, totalRecords) {
"fnServerData": function (aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {"area": cacheSelection.val()}, function (data, totalRecords) {
successCallback({aaData: data, iTotalDisplayRecords: totalRecords, iTotalRecords: totalRecords});
}, null, true);
},
@@ -78,17 +78,17 @@ migor.pageCacheEntries = new function () {
"bFilter": true,
"bJQueryUI": true,
"aLengthMenu": migor.configuration.dataTable.aLengthMenu,
"iDisplayLength" : migor.configuration.dataTable.iDisplayLength,
"iDisplayLength": migor.configuration.dataTable.iDisplayLength,
"bDestroy": true,
"oLanguage": migor.configuration.dataTable.oLanguage,
"aoColumns": [
{ "mData": "key", sTitle: "Key", sClass:"right", "bSortable": false, "bVisible": true, "sWidth": '100px',
"mRender": function ( tableData, type, full ) {
{ "mData": "key", sTitle: "Key", sClass: "right", "bSortable": false, "bVisible": true, "sWidth": '100px',
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
},
{ "mData": "value", sTitle: "Value", "bSortable": false, "bVisible": true,
"mRender": function ( tableData, type, full ) {
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
}

View File

@@ -6,8 +6,8 @@
migor.pageCustomerConfiguration = new function () {
this.options = {
"id":'customerConfig',
"closable":true,
"id": 'customerConfig',
"closable": true,
"label": 'Customers',
"funcGetEntities": null
@@ -29,7 +29,7 @@ migor.pageCustomerConfiguration = new function () {
}
}
);
refreshButton.on('click', function() {
refreshButton.on('click', function () {
self.refresh(content);
});
@@ -44,12 +44,12 @@ migor.pageCustomerConfiguration = new function () {
};
this.resizeDataTables = function() {
table.parent().css('height', hpip.pageCustomerConfiguration.getRemainingDataTableContentHeight()+"px");
this.resizeDataTables = function () {
table.parent().css('height', hpip.pageCustomerConfiguration.getRemainingDataTableContentHeight() + "px");
table.dataTable().fnAdjustColumnSizing();
};
this.getRemainingDataTableContentHeight = function() {
this.getRemainingDataTableContentHeight = function () {
// measured height from the top of the page until including the table headers
var topHeight = 299;
// measured height of the table footer + 20% buffer for safety
@@ -57,7 +57,7 @@ migor.pageCustomerConfiguration = new function () {
return $(window).height() - topHeight;
};
this.displayDataTable = function(content) {
this.displayDataTable = function (content) {
var self = this;
table = $('<table></table>');
@@ -67,8 +67,8 @@ migor.pageCustomerConfiguration = new function () {
"sDom": '<"top dataTables_filter"l>rt<"bottom"ip><"clear">',
"bServerSide": true,
// "sAjaxSource": "/hpip",
"fnServerData": function(aSource, aoData, successCallback) {
hpip.rest.request(self.options.funcGetEntities, hpip.rest.generateArgsFromAoData(aoData), function(data, totalRecords) {
"fnServerData": function (aSource, aoData, successCallback) {
hpip.rest.request(self.options.funcGetEntities, hpip.rest.generateArgsFromAoData(aoData), function (data, totalRecords) {
successCallback({aaData: data, iTotalDisplayRecords: totalRecords, iTotalRecords: totalRecords});
});
},
@@ -84,22 +84,22 @@ migor.pageCustomerConfiguration = new function () {
"sPaginationType": "full_numbers",
// use rbt-default number of entries
"aLengthMenu": hpip.configuration.dataTable.aLengthMenu,
"iDisplayLength" : hpip.configuration.dataTable.iDisplayLength,
"iDisplayLength": hpip.configuration.dataTable.iDisplayLength,
"bDestroy": true,
"oLanguage": hpip.configuration.dataTable.oLanguage,
"aoColumns": [
{ "mData": "msisdn", sTitle: "MSISDN", sClass:"center", "bSortable": false,
"mRender": function ( tableData, type, full ) {
{ "mData": "msisdn", sTitle: "MSISDN", sClass: "center", "bSortable": false,
"mRender": function (tableData, type, full) {
return hpip.utils.escapeHtml(tableData);
}
},
{ "mData": "businessAccount", sTitle: "Business Account", sClass:"left", "bSortable": false,
"mRender": function ( tableData, type, full ) {
{ "mData": "businessAccount", sTitle: "Business Account", sClass: "left", "bSortable": false,
"mRender": function (tableData, type, full) {
if (tableData) {
return 'License plate: ' + hpip.utils.escapeHtml(tableData.licensePlate) + '<br/>' +
'City id: ' + hpip.utils.escapeHtml(tableData.cityId) + '<br/>' +
'Remaining minutes: ' + hpip.utils.escapeHtml(tableData.remainingMinutes) + '<br/>' +
'City id: ' + hpip.utils.escapeHtml(tableData.cityId) + '<br/>' +
'Remaining minutes: ' + hpip.utils.escapeHtml(tableData.remainingMinutes) + '<br/>' +
'Remaining Eurocents: ' + hpip.utils.escapeHtml(tableData.remainingEuroCents)
;
} else {
@@ -108,12 +108,12 @@ migor.pageCustomerConfiguration = new function () {
}
},
{ "mData": "privateAccount", sTitle: "Private Account", sClass:"left", "bSortable": false,
"mRender": function ( tableData, type, full ) {
{ "mData": "privateAccount", sTitle: "Private Account", sClass: "left", "bSortable": false,
"mRender": function (tableData, type, full) {
if (tableData) {
return 'License plate: ' + hpip.utils.escapeHtml(tableData.licensePlate) + '<br/>' +
'City id: ' + hpip.utils.escapeHtml(tableData.cityId) + '<br/>' +
'Remaining minutes: ' + hpip.utils.escapeHtml(tableData.remainingMinutes) + '<br/>' +
'City id: ' + hpip.utils.escapeHtml(tableData.cityId) + '<br/>' +
'Remaining minutes: ' + hpip.utils.escapeHtml(tableData.remainingMinutes) + '<br/>' +
'Remaining Eurocents: ' + hpip.utils.escapeHtml(tableData.remainingEuroCents)
;
} else {
@@ -121,8 +121,8 @@ migor.pageCustomerConfiguration = new function () {
}
}
},
{ "mData": "modifiedAt", sTitle: "Modified At", sClass:"center", "bSortable": true,
"mRender": function ( tableData, type, full ) {
{ "mData": "modifiedAt", sTitle: "Modified At", sClass: "center", "bSortable": true,
"mRender": function (tableData, type, full) {
return hpip.utils.escapeHtml(tableData);
}
}

View File

@@ -6,8 +6,8 @@
migor.pageLocationEntries = new function () {
this.options = {
"id":'locationEntries',
"closable":true,
"id": 'locationEntries',
"closable": true,
"label": 'Location Entries',
// function defined in the js client stub
@@ -31,7 +31,7 @@ migor.pageLocationEntries = new function () {
}
}
);
refreshButton.on('click', function() {
refreshButton.on('click', function () {
self.refresh();
});
@@ -39,7 +39,7 @@ migor.pageLocationEntries = new function () {
buttonDiv.append(refreshButton);
content.append(buttonDiv);
migor.rest.request(self.options.funcGetEntries, {}, function(data, totalRecords) {
migor.rest.request(self.options.funcGetEntries, {}, function (data, totalRecords) {
self.displayDataTable(content, data);
self.displayMap(content, data);
@@ -50,43 +50,43 @@ migor.pageLocationEntries = new function () {
this.refresh = function () {
var self = this;
migor.rest.request(UserService.setLocation, {$entity: JSON.stringify(self.map.openMap('getMainMarkerLocation'))}, function() {
migor.rest.request(UserService.setLocation, {$entity: JSON.stringify(self.map.openMap('getMainMarkerLocation'))}, function () {
table.fnDraw();
});
};
this.displayMap = function(content, data) {
this.displayMap = function (content, data) {
var self = this;
self.map = $('<div style="float: right; width:49%;height:389px"></div>');
self.map = $('<div style="float: right; width:49%;height:389px"></div>');
//map.openStreetMap({
// center: {lat: data.userLocation.latitude, lng: data.userLocation.longitude},
// zoom: 5, // Zoom level (1 to 18)
// zoombar: true // Show the zoombar? (true or false)
//});
content.append(self.map );
content.append(self.map);
self.map.openMap({callback: function() {
self.map.openMap({callback: function () {
self.refresh();
}});
self.map.openMap('center', data.userLocation.latitude,data.userLocation.longitude,14);
self.map.openMap('center', data.userLocation.latitude, data.userLocation.longitude, 14);
self.map.openMap('setMainMarker', data.userLocation);
for (var i=0; i<data.boundingBoxes.length; i++) {
self.map .openMap('addBBox',data.boundingBoxes[i], 'yellow');
for (var i = 0; i < data.boundingBoxes.length; i++) {
self.map.openMap('addBBox', data.boundingBoxes[i], 'yellow');
}
self.setLocationMarkers(data);
};
this.setLocationMarkers = function(data) {
this.setLocationMarkers = function (data) {
var self = this;
self.map.openMap('setMarkers', data.locationMarks);
};
this.displayDataTable = function(content, data) {
this.displayDataTable = function (content, data) {
var self = this;
table = $('<table width="100%"></table>');
@@ -94,36 +94,36 @@ migor.pageLocationEntries = new function () {
table.dataTable({
"bServerSide": true,
"fnServerData": function(aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {}, function(data, totalRecords) {
"fnServerData": function (aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {}, function (data, totalRecords) {
successCallback({aaData: data.locationMarks});
self.setLocationMarkers(data);
}, null, true);
},
"aaData":data.locationMarks,
"aaData": data.locationMarks,
"bProcessing": false,
"bPaginate": false,
"bSort": false,
"bFilter": true,
"bJQueryUI": true,
"aLengthMenu": migor.configuration.dataTable.aLengthMenu,
"iDisplayLength" : migor.configuration.dataTable.iDisplayLength,
"iDisplayLength": migor.configuration.dataTable.iDisplayLength,
"bDestroy": true,
"oLanguage": migor.configuration.dataTable.oLanguage,
"aoColumns": [
{ "mData": "locationMarkType", sTitle: "Type", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '50px',
"mRender": function ( tableData, type, full ) {
{ "mData": "locationMarkType", sTitle: "Type", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '50px',
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
},
{ "mData": "name", sTitle: "Name", sClass:"right", "bSortable": false, "bVisible": true,
"mRender": function ( tableData, type, full ) {
{ "mData": "name", sTitle: "Name", sClass: "right", "bSortable": false, "bVisible": true,
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
},
{ "mData": "lastModifiedAt", sTitle: "Modified At", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function ( tableData, type, full ) {
{ "mData": "lastModifiedAt", sTitle: "Modified At", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
}

View File

@@ -6,8 +6,8 @@
migor.pageNodeStatus = new function () {
this.options = {
"id":'nodeStatus',
"closable":true,
"id": 'nodeStatus',
"closable": true,
"label": 'Status',
// function defined in the js client stub
@@ -30,7 +30,7 @@ migor.pageNodeStatus = new function () {
}
}
);
refreshButton.on('click', function() {
refreshButton.on('click', function () {
self.refresh();
});
content.append(refreshButton);
@@ -44,7 +44,7 @@ migor.pageNodeStatus = new function () {
};
this.displayDataTable = function(content, data) {
this.displayDataTable = function (content, data) {
var self = this;
table = $('<table width="100%"></table>');
@@ -52,8 +52,8 @@ migor.pageNodeStatus = new function () {
table.dataTable({
"bServerSide": true,
"fnServerData": function(aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {}, function(data, totalRecords) {
"fnServerData": function (aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {}, function (data, totalRecords) {
successCallback({aaData: data, iTotalDisplayRecords: totalRecords, iTotalRecords: totalRecords});
}, null, true);
},
@@ -63,22 +63,22 @@ migor.pageNodeStatus = new function () {
"bFilter": true,
"bJQueryUI": true,
"aLengthMenu": migor.configuration.dataTable.aLengthMenu,
"iDisplayLength" : migor.configuration.dataTable.iDisplayLength,
"iDisplayLength": migor.configuration.dataTable.iDisplayLength,
"bDestroy": true,
"oLanguage": migor.configuration.dataTable.oLanguage,
"aoColumns": [
{ "mData": "id", sTitle: "Node", sClass:"right", "bSortable": false, "bVisible": true,
"mRender": function ( tableData, type, full ) {
{ "mData": "id", sTitle: "Node", sClass: "right", "bSortable": false, "bVisible": true,
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
},
{ "mData": "startedAt", sTitle: "Started At", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function ( tableData, type, full ) {
{ "mData": "startedAt", sTitle: "Started At", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
},
{ "mData": "lastModifiedAt", sTitle: "Last Modified At", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function ( tableData, type, full ) {
{ "mData": "lastModifiedAt", sTitle: "Last Modified At", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData);
}
}

View File

@@ -1,4 +1,4 @@
migor.rest = new function() {
migor.rest = new function () {
/**
*
@@ -8,7 +8,7 @@ migor.rest = new function() {
* @param [validationCallback]
* @param [loader]
*/
this.request = function(restFunc, params, successCallback, validationCallback, loader) {
this.request = function (restFunc, params, successCallback, validationCallback, loader) {
if (typeof(restFunc) === 'function') {
@@ -17,7 +17,7 @@ migor.rest = new function() {
}
params["$callback"] = function(code, request, response) {
params["$callback"] = function (code, request, response) {
// var response = ;
if (loader) {
$.unblockUI();
@@ -42,7 +42,7 @@ migor.rest = new function() {
break;
}
} else {
migor.dialog.openErrorDialog(code + ': ' +request.responseText);
migor.dialog.openErrorDialog(code + ': ' + request.responseText);
}
};
@@ -72,7 +72,7 @@ migor.rest = new function() {
* @param [invalidFieldsCallback]
* @param [loader]
*/
this.postSubmitJSON = function(url, urlReplacements, formObject, callbackFunction, invalidFieldsCallback, loader) {
this.postSubmitJSON = function (url, urlReplacements, formObject, callbackFunction, invalidFieldsCallback, loader) {
var self = this;
// self.block();
@@ -81,10 +81,10 @@ migor.rest = new function() {
}
formObject.ajaxSubmit({
type: "POST",
url: self.replaceInUrl(url,urlReplacements),
dataType:'json',
iframe:true,
success: function(data) {
url: self.replaceInUrl(url, urlReplacements),
dataType: 'json',
iframe: true,
success: function (data) {
if (loader) {
$.unblockUI();
}
@@ -100,7 +100,7 @@ migor.rest = new function() {
callbackFunction(data);
}
},
error: function() {
error: function () {
if (loader) {
$.unblockUI();
}
@@ -109,7 +109,7 @@ migor.rest = new function() {
});
};
this.generateArgsFromAoData = function(aoData) {
this.generateArgsFromAoData = function (aoData) {
var columns = aoData[1].value;
@@ -118,12 +118,12 @@ migor.rest = new function() {
args["span"] = aoData[4].value;
for (var i=5; i<5+columns; i++) {
var propIndex = i-5;
for (var i = 5; i < 5 + columns; i++) {
var propIndex = i - 5;
var propName = aoData[i].value;
var searchValue = aoData[7+columns+(propIndex*3)].value;
if (aoData[7+columns+(propIndex*3)+2].value == true && searchValue != null && searchValue != '' && searchValue != '~') {
var searchValue = aoData[7 + columns + (propIndex * 3)].value;
if (aoData[7 + columns + (propIndex * 3) + 2].value == true && searchValue != null && searchValue != '' && searchValue != '~') {
if (searchValue.indexOf("~") >= 0) {
args[propName] = searchValue.split('~');
@@ -141,14 +141,14 @@ migor.rest = new function() {
* @param urlReplacements
* @returns {*}
*/
this.replaceInUrl = function(url, urlReplacements) {
this.replaceInUrl = function (url, urlReplacements) {
var self = this;
if (urlReplacements == null)
return url;
for (var key in urlReplacements) {
//noinspection JSUnfilteredForInLoop
var value= urlReplacements[key];
var value = urlReplacements[key];
if (value == null || value == "") {
//noinspection JSUnfilteredForInLoop
url = url.replace(key, " ");
@@ -168,31 +168,31 @@ migor.rest = new function() {
*
* @param value string to encode
*/
this.urlEncodePathParameter = function(value) {
this.urlEncodePathParameter = function (value) {
// be on the safe side
if (value == null) {
return null;
}
var _value =''+value;
var _value = '' + value;
var encodeMe = {
"?":"%3F",
"%":"%25",
"?": "%3F",
"%": "%25",
"/": "%2F"
};
var result="";
for ( var i = 0; i < _value.length; i++ ) {
var result = "";
for (var i = 0; i < _value.length; i++) {
result += encodeMe[_value.charAt(i)] == undefined ? _value.charAt(i) : encodeMe[_value.charAt(i)];
}
return result;
};
this.block = function() {
$.blockUI({ message: $('#block'), css: { position:'relative', top:'0px', left:'0px', width:'100%', height:'100%', 'vertical-align':'middle', background: 'none', color: '#fff'} });
this.block = function () {
$.blockUI({ message: $('#block'), css: { position: 'relative', top: '0px', left: '0px', width: '100%', height: '100%', 'vertical-align': 'middle', background: 'none', color: '#fff'} });
};
this.unblock = function() {
this.unblock = function () {
$.unblockUI();
};

View File

@@ -3,22 +3,22 @@
* daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH
*/
migor.utils = new function() {
migor.utils = new function () {
this.getCities = function(callback) {
this.getCities = function (callback) {
// TODO implement service where only id and name is returned!
migor.rest.request(CityAdminService.getCities, {}, callback);
};
this.getCaches = function(callback) {
this.getCaches = function (callback) {
migor.rest.request(CacheAdminService.getCaches, {}, callback);
};
this.escapeHtml = function(string, trimLength) {
this.escapeHtml = function (string, trimLength) {
if (string != null) {
if (trimLength > 0 && string.length > trimLength) {
return $('<div><span' + ' title="' + string + '"'+'>'+string.substring(0,trimLength) + '...'+'</span></div>').html();
return $('<div><span' + ' title="' + string + '"' + '>' + string.substring(0, trimLength) + '...' + '</span></div>').html();
} else {
return $('<div></div>').text(string).html();
}
@@ -27,7 +27,7 @@ migor.utils = new function() {
}
};
this.replaceString = function(text, string, replaceString) {
this.replaceString = function (text, string, replaceString) {
if (text != null) {
return text.replace(string, replaceString);
} else {
@@ -54,7 +54,7 @@ migor.utils = new function() {
* @param ts timestamp
* @return String a human readable and sortable date representation of the timestamp
*/
this.formatTimeStamp = function(ts, displayShort) {
this.formatTimeStamp = function (ts, displayShort) {
if (ts == null || ts <= 0) {
return "";
}
@@ -66,9 +66,9 @@ migor.utils = new function() {
var minute = dateObject.getMinutes();
var second = dateObject.getSeconds();
if (!displayShort) {
return year + "-" + (month < 10 ? ("0"+month) : month)+ "-" + (day < 10 ? ("0"+day) : day) + " " + (hour < 10 ? ("0"+hour) : hour) + ":" + (minute < 10 ? ("0"+minute) : minute) + ":" + (second < 10 ? ("0"+second) : second);
return year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (day < 10 ? ("0" + day) : day) + " " + (hour < 10 ? ("0" + hour) : hour) + ":" + (minute < 10 ? ("0" + minute) : minute) + ":" + (second < 10 ? ("0" + second) : second);
}
return year + "-" + (month < 10 ? ("0"+month) : month)+ "-" + (day < 10 ? ("0"+day) : day) + " " + (hour < 10 ? ("0"+hour) : hour) + ":" + (minute < 10 ? ("0"+minute): minute);
return year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (day < 10 ? ("0" + day) : day) + " " + (hour < 10 ? ("0" + hour) : hour) + ":" + (minute < 10 ? ("0" + minute) : minute);
};

View File

@@ -12,7 +12,7 @@ $(function () {
label: '',
clickCallback: null
},
_create: function(){
_create: function () {
var that = this;
// create button link
@@ -28,7 +28,7 @@ $(function () {
that.element.addClass("hpip-button");
that.element.append(link);
},
clickAction: function(event) {
clickAction: function (event) {
var that = this;
if (typeof(that.options.clickCallback) === 'function') {
that.options.clickCallback.call(this);

View File

@@ -1,19 +1,21 @@
$.widget("hpip.form", {
tabs: null,
elements:[],
elements: [],
options: {
data: null,
elementOptions: [{name:"test", label:"Test"}],
elementOptions: [
{name: "test", label: "Test"}
],
errorClass: 'ui-state-error ui-corner-all'
},
_create:function () {
_create: function () {
this._load();
},
_setOptions: function() {
this._superApply( arguments );
_setOptions: function () {
this._superApply(arguments);
this._load();
},
_load: function() {
_load: function () {
var self = this;
@@ -23,7 +25,7 @@ $.widget("hpip.form", {
self.tabs = $('<div></div>');
var tabsHeader = $('<ul></ul>');
$.each(self.options.elementOptions.tabs, function(index, item) {
$.each(self.options.elementOptions.tabs, function (index, item) {
self._createTabContent(item, tabsHeader, self.tabs, index);
});
@@ -36,15 +38,15 @@ $.widget("hpip.form", {
self.element.append(self.tabs);
},
_createTabContent: function(item, tabsHeader, content, tabIndex) {
_createTabContent: function (item, tabsHeader, content, tabIndex) {
var self = this;
tabsHeader.append('<li><a href="#tab-'+item.title+'">'+item.title+'</a></li>');
tabsHeader.append('<li><a href="#tab-' + item.title + '">' + item.title + '</a></li>');
var tabContent = $('<div id="tab-'+item.title+'"></div>');
var tabContent = $('<div id="tab-' + item.title + '"></div>');
var message = $('<p class="form-error-message error-message ui-state-error ui-corner-all" style="display: none; text-align: center;"></p>');
tabContent.append(message);
for (var i=0; i<item.options.length; i++) {
for (var i = 0; i < item.options.length; i++) {
var elementOptions = item.options[i];
if (self.options.data != null) {
@@ -60,26 +62,26 @@ $.widget("hpip.form", {
}
content.append(tabContent);
},
getElement: function(name) {
getElement: function (name) {
var self = this;
for (var i=0; i<self.elements.length; i++) {
for (var i = 0; i < self.elements.length; i++) {
if (self.elements[i].name == name) {
return self.elements[i].element;
}
}
return null;
},
reset: function() {
reset: function () {
var self = this;
self.element.find('p.form-error-message')
.removeClass(this.options.errorClass)
.html('')
.hide();
$.each(self.elements, function(index, item) {
$.each(self.elements, function (index, item) {
item.element.formElement('resetError');
});
},
markViolations: function(data) {
markViolations: function (data) {
var self = this;
if (data.errorMessage != null) {
@@ -91,7 +93,7 @@ $.widget("hpip.form", {
var firstTab = null;
for (var key in data.affectedFields) {
$.each(self.elements, function(index, item) {
$.each(self.elements, function (index, item) {
if (item.name == key) {
item.element.formElement('setError', data.affectedFields[key]);
@@ -105,9 +107,9 @@ $.widget("hpip.form", {
self.tabs.tabs({active: firstTab});
}
},
values: function() {
values: function () {
var result = {};
for (var i=0; i<this.elements.length; i++) {
for (var i = 0; i < this.elements.length; i++) {
result[this.elements[i].name] = this.elements[i].element.formElement('value');
}
return result;
@@ -119,7 +121,7 @@ $.widget("hpip.formElement", {
input: null,
errorMessage: null,
options:{
options: {
// display options
disabled: false,
readOnly: false,
@@ -143,24 +145,24 @@ $.widget("hpip.formElement", {
// classes
errorClass: 'ui-state-error ui-corner-all'
},
_create:function () {
_create: function () {
this._load();
},
_setOptions: function() {
this._superApply( arguments );
_setOptions: function () {
this._superApply(arguments);
this._load();
},
_load: function() {
_load: function () {
var self = this;
self.element.empty();
self.element.attr('id', 'form-element-'+self.options.name);
self.element.attr('id', 'form-element-' + self.options.name);
self.element.addClass('form-element');
var label = '';
if (self.options.label != null) {
label = $('<label class="form-element"></label>').append(self.options.label + ': ' + (self.options.mandatory?'*':''));
label = $('<label class="form-element"></label>').append(self.options.label + ': ' + (self.options.mandatory ? '*' : ''));
} else {
label = $('<div></div>');
}
@@ -168,39 +170,39 @@ $.widget("hpip.formElement", {
switch (self.options.type) {
case 'hidden':
self.input = $('<input name="'+self.options.name+'" type="hidden" class="form-element" value="'+value+'"/>');
self.input = $('<input name="' + self.options.name + '" type="hidden" class="form-element" value="' + value + '"/>');
label = self.input;
self.element.hide();
break;
case 'textOnly':
self.input = $('<span name="'+self.options.name+'" style="text-align: left;" class="form-element">'+value+'</span>');
self.input = $('<span name="' + self.options.name + '" style="text-align: left;" class="form-element">' + value + '</span>');
label.append(self.input);
break;
case 'button':
self.input = $('<button"></button>');
self.input.button( {
self.input.button({
label: self.options.name
});
if (typeof(self.options.click) === 'function') {
self.input.on('click', function() {
self.input.on('click', function () {
self.options.click(self.element, self.input, self.options);
});
}
label.append(self.input);
break;
case 'select':
self.input = $('<select name="'+self.options.name+'" class="form-element"></select>');
self.input = $('<select name="' + self.options.name + '" class="form-element"></select>');
if (typeof(self.options.changeElement) === 'function') {
self.input.change(function() {
self.input.change(function () {
self.options.changeElement(self.element, self.input, self.options);
});
}
label.append(self.input);
break;
case 'multiselect':
self.input = $('<select style="width: 380px; height: 200px;" name="'+self.options.name+'[]" multiple="multiple" class="multiselect"></select>');
self.input = $('<select style="width: 380px; height: 200px;" name="' + self.options.name + '[]" multiple="multiple" class="multiselect"></select>');
if (typeof(self.options.changeElement) === 'function') {
self.input.change(function() {
self.input.change(function () {
self.options.changeElement(self.element, self.input, self.options);
});
}
@@ -220,33 +222,33 @@ $.widget("hpip.formElement", {
case 'textarea':
if (self.options.idAttributeName != null) {
self.input = $('<textarea name="'+self.options.name+'" class="form-element" id="'+self.options.idAttributeName+'" style="'+self.options.cssStyle+'">'+value+'</textarea>');
self.input = $('<textarea name="' + self.options.name + '" class="form-element" id="' + self.options.idAttributeName + '" style="' + self.options.cssStyle + '">' + value + '</textarea>');
} else {
self.input = $('<textarea name="'+self.options.name+'" class="form-element" style="'+self.options.cssStyle+'">'+value+'</textarea>');
self.input = $('<textarea name="' + self.options.name + '" class="form-element" style="' + self.options.cssStyle + '">' + value + '</textarea>');
}
label.append(self.input);
break;
case 'iframe':
if (self.options.idAttributeName != null) {
self.input = $('<iframe name="'+self.options.name+'" class="form-element" id="'+self.options.idAttributeName+'" style="'+self.options.cssStyle+'" src="'+value+'"></iframe>');
self.input = $('<iframe name="' + self.options.name + '" class="form-element" id="' + self.options.idAttributeName + '" style="' + self.options.cssStyle + '" src="' + value + '"></iframe>');
} else {
self.input = $('<iframe name="'+self.options.name+'" class="form-element" style="'+self.options.cssStyle+'" src="'+value+'"></iframe>');
self.input = $('<iframe name="' + self.options.name + '" class="form-element" style="' + self.options.cssStyle + '" src="' + value + '"></iframe>');
}
label.append(self.input);
break;
case 'image':
self.input = $('<p style="text-align: center;"><img alt="city image" height="200" src="'+value+'"></p>');
self.input = $('<p style="text-align: center;"><img alt="city image" height="200" src="' + value + '"></p>');
label.append(self.input);
break;
case 'password':
self.input = $('<input name="'+self.options.name+'" type="password" class="form-element" value="'+value+'"/>');
self.input = $('<input name="' + self.options.name + '" type="password" class="form-element" value="' + value + '"/>');
break;
case 'checkbox':
self.input = $('<input name="'+self.options.name+'" align="left" type="checkbox" class="form-element" ' +(value?'checked="checked"':'')+ '/>');
self.input = $('<input name="' + self.options.name + '" align="left" type="checkbox" class="form-element" ' + (value ? 'checked="checked"' : '') + '/>');
label.append(self.input);
break;
case 'file':
self.input = $('<input name="'+self.options.name+'" align="left" type="file" class="form-element fileUpload" ' +(value?'checked="checked"':'')+ '/>');
self.input = $('<input name="' + self.options.name + '" align="left" type="file" class="form-element fileUpload" ' + (value ? 'checked="checked"' : '') + '/>');
label.append(self.input);
break;
case 'table':
@@ -255,25 +257,25 @@ $.widget("hpip.formElement", {
var tableMarkup = ""; //dodaj NULL pointer check
if (self.options.value != null) {
tableMarkup += "<tr>";
$.each(Object.keys(self.options.value[0]), function( index, value ) {
tableMarkup += "<th>"+value+"</th>"
$.each(Object.keys(self.options.value[0]), function (index, value) {
tableMarkup += "<th>" + value + "</th>"
});
tableMarkup += "</tr>";
for (var i = 0; i < self.options.value.length; i++) {
tableMarkup += "<tr>";
$.each(self.options.value[i], function( key, value1 ) {
tableMarkup += "<td>"+value1+"</td>"
$.each(self.options.value[i], function (key, value1) {
tableMarkup += "<td>" + value1 + "</td>"
});
tableMarkup += "</tr>";
}
self.input = $('<table class="form-element" style="width: 100%;"><tbody>'+tableMarkup+'</tbody><table/>');
self.input = $('<table class="form-element" style="width: 100%;"><tbody>' + tableMarkup + '</tbody><table/>');
} else {
self.input = $('<span name="'+self.options.name+'" style="text-align: left;" class="form-element"></span>');
self.input = $('<span name="' + self.options.name + '" style="text-align: left;" class="form-element"></span>');
}
label.append(self.input);
break;
default:
self.input = $('<input name="'+self.options.name+'" class="form-element" type="text" style="'+self.options.cssStyle+'" value="'+value+'"/>');
self.input = $('<input name="' + self.options.name + '" class="form-element" type="text" style="' + self.options.cssStyle + '" value="' + value + '"/>');
label.append(self.input);
break;
}
@@ -297,14 +299,14 @@ $.widget("hpip.formElement", {
/**
* @return name of the element
*/
name: function() {
name: function () {
var self = this;
return self.options.name;
},
/**
* @return current value of the element
*/
value: function() {
value: function () {
var self = this;
var value = null;
@@ -317,7 +319,7 @@ $.widget("hpip.formElement", {
break;
case 'multiselect':
value = [];
$.each(self.input.find('option[chosen="chosen"]'), function(index, item) {
$.each(self.input.find('option[chosen="chosen"]'), function (index, item) {
value.push(item.attr('value'));
});
break;
@@ -332,7 +334,7 @@ $.widget("hpip.formElement", {
*
* @param bool boolean value, true will call show() on the element, false calls hide().
*/
setVisible: function(bool) {
setVisible: function (bool) {
if (bool) {
this.element.show();
} else {
@@ -344,11 +346,11 @@ $.widget("hpip.formElement", {
*
* @param message error message
*/
setError: function(message) {
this.errorMessage.html(message === undefined?'':message).show();
setError: function (message) {
this.errorMessage.html(message === undefined ? '' : message).show();
this.element.addClass(this.options.errorClass);
},
resetError: function() {
resetError: function () {
this.errorMessage.html('').hide();
this.element.removeClass(this.options.errorClass);
}

View File

@@ -7,60 +7,60 @@ $.widget("migor.openMap", {
mapId: 'map_22',
callback: null
},
_create:function () {
_create: function () {
var self = this;
self.element.attr('id', self.options.mapId);
self.map=khtml.maplib.Map(document.getElementById(self.options.mapId));
self.map = khtml.maplib.Map(document.getElementById(self.options.mapId));
self.map.addOverlay(new khtml.maplib.ui.Zoombar());
self.markers = [];
},
center:function(latitude, longitude, zoom) {
center: function (latitude, longitude, zoom) {
var self = this;
self.map.centerAndZoom(new khtml.maplib.LatLng(latitude,longitude),zoom);
self.map.centerAndZoom(new khtml.maplib.LatLng(latitude, longitude), zoom);
},
addBBox:function(bbox, color) {
addBBox: function (bbox, color) {
var self = this;
var polygon={
type:"Feature",
geometry:{
type:"Polygon",
coordinates:[[
[bbox.leftTopLongitude, bbox.leftTopLatitude],
[bbox.rightBottomLongitude,bbox.leftTopLatitude],
[bbox.rightBottomLongitude,bbox.rightBottomLatitude],
[bbox.leftTopLongitude, bbox.rightBottomLatitude]]]
var polygon = {
type: "Feature",
geometry: {
type: "Polygon",
coordinates: [
[
[bbox.leftTopLongitude, bbox.leftTopLatitude],
[bbox.rightBottomLongitude, bbox.leftTopLatitude],
[bbox.rightBottomLongitude, bbox.rightBottomLatitude],
[bbox.leftTopLongitude, bbox.rightBottomLatitude]
]
]
},
style:{
fill:color,
stroke:"black",
opacity:0.4
style: {
fill: color,
stroke: "black",
opacity: 0.4
}
};
self.map.featureCollection.appendChild(polygon);
},
setMarkers:function(locations) {
setMarkers: function (locations) {
var self = this;
for (var i=0; i<self.markers.length; i++) {
for (var i = 0; i < self.markers.length; i++) {
self.markers[i].destroy();
}
self.markers = [];
for (var j=0; j<locations.length; j++) {
for (var j = 0; j < locations.length; j++) {
var image = new khtml.maplib.overlay.MarkerImage(
'images/marker_blue_32.png', // url
{width: 32,height: 32}, // size
{x: 0,y:0}, // origin
{x:16,y:24} // anchorPoint
{width: 32, height: 32}, // size
{x: 0, y: 0}, // origin
{x: 16, y: 24} // anchorPoint
);
var point = new khtml.maplib.LatLng(locations[j].latitude,locations[j].longitude);
var point = new khtml.maplib.LatLng(locations[j].latitude, locations[j].longitude);
self.markers.push(new khtml.maplib.overlay.Marker({
@@ -73,18 +73,18 @@ $.widget("migor.openMap", {
}));
}
},
setMainMarker:function(location) {
setMainMarker: function (location) {
var self = this;
if (self.mainMarker != null) {
self.mainMarker.destroy();
}
var image = new khtml.maplib.overlay.MarkerImage(
'images/marker_red_32.png', // url
{width: 32,height: 32}, // size
{x: 0,y:0}, // origin
{x:16,y:24} // anchorPoint
{width: 32, height: 32}, // size
{x: 0, y: 0}, // origin
{x: 16, y: 24} // anchorPoint
);
var p = new khtml.maplib.LatLng(location.latitude,location.longitude);
var p = new khtml.maplib.LatLng(location.latitude, location.longitude);
self.mainMarker = new khtml.maplib.overlay.Marker({
draggable: true,
@@ -98,7 +98,7 @@ $.widget("migor.openMap", {
self.mainMarker.addCallbackFunction(self.options.callback);
}
},
getMainMarkerLocation:function(location) {
getMainMarkerLocation: function (location) {
var self = this;
return {latitude: self.mainMarker.getPosition().lat(), longitude: self.mainMarker.getPosition().lng(), accuracy: 0};
}

View File

@@ -13,11 +13,11 @@
* jquery.ui.position.js
* jquery.ui.menu.js
*/
(function( $ ) {
(function ($) {
// TODO when mixing clicking menus and keyboard navigation, focus handling is broken
// there has to be just one item that has tabindex
$.widget( "ui.menuBar", {
$.widget("ui.menuBar", {
version: "@VERSION",
options: {
autoExpand: false,
@@ -30,34 +30,34 @@
at: "left bottom"
}
},
_create: function() {
_create: function () {
var that = this;
this.menuItems = this.element.children( this.options.items );
this.items = this.menuItems.children( "button, a" );
this.menuItems = this.element.children(this.options.items);
this.items = this.menuItems.children("button, a");
this.menuItems
.addClass( "ui-menubar-item" )
.attr( "role", "presentation" );
.addClass("ui-menubar-item")
.attr("role", "presentation");
// let only the first item receive focus
this.items.slice(1).attr( "tabIndex", -1 );
this.items.slice(1).attr("tabIndex", -1);
this.element
.addClass( "ui-menubar ui-widget-header ui-helper-clearfix" )
.css("border-left","0")
.attr( "role", "menubar" );
this._focusable( this.items );
this._hoverable( this.items );
this.items.siblings( this.options.menuElement )
.addClass("ui-menubar ui-widget-header ui-helper-clearfix")
.css("border-left", "0")
.attr("role", "menubar");
this._focusable(this.items);
this._hoverable(this.items);
this.items.siblings(this.options.menuElement)
.menu({
position: {
within: this.options.position.within
},
select: function( event, ui ) {
ui.item.parents( "ul.ui-menu:last" ).hide();
select: function (event, ui) {
ui.item.parents("ul.ui-menu:last").hide();
that._close();
// TODO what is this targetting? there's probably a better way to access it
$(event.target).prev().focus();
that._trigger( "select", event, ui );
that._trigger("select", event, ui);
},
menus: that.options.menuElement
})
@@ -67,120 +67,120 @@
"aria-expanded": "false"
})
// TODO use _on
.bind( "keydown.menubar", function( event ) {
var menu = $( this );
if ( menu.is( ":hidden" ) ) {
.bind("keydown.menubar", function (event) {
var menu = $(this);
if (menu.is(":hidden")) {
return;
}
switch ( event.keyCode ) {
switch (event.keyCode) {
case $.ui.keyCode.LEFT:
that.previous( event );
that.previous(event);
event.preventDefault();
break;
case $.ui.keyCode.RIGHT:
that.next( event );
that.next(event);
event.preventDefault();
break;
}
});
this.items.each(function() {
this.items.each(function () {
var input = $(this),
// TODO menu var is only used on two places, doesn't quite justify the .each
menu = input.next( that.options.menuElement );
menu = input.next(that.options.menuElement);
// might be a non-menu button
if ( menu.length ) {
if (menu.length) {
// TODO use _on
input.bind( "click.menubar focus.menubar mouseenter.menubar", function( event ) {
input.bind("click.menubar focus.menubar mouseenter.menubar", function (event) {
// ignore triggered focus event
if ( event.type === "focus" && !event.originalEvent ) {
if (event.type === "focus" && !event.originalEvent) {
return;
}
event.preventDefault();
// TODO can we simplify or extractthis check? especially the last two expressions
// there's a similar active[0] == menu[0] check in _open
if ( event.type === "click" && menu.is( ":visible" ) && that.active && that.active[0] === menu[0] ) {
if (event.type === "click" && menu.is(":visible") && that.active && that.active[0] === menu[0]) {
that._close();
return;
}
if ( ( that.open && event.type === "mouseenter" ) || event.type === "click" || that.options.autoExpand ) {
if( that.options.autoExpand ) {
clearTimeout( that.closeTimer );
if (( that.open && event.type === "mouseenter" ) || event.type === "click" || that.options.autoExpand) {
if (that.options.autoExpand) {
clearTimeout(that.closeTimer);
}
that._open( event, menu );
that._open(event, menu);
}
})
// TODO use _on
.bind( "keydown", function( event ) {
switch ( event.keyCode ) {
.bind("keydown", function (event) {
switch (event.keyCode) {
case $.ui.keyCode.SPACE:
case $.ui.keyCode.UP:
case $.ui.keyCode.DOWN:
that._open( event, $( this ).next() );
that._open(event, $(this).next());
event.preventDefault();
break;
case $.ui.keyCode.LEFT:
that.previous( event );
that.previous(event);
event.preventDefault();
break;
case $.ui.keyCode.RIGHT:
that.next( event );
that.next(event);
event.preventDefault();
break;
}
})
.attr( "aria-haspopup", "true" );
.attr("aria-haspopup", "true");
// TODO review if these options (menuIcon and buttons) are a good choice, maybe they can be merged
if ( that.options.menuIcon ) {
input.addClass( "ui-state-default" ).append( "<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>" );
input.removeClass( "ui-button-text-only" ).addClass( "ui-button-text-icon-secondary" );
if (that.options.menuIcon) {
input.addClass("ui-state-default").append("<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>");
input.removeClass("ui-button-text-only").addClass("ui-button-text-icon-secondary");
}
} else {
// TODO use _on
input.bind( "click.menubar mouseenter.menubar", function( event ) {
if ( ( that.open && event.type === "mouseenter" ) || event.type === "click" ) {
input.bind("click.menubar mouseenter.menubar", function (event) {
if (( that.open && event.type === "mouseenter" ) || event.type === "click") {
that._close();
}
});
}
input
.addClass( "ui-button ui-widget ui-button-text-only ui-menubar-link" )
.attr( "role", "menuitem" )
.wrapInner( "<span class='ui-button-text'></span>" );
.addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
.attr("role", "menuitem")
.wrapInner("<span class='ui-button-text'></span>");
if ( that.options.buttons ) {
input.removeClass( "ui-menubar-link" ).addClass( "ui-state-default" );
if (that.options.buttons) {
input.removeClass("ui-menubar-link").addClass("ui-state-default");
}
});
that._on( {
keydown: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE && that.active && that.active.menu( "collapse", event ) !== true ) {
that._on({
keydown: function (event) {
if (event.keyCode === $.ui.keyCode.ESCAPE && that.active && that.active.menu("collapse", event) !== true) {
var active = that.active;
that.active.blur();
that._close( event );
that._close(event);
active.prev().focus();
}
},
focusin: function( event ) {
clearTimeout( that.closeTimer );
focusin: function (event) {
clearTimeout(that.closeTimer);
},
focusout: function( event ) {
that.closeTimer = setTimeout( function() {
that._close( event );
focusout: function (event) {
that.closeTimer = setTimeout(function () {
that._close(event);
}, 150);
},
"mouseleave .ui-menubar-item": function( event ) {
if ( that.options.autoExpand ) {
that.closeTimer = setTimeout( function() {
that._close( event );
"mouseleave .ui-menubar-item": function (event) {
if (that.options.autoExpand) {
that.closeTimer = setTimeout(function () {
that._close(event);
}, 150);
}
},
"mouseenter .ui-menubar-item": function( event ) {
clearTimeout( that.closeTimer );
"mouseenter .ui-menubar-item": function (event) {
clearTimeout(that.closeTimer);
}
});
@@ -188,44 +188,44 @@
this.openSubmenus = 0;
},
_destroy : function() {
_destroy: function () {
this.menuItems
.removeClass( "ui-menubar-item" )
.removeAttr( "role" );
.removeClass("ui-menubar-item")
.removeAttr("role");
this.element
.removeClass( "ui-menubar ui-widget-header ui-helper-clearfix" )
.removeAttr( "role" )
.unbind( ".menubar" );
.removeClass("ui-menubar ui-widget-header ui-helper-clearfix")
.removeAttr("role")
.unbind(".menubar");
this.items
.unbind( ".menubar" )
.removeClass( "ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default" )
.removeAttr( "role" )
.removeAttr( "aria-haspopup" )
.unbind(".menubar")
.removeClass("ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default")
.removeAttr("role")
.removeAttr("aria-haspopup")
// TODO unwrap?
.children( "span.ui-button-text" ).each(function( i, e ) {
var item = $( this );
item.parent().html( item.html() );
.children("span.ui-button-text").each(function (i, e) {
var item = $(this);
item.parent().html(item.html());
})
.end()
.children( ".ui-icon" ).remove();
.children(".ui-icon").remove();
this.element.find( ":ui-menu" )
.menu( "destroy" )
this.element.find(":ui-menu")
.menu("destroy")
.show()
.removeAttr( "aria-hidden" )
.removeAttr( "aria-expanded" )
.removeAttr( "tabindex" )
.unbind( ".menubar" );
.removeAttr("aria-hidden")
.removeAttr("aria-expanded")
.removeAttr("tabindex")
.unbind(".menubar");
},
_close: function() {
if ( !this.active || !this.active.length ) {
_close: function () {
if (!this.active || !this.active.length) {
return;
}
this.active
.menu( "collapseAll" )
.menu("collapseAll")
.hide()
.attr({
"aria-hidden": "true",
@@ -233,22 +233,22 @@
});
this.active
.prev()
.removeClass( "ui-state-active" )
.removeAttr( "tabIndex" );
.removeClass("ui-state-active")
.removeAttr("tabIndex");
this.active = null;
this.open = false;
this.openSubmenus = 0;
},
_open: function( event, menu ) {
_open: function (event, menu) {
// on a single-button menubar, ignore reopening the same menu
if ( this.active && this.active[0] === menu[0] ) {
if (this.active && this.active[0] === menu[0]) {
return;
}
// TODO refactor, almost the same as _close above, but don't remove tabIndex
if ( this.active ) {
if (this.active) {
this.active
.menu( "collapseAll" )
.menu("collapseAll")
.hide()
.attr({
"aria-hidden": "true",
@@ -256,73 +256,73 @@
});
this.active
.prev()
.removeClass( "ui-state-active" );
.removeClass("ui-state-active");
}
// set tabIndex -1 to have the button skipped on shift-tab when menu is open (it gets focus)
var button = menu.prev().addClass( "ui-state-active" ).attr( "tabIndex", -1 );
var button = menu.prev().addClass("ui-state-active").attr("tabIndex", -1);
this.active = menu
.show()
.position( $.extend({
of: button
}, this.options.position ) )
.removeAttr( "aria-hidden" )
.attr( "aria-expanded", "true" )
.menu("focus", event, menu.children( ".ui-menu-item" ).first() )
.position($.extend({
of: button
}, this.options.position))
.removeAttr("aria-hidden")
.attr("aria-expanded", "true")
.menu("focus", event, menu.children(".ui-menu-item").first())
// TODO need a comment here why both events are triggered
.focus()
.focusin();
this.open = true;
},
next: function( event ) {
if ( this.open && this.active.data( "menu" ).active.has( ".ui-menu" ).length ) {
next: function (event) {
if (this.open && this.active.data("menu").active.has(".ui-menu").length) {
// Track number of open submenus and prevent moving to next menubar item
this.openSubmenus++;
return;
}
this.openSubmenus = 0;
this._move( "next", "first", event );
this._move("next", "first", event);
},
previous: function( event ) {
if ( this.open && this.openSubmenus ) {
previous: function (event) {
if (this.open && this.openSubmenus) {
// Track number of open submenus and prevent moving to previous menubar item
this.openSubmenus--;
return;
}
this.openSubmenus = 0;
this._move( "prev", "last", event );
this._move("prev", "last", event);
},
_move: function( direction, filter, event ) {
_move: function (direction, filter, event) {
var next,
wrapItem;
if ( this.open ) {
next = this.active.closest( ".ui-menubar-item" )[ direction + "All" ]( this.options.items ).first().children( ".ui-menu" ).eq( 0 );
wrapItem = this.menuItems[ filter ]().children( ".ui-menu" ).eq( 0 );
if (this.open) {
next = this.active.closest(".ui-menubar-item")[ direction + "All" ](this.options.items).first().children(".ui-menu").eq(0);
wrapItem = this.menuItems[ filter ]().children(".ui-menu").eq(0);
} else {
if ( event ) {
next = $( event.target ).closest( ".ui-menubar-item" )[ direction + "All" ]( this.options.items ).children( ".ui-menubar-link" ).eq( 0 );
wrapItem = this.menuItems[ filter ]().children( ".ui-menubar-link" ).eq( 0 );
if (event) {
next = $(event.target).closest(".ui-menubar-item")[ direction + "All" ](this.options.items).children(".ui-menubar-link").eq(0);
wrapItem = this.menuItems[ filter ]().children(".ui-menubar-link").eq(0);
} else {
next = wrapItem = this.menuItems.children( "a" ).eq( 0 );
next = wrapItem = this.menuItems.children("a").eq(0);
}
}
if ( next.length ) {
if ( this.open ) {
this._open( event, next );
if (next.length) {
if (this.open) {
this._open(event, next);
} else {
next.removeAttr( "tabIndex")[0].focus();
next.removeAttr("tabIndex")[0].focus();
}
} else {
if ( this.open ) {
this._open( event, wrapItem );
if (this.open) {
this._open(event, wrapItem);
} else {
wrapItem.removeAttr( "tabIndex")[0].focus();
wrapItem.removeAttr("tabIndex")[0].focus();
}
}
}
});
}( jQuery ));
}(jQuery));

View File

@@ -4,16 +4,16 @@
* daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH
*/
(function( $ ) {
(function ($) {
$.widget( "hpip.titleBar", {
$.widget("hpip.titleBar", {
options: {
headline: "Administration",
subHeadline: "> revision 1",
info:""
info: ""
},
_create: function() {
_create: function () {
var that = this;
var logo = $('<div class="logo"><img height="90px" src="images/gps.gif"></div>');
@@ -33,13 +33,13 @@
that.element.addClass('header');
},
_destroy : function() {
_destroy: function () {
this.element.empty();
},
_setOption: function ( key, value ) {
_setOption: function (key, value) {
}
});
}( jQuery ));
}(jQuery));

View File

@@ -12,8 +12,6 @@
<link href="css/jquery.mobile-1.3.2.min.css?_=<%=buildDate%>" rel="stylesheet" type="text/css"/>
<%-- Plugins --%>
<script type="text/javascript" src="js/plugin/jquery-1.10.2.js?_=<%=buildDate%>"></script>
<script type="text/javascript" src="js/plugin/jquery.mobile-1.3.2.js?_=<%=buildDate%>"></script>
@@ -22,15 +20,11 @@
<script type="text/javascript" src="js/widget/widget-chat.js?_=<%=buildDate%>"></script>
<!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function () {
$('#chat-content').chat();
$('#send').on('click', function() {
$('#send').on('click', function () {
var message = $('#message').val();
if (message.length > 0) {
$('#chat-content').chat('send', message);

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
#login-content {
background: #FFFFFF url(../image/gps.gif) no-repeat fixed top;
background-size: 200px;
position:absolute;
top:40px;
right:0;
bottom:0;
left:0;
position: absolute;
top: 40px;
right: 0;
bottom: 0;
left: 0;
}

View File

@@ -1 +1 @@
<meta http-equiv="refresh" content="0;url=./index.jsp" />
<meta http-equiv="refresh" content="0;url=./index.jsp"/>

View File

@@ -16,14 +16,13 @@
<script type="text/javascript" src="js/plugin/jquery.mobile-1.3.2.js?_=<%=buildDate%>"></script>
<!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function () {
$('#startButton')
.button('disable')
.on('click', function() {
$.mobile.changePage( "chat.jsp", {
.on('click', function () {
$.mobile.changePage("chat.jsp", {
transition: 'fade'
}
);
@@ -31,7 +30,7 @@
);
$('#username').on('change', function(event) {
$('#username').on('change', function (event) {
if ($('#username').val().length > 2) {
$('#startButton').button('enable');
} else {
@@ -62,12 +61,13 @@
</div>
<div id="login-content" data-role="content" style="padding-top: 120px;">
<p>
<input id="username" type="text" value="" placeholder="Username" />
</p>
<p>
<button id="startButton" data-role="button">Start</button>
</p>
<p>
<input id="username" type="text" value="" placeholder="Username"/>
</p>
<p>
<button id="startButton" data-role="button">Start</button>
</p>
</div>
</div>

View File

@@ -14,39 +14,35 @@
var bb = {
success: 0,
error: 0,
blackberryTimeoutId : -1
blackberryTimeoutId: -1
};
function handleBlackBerryLocationTimeout()
{
if(bb.blackberryTimeoutId!=-1) {
bb.error({ message: "Timeout error",
code: 3
function handleBlackBerryLocationTimeout() {
if (bb.blackberryTimeoutId != -1) {
bb.error({ message: "Timeout error",
code: 3
});
}
}
function handleBlackBerryLocation()
{
function handleBlackBerryLocation() {
clearTimeout(bb.blackberryTimeoutId);
bb.blackberryTimeoutId=-1;
bb.blackberryTimeoutId = -1;
if (bb.success && bb.error) {
if(blackberry.location.latitude==0 && blackberry.location.longitude==0) {
if (blackberry.location.latitude == 0 && blackberry.location.longitude == 0) {
//http://dev.w3.org/geo/api/spec-source.html#position_unavailable_error
//POSITION_UNAVAILABLE (numeric value 2)
bb.error({message:"Position unavailable", code:2});
bb.error({message: "Position unavailable", code: 2});
}
else
{
var timestamp=null;
else {
var timestamp = null;
//only available with 4.6 and later
//http://na.blackberry.com/eng/deliverables/8861/blackberry_location_568404_11.jsp
if (blackberry.location.timestamp)
{
timestamp = new Date( blackberry.location.timestamp );
if (blackberry.location.timestamp) {
timestamp = new Date(blackberry.location.timestamp);
}
bb.success( { timestamp: timestamp ,
bb.success({ timestamp: timestamp,
coords: {
latitude: blackberry.location.latitude,
latitude: blackberry.location.latitude,
longitude: blackberry.location.longitude
}
});
@@ -60,22 +56,21 @@ function handleBlackBerryLocation()
}
}
var geoPosition=function() {
var geoPosition = function () {
var pub = {};
var provider=null;
var u="undefined";
var provider = null;
var u = "undefined";
var ipGeolocationSrv = 'http://freegeoip.net/json/?callback=JSONPCallback';
pub.getCurrentPosition = function(success,error,opts)
{
provider.getCurrentPosition(success, error,opts);
pub.getCurrentPosition = function (success, error, opts) {
provider.getCurrentPosition(success, error, opts);
}
pub.jsonp = {
callbackCounter: 0,
fetch: function(url, callback) {
fetch: function (url, callback) {
var fn = 'JSONPCallback_' + this.callbackCounter++;
window[fn] = this.evalJSONP(callback);
url = url.replace('=JSONPCallback', '=' + fn);
@@ -85,96 +80,93 @@ var geoPosition=function() {
document.getElementsByTagName('HEAD')[0].appendChild(scriptTag);
},
evalJSONP: function(callback) {
return function(data) {
evalJSONP: function (callback) {
return function (data) {
callback(data);
}
}
};
pub.confirmation = function()
{
pub.confirmation = function () {
return confirm('This Webpage wants to track your physical location.\nDo you allow it?');
};
pub.init = function()
{
try
{
var hasGeolocation = typeof(navigator.geolocation)!=u;
if( !hasGeolocation ){
if( !pub.confirmation() ){
pub.init = function () {
try {
var hasGeolocation = typeof(navigator.geolocation) != u;
if (!hasGeolocation) {
if (!pub.confirmation()) {
return false;
}
}
if ( ( typeof(geoPositionSimulator)!=u ) && (geoPositionSimulator.length > 0 ) ){
provider=geoPositionSimulator;
} else if (typeof(bondi)!=u && typeof(bondi.geolocation)!=u ) {
provider=bondi.geolocation;
} else if ( hasGeolocation ) {
provider=navigator.geolocation;
pub.getCurrentPosition = function(success, error, opts) {
if (( typeof(geoPositionSimulator) != u ) && (geoPositionSimulator.length > 0 )) {
provider = geoPositionSimulator;
} else if (typeof(bondi) != u && typeof(bondi.geolocation) != u) {
provider = bondi.geolocation;
} else if (hasGeolocation) {
provider = navigator.geolocation;
pub.getCurrentPosition = function (success, error, opts) {
function _success(p) {
//for mozilla geode,it returns the coordinates slightly differently
var params;
if(typeof(p.latitude)!=u) {
if (typeof(p.latitude) != u) {
params = {
timestamp: p.timestamp,
coords: {
latitude: p.latitude,
latitude: p.latitude,
longitude: p.longitude
}
};
} else {
params = p;
}
success( params );
success(params);
}
provider.getCurrentPosition(_success,error,opts);
provider.getCurrentPosition(_success, error, opts);
}
} else if(typeof(window.blackberry)!=u && blackberry.location.GPSSupported) {
} else if (typeof(window.blackberry) != u && blackberry.location.GPSSupported) {
// set to autonomous mode
if(typeof(blackberry.location.setAidMode)==u) {
if (typeof(blackberry.location.setAidMode) == u) {
return false;
}
blackberry.location.setAidMode(2);
//override default method implementation
pub.getCurrentPosition = function(success,error,opts)
{
pub.getCurrentPosition = function (success, error, opts) {
//passing over callbacks as parameter didn't work consistently
//In the onLocationUpdate method, thats why they have to be set outside
bb.success = success;
bb.error = error;
//function needs to be a string according to
//http://www.tonybunce.com/2008/05/08/Blackberry-Browser-Amp-GPS.aspx
if(opts['timeout']) {
bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()",opts['timeout']);
if (opts['timeout']) {
bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()", opts['timeout']);
} else {
//default timeout when none is given to prevent a hanging script
bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()",60000);
bb.blackberryTimeoutId = setTimeout("handleBlackBerryLocationTimeout()", 60000);
}
blackberry.location.onLocationUpdate("handleBlackBerryLocation()");
blackberry.location.refreshLocation();
}
provider = blackberry.location;
} else if ( typeof(Mojo) !=u && typeof(Mojo.Service.Request)!="Mojo.Service.Request") {
} else if (typeof(Mojo) != u && typeof(Mojo.Service.Request) != "Mojo.Service.Request") {
provider = true;
pub.getCurrentPosition = function(success, error, opts) {
pub.getCurrentPosition = function (success, error, opts) {
parameters = {};
if( opts ) {
if (opts) {
//http://developer.palm.com/index.php?option=com_content&view=article&id=1673#GPS-getCurrentPosition
if (opts.enableHighAccuracy && opts.enableHighAccuracy == true ){
if (opts.enableHighAccuracy && opts.enableHighAccuracy == true) {
parameters.accuracy = 1;
}
if ( opts.maximumAge ) {
if (opts.maximumAge) {
parameters.maximumAge = opts.maximumAge;
}
if (opts.responseTime) {
if( opts.responseTime < 5 ) {
if (opts.responseTime < 5) {
parameters.responseTime = 1;
} else if ( opts.responseTime < 20 ) {
} else if (opts.responseTime < 20) {
parameters.responseTime = 2;
} else {
parameters.timeout = 3;
@@ -182,30 +174,30 @@ var geoPosition=function() {
}
}
r = new Mojo.Service.Request( 'palm://com.palm.location' , {
method:"getCurrentPosition",
parameters:parameters,
onSuccess: function( p ){
success( { timestamp: p.timestamp,
r = new Mojo.Service.Request('palm://com.palm.location', {
method: "getCurrentPosition",
parameters: parameters,
onSuccess: function (p) {
success({ timestamp: p.timestamp,
coords: {
latitude: p.latitude,
latitude: p.latitude,
longitude: p.longitude,
heading: p.heading
heading: p.heading
}
});
},
onFailure: function( e ){
if (e.errorCode==1) {
error({ code: 3,
message: "Timeout"
onFailure: function (e) {
if (e.errorCode == 1) {
error({ code: 3,
message: "Timeout"
});
} else if (e.errorCode==2){
error({ code: 2,
message: "Position unavailable"
} else if (e.errorCode == 2) {
error({ code: 2,
message: "Position unavailable"
});
} else {
error({ code: 0,
message: "Unknown Error: webOS-code" + errorCode
error({ code: 0,
message: "Unknown Error: webOS-code" + errorCode
});
}
}
@@ -213,51 +205,54 @@ var geoPosition=function() {
}
}
else if (typeof(device)!=u && typeof(device.getServiceObject)!=u) {
provider=device.getServiceObject("Service.Location", "ILocation");
else if (typeof(device) != u && typeof(device.getServiceObject) != u) {
provider = device.getServiceObject("Service.Location", "ILocation");
//override default method implementation
pub.getCurrentPosition = function(success, error, opts){
pub.getCurrentPosition = function (success, error, opts) {
function callback(transId, eventCode, result) {
if (eventCode == 4) {
error({message:"Position unavailable", code:2});
error({message: "Position unavailable", code: 2});
} else {
//no timestamp of location given?
success( { timestamp:null,
success({ timestamp: null,
coords: {
latitude: result.ReturnValue.Latitude,
longitude: result.ReturnValue.Longitude,
altitude: result.ReturnValue.Altitude,
heading: result.ReturnValue.Heading }
latitude: result.ReturnValue.Latitude,
longitude: result.ReturnValue.Longitude,
altitude: result.ReturnValue.Altitude,
heading: result.ReturnValue.Heading }
});
}
}
//location criteria
var criteria = new Object();
criteria.LocationInformationClass = "BasicLocationInformation";
//make the call
provider.ILocation.GetLocation(criteria,callback);
provider.ILocation.GetLocation(criteria, callback);
}
} else {
pub.getCurrentPosition = function(success, error, opts) {
} else {
pub.getCurrentPosition = function (success, error, opts) {
pub.jsonp.fetch(ipGeolocationSrv,
function( p ){ success( { timestamp: p.timestamp,
coords: {
latitude: p.latitude,
longitude: p.longitude,
heading: p.heading
}
});});
function (p) {
success({ timestamp: p.timestamp,
coords: {
latitude: p.latitude,
longitude: p.longitude,
heading: p.heading
}
});
});
}
provider = true;
}
}
catch (e){
if( typeof(console) != u ) console.log(e);
catch (e) {
if (typeof(console) != u) console.log(e);
return false;
}
return provider!=null;
return provider != null;
}
return pub;
}();

View File

@@ -5,7 +5,7 @@ $.widget("migor.chat", {
options: {
endpoint: '/migor/services/client/socket/chat'
},
_create:function () {
_create: function () {
var self = this;
@@ -13,10 +13,10 @@ $.widget("migor.chat", {
var endpoint = 'ws://192.168.0.18:8080' + self.options.endpoint;
self.socket = new WebSocket(endpoint);
self.socket.onmessage = function(event) {
self.socket.onmessage = function (event) {
self._onMessage(event.data);
};
self.socket.onerror = function(event) {
self.socket.onerror = function (event) {
self.element.prepend('<p class="message error">Cannot connect to web socket!!</p>');
};
} else {
@@ -24,7 +24,7 @@ $.widget("migor.chat", {
}
},
_destroy: function() {
_destroy: function () {
var self = this;
if (self.socket) {
@@ -32,15 +32,15 @@ $.widget("migor.chat", {
self.socket = null;
}
},
_setOptions: function() {
this._superApply( arguments );
_setOptions: function () {
this._superApply(arguments);
},
_onMessage: function(message) {
_onMessage: function (message) {
var self = this;
self.element.prepend('<p class="message received">'+message+'</p>');
self.element.prepend('<p class="message received">' + message + '</p>');
},
send: function(message) {
send: function (message) {
var self = this;
if (self.socket) {

View File

@@ -5,7 +5,7 @@ $.widget("migor.mobile", {
options: {
},
_create:function () {
_create: function () {
var self = this;
if (!self.user) {
@@ -20,8 +20,8 @@ $.widget("migor.mobile", {
}
},
_setOptions: function() {
this._superApply( arguments );
_setOptions: function () {
this._superApply(arguments);
}
});