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

@@ -29,7 +29,7 @@ public class BeanUtils {
* @return injected bean. * @return injected bean.
* @throws javax.naming.NamingException if lookup for the BeanManager fails * @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 { public static <T> T get(@NotNull final Class<T> instanceClass) throws NamingException {
BeanManager beanManager = getBeanManager(); BeanManager beanManager = getBeanManager();
@@ -38,13 +38,12 @@ public class BeanUtils {
CreationalContext<Object> context = beanManager.createCreationalContext(null); CreationalContext<Object> context = beanManager.createCreationalContext(null);
Object instance = injectionTarget.produce(context); Object instance = injectionTarget.produce(context);
injectionTarget.inject(instance, context); injectionTarget.inject(instance, context);
injectionTarget.postConstruct( instance ); injectionTarget.postConstruct(instance);
return (T) instance; return (T) instance;
} }
/** /**
*
* @return BeanManager * @return BeanManager
* @throws javax.naming.NamingException * @throws javax.naming.NamingException
*/ */

View File

@@ -8,6 +8,7 @@ import java.util.zip.GZIPOutputStream;
/** /**
* The type Zip utils. * The type Zip utils.
*
* @author Daniel Scheidle * @author Daniel Scheidle
* daniel.scheidle@ucs.at * daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH * Unique Computing Solutions GmbH
@@ -34,8 +35,7 @@ public class ZipUtils {
outputStream = new ByteArrayOutputStream(); outputStream = new ByteArrayOutputStream();
compress(inputStream, outputStream); compress(inputStream, outputStream);
return outputStream.toByteArray(); return outputStream.toByteArray();
} } catch (Exception e) {
catch(Exception e) {
throw new Exception(e.getMessage(), e); throw new Exception(e.getMessage(), e);
} finally { } finally {
if (outputStream != null) outputStream.close(); if (outputStream != null) outputStream.close();
@@ -60,8 +60,7 @@ public class ZipUtils {
outputStream = new ByteArrayOutputStream(); outputStream = new ByteArrayOutputStream();
decompress(inputStream, outputStream); decompress(inputStream, outputStream);
return outputStream.toByteArray(); return outputStream.toByteArray();
} } catch (Exception e) {
catch(Exception e) {
throw new Exception(e.getMessage(), e); throw new Exception(e.getMessage(), e);
} finally { } finally {
if (outputStream != null) outputStream.close(); if (outputStream != null) outputStream.close();

View File

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

View File

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

View File

@@ -16,7 +16,6 @@
</listener> </listener>
<!-- RESTeasy Servlet for generating js client stubs --> <!-- RESTeasy Servlet for generating js client stubs -->
<servlet> <servlet>
<servlet-name>RESTEasy JSAPI</servlet-name> <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"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=8"> <meta http-equiv="X-UA-Compatible" content="IE=8">
</head> </head>
<body> <body>
</body> </body>
</html> </html>

View File

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

View File

@@ -27,29 +27,29 @@ public class GenericParser {
return null; return null;
} else if (clazz.isPrimitive()) { } else if (clazz.isPrimitive()) {
if (clazz.toString().equals("float")) { if (clazz.toString().equals("float")) {
return (T)Float.valueOf(value); return (T) Float.valueOf(value);
} else if (clazz.toString().equals("double")) { } else if (clazz.toString().equals("double")) {
return (T)Double.valueOf(value); return (T) Double.valueOf(value);
} else if (clazz.toString().equals("long")) { } else if (clazz.toString().equals("long")) {
return (T)Long.valueOf(value); return (T) Long.valueOf(value);
} else if (clazz.toString().equals("int")) { } else if (clazz.toString().equals("int")) {
return (T)Integer.valueOf(value); return (T) Integer.valueOf(value);
} else if (clazz.toString().equals("boolean")) { } else if (clazz.toString().equals("boolean")) {
return (T)Boolean.valueOf(value); return (T) Boolean.valueOf(value);
} }
} else if (clazz.equals(Boolean.class)) { } else if (clazz.equals(Boolean.class)) {
return (T)Boolean.valueOf(value); return (T) Boolean.valueOf(value);
} else if (clazz.equals(Long.class)) { } else if (clazz.equals(Long.class)) {
return (T)Long.valueOf(value); return (T) Long.valueOf(value);
} else if (clazz.equals(Integer.class)) { } else if (clazz.equals(Integer.class)) {
return (T)Integer.valueOf(value); return (T) Integer.valueOf(value);
} else if (clazz.equals(Double.class)) { } else if (clazz.equals(Double.class)) {
return (T)Double.valueOf(value); return (T) Double.valueOf(value);
} else if (clazz.equals( Float.class )) { } else if (clazz.equals(Float.class)) {
return (T)Float.valueOf(value); return (T) Float.valueOf(value);
} else if (clazz.equals( Date.class )) { } else if (clazz.equals(Date.class)) {
try { try {
return (T)(new SimpleDateFormat(getDateFormatPattern()).parse(value)); return (T) (new SimpleDateFormat(getDateFormatPattern()).parse(value));
} catch (Exception t) { } catch (Exception t) {
throw new RuntimeException("Failed to parse date: " + t.getMessage()); throw new RuntimeException("Failed to parse date: " + t.getMessage());
} }
@@ -57,17 +57,17 @@ public class GenericParser {
Object[] defined_values = clazz.getEnumConstants(); Object[] defined_values = clazz.getEnumConstants();
for (Object t : defined_values) { for (Object t : defined_values) {
if (t.toString().equalsIgnoreCase(value)) { 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)) { } else if (clazz.isAssignableFrom(Parsable.class)) {
return (T) ((Parsable) clazz.newInstance()).parse(value); return (T) ((Parsable) clazz.newInstance()).parse(value);
} else if (clazz.isAssignableFrom(String.class)) { } 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) { } catch (ParseException e) {
throw e; throw e;
} catch (Exception t) { } 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 { public static <T> T[] parseArray(Class<T> clazz, String value) throws ParseException {
try { try {
String[] values = value.split(getArrayDelimiter()); String[] values = value.split(getArrayDelimiter());
@@ -95,7 +95,7 @@ public class GenericParser {
return dateFormatPattern; return dateFormatPattern;
} }
public static void setDateFormatPattern( final String newDateFormatPattern ) { public static void setDateFormatPattern(final String newDateFormatPattern) {
dateFormatPattern = newDateFormatPattern; dateFormatPattern = newDateFormatPattern;
} }
@@ -103,7 +103,7 @@ public class GenericParser {
return arrayDelimiter; return arrayDelimiter;
} }
public static void setArrayDelimiter( final String newArrayDelimiter ) { public static void setArrayDelimiter(final String newArrayDelimiter) {
arrayDelimiter = 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 {
.cleditorMain iframe {border:none; margin:0; padding:0} border: 1px solid #999;
.cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */} padding: 0 1px 1px;
.cleditorToolbar {background: url('images/toolbar.gif') repeat} background-color: white
.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)} .cleditorMain iframe {
.cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC} border: none;
.cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000} margin: 0;
.cleditorList div {padding:2px 4px 2px 4px} 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 p,
.cleditorList h1, .cleditorList h1,
.cleditorList h2, .cleditorList h2,
@@ -15,10 +71,38 @@
.cleditorList h4, .cleditorList h4,
.cleditorList h5, .cleditorList h5,
.cleditorList h6, .cleditorList h6,
.cleditorList font {padding:0; margin:0; background-color:Transparent} .cleditorList font {
.cleditorColor {width:150px; padding:1px 0 0 1px} padding: 0;
.cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0} margin: 0;
.cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt} 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 input,
.cleditorPrompt textarea {font:8.5pt Arial,Verdana;} .cleditorPrompt textarea {
.cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt} font: 8.5pt Arial, Verdana;
}
.cleditorMsg {
background-color: #FDFCEE;
width: 150px;
padding: 4px;
font-size: 8.5pt
}

View File

@@ -1,5 +1,3 @@
/* /*
* Table * Table
*/ */
@@ -29,16 +27,37 @@ table.dataTable td.dataTables_empty {
text-align: center; text-align: center;
} }
table.dataTable tr.odd { background-color: #E2E4FF; } table.dataTable tr.odd {
table.dataTable tr.even { background-color: white; } background-color: #E2E4FF;
}
table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; } table.dataTable tr.even {
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; } background-color: white;
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.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 * Table wrapper
@@ -48,14 +67,15 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
clear: both; clear: both;
*zoom: 1; *zoom: 1;
} }
.dataTables_wrapper .ui-widget-header { .dataTables_wrapper .ui-widget-header {
font-weight: normal; font-weight: normal;
} }
.dataTables_wrapper .ui-toolbar { .dataTables_wrapper .ui-toolbar {
padding: 5px; padding: 5px;
} }
/* /*
* Page length menu * Page length menu
*/ */
@@ -63,7 +83,6 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
float: left; float: left;
} }
/* /*
* Filter * Filter
*/ */
@@ -72,7 +91,6 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
text-align: right; text-align: right;
} }
/* /*
* Table information * Table information
*/ */
@@ -82,7 +100,6 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
float: left; float: left;
} }
/* /*
* Pagination * Pagination
*/ */
@@ -98,14 +115,14 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
.paging_two_button .ui-button { .paging_two_button .ui-button {
float: left; float: left;
cursor: pointer; cursor: pointer;
* cursor: hand; *cursor: hand;
} }
.paging_full_numbers .ui-button { .paging_full_numbers .ui-button {
padding: 2px 6px; padding: 2px 6px;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
* cursor: hand; *cursor: hand;
color: #333 !important; color: #333 !important;
} }
@@ -120,12 +137,14 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
*cursor: hand; *cursor: hand;
color: #111 !important; color: #111 !important;
} }
.paginate_disabled_previous:hover, .paginate_disabled_previous:hover,
.paginate_enabled_previous:hover, .paginate_enabled_previous:hover,
.paginate_disabled_next:hover, .paginate_disabled_next:hover,
.paginate_enabled_next:hover { .paginate_enabled_next:hover {
text-decoration: none !important; text-decoration: none !important;
} }
.paginate_disabled_previous:active, .paginate_disabled_previous:active,
.paginate_enabled_previous:active, .paginate_enabled_previous:active,
.paginate_disabled_next:active, .paginate_disabled_next:active,
@@ -137,28 +156,47 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
.paginate_disabled_next { .paginate_disabled_next {
color: #666 !important; color: #666 !important;
} }
.paginate_disabled_previous, .paginate_disabled_previous,
.paginate_enabled_previous { .paginate_enabled_previous {
padding-left: 23px; padding-left: 23px;
} }
.paginate_disabled_next, .paginate_disabled_next,
.paginate_enabled_next { .paginate_enabled_next {
padding-right: 23px; padding-right: 23px;
margin-left: 10px; margin-left: 10px;
} }
.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; } .paginate_enabled_previous {
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; } background: url('../images/back_enabled.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_previous:hover {
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; } background: url('../images/back_enabled_hover.png') no-repeat top left;
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; } }
.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 */ /* Full number pagination */
.paging_full_numbers a:active { .paging_full_numbers a:active {
outline: none outline: none
} }
.paging_full_numbers a:hover { .paging_full_numbers a:hover {
text-decoration: none; text-decoration: none;
} }
@@ -189,7 +227,6 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
background-color: #99B3FF; background-color: #99B3FF;
} }
/* /*
* Processing indicator * Processing indicator
*/ */
@@ -209,7 +246,6 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
background-color: white; background-color: white;
} }
/* /*
* Sorting * Sorting
*/ */
@@ -229,7 +265,6 @@ table.dataTable th:active {
outline: none; outline: none;
} }
/* /*
* Scrolling * Scrolling
*/ */

View File

@@ -1,5 +1,3 @@
/* /*
* Table * Table
*/ */
@@ -29,8 +27,13 @@ table.dataTable td.dataTables_empty {
text-align: center; text-align: center;
} }
table.dataTable tr.odd { background-color: #f0fff0; } table.dataTable tr.odd {
table.dataTable tr.even { background-color: #ffffff; } 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_1 { background-color: #D3D6FF; }*/
/*table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }*/ /*table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }*/
@@ -39,7 +42,6 @@ table.dataTable tr.even { background-color: #ffffff; }
/*table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }*/ /*table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }*/
/*table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }*/ /*table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }*/
/* /*
* Table wrapper * Table wrapper
*/ */
@@ -48,14 +50,15 @@ table.dataTable tr.even { background-color: #ffffff; }
clear: both; clear: both;
*zoom: 1; *zoom: 1;
} }
.dataTables_wrapper .ui-widget-header { .dataTables_wrapper .ui-widget-header {
font-weight: normal; font-weight: normal;
} }
.dataTables_wrapper .ui-toolbar { .dataTables_wrapper .ui-toolbar {
padding: 5px; padding: 5px;
} }
/* /*
* Page length menu * Page length menu
*/ */
@@ -63,7 +66,6 @@ table.dataTable tr.even { background-color: #ffffff; }
float: left; float: left;
} }
/* /*
* Filter * Filter
*/ */
@@ -72,7 +74,6 @@ table.dataTable tr.even { background-color: #ffffff; }
text-align: right; text-align: right;
} }
/* /*
* Table information * Table information
*/ */
@@ -82,7 +83,6 @@ table.dataTable tr.even { background-color: #ffffff; }
float: left; float: left;
} }
/* /*
* Pagination * Pagination
*/ */
@@ -98,14 +98,14 @@ table.dataTable tr.even { background-color: #ffffff; }
.paging_two_button .ui-button { .paging_two_button .ui-button {
float: left; float: left;
cursor: pointer; cursor: pointer;
* cursor: hand; *cursor: hand;
} }
.paging_full_numbers .ui-button { .paging_full_numbers .ui-button {
padding: 2px 6px; padding: 2px 6px;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
* cursor: hand; *cursor: hand;
color: #333 !important; color: #333 !important;
} }
@@ -120,12 +120,14 @@ table.dataTable tr.even { background-color: #ffffff; }
*cursor: hand; *cursor: hand;
color: #111 !important; color: #111 !important;
} }
.paginate_disabled_previous:hover, .paginate_disabled_previous:hover,
.paginate_enabled_previous:hover, .paginate_enabled_previous:hover,
.paginate_disabled_next:hover, .paginate_disabled_next:hover,
.paginate_enabled_next:hover { .paginate_enabled_next:hover {
text-decoration: none !important; text-decoration: none !important;
} }
.paginate_disabled_previous:active, .paginate_disabled_previous:active,
.paginate_enabled_previous:active, .paginate_enabled_previous:active,
.paginate_disabled_next:active, .paginate_disabled_next:active,
@@ -137,28 +139,47 @@ table.dataTable tr.even { background-color: #ffffff; }
.paginate_disabled_next { .paginate_disabled_next {
color: #666 !important; color: #666 !important;
} }
.paginate_disabled_previous, .paginate_disabled_previous,
.paginate_enabled_previous { .paginate_enabled_previous {
padding-left: 23px; padding-left: 23px;
} }
.paginate_disabled_next, .paginate_disabled_next,
.paginate_enabled_next { .paginate_enabled_next {
padding-right: 23px; padding-right: 23px;
margin-left: 10px; margin-left: 10px;
} }
.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; } .paginate_enabled_previous {
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; } background: url('../images/back_enabled.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_previous:hover {
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; } background: url('../images/back_enabled_hover.png') no-repeat top left;
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; } }
.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 */ /* Full number pagination */
.paging_full_numbers a:active { .paging_full_numbers a:active {
outline: none outline: none
} }
.paging_full_numbers a:hover { .paging_full_numbers a:hover {
text-decoration: none; text-decoration: none;
} }
@@ -189,7 +210,6 @@ table.dataTable tr.even { background-color: #ffffff; }
background-color: #99B3FF; background-color: #99B3FF;
} }
/* /*
* Processing indicator * Processing indicator
*/ */
@@ -209,7 +229,6 @@ table.dataTable tr.even { background-color: #ffffff; }
background-color: white; background-color: white;
} }
/* /*
* Sorting * Sorting
*/ */
@@ -229,7 +248,6 @@ table.dataTable th:active {
outline: none; outline: none;
} }
/* /*
* Scrolling * Scrolling
*/ */

View File

@@ -1,9 +1,6 @@
/* G L O B A L */ /* G L O B A L */
html, body { html, body {
font-family: Verdana,serif; font-family: Verdana, serif;
font-size: 12px; font-size: 12px;
color: #433F38; color: #433F38;
line-height: 16px; line-height: 16px;
@@ -24,6 +21,7 @@ h1 {
#migor-titleBar .logo { #migor-titleBar .logo {
float: left; float: left;
} }
#migor-titleBar .headline { #migor-titleBar .headline {
color: #649C21; color: #649C21;
float: left; float: left;
@@ -35,6 +33,7 @@ h1 {
position: relative; position: relative;
width: 600px; width: 600px;
} }
#migor-titleBar .headline .subHeadline { #migor-titleBar .headline .subHeadline {
color: #333333; color: #333333;
font-size: 16px; font-size: 16px;
@@ -42,6 +41,7 @@ h1 {
position: relative; position: relative;
top: 10px; top: 10px;
} }
#migor-titleBar .company { #migor-titleBar .company {
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
@@ -51,7 +51,6 @@ h1 {
white-space: nowrap; white-space: nowrap;
} }
/* M E N U */ /* M E N U */
#migor-menuBar { #migor-menuBar {
background: url("images/ui-bg_highlight-hard_75_e6e6e6_1x100.png") repeat-x scroll 50% 50% #EEEEEE; 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 */ /* D I A L O G */
ul.service-config { ul.service-config {
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
@@ -73,7 +71,6 @@ li.service-config {
padding: 5px; padding: 5px;
} }
/* W I D G E T S */ /* W I D G E T S */
/* Form */ /* Form */
@@ -136,10 +133,10 @@ img.form-element {
hr.dialogDivider { hr.dialogDivider {
border: 0; border: 0;
height: 1px; 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: -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: -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: -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: -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, input[type=text].form-element,
@@ -162,7 +159,6 @@ p.form-element-error-message {
padding: 0 0 5px 0; padding: 0 0 5px 0;
} }
div.from-error-message { div.from-error-message {
margin: 0 0 10px 115px; margin: 0 0 10px 115px;
} }
@@ -179,7 +175,6 @@ a.ui-tabs-anchor.closable span.ui-icon {
top: 7px; top: 7px;
} }
/*Button*/ /*Button*/
.migor-button { .migor-button {
display: block; display: block;
@@ -235,15 +230,49 @@ a.ui-tabs-anchor.closable span.ui-icon {
font-weight: normal; 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 {
.ui-timepicker-div dl { text-align: left; } 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-rtl{ direction: rtl; } .ui-timepicker-div dl dt {
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; } float: left;
.ui-timepicker-rtl dl dt{ float: right; clear: right; } clear: left;
.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; } 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.apache.commons.lang.StringUtils" %>
<%@ page import="org.migor.shared.enums.CacheArea" %> <%@ page import="org.migor.shared.enums.CacheArea" %>
<?xml version="1.0" encoding="UTF-8" ?> <?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"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -43,7 +43,6 @@
<script type="text/javascript" src="js/plugins/khtml_all.js"></script> <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-geoLocation.js"></script>
<script type="text/javascript" src="js/widgets/widget-components.js"></script> <script type="text/javascript" src="js/widgets/widget-components.js"></script>
@@ -75,7 +74,7 @@
<!-- EXECUTE INIT SCRIPT --> <!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function () {
migor.bootstrap.init(); migor.bootstrap.init();
}); });
@@ -88,7 +87,7 @@
// ignore // ignore
} }
cacheAreas = ['<%= CacheArea.USERS %>','<%= CacheArea.LOCATIONS %>','<%= CacheArea.NODE_STATUS %>']; cacheAreas = ['<%= CacheArea.USERS %>', '<%= CacheArea.LOCATIONS %>', '<%= CacheArea.NODE_STATUS %>'];
</script> </script>
</head> </head>
<body> <body>

View File

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

View File

@@ -4,22 +4,22 @@
* daniel.scheidle@ucs.at * daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH * Unique Computing Solutions GmbH
*/ */
migor.dialog = new function() { migor.dialog = new function () {
var _defaultDialogWidth = 420; var _defaultDialogWidth = 420;
this.openEditor = function(dlgTitle, dlgContent, dlgWidth, okCallback, cancelCallback) { this.openEditor = function (dlgTitle, dlgContent, dlgWidth, okCallback, cancelCallback) {
_showDialog( _showDialog(
dlgTitle, dlgTitle,
dlgContent, dlgContent,
{ {
"Cancel": function() { "Cancel": function () {
if (typeof(cancelCallback) === 'function') { if (typeof(cancelCallback) === 'function') {
cancelCallback.call(this); cancelCallback.call(this);
} }
$( this ).dialog( "close" ); $(this).dialog("close");
}, },
"Save": function() { "Save": function () {
if (typeof(okCallback) === 'function') { if (typeof(okCallback) === 'function') {
okCallback.call(this); 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); var messageContent = $('<p style="text-align: center;"></p>').append(message);
_showDialog( _showDialog(
"Warning", "Warning",
messageContent, messageContent,
{ {
"Cancel": function() { "Cancel": function () {
if (typeof(cancelCallback) === 'function') { if (typeof(cancelCallback) === 'function') {
cancelCallback.call(this); cancelCallback.call(this);
} }
$( this ).dialog( "close" ); $(this).dialog("close");
}, },
"Ok": function() { "Ok": function () {
if (typeof(okCallback) === 'function') { if (typeof(okCallback) === 'function') {
okCallback.call(this); 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>'); }, 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); var messageContent = $('<p style="text-align: center;"></p>').append(message);
_showDialog( _showDialog(
title, title,
messageContent, messageContent,
{ {
"Ok": function() { "Ok": function () {
if (typeof(closeCallback) === 'function') { if (typeof(closeCallback) === 'function') {
closeCallback.call(this); 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>'); }, 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); var messageContent = $('<p style="text-align: center;"></p>').text(message);
_showDialog( _showDialog(
'Error', 'Error',
messageContent, messageContent,
{ {
"Ok": function() { "Ok": function () {
if (typeof(closeCallback) === 'function') { if (typeof(closeCallback) === 'function') {
closeCallback.call(this); 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>'); }, 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); _showDialog(dlgTitle, dlgContent, buttonCfg, dlgWidth, dialogClass, dialogIcon);
}; };
@@ -89,10 +89,10 @@ migor.dialog = new function() {
var dwidth = dialogWidth ? dialogWidth : _defaultDialogWidth; var dwidth = dialogWidth ? dialogWidth : _defaultDialogWidth;
var dialog = _createDialogDiv(dlgTitle ); var dialog = _createDialogDiv(dlgTitle);
dialog.append(content); dialog.append(content);
var pos = position?position:'center'; var pos = position ? position : 'center';
dialog.dialog( dialog.dialog(
{ {
@@ -101,16 +101,16 @@ migor.dialog = new function() {
maxHeight: $("body").height() - 10, maxHeight: $("body").height() - 10,
autoOpen: true, autoOpen: true,
modal: true, modal: true,
position:pos, position: pos,
buttons: buttonCfg, buttons: buttonCfg,
stack: false, stack: false,
// resizable: false, // resizable: false,
//add custom style classes to dialog container //add custom style classes to dialog container
// dialogClass: dialogClass, // dialogClass: dialogClass,
open: function() { open: function () {
dialog.parent().find('.ui-dialog-titlebar').prepend(dialogIcon).addClass(dialogClass); dialog.parent().find('.ui-dialog-titlebar').prepend(dialogIcon).addClass(dialogClass);
}, },
close: function() { close: function () {
$(this).dialog('destroy'); $(this).dialog('destroy');
$(this).remove(); $(this).remove();
} }
@@ -129,6 +129,6 @@ migor.dialog = new function() {
function _createDialogDiv(dialogTitle) { 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 () { migor.bootstrap = new function () {
this.init = function() { this.init = function () {
var self = this; var self = this;
// $('body').addClass('ui-widget'); // $('body').addClass('ui-widget');
@@ -11,23 +11,21 @@ migor.bootstrap = new function () {
$('#migor-titleBar').titleBar({ $('#migor-titleBar').titleBar({
headline: "Migor - Administration", headline: "Migor - Administration",
subHeadline: '> Version ' + version + ' Revision ' + buildNumber, subHeadline: '> Version ' + version + ' Revision ' + buildNumber,
info:$('<span></span>').geoLocation() info: $('<span></span>').geoLocation()
}); });
var menuSettings = [ var menuSettings = [
{ {
"label": 'System', "label": 'System',
"menus": "menus": [
[
{page: migor.pageNodeStatus}, {page: migor.pageNodeStatus},
{page: migor.pageCacheEntries} {page: migor.pageCacheEntries}
] ]
}, },
{ {
"label": 'Location', "label": 'Location',
"menus": "menus": [
[
{page: migor.pageLocationEntries} {page: migor.pageLocationEntries}
] ]
} }
@@ -41,7 +39,7 @@ migor.bootstrap = new function () {
var menuItem = $('<li></li>'); var menuItem = $('<li></li>');
var menuItemLink = $('<a href="#">About</a>'); 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>'); 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; var self = this;
$.each(settings, function(index, m){ $.each(settings, function (index, m) {
var item; var item;
var itemContainer; var itemContainer;
if (m.menus != null) { if (m.menus != null) {
item = $('<a href="#">'+m.label+'</a>'); item = $('<a href="#">' + m.label + '</a>');
var subMenu = $('<ul></ul>'); var subMenu = $('<ul></ul>');
self.appendMenus(subMenu, m.menus); self.appendMenus(subMenu, m.menus);
itemContainer = $('<li></li>'); itemContainer = $('<li></li>');
itemContainer.append(item); itemContainer.append(item);
itemContainer.append(subMenu); itemContainer.append(subMenu);
} else if (m.page != null ) { } else if (m.page != null) {
item = $('<a href="#">'+m.page.options.label+'</a>'); item = $('<a href="#">' + m.page.options.label + '</a>');
item.click(function() { item.click(function () {
migor.bootstrap.open(m.page); 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 id = page.options.id;
var tab = $('#migor-content'); var tab = $('#migor-content');
var content = tab.find('#'+id); var content = tab.find('#' + id);
if (content.length == 0) { if (content.length == 0) {
// create new tab // create new tab
var header = $('<a href="#'+id+'">'+page.options.label+'</a>'); 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 newContent = $('<div id="' + id + '" class="ui-tabs-panel ui-widget-content ui-corner-bottom"></div>');
if (page.options.closable) { if (page.options.closable) {
var closeButton = $('<span class="ui-icon ui-icon-close"></span>'); var closeButton = $('<span class="ui-icon ui-icon-close"></span>');
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
closeButton.click(function(event) { closeButton.click(function (event) {
header.parent().remove(); header.parent().remove();
newContent.remove(); newContent.remove();
tab.tabs( "refresh" ); tab.tabs("refresh");
}); });
header.append(closeButton); header.append(closeButton);
header.addClass('closable'); header.addClass('closable');
@@ -116,13 +114,13 @@ migor.bootstrap = new function () {
page.init(newContent, argument); page.init(newContent, argument);
// refresh // refresh
tab.tabs( "refresh" ); tab.tabs("refresh");
} else { } else {
// refresh tab content // refresh tab content
page.refresh(content, argument); page.refresh(content, argument);
} }
// Activate current tab // 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); tab.tabs('option', 'active', index);
}; };
}; };

View File

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

View File

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

View File

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

View File

@@ -6,8 +6,8 @@
migor.pageNodeStatus = new function () { migor.pageNodeStatus = new function () {
this.options = { this.options = {
"id":'nodeStatus', "id": 'nodeStatus',
"closable":true, "closable": true,
"label": 'Status', "label": 'Status',
// function defined in the js client stub // 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(); self.refresh();
}); });
content.append(refreshButton); content.append(refreshButton);
@@ -44,7 +44,7 @@ migor.pageNodeStatus = new function () {
}; };
this.displayDataTable = function(content, data) { this.displayDataTable = function (content, data) {
var self = this; var self = this;
table = $('<table width="100%"></table>'); table = $('<table width="100%"></table>');
@@ -52,8 +52,8 @@ migor.pageNodeStatus = new function () {
table.dataTable({ table.dataTable({
"bServerSide": true, "bServerSide": true,
"fnServerData": function(aSource, aoData, successCallback) { "fnServerData": function (aSource, aoData, successCallback) {
migor.rest.request(self.options.funcGetEntries, {}, function(data, totalRecords) { migor.rest.request(self.options.funcGetEntries, {}, function (data, totalRecords) {
successCallback({aaData: data, iTotalDisplayRecords: totalRecords, iTotalRecords: totalRecords}); successCallback({aaData: data, iTotalDisplayRecords: totalRecords, iTotalRecords: totalRecords});
}, null, true); }, null, true);
}, },
@@ -63,22 +63,22 @@ migor.pageNodeStatus = new function () {
"bFilter": true, "bFilter": true,
"bJQueryUI": true, "bJQueryUI": true,
"aLengthMenu": migor.configuration.dataTable.aLengthMenu, "aLengthMenu": migor.configuration.dataTable.aLengthMenu,
"iDisplayLength" : migor.configuration.dataTable.iDisplayLength, "iDisplayLength": migor.configuration.dataTable.iDisplayLength,
"bDestroy": true, "bDestroy": true,
"oLanguage": migor.configuration.dataTable.oLanguage, "oLanguage": migor.configuration.dataTable.oLanguage,
"aoColumns": [ "aoColumns": [
{ "mData": "id", sTitle: "Node", sClass:"right", "bSortable": false, "bVisible": true, { "mData": "id", sTitle: "Node", sClass: "right", "bSortable": false, "bVisible": true,
"mRender": function ( tableData, type, full ) { "mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData); return migor.utils.escapeHtml(tableData);
} }
}, },
{ "mData": "startedAt", sTitle: "Started At", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '250px', { "mData": "startedAt", sTitle: "Started At", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function ( tableData, type, full ) { "mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData); return migor.utils.escapeHtml(tableData);
} }
}, },
{ "mData": "lastModifiedAt", sTitle: "Last Modified At", sClass:"center", "bSortable": false, "bVisible": true, "sWidth": '250px', { "mData": "lastModifiedAt", sTitle: "Last Modified At", sClass: "center", "bSortable": false, "bVisible": true, "sWidth": '250px',
"mRender": function ( tableData, type, full ) { "mRender": function (tableData, type, full) {
return migor.utils.escapeHtml(tableData); 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 [validationCallback]
* @param [loader] * @param [loader]
*/ */
this.request = function(restFunc, params, successCallback, validationCallback, loader) { this.request = function (restFunc, params, successCallback, validationCallback, loader) {
if (typeof(restFunc) === 'function') { 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 = ; // var response = ;
if (loader) { if (loader) {
$.unblockUI(); $.unblockUI();
@@ -42,7 +42,7 @@ migor.rest = new function() {
break; break;
} }
} else { } else {
migor.dialog.openErrorDialog(code + ': ' +request.responseText); migor.dialog.openErrorDialog(code + ': ' + request.responseText);
} }
}; };
@@ -72,7 +72,7 @@ migor.rest = new function() {
* @param [invalidFieldsCallback] * @param [invalidFieldsCallback]
* @param [loader] * @param [loader]
*/ */
this.postSubmitJSON = function(url, urlReplacements, formObject, callbackFunction, invalidFieldsCallback, loader) { this.postSubmitJSON = function (url, urlReplacements, formObject, callbackFunction, invalidFieldsCallback, loader) {
var self = this; var self = this;
// self.block(); // self.block();
@@ -81,10 +81,10 @@ migor.rest = new function() {
} }
formObject.ajaxSubmit({ formObject.ajaxSubmit({
type: "POST", type: "POST",
url: self.replaceInUrl(url,urlReplacements), url: self.replaceInUrl(url, urlReplacements),
dataType:'json', dataType: 'json',
iframe:true, iframe: true,
success: function(data) { success: function (data) {
if (loader) { if (loader) {
$.unblockUI(); $.unblockUI();
} }
@@ -100,7 +100,7 @@ migor.rest = new function() {
callbackFunction(data); callbackFunction(data);
} }
}, },
error: function() { error: function () {
if (loader) { if (loader) {
$.unblockUI(); $.unblockUI();
} }
@@ -109,7 +109,7 @@ migor.rest = new function() {
}); });
}; };
this.generateArgsFromAoData = function(aoData) { this.generateArgsFromAoData = function (aoData) {
var columns = aoData[1].value; var columns = aoData[1].value;
@@ -118,12 +118,12 @@ migor.rest = new function() {
args["span"] = aoData[4].value; args["span"] = aoData[4].value;
for (var i=5; i<5+columns; i++) { for (var i = 5; i < 5 + columns; i++) {
var propIndex = i-5; var propIndex = i - 5;
var propName = aoData[i].value; var propName = aoData[i].value;
var searchValue = aoData[7+columns+(propIndex*3)].value; var searchValue = aoData[7 + columns + (propIndex * 3)].value;
if (aoData[7+columns+(propIndex*3)+2].value == true && searchValue != null && searchValue != '' && searchValue != '~') { if (aoData[7 + columns + (propIndex * 3) + 2].value == true && searchValue != null && searchValue != '' && searchValue != '~') {
if (searchValue.indexOf("~") >= 0) { if (searchValue.indexOf("~") >= 0) {
args[propName] = searchValue.split('~'); args[propName] = searchValue.split('~');
@@ -141,14 +141,14 @@ migor.rest = new function() {
* @param urlReplacements * @param urlReplacements
* @returns {*} * @returns {*}
*/ */
this.replaceInUrl = function(url, urlReplacements) { this.replaceInUrl = function (url, urlReplacements) {
var self = this; var self = this;
if (urlReplacements == null) if (urlReplacements == null)
return url; return url;
for (var key in urlReplacements) { for (var key in urlReplacements) {
//noinspection JSUnfilteredForInLoop //noinspection JSUnfilteredForInLoop
var value= urlReplacements[key]; var value = urlReplacements[key];
if (value == null || value == "") { if (value == null || value == "") {
//noinspection JSUnfilteredForInLoop //noinspection JSUnfilteredForInLoop
url = url.replace(key, " "); url = url.replace(key, " ");
@@ -168,31 +168,31 @@ migor.rest = new function() {
* *
* @param value string to encode * @param value string to encode
*/ */
this.urlEncodePathParameter = function(value) { this.urlEncodePathParameter = function (value) {
// be on the safe side // be on the safe side
if (value == null) { if (value == null) {
return null; return null;
} }
var _value =''+value; var _value = '' + value;
var encodeMe = { var encodeMe = {
"?":"%3F", "?": "%3F",
"%":"%25", "%": "%25",
"/": "%2F" "/": "%2F"
}; };
var result=""; var result = "";
for ( var i = 0; i < _value.length; i++ ) { for (var i = 0; i < _value.length; i++) {
result += encodeMe[_value.charAt(i)] == undefined ? _value.charAt(i) : encodeMe[_value.charAt(i)]; result += encodeMe[_value.charAt(i)] == undefined ? _value.charAt(i) : encodeMe[_value.charAt(i)];
} }
return result; return result;
}; };
this.block = function() { this.block = function () {
$.blockUI({ message: $('#block'), css: { position:'relative', top:'0px', left:'0px', width:'100%', height:'100%', 'vertical-align':'middle', background: 'none', color: '#fff'} }); $.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(); $.unblockUI();
}; };

View File

@@ -3,22 +3,22 @@
* daniel.scheidle@ucs.at * daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH * 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! // TODO implement service where only id and name is returned!
migor.rest.request(CityAdminService.getCities, {}, callback); migor.rest.request(CityAdminService.getCities, {}, callback);
}; };
this.getCaches = function(callback) { this.getCaches = function (callback) {
migor.rest.request(CacheAdminService.getCaches, {}, callback); migor.rest.request(CacheAdminService.getCaches, {}, callback);
}; };
this.escapeHtml = function(string, trimLength) { this.escapeHtml = function (string, trimLength) {
if (string != null) { if (string != null) {
if (trimLength > 0 && string.length > trimLength) { 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 { } else {
return $('<div></div>').text(string).html(); 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) { if (text != null) {
return text.replace(string, replaceString); return text.replace(string, replaceString);
} else { } else {
@@ -54,7 +54,7 @@ migor.utils = new function() {
* @param ts timestamp * @param ts timestamp
* @return String a human readable and sortable date representation of the 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) { if (ts == null || ts <= 0) {
return ""; return "";
} }
@@ -66,9 +66,9 @@ migor.utils = new function() {
var minute = dateObject.getMinutes(); var minute = dateObject.getMinutes();
var second = dateObject.getSeconds(); var second = dateObject.getSeconds();
if (!displayShort) { 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: '', label: '',
clickCallback: null clickCallback: null
}, },
_create: function(){ _create: function () {
var that = this; var that = this;
// create button link // create button link
@@ -28,7 +28,7 @@ $(function () {
that.element.addClass("hpip-button"); that.element.addClass("hpip-button");
that.element.append(link); that.element.append(link);
}, },
clickAction: function(event) { clickAction: function (event) {
var that = this; var that = this;
if (typeof(that.options.clickCallback) === 'function') { if (typeof(that.options.clickCallback) === 'function') {
that.options.clickCallback.call(this); that.options.clickCallback.call(this);

View File

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

View File

@@ -7,60 +7,60 @@ $.widget("migor.openMap", {
mapId: 'map_22', mapId: 'map_22',
callback: null callback: null
}, },
_create:function () { _create: function () {
var self = this; var self = this;
self.element.attr('id', self.options.mapId); 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.map.addOverlay(new khtml.maplib.ui.Zoombar());
self.markers = []; self.markers = [];
}, },
center:function(latitude, longitude, zoom) { center: function (latitude, longitude, zoom) {
var self = this; 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 self = this;
var polygon={ var polygon = {
type:"Feature", type: "Feature",
geometry:{ geometry: {
type:"Polygon", type: "Polygon",
coordinates:[[ coordinates: [
[
[bbox.leftTopLongitude, bbox.leftTopLatitude], [bbox.leftTopLongitude, bbox.leftTopLatitude],
[bbox.rightBottomLongitude,bbox.leftTopLatitude], [bbox.rightBottomLongitude, bbox.leftTopLatitude],
[bbox.rightBottomLongitude,bbox.rightBottomLatitude], [bbox.rightBottomLongitude, bbox.rightBottomLatitude],
[bbox.leftTopLongitude, bbox.rightBottomLatitude]]] [bbox.leftTopLongitude, bbox.rightBottomLatitude]
]
]
}, },
style:{ style: {
fill:color, fill: color,
stroke:"black", stroke: "black",
opacity:0.4 opacity: 0.4
} }
}; };
self.map.featureCollection.appendChild(polygon); self.map.featureCollection.appendChild(polygon);
}, },
setMarkers:function(locations) { setMarkers: function (locations) {
var self = this; 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[i].destroy();
} }
self.markers = []; 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( var image = new khtml.maplib.overlay.MarkerImage(
'images/marker_blue_32.png', // url 'images/marker_blue_32.png', // url
{width: 32,height: 32}, // size {width: 32, height: 32}, // size
{x: 0,y:0}, // origin {x: 0, y: 0}, // origin
{x:16,y:24} // anchorPoint {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({ self.markers.push(new khtml.maplib.overlay.Marker({
@@ -73,18 +73,18 @@ $.widget("migor.openMap", {
})); }));
} }
}, },
setMainMarker:function(location) { setMainMarker: function (location) {
var self = this; var self = this;
if (self.mainMarker != null) { if (self.mainMarker != null) {
self.mainMarker.destroy(); self.mainMarker.destroy();
} }
var image = new khtml.maplib.overlay.MarkerImage( var image = new khtml.maplib.overlay.MarkerImage(
'images/marker_red_32.png', // url 'images/marker_red_32.png', // url
{width: 32,height: 32}, // size {width: 32, height: 32}, // size
{x: 0,y:0}, // origin {x: 0, y: 0}, // origin
{x:16,y:24} // anchorPoint {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({ self.mainMarker = new khtml.maplib.overlay.Marker({
draggable: true, draggable: true,
@@ -98,7 +98,7 @@ $.widget("migor.openMap", {
self.mainMarker.addCallbackFunction(self.options.callback); self.mainMarker.addCallbackFunction(self.options.callback);
} }
}, },
getMainMarkerLocation:function(location) { getMainMarkerLocation: function (location) {
var self = this; var self = this;
return {latitude: self.mainMarker.getPosition().lat(), longitude: self.mainMarker.getPosition().lng(), accuracy: 0}; 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.position.js
* jquery.ui.menu.js * jquery.ui.menu.js
*/ */
(function( $ ) { (function ($) {
// TODO when mixing clicking menus and keyboard navigation, focus handling is broken // TODO when mixing clicking menus and keyboard navigation, focus handling is broken
// there has to be just one item that has tabindex // there has to be just one item that has tabindex
$.widget( "ui.menuBar", { $.widget("ui.menuBar", {
version: "@VERSION", version: "@VERSION",
options: { options: {
autoExpand: false, autoExpand: false,
@@ -30,34 +30,34 @@
at: "left bottom" at: "left bottom"
} }
}, },
_create: function() { _create: function () {
var that = this; var that = this;
this.menuItems = this.element.children( this.options.items ); this.menuItems = this.element.children(this.options.items);
this.items = this.menuItems.children( "button, a" ); this.items = this.menuItems.children("button, a");
this.menuItems this.menuItems
.addClass( "ui-menubar-item" ) .addClass("ui-menubar-item")
.attr( "role", "presentation" ); .attr("role", "presentation");
// let only the first item receive focus // let only the first item receive focus
this.items.slice(1).attr( "tabIndex", -1 ); this.items.slice(1).attr("tabIndex", -1);
this.element this.element
.addClass( "ui-menubar ui-widget-header ui-helper-clearfix" ) .addClass("ui-menubar ui-widget-header ui-helper-clearfix")
.css("border-left","0") .css("border-left", "0")
.attr( "role", "menubar" ); .attr("role", "menubar");
this._focusable( this.items ); this._focusable(this.items);
this._hoverable( this.items ); this._hoverable(this.items);
this.items.siblings( this.options.menuElement ) this.items.siblings(this.options.menuElement)
.menu({ .menu({
position: { position: {
within: this.options.position.within within: this.options.position.within
}, },
select: function( event, ui ) { select: function (event, ui) {
ui.item.parents( "ul.ui-menu:last" ).hide(); ui.item.parents("ul.ui-menu:last").hide();
that._close(); that._close();
// TODO what is this targetting? there's probably a better way to access it // TODO what is this targetting? there's probably a better way to access it
$(event.target).prev().focus(); $(event.target).prev().focus();
that._trigger( "select", event, ui ); that._trigger("select", event, ui);
}, },
menus: that.options.menuElement menus: that.options.menuElement
}) })
@@ -67,120 +67,120 @@
"aria-expanded": "false" "aria-expanded": "false"
}) })
// TODO use _on // TODO use _on
.bind( "keydown.menubar", function( event ) { .bind("keydown.menubar", function (event) {
var menu = $( this ); var menu = $(this);
if ( menu.is( ":hidden" ) ) { if (menu.is(":hidden")) {
return; return;
} }
switch ( event.keyCode ) { switch (event.keyCode) {
case $.ui.keyCode.LEFT: case $.ui.keyCode.LEFT:
that.previous( event ); that.previous(event);
event.preventDefault(); event.preventDefault();
break; break;
case $.ui.keyCode.RIGHT: case $.ui.keyCode.RIGHT:
that.next( event ); that.next(event);
event.preventDefault(); event.preventDefault();
break; break;
} }
}); });
this.items.each(function() { this.items.each(function () {
var input = $(this), var input = $(this),
// TODO menu var is only used on two places, doesn't quite justify the .each // 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 // might be a non-menu button
if ( menu.length ) { if (menu.length) {
// TODO use _on // 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 // ignore triggered focus event
if ( event.type === "focus" && !event.originalEvent ) { if (event.type === "focus" && !event.originalEvent) {
return; return;
} }
event.preventDefault(); event.preventDefault();
// TODO can we simplify or extractthis check? especially the last two expressions // TODO can we simplify or extractthis check? especially the last two expressions
// there's a similar active[0] == menu[0] check in _open // 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(); that._close();
return; return;
} }
if ( ( that.open && event.type === "mouseenter" ) || event.type === "click" || that.options.autoExpand ) { if (( that.open && event.type === "mouseenter" ) || event.type === "click" || that.options.autoExpand) {
if( that.options.autoExpand ) { if (that.options.autoExpand) {
clearTimeout( that.closeTimer ); clearTimeout(that.closeTimer);
} }
that._open( event, menu ); that._open(event, menu);
} }
}) })
// TODO use _on // TODO use _on
.bind( "keydown", function( event ) { .bind("keydown", function (event) {
switch ( event.keyCode ) { switch (event.keyCode) {
case $.ui.keyCode.SPACE: case $.ui.keyCode.SPACE:
case $.ui.keyCode.UP: case $.ui.keyCode.UP:
case $.ui.keyCode.DOWN: case $.ui.keyCode.DOWN:
that._open( event, $( this ).next() ); that._open(event, $(this).next());
event.preventDefault(); event.preventDefault();
break; break;
case $.ui.keyCode.LEFT: case $.ui.keyCode.LEFT:
that.previous( event ); that.previous(event);
event.preventDefault(); event.preventDefault();
break; break;
case $.ui.keyCode.RIGHT: case $.ui.keyCode.RIGHT:
that.next( event ); that.next(event);
event.preventDefault(); event.preventDefault();
break; 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 // TODO review if these options (menuIcon and buttons) are a good choice, maybe they can be merged
if ( that.options.menuIcon ) { 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.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" ); input.removeClass("ui-button-text-only").addClass("ui-button-text-icon-secondary");
} }
} else { } else {
// TODO use _on // TODO use _on
input.bind( "click.menubar mouseenter.menubar", function( event ) { input.bind("click.menubar mouseenter.menubar", function (event) {
if ( ( that.open && event.type === "mouseenter" ) || event.type === "click" ) { if (( that.open && event.type === "mouseenter" ) || event.type === "click") {
that._close(); that._close();
} }
}); });
} }
input input
.addClass( "ui-button ui-widget ui-button-text-only ui-menubar-link" ) .addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
.attr( "role", "menuitem" ) .attr("role", "menuitem")
.wrapInner( "<span class='ui-button-text'></span>" ); .wrapInner("<span class='ui-button-text'></span>");
if ( that.options.buttons ) { if (that.options.buttons) {
input.removeClass( "ui-menubar-link" ).addClass( "ui-state-default" ); input.removeClass("ui-menubar-link").addClass("ui-state-default");
} }
}); });
that._on( { that._on({
keydown: function( event ) { keydown: function (event) {
if ( event.keyCode === $.ui.keyCode.ESCAPE && that.active && that.active.menu( "collapse", event ) !== true ) { if (event.keyCode === $.ui.keyCode.ESCAPE && that.active && that.active.menu("collapse", event) !== true) {
var active = that.active; var active = that.active;
that.active.blur(); that.active.blur();
that._close( event ); that._close(event);
active.prev().focus(); active.prev().focus();
} }
}, },
focusin: function( event ) { focusin: function (event) {
clearTimeout( that.closeTimer ); clearTimeout(that.closeTimer);
}, },
focusout: function( event ) { focusout: function (event) {
that.closeTimer = setTimeout( function() { that.closeTimer = setTimeout(function () {
that._close( event ); that._close(event);
}, 150); }, 150);
}, },
"mouseleave .ui-menubar-item": function( event ) { "mouseleave .ui-menubar-item": function (event) {
if ( that.options.autoExpand ) { if (that.options.autoExpand) {
that.closeTimer = setTimeout( function() { that.closeTimer = setTimeout(function () {
that._close( event ); that._close(event);
}, 150); }, 150);
} }
}, },
"mouseenter .ui-menubar-item": function( event ) { "mouseenter .ui-menubar-item": function (event) {
clearTimeout( that.closeTimer ); clearTimeout(that.closeTimer);
} }
}); });
@@ -188,44 +188,44 @@
this.openSubmenus = 0; this.openSubmenus = 0;
}, },
_destroy : function() { _destroy: function () {
this.menuItems this.menuItems
.removeClass( "ui-menubar-item" ) .removeClass("ui-menubar-item")
.removeAttr( "role" ); .removeAttr("role");
this.element this.element
.removeClass( "ui-menubar ui-widget-header ui-helper-clearfix" ) .removeClass("ui-menubar ui-widget-header ui-helper-clearfix")
.removeAttr( "role" ) .removeAttr("role")
.unbind( ".menubar" ); .unbind(".menubar");
this.items this.items
.unbind( ".menubar" ) .unbind(".menubar")
.removeClass( "ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default" ) .removeClass("ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default")
.removeAttr( "role" ) .removeAttr("role")
.removeAttr( "aria-haspopup" ) .removeAttr("aria-haspopup")
// TODO unwrap? // TODO unwrap?
.children( "span.ui-button-text" ).each(function( i, e ) { .children("span.ui-button-text").each(function (i, e) {
var item = $( this ); var item = $(this);
item.parent().html( item.html() ); item.parent().html(item.html());
}) })
.end() .end()
.children( ".ui-icon" ).remove(); .children(".ui-icon").remove();
this.element.find( ":ui-menu" ) this.element.find(":ui-menu")
.menu( "destroy" ) .menu("destroy")
.show() .show()
.removeAttr( "aria-hidden" ) .removeAttr("aria-hidden")
.removeAttr( "aria-expanded" ) .removeAttr("aria-expanded")
.removeAttr( "tabindex" ) .removeAttr("tabindex")
.unbind( ".menubar" ); .unbind(".menubar");
}, },
_close: function() { _close: function () {
if ( !this.active || !this.active.length ) { if (!this.active || !this.active.length) {
return; return;
} }
this.active this.active
.menu( "collapseAll" ) .menu("collapseAll")
.hide() .hide()
.attr({ .attr({
"aria-hidden": "true", "aria-hidden": "true",
@@ -233,22 +233,22 @@
}); });
this.active this.active
.prev() .prev()
.removeClass( "ui-state-active" ) .removeClass("ui-state-active")
.removeAttr( "tabIndex" ); .removeAttr("tabIndex");
this.active = null; this.active = null;
this.open = false; this.open = false;
this.openSubmenus = 0; this.openSubmenus = 0;
}, },
_open: function( event, menu ) { _open: function (event, menu) {
// on a single-button menubar, ignore reopening the same 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; return;
} }
// TODO refactor, almost the same as _close above, but don't remove tabIndex // TODO refactor, almost the same as _close above, but don't remove tabIndex
if ( this.active ) { if (this.active) {
this.active this.active
.menu( "collapseAll" ) .menu("collapseAll")
.hide() .hide()
.attr({ .attr({
"aria-hidden": "true", "aria-hidden": "true",
@@ -256,73 +256,73 @@
}); });
this.active this.active
.prev() .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) // 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 this.active = menu
.show() .show()
.position( $.extend({ .position($.extend({
of: button of: button
}, this.options.position ) ) }, this.options.position))
.removeAttr( "aria-hidden" ) .removeAttr("aria-hidden")
.attr( "aria-expanded", "true" ) .attr("aria-expanded", "true")
.menu("focus", event, menu.children( ".ui-menu-item" ).first() ) .menu("focus", event, menu.children(".ui-menu-item").first())
// TODO need a comment here why both events are triggered // TODO need a comment here why both events are triggered
.focus() .focus()
.focusin(); .focusin();
this.open = true; this.open = true;
}, },
next: function( event ) { next: function (event) {
if ( this.open && this.active.data( "menu" ).active.has( ".ui-menu" ).length ) { if (this.open && this.active.data("menu").active.has(".ui-menu").length) {
// Track number of open submenus and prevent moving to next menubar item // Track number of open submenus and prevent moving to next menubar item
this.openSubmenus++; this.openSubmenus++;
return; return;
} }
this.openSubmenus = 0; this.openSubmenus = 0;
this._move( "next", "first", event ); this._move("next", "first", event);
}, },
previous: function( event ) { previous: function (event) {
if ( this.open && this.openSubmenus ) { if (this.open && this.openSubmenus) {
// Track number of open submenus and prevent moving to previous menubar item // Track number of open submenus and prevent moving to previous menubar item
this.openSubmenus--; this.openSubmenus--;
return; return;
} }
this.openSubmenus = 0; 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, var next,
wrapItem; wrapItem;
if ( this.open ) { if (this.open) {
next = this.active.closest( ".ui-menubar-item" )[ direction + "All" ]( this.options.items ).first().children( ".ui-menu" ).eq( 0 ); 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 ); wrapItem = this.menuItems[ filter ]().children(".ui-menu").eq(0);
} else { } else {
if ( event ) { if (event) {
next = $( event.target ).closest( ".ui-menubar-item" )[ direction + "All" ]( this.options.items ).children( ".ui-menubar-link" ).eq( 0 ); 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 ); wrapItem = this.menuItems[ filter ]().children(".ui-menubar-link").eq(0);
} else { } else {
next = wrapItem = this.menuItems.children( "a" ).eq( 0 ); next = wrapItem = this.menuItems.children("a").eq(0);
} }
} }
if ( next.length ) { if (next.length) {
if ( this.open ) { if (this.open) {
this._open( event, next ); this._open(event, next);
} else { } else {
next.removeAttr( "tabIndex")[0].focus(); next.removeAttr("tabIndex")[0].focus();
} }
} else { } else {
if ( this.open ) { if (this.open) {
this._open( event, wrapItem ); this._open(event, wrapItem);
} else { } else {
wrapItem.removeAttr( "tabIndex")[0].focus(); wrapItem.removeAttr("tabIndex")[0].focus();
} }
} }
} }
}); });
}( jQuery )); }(jQuery));

View File

@@ -4,16 +4,16 @@
* daniel.scheidle@ucs.at * daniel.scheidle@ucs.at
* Unique Computing Solutions GmbH * Unique Computing Solutions GmbH
*/ */
(function( $ ) { (function ($) {
$.widget( "hpip.titleBar", { $.widget("hpip.titleBar", {
options: { options: {
headline: "Administration", headline: "Administration",
subHeadline: "> revision 1", subHeadline: "> revision 1",
info:"" info: ""
}, },
_create: function() { _create: function () {
var that = this; var that = this;
var logo = $('<div class="logo"><img height="90px" src="images/gps.gif"></div>'); var logo = $('<div class="logo"><img height="90px" src="images/gps.gif"></div>');
@@ -33,13 +33,13 @@
that.element.addClass('header'); that.element.addClass('header');
}, },
_destroy : function() { _destroy: function () {
this.element.empty(); 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"/> <link href="css/jquery.mobile-1.3.2.min.css?_=<%=buildDate%>" rel="stylesheet" type="text/css"/>
<%-- Plugins --%> <%-- Plugins --%>
<script type="text/javascript" src="js/plugin/jquery-1.10.2.js?_=<%=buildDate%>"></script> <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> <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> <script type="text/javascript" src="js/widget/widget-chat.js?_=<%=buildDate%>"></script>
<!-- EXECUTE INIT SCRIPT --> <!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function () {
$('#chat-content').chat(); $('#chat-content').chat();
$('#send').on('click', function() { $('#send').on('click', function () {
var message = $('#message').val(); var message = $('#message').val();
if (message.length > 0) { if (message.length > 0) {
$('#chat-content').chat('send', message); $('#chat-content').chat('send', message);

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
#login-content { #login-content {
background: #FFFFFF url(../image/gps.gif) no-repeat fixed top; background: #FFFFFF url(../image/gps.gif) no-repeat fixed top;
background-size: 200px; background-size: 200px;
position:absolute; position: absolute;
top:40px; top: 40px;
right:0; right: 0;
bottom:0; bottom: 0;
left: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> <script type="text/javascript" src="js/plugin/jquery.mobile-1.3.2.js?_=<%=buildDate%>"></script>
<!-- EXECUTE INIT SCRIPT --> <!-- EXECUTE INIT SCRIPT -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function () {
$('#startButton') $('#startButton')
.button('disable') .button('disable')
.on('click', function() { .on('click', function () {
$.mobile.changePage( "chat.jsp", { $.mobile.changePage("chat.jsp", {
transition: 'fade' transition: 'fade'
} }
); );
@@ -31,7 +30,7 @@
); );
$('#username').on('change', function(event) { $('#username').on('change', function (event) {
if ($('#username').val().length > 2) { if ($('#username').val().length > 2) {
$('#startButton').button('enable'); $('#startButton').button('enable');
} else { } else {
@@ -63,8 +62,9 @@
<div id="login-content" data-role="content" style="padding-top: 120px;"> <div id="login-content" data-role="content" style="padding-top: 120px;">
<p> <p>
<input id="username" type="text" value="" placeholder="Username" /> <input id="username" type="text" value="" placeholder="Username"/>
</p> </p>
<p> <p>
<button id="startButton" data-role="button">Start</button> <button id="startButton" data-role="button">Start</button>
</p> </p>

View File

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

View File

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

View File

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