init commit

This commit is contained in:
Ulf Gebhardt 2013-02-12 23:45:29 +01:00
commit d715e1408d
135 changed files with 16326 additions and 0 deletions

7
dbd/autoload.inc.php Normal file
View File

@ -0,0 +1,7 @@
<?php
$autoload = SYSTEM\autoload::getInstance();
$autoload->registerFolder(dirname(__FILE__).'/db/','DBD');
$autoload->registerFolder(dirname(__FILE__).'/tbl/','DBD');
$autoload->registerFolder(dirname(__FILE__).'/tbl/analysis/','DBD\ANALYSIS');

9
dbd/db/system.php Normal file
View File

@ -0,0 +1,9 @@
<?php
namespace DBD;
class system extends \SYSTEM\DB\DBInfo {
public function __construct() {
throw new Exception('DEFINE ME ADMIN! NOW!');
parent::__construct('DBNAME', 'USER', 'PASSWORD', 'HOST');}
}

19
dbd/tbl/APITable.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace DBD;
class APITable {
const NAME = 'APICalls';
const FIELD_ID = 'ID';
const FIELD_FLAG = 'Flag';
const FIELD_PARENTID = 'ParentID';
const FIELD_PARENTVALUE = 'ParentValue';
const FIELD_NAME = 'Name';
// const FIELD_ISCHACHED = 'IsCached'; use flagfield!
const FIELD_ALLOWEDVALUES = 'AllowedValues';
const VALUE_FLAG_COMMAND = 0;
const VALUE_FLAG_PARAM = 1;
}

19
dbd/tbl/PAGETable.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace DBD;
class PAGETable {
const NAME = 'PAGECalls';
const FIELD_ID = 'ID';
const FIELD_FLAG = 'Flag';
const FIELD_PARENTID = 'ParentID';
const FIELD_PARENTVALUE = 'ParentValue';
const FIELD_NAME = 'Name';
// const FIELD_ISCHACHED = 'IsCached'; use flagfield!
const FIELD_ALLOWEDVALUES = 'AllowedValues';
const VALUE_FLAG_COMMAND = 0;
const VALUE_FLAG_PARAM = 1;
}

View File

@ -0,0 +1,11 @@
<?php
namespace DBD;
class UserRightsTable {
const NAME = 'user_rights';
const FIELD_USERID = 'userid';
const FIELD_RIGHTID = 'rightid';
}

14
dbd/tbl/UserTable.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DBD;
class UserTable {
const NAME = 'user';
const FIELD_ID = 'id';
const FIELD_USERNAME = 'username';
const FIELD_PASSWORD = 'password';
const FIELD_EMAIL = 'email';
const FIELD_CREATIONTIMESTAMP = 'creationTimestamp';
}

40
dbd/tbl/locale_string.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace DBD;
class locale_string {
const NAME = 'locale_string';
const FIELD_ID = 'id';
const FIELD_CATEGORY = 'category';
const VALUE_CATEGORY_TEST1 = 1;
const VALUE_CATEGORY_TEST2 = 2;
const VALUE_CATEGORY_SYSTEM = 10;
const VALUE_CATEGORY_DASENSE = 100;
const VALUE_CATEGORY_DASENSE_DEFAULTPAGE = 110;
const VALUE_CATEGORY_DASENSE_GEOPOINT = 111;
const VALUE_CATEGORY_DASENSE_IMPRESSUM = 112;
const VALUE_CATEGORY_DASENSE_PROJECT = 113;
const VALUE_CATEGORY_DASENSE_SENSOR = 114;
const VALUE_CATEGORY_DASENSE_USERLOGIN = 115;
const VALUE_CATEGORY_DASENSE_USERLOGOUT = 116;
const VALUE_CATEGORY_DASENSE_USER = 117;
const VALUE_CATEGORY_DASENSE_PRESS = 118;
const VALUE_CATEGORY_DASENSE_CONTACT = 119;
const VALUE_CATEGORY_DASENSE_USERSTATISTICS = 120;
const VALUE_CATEGORY_DASENSE_HIGHSCORE = 121;
const VALUE_CATEGORY_DASENSE_DEVS = 122;
const VALUE_CATEGORY_DB_ADMIN_LEVEL = 200;
const VALUE_CATEGORY_DB_BADGE_CATEGORY = 201;
const VALUE_CATEGORY_DB_BADGE = 202;
const VALUE_CATEGORY_DB_TITLE = 203;
const VALUE_CATEGORY_DB_LOCALITY = 204;
const VALUE_CATEGORY_APP_ALL = 300;
const VALUE_CATEGORY_APP_ANDROID = 301;
const VALUE_CATEGORY_APP_IOS = 302;
}

167
system/api/Api.php Normal file
View File

@ -0,0 +1,167 @@
<?php
/*
API CALL:
COMMANDS OPTIONS PARAMETERS via post/get
COMMANDS:
Handled by the Api, verified and processed via database table
COMMAND(ID,VALUE)
PARAMS:
Verified and typechecked by the api
PARAM(ID,VALUE)
*/
// $api = new \API\API(..);
// return $api->CALL($call);
/*
* Table:
* ID FLAG C/P PARENTCOMMANDID ISCHACHED ALLOWEDVALUES (cache only for commands, null on command = dont care)
* 0 C 'CALL' -1 null null (calculated by the api for commands)
* 1 C 'ALGO' 0 true null
* 2 P 'x' 1 null GOOGLEMAPXY (function in MYVERIFY::func)
* 3 P 'y' 1 null GOOGLEMAPXY
* 4 P 'zoom' 1 null GOOGLEMAPZOOM
* 5 P 'from' 1 null TIMEWIERDFORMAT
* 6 P 'to' 1 null TIMEWIERDFORMAT
* 7 P 'type' 1 null SENSORTYPE
* 8 P 'provider' 1 null SENSORPROVIDER
* 9 P 'visibility' 1 null SENSORVISIBILITY
* 10 C 'markers' 1 null BOOL
*
* MYAPI::map_heatmap($PARAMS,$OPTIONS)
* MYAPI::map_heatmap_key
*/
namespace SYSTEM\API;
class Api {
private $m_dbinfo = null;
private $m_verifyclass = null;
private $m_apiclass = null;
public function __construct($DBInfo,\SYSTEM\verifyclass $VerifyClass, \SYSTEM\API\apiclass $ApiClass){
$this->m_dbinfo = $DBInfo;
$this->m_verifyclass = $VerifyClass;
$this->m_apiclass = $ApiClass;
}
// $call = post + get params
// returns resultstring
public function CALL($call = array()){
if( !isset($call) ||
!is_array($call) ||
count($call) <= 0){
throw new \Exception("No call given for the api");
return null;}
//Get the Databasetree
$tree = array();
if($this->m_dbinfo instanceof \SYSTEM\DB\DBInfo){
$tree = self::getApiTree();}
else {
if(!is_array($this->m_dbinfo)){
throw new Exception('No Connectioninfo and no call table given to the api');}
$tree = $this->m_dbinfo;
}
//print_r($tree);
if(!is_array($tree)){
throw new \Exception("Database Tree for Api empty - cannot proced!");}
//Commands
$commands = array();
$parentid = -1;
foreach($tree as $item){
if( $item[\DBD\APITable::FIELD_FLAG] == \DBD\APITable::VALUE_FLAG_COMMAND &&
$item[\DBD\APITable::FIELD_PARENTID] == $parentid &&
isset($call[$item[\DBD\APITable::FIELD_NAME]])){
if( isset($item[\DBD\APITable::FIELD_PARENTVALUE]) &&
$commands[count($commands)-1][1] != $item[\DBD\APITable::FIELD_PARENTVALUE]){
continue;}
$commands[] = array($item,$call[$item[\DBD\APITable::FIELD_NAME]]);
$parentid = $item[\DBD\APITable::FIELD_ID];
}
}
//Parameters
$parameters = array();
$lastCommand = $commands[count($commands)-1][0];
foreach($tree as $item){
if( $item[\DBD\APITable::FIELD_FLAG] == \DBD\APITable::VALUE_FLAG_PARAM &&
$item[\DBD\APITable::FIELD_PARENTID] == $lastCommand[\DBD\APITable::FIELD_ID]){
if( isset($item[\DBD\APITable::FIELD_PARENTVALUE]) &&
$commands[count($commands)-1][1] != $item[\DBD\APITable::FIELD_PARENTVALUE]){
continue;}
if(!isset($call[$item[\DBD\APITable::FIELD_NAME]])){
throw new \Exception('Parameter missing: '.$item[\DBD\APITable::FIELD_NAME]);}
if( !method_exists($this->m_verifyclass, $item[\DBD\APITable::FIELD_ALLOWEDVALUES]) ||
!$this->m_verifyclass->$item[\DBD\APITable::FIELD_ALLOWEDVALUES]($call[$item[\DBD\APITable::FIELD_NAME]])){
throw new \Exception('Parameter type missmacht or Missing Verifier. Param: '.$item[\DBD\APITable::FIELD_NAME].' Verifier: '.$item[\DBD\APITable::FIELD_ALLOWEDVALUES]);}
$parameters[] = array($item, $call[$item[\DBD\APITable::FIELD_NAME]]);
}
}
//Check
/*echo "<pre>";
print_r($commands);
echo "</pre>";
echo "</br>---</br>";
print_r($parameters);
echo "</br>---</br>";
print_r($call);
echo "</br>---</br>";
echo count($call).'-'.count($parameters).'-'.count($commands);*/
if(count($call) != count($parameters) + count($commands)){
throw new \Exception("Unhandled or misshandled parameters - api query is invalid");}
//Function Name
$command_call = "";
foreach($commands as $com){
if(!\preg_match('^[0-9A-Za-z_]+$^', $com[1])){
throw new \Exception("Call Command can only have letters!");}
if($com[0][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG'){
$command_call .= '_flag_'.$com[0][\DBD\APITable::FIELD_NAME];
} else {
$command_call .= '_'.$com[0][\DBD\APITable::FIELD_NAME].'_'.\strtolower($com[1]);}
}
$command_call = substr($command_call, 1);
//Function parameters
$parameter_call = array();
foreach($parameters as $param){
$parameter_call[] = $param[1];}
if(!\method_exists($this->m_apiclass, $command_call)){
throw new \Exception("API call is not implemented in API: ".$command_call);}
//Call Function
return \call_user_func_array(array($this->m_apiclass,$command_call),$parameter_call);
}
private function getApiTree(){
$con = new \SYSTEM\DB\Connection($this->m_dbinfo);
$res = $con->query("SELECT * FROM ".\DBD\APITable::NAME." ORDER BY ".\DBD\APITable::FIELD_ID);
unset($con);
if(!$res){
throw new \Exception("Sql Error ".mysqli_error());}
$result = array();
while($row = $res->next()){
$result[] = $row;}
return $result;
}
}

5
system/api/apiclass.php Normal file
View File

@ -0,0 +1,5 @@
<?php
namespace SYSTEM\API;
class apiclass {}

View File

@ -0,0 +1,35 @@
<?php
namespace SYSTEM\API;
abstract class apiloginclass extends \SYSTEM\API\apiclass {
protected abstract static function getUserDBInfo();
/*
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (0, 0, -1, NULL, 'call', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (60, 0, 0, 'account', 'action', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (61, 1, 60, 'login', 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (62, 1, 60, 'login', 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (63, 1, 60, 'login', 'hashed', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (64, 1, 60, 'check', 'rightid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (65, 1, 60, 'create', 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (66, 1, 60, 'create', 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (67, 1, 60, 'create', 'email', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (68, 1, 60, 'create', 'hashed', 'ALL');
*/
public static function call_account_action_login($username, $password, $hashed){
return \SYSTEM\SECURITY\Security::login(static::getUserDBInfo(), $username, $password, $hashed);}
public static function call_account_action_logout(){
return \SYSTEM\SECURITY\Security::logout();}
public static function call_account_action_isloggedin(){
return \SYSTEM\SECURITY\Security::isLoggedIn();}
public static function call_account_action_check($rightid){
return \SYSTEM\SECURITY\Security::check(static::getUserDBInfo(),$rightid);}
public static function call_account_action_create($username, $password, $email, $hashed){
return \SYSTEM\SECURITY\Security::create(static::getUserDBInfo(), $username, $password, $email, $hashed);}
}

16
system/autoload.inc.php Normal file
View File

@ -0,0 +1,16 @@
<?php
//includ autoloadclass
require_once dirname(__FILE__).'/system/path.php';
require_once dirname(__FILE__).'/system/autoload.php';
//autoload hook -> refers to autoload class singleton
function __autoload_system($class_name) {
return system\autoload::getInstance()->autoload($class_name);
}
//Register autoload
spl_autoload_register('__autoload_system');
//Register system classes
require_once dirname(__FILE__).'/system/register_system_autoload_classes.php';

84
system/db/Connection.php Normal file
View File

@ -0,0 +1,84 @@
<?php
namespace SYSTEM\DB;
class Connection {
private $connection = NULL;
private $dbinfo = NULL;
public function __construct(DBInfo $dbinfo, $new_link = false, $client_flag = 0){
$this->dbinfo = $dbinfo;
$this->connection = mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag);
if(!$this->connection){
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
if(!mysqli_select_db($this->connection, $dbinfo->m_database)){
mysqli_close($this->connection);
throw new \Exception('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
}
public function __destruct(){
$this->close();}
private static function getPrepareValueType($value){
if(is_double($value)){
return 'd';}
if(is_integer($value)){
return 'i';}
if(is_string($value)){
return 's';}
//blob
return 'b';
}
//stmt = sql string with ?
//values = array of values
public function prepare($stmt, $values){
$prepStmt = \mysqli_prepare($this->connection, $stmt);
if(!$prepStmt){
throw new \Exception('Prepared Statement prepare fail: '. \mysqli_error($this->connection));}
$types = '';
$binds = array($prepStmt,null);
for($i =0; $i < \count($values);$i++){
$types .= self::getPrepareValueType($values[$i]);
$binds[] = &$values[$i];
}
$binds[1] = $types;
\call_user_func_array('mysqli_stmt_bind_param', $binds);
if(!mysqli_stmt_execute($prepStmt)){
throw new \Exception("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
return new ResultMysqliPrepare($prepStmt);
}
public function close(){
return mysqli_close($this->connection);}
public function query($query){
$_query = NULL;
if(\is_string($query)){
$_query = new QueryString($query);
} elseif($query instanceof Query) {
$_query = $query;
} else {
throw new \Exception('Could not understand given Query: '.$query);
}
$result = mysqli_query($this->connection, $_query->getSQL());
if(!$result){
throw new \Exception('Could not query Database. Check ur Query Syntax or required Rights: '.mysqli_error($this->connection));}
if($result === TRUE){
return TRUE;}
return new ResultMysqli($result);
}
}

24
system/db/DBInfo.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace SYSTEM\DB;
class DBInfo {
public $m_database = null;
public $m_user = null;
public $m_password = null;
public $m_host = null;
public function __construct($database , $user , $password, $host){
$this->m_database = $database;
$this->m_user = $user;
$this->m_password = $password;
$this->m_host = $host;
if( $this->m_database == null ||
$this->m_user == null ||
$this->m_password == null ||
$this->m_host == null){
throw new \Exception("DBInfo not correct, database, user, password or host are null");}
}
}

7
system/db/Query.php Normal file
View File

@ -0,0 +1,7 @@
<?php
namespace SYSTEM\DB;
abstract class Query {
abstract public function getSQL();
}

14
system/db/QueryString.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace SYSTEM\DB;
class QueryString extends Query{
private $sqlstr = NULL;
public function __construct($string){
$this->sqlstr = $string;}
public function getSQL(){
return $this->sqlstr;}
}

16
system/db/Result.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace SYSTEM\DB;
abstract class Result {
public abstract function count();
public abstract function affectedRows();
public abstract function next($object = false, $result_type = MYSQL_BOTH);
public abstract function seek($row_number);
public abstract function close();
}

View File

@ -0,0 +1,37 @@
<?php
namespace SYSTEM\DB;
class ResultMysqli extends \SYSTEM\DB\Result{
private $res = NULL;
private $current = NULL;
//Result from mysql_query
public function __construct($res){
$this->res = $res;}
public function __destruct(){
$this->close();}
public function close(){
mysqli_free_result($this->res);}
public function count(){
return mysqli_num_rows($this->res);}
public function affectedRows(){
return mysqli_affected_rows($this->res);}
public function next($object = false, $result_type = MYSQL_BOTH){
if($object){
$this->current = mysqli_fetch_object($this->res);
} else {
$this->current = mysqli_fetch_assoc($this->res);
}
return $this->current;
}
public function seek($row_number){
return mysqli_data_seek($this->res,$row_number);}
}

View File

@ -0,0 +1,55 @@
<?php
namespace SYSTEM\DB;
class ResultMysqliPrepare extends \SYSTEM\DB\Result{
private $res = NULL;
private $meta = NULL;
private $binds = array();
//Result from mysql_query
public function __construct($res){
$this->res = $res;
$this->meta = \mysqli_stmt_result_metadata($this->res);
if(!$this->meta){
//occurs on insert
//throw new \Exception("Could not retrieve meta for prepare statement");}
return;}
while ($field = $this->meta->fetch_field() ) {
$this->binds[$field->name] = &$this->binds[$field->name];}
\mysqli_free_result($this->meta);
call_user_func_array(array($this->res, 'bind_result'), $this->binds);
}
public function __destruct() {
$this->close();}
public function close(){
mysqli_stmt_free_result($this->res);
mysqli_stmt_close($this->res);
}
public function count(){
return \mysqli_stmt_num_rows($this->res);}
public function affectedRows(){
return \mysqli_stmt_affected_rows($this->res);}
//$object not used
//$result_type not used!
public function next($object = false, $result_type = MYSQL_BOTH){
if(\mysqli_stmt_fetch($this->res)){
return $this->binds;}
return NULL;
}
public function seek($row_number){
return \mysqli_stmt_data_seek($this->res,$row_number);}
}

View File

@ -0,0 +1,345 @@
<?php
/*
//call=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (0, 0, -1, NULL, 'call', NULL);
//call=page&page=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (1, 0, 0, 'page', 'page', NULL);
//call=sensor
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (140, 1, 1, 'sensor', 'sensorid', 'INT');
//call=geopoint
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (41, 1, 1, 'geopoint', 'lat', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (42, 1, 1, 'geopoint', 'long', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (43, 1, 1, 'geopoint', 'radius', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (45, 1, 1, 'geopoint', 'datatype', 'ALL');
//call=geopoint&explore=1
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (46, 0, 1, 'geopoint', 'explore', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (47, 1, 46, NULL, 'lat', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (48, 1, 46, NULL, 'long', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (49, 1, 46, NULL, 'radius', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (51, 1, 46, NULL, 'datatype', 'ALL');
//call=log
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (135, 1, 0, 'log', 'json', 'ALL');
//call=map&algo=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (5, 0, 0, 'map', 'algo', NULL);
//call=map&algo=&key=1
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (6, 0, 5, NULL, 'key', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (16, 1, 6, NULL, 'type', 'ALL');
//call=map&algo=&markers=1
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (7, 0, 5, NULL, 'markers', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (17, 1, 7, NULL, 'x', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (18, 1, 7, NULL, 'y', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (19, 1, 7, NULL, 'zoom', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (20, 1, 7, NULL, 'from', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (21, 1, 7, NULL, 'to', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (22, 1, 7, NULL, 'type', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (23, 1, 7, NULL, 'provider', 'ALL');
//call=map&algo=&animation=1
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (8, 0, 5, NULL, 'animation', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (34, 1, 8, NULL, 'x', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (35, 1, 8, NULL, 'y', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (36, 1, 8, NULL, 'zoom', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (37, 1, 8, NULL, 'from', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (38, 1, 8, NULL, 'to', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (39, 1, 8, NULL, 'type', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (40, 1, 8, NULL, 'provider', 'ALL');
//call=map&algo=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (9, 1, 5, NULL, 'x', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (10, 1, 5, NULL, 'y', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (11, 1, 5, NULL, 'zoom', 'UINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (12, 1, 5, NULL, 'from', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (13, 1, 5, NULL, 'to', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (14, 1, 5, NULL, 'type', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (15, 1, 5, NULL, 'provider', 'ALL');
//call=account&action=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (60, 0, 0, 'account', 'action', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (61, 1, 60, 'login', 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (62, 1, 60, 'login', 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (63, 1, 60, 'login', 'hashed', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (64, 1, 60, 'check', 'rightid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (65, 1, 60, 'create', 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (66, 1, 60, 'create', 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (67, 1, 60, 'create', 'email', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (68, 1, 60, 'create', 'hashed', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (120, 0, 60, 'login', 'compatibility', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (121, 1, 120, NULL, 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (122, 1, 120, NULL, 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (123, 1, 120, NULL, 'hashed', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (125, 0, 60, 'available', 'compatibility', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (126, 1, 125, NULL, 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (130, 0, 60, 'create', 'compatibility', 'FLAG');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (131, 1, 130, NULL, 'username', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (132, 1, 130, NULL, 'password', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (133, 1, 130, NULL, 'email', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (134, 1, 130, NULL, 'hashed', 'ALL');
//call=analysis&action=&mthd=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (70, 0, 0, 'analysis', 'action', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (71, 0, 70, NULL, 'mthd', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (72, 1, 71, 'within', 'lat', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (73, 1, 71, 'within', 'lng', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (74, 1, 71, 'within', 'when', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (75, 1, 71, 'gettotal', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (76, 1, 71, 'gettotal', 'intval', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (77, 1, 71, 'getseries', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (78, 1, 71, 'projection24', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (79, 1, 71, 'projection24', 'intval', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (80, 1, 71, 'get', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (81, 1, 71, 'get', 'acronym', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (82, 1, 71, 'gethist', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (83, 1, 71, 'gethist', 'sort', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (84, 1, 71, 'is', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (85, 1, 71, 'is', 'acronym', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (86, 1, 71, 'getbyuser', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (87, 1, 71, 'getallcond', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (88, 1, 71, 'getallcond', 'acronym', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (89, 1, 71, 'getalldefs', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (90, 1, 71, 'getalldefs', 'acronym', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (91, 1, 71, 'all', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (92, 1, 71, 'all', 'last', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (93, 1, 71, 'own', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (94, 1, 71, 'own', 'last', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (95, 1, 71, 'register', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (96, 1, 71, 'register', 'regid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (97, 1, 71, 'register', 'deviceid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (98, 1, 71, 'fetch', 'useruid', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (99, 1, 71, 'fetch', 'last', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (100, 1, 71, 'explore', 'lat', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (101, 1, 71, 'explore', 'lng', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (102, 1, 71, 'explore', 'radius', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (103, 1, 71, 'explore', 'endtime', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (104, 1, 71, 'citybyzip', 'zip', 'ALL');
//call=input&type=
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (110, 0, 0, 'input', 'type', NULL);
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (111, 1, 110, 'data', 'source', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (112, 1, 110, 'data', 'json', 'ALL');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (113, 1, 110, 'deviceinfo', 'json', 'ALL');
//call=locale
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (145, 1, 0, 'locale', 'request', 'ARRAYINT');
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (146, 1, 0, 'locale', 'lang', 'LANG');
*/
class ApiClass extends \SYSTEM\API\apiloginclass {
//DB hook for loginapi
protected static function getUserDBInfo(){
return new DBD\dasenseuser();}
//#OLD
//public static function call_account_flag_login(){}
//public static function call_account_flag_loginstudy(){}
//public static function call_account_flag_available(){}
//public static function call_account_flag_registration(){}
//public static function call_account_flag_registrationstudy(){}
//public static function call_account_flag_protocol(){}
//public static function flag_log(){we should better log somewhere in the admin interface}
//#Sensor & Geopoint
public static function call_page_page_sensor($sensorid){
return page_sensor::json($sensorid);}
public static function call_page_page_geopoint($lat,$long,$radius,$datatype){
return page_geopoint::json($lat, $long, $radius, $datatype);}
public static function call_page_page_geopoint_flag_explore($lat,$long,$radius,$datatype){
return page_geopoint_explore::json($lat, $long, $radius, $datatype);}
//#Old logincalls
public static function call_account_action_login_flag_compatibility($username, $password, $hashed){
return DasenseLogin::login($username, $password, $hashed);}
public static function call_account_action_available_flag_compatibility($username){
return DasenseLogin::available($username);}
public static function call_account_action_create_flag_compatibility($username,$password,$email,$hashed){
return DasenseRegistration::create($username, $password, $email, $hashed);}
//Logging system
public static function call_log($json){
return ProtocolLogger::protocol($json);}
//#Input
public static function call_input_type_deviceinfo($json){
$pars = new JSONParser($json);
return $pars->input_deviceinfo();}
public static function call_input_type_data($source,$json){
$pars = new JSONParser($json, $source);
return $pars->input_data();}
//#Imageoverlays
public static function call_map_algo_heatmapStd($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new heatmapStd_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_heatmapStd_flag_key($type){
$imggen = new heatmapStd_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_heatmapStd_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new heatmapStd_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_heatmapRect($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new heatmapRect_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_heatmapRect_flag_key($type){
$imggen = new heatmapRect_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_heatmapRect_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new heatmapRect_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_speedmap($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new speedmap_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_speedmap_flag_key($type){
$imggen = new speedmap_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_speedmap_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new speedmap_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_differencemap($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new differencemap_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_differencemap_flag_key($type){
$imggen = new differencemap_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_differencemap_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new differencemap_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_tramlines($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new tramlines_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_tramlines_flag_key($type){
$imggen = new tramlines_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_tramlines_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new tramlines_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_tram($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new tram_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_tram_flag_key($type){
$imggen = new tram_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_tram_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new tram_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_animationTest($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new animationTest_algo();
return $imggen->generateTile($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_animationTest_flag_key($type){
$imggen = new animationTest_algo();
return $imggen->generateMapKey($type);}
public static function call_map_algo_animationTest_flag_markers($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new animationTest_algo();
return $imggen->getMarkers($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
public static function call_map_algo_animationTest_flag_animation($x,$y,$zoom,$time_start,$time_end,$type,$provider){
$imggen = new animationTest_algo();
return $imggen->getAnimation($x,$y,$zoom,$time_start,$time_end,$type,$provider);}
//#Analysis API
// insert new bonus area
public static function call_analysis_action_barea_mthd_insert($pswd,$json){
return BonusAreaController::insert($pswd, $json);}
// get all bonus areas
public static function call_analysis_action_barea_mthd_getall(){
return BonusAreaController::getall();}
// get all active bonus areas
public static function call_analysis_action_barea_mthd_getallactive(){
return BonusAreaController::getallactive();}
// within a bonus area?
public static function call_analysis_action_barea_mthd_within($lat,$lng,$when){
return BonusAreaController::within($lat, $lng, $when);}
// get total statistics
public static function call_analysis_action_statistic_mthd_gettotal($useruid,$intval){
return StatisticsController::getTotalUserStatistics($useruid,$intval);}
// get series statistics
public static function call_analysis_action_statistic_mthd_getseries($useruid){
return StatisticsController::getTotalSeriesStatistics($useruid);}
// get 24 map projection
public static function call_analysis_action_statistic_mthd_projection24($useruid,$intval){
return StatisticsController::getProjection24($intval, $useruid);}
// get own rank
public static function call_analysis_action_rank_mthd_get($useruid,$acronym){
return RankController::getRank($useruid, $acronym);}
// get own history ranks
public static function call_analysis_action_rank_mthd_gethist($useruid,$sort){
return RankController::getRankHistoryByUser($useruid, $sort);}
// questions calls
public static function call_analysis_action_rank_mthd_is($useruid,$acronym){
return RankController::isRank($useruid, $acronym);}
// get all achievements by userUID
public static function call_analysis_action_achievement_mthd_getbyuser($useruid){
return AchievementController::getReachedAchievements($useruid);}
// get all defined achievements conditions
public static function call_analysis_action_achievement_mthd_getallcond($useruid, $acronym){
return AchievementController::getAllAchievementDefinitionCondition($acronym, $useruid);}
// get all defined achievements
public static function call_analysis_action_achievement_mthd_getalldefs($useruid, $acronym){
return AchievementController::getAllAchievementDefinitionCondition($acronym, $useruid);}
// get current ranking all
public static function call_analysis_action_ranking_mthd_all($useruid,$last){
return RankingController::getRankingAll($useruid,$last);}
// get current ranking own
public static function call_analysis_action_ranking_mthd_own($useruid,$last){
return RankingController::getRankingOwn($useruid,$last);}
// get explore factor
public static function call_analysis_action_data_mthd_explore($lat,$lng,$radius,$endtime){
return DataController::getExplore($lat, $lng, $radius, $endtime);}
// get cities by postal code
public static function call_analysis_action_data_mthd_citybyzip($zip){
return DataController::queryByZip($zip);}
// store registration id
public static function call_analysis_action_ctwodm_mthd_register($useruid, $regid, $deviceid){
return MessageController::handleRegistrationId($regid, $useruid, $deviceid);}
// fetch new messages
public static function call_analysis_action_ctwodm_mthd_fetch($useruid, $last){
return MessageController::fetchAllData($useruid,$last);}
// call=locale
public static function call_locale($request,$lang){
$starttime = microtime(true);
return JsonResult::toString($starttime, \SYSTEM\locale::getStrings($request, $lang));}
//TODO remove -> backend
public function call_preprocessing1233423DONOTCALL(){
PreprocessAll::process();
}
};

View File

@ -0,0 +1,17 @@
<?php
class ApiVerify extends \SYSTEM\verifyclass {
public static function INPUTSOURCE ($param){ return ($param == 'smartphone') || ($param == 'waspmote');}
public static function SENSORTYPE ($param){ return self::UINT($param) && $param > 0 & $param < 10;}
public static function GOOGLEMAPCOORD ($param){ return self::UINT($param);}
public static function GOOGLEMAPZOOM ($param){ return self::UINT($param) && $param < 20;}
public static function WIERDTIMESTAMP ($param){ return (strtotime($param)==false) ? false : true;}
public static function SENSORPROVIDER ($param){ return true;} //TODO remove this param
public static function LATLONCOORD ($param){ return self::FLOAT($param) && floatval($param) >= 0 && floatval($param) <= 180;}
public static function USERNAME ($param){ return self::STRING($param) && strlen($param) >=3 && strlen($param) <= 30;}
public static function PASSWORD ($param){ return self::STRING($param) && strlen($param) >=5 && strlen($param) <= 16;}
public static function HASH ($param){ return preg_match("^[0-9A-Fa-f]+$^", $param) != 0 && strlen($param) >=5;}
public static function PASSHASH ($param){ return self::PASSWORD($param) || self::HASH($param);}
public static function EMAIL ($param){ return filter_var($param, FILTER_VALIDATE_EMAIL);}
public static function ARRAYINT ($param){ return self::ARY($param) || self::INT($param);}
}

View File

@ -0,0 +1,110 @@
<?php
class PageApi extends \SYSTEM\PAGE\PageClass {
public static function default_page(){
return new default_page();
}
//?module=X&action=Y
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (0, 0, -1, NULL, 'module', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (1, 0, 0, NULL, 'action', 'ALL');
//?module=X&action=sensor&sensorIDs=Z
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (2, 1, 1, 'sensor', 'sensorIDs', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (3, 1, 1, 'login', 'old_module', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (4, 1, 1, 'login', 'old_action', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (7, 1, 1, 'geopoint', 'coord', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (8, 1, 1, 'geopoint', 'datatype', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (9, 1, 1, 'geopoint', 'radius', 'ALL');
//?action=X[&sensorIDS=Y]
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (5, 0, -1, NULL, 'action', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (6, 1, 5, 'sensor', 'sensorIDs', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (10, 1, 5, 'geopoint', 'coord', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (11, 1, 5, 'geopoint', 'datatype', 'ALL');
//INSERT INTO `PAGECalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (12, 1, 5, 'geopoint', 'radius', 'ALL');
public static function action_contact(){
return new default_contact();}
public static function module_default_action_contact(){
return new default_contact();}
public static function action_developer(){
return new default_developer();}
public static function module_default_action_developer(){
return new default_developer();}
public static function action_welcome(){
return new default_welcome();}
public static function module_default_action_welcome(){
return new default_welcome();}
public static function action_project(){
return new default_project();}
public static function module_default_action_project(){
return new default_project();}
public static function action_apiQuery(){
return new api_query();}
public static function module_default_apiQuery(){
return new api_query();}
public static function action_press(){
return new default_press();}
public static function module_default_action_press(){
return new default_press();}
public static function action_impressum(){
return new default_impressum();}
public static function module_default_action_impressum(){
return new default_impressum();}
public static function action_devs(){
return new default_devs();}
public static function module_default_action_devs(){
return new default_devs();}
public static function action_sensor($sensorIDs){
return new default_sensor($sensorIDs);}
public static function module_default_action_sensor($sensorIDs){
return new default_sensor($sensorIDs);}
public static function action_geopoint($coord,$datatype,$radius){
return new default_geopoint($coord,$datatype,$radius);}
public static function module_default_action_geopoint($coord,$datatype,$radius){
return new default_geopoint($coord,$datatype,$radius);}
public static function module_user_action_area(){
return new user_area();
}
public static function module_user_action_statistic(){
return new user_statistic();
}
public static function module_default_action_highscore(){
return new default_highscore();
}
public static function module_user_action_user(){
if(SYSTEM\SECURITY\Security::isLoggedIn()){
return new user_user();}
else {
return new user_login('user','user');}
}
public static function module_user_action_login($old_module,$old_action){
return new user_login($old_module,$old_action);}
public static function module_user_action_logout(){
return new user_logout();}
}

119
system/docu/index/api.php Normal file
View File

@ -0,0 +1,119 @@
<?php
require_once 'system/autoload.inc.php';
require_once 'dbd/autoload.inc.php';
require_once 'dasense/autoload.inc.php';
$call = new DBD\dasensedata();
/*$call = array( array(\DBD\APITable::FIELD_ID => 0, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>-1, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'call', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 45, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'geopoint', \DBD\APITable::FIELD_NAME =>'datatype', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 120, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'login', \DBD\APITable::FIELD_NAME =>'compatibility', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 5, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'map', \DBD\APITable::FIELD_NAME =>'algo', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 6, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'key', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 16, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>6, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'type', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORTYPE'),
array(\DBD\APITable::FIELD_ID => 7, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'markers', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 8, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'animation', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 17, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'x', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 18, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'y', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 19, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'zoom', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPZOOM'),
array(\DBD\APITable::FIELD_ID => 20, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'from', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 21, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'to', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 22, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'type', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORTYPE'),
array(\DBD\APITable::FIELD_ID => 23, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>7, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'provider', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORPROVIDER'),
array(\DBD\APITable::FIELD_ID => 9, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'x', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 10, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'y', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 11, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'zoom', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPZOOM'),
array(\DBD\APITable::FIELD_ID => 12, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'from', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 13, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'to', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 14, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'type', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORTYPE'),
array(\DBD\APITable::FIELD_ID => 15, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>5, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'provider', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORPROVIDER'),
array(\DBD\APITable::FIELD_ID => 132, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>130, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'password', \DBD\APITable::FIELD_ALLOWEDVALUES =>'PASSWORD'),
array(\DBD\APITable::FIELD_ID => 111, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>110, \DBD\APITable::FIELD_PARENTVALUE =>'data', \DBD\APITable::FIELD_NAME =>'source', \DBD\APITable::FIELD_ALLOWEDVALUES =>'INPUTSOURCE'),
array(\DBD\APITable::FIELD_ID => 110, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'input', \DBD\APITable::FIELD_NAME =>'type', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 131, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>130, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'username', \DBD\APITable::FIELD_ALLOWEDVALUES =>'USERNAME'),
array(\DBD\APITable::FIELD_ID => 130, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'create', \DBD\APITable::FIELD_NAME =>'compatibility', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 126, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>125, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'username', \DBD\APITable::FIELD_ALLOWEDVALUES =>'USERNAME'),
array(\DBD\APITable::FIELD_ID => 125, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'available', \DBD\APITable::FIELD_NAME =>'compatibility', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'),
array(\DBD\APITable::FIELD_ID => 123, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>120, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'hashed', \DBD\APITable::FIELD_ALLOWEDVALUES =>'BOOL'),
array(\DBD\APITable::FIELD_ID => 122, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>120, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'password', \DBD\APITable::FIELD_ALLOWEDVALUES =>'PASSWORD'),
array(\DBD\APITable::FIELD_ID => 121, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>120, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'username', \DBD\APITable::FIELD_ALLOWEDVALUES =>'USERNAME'),
array(\DBD\APITable::FIELD_ID => 34, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'x', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 35, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'y', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPCOORD'),
array(\DBD\APITable::FIELD_ID => 36, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'zoom', \DBD\APITable::FIELD_ALLOWEDVALUES =>'GOOGLEMAPZOOM'),
array(\DBD\APITable::FIELD_ID => 37, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'from', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 38, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'to', \DBD\APITable::FIELD_ALLOWEDVALUES =>'WIERDTIMESTAMP'),
array(\DBD\APITable::FIELD_ID => 39, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'type', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORTYPE'),
array(\DBD\APITable::FIELD_ID => 40, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>8, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'provider', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORPROVIDER'),
array(\DBD\APITable::FIELD_ID => 43, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'geopoint', \DBD\APITable::FIELD_NAME =>'radius', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 42, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'geopoint', \DBD\APITable::FIELD_NAME =>'long', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 41, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'geopoint', \DBD\APITable::FIELD_NAME =>'lat', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 60, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'account', \DBD\APITable::FIELD_NAME =>'action', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 140, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'sensor', \DBD\APITable::FIELD_NAME =>'sensorid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'INT'),
array(\DBD\APITable::FIELD_ID => 1, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'page', \DBD\APITable::FIELD_NAME =>'page', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 47, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>46, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'lat', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 48, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>46, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'long', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 49, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>46, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'radius', \DBD\APITable::FIELD_ALLOWEDVALUES =>'UINT'),
array(\DBD\APITable::FIELD_ID => 61, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'login', \DBD\APITable::FIELD_NAME =>'username', \DBD\APITable::FIELD_ALLOWEDVALUES =>'USERNAME'),
array(\DBD\APITable::FIELD_ID => 51, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>46, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'datatype', \DBD\APITable::FIELD_ALLOWEDVALUES =>'SENSORTYPE'),
array(\DBD\APITable::FIELD_ID => 62, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'login', \DBD\APITable::FIELD_NAME =>'password', \DBD\APITable::FIELD_ALLOWEDVALUES =>'PASSWORD'),
array(\DBD\APITable::FIELD_ID => 63, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'login', \DBD\APITable::FIELD_NAME =>'hashed', \DBD\APITable::FIELD_ALLOWEDVALUES =>'BOOL'),
array(\DBD\APITable::FIELD_ID => 64, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'check', \DBD\APITable::FIELD_NAME =>'rightid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'UINT'),
array(\DBD\APITable::FIELD_ID => 65, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'create', \DBD\APITable::FIELD_NAME =>'username', \DBD\APITable::FIELD_ALLOWEDVALUES =>'USERNAME'),
array(\DBD\APITable::FIELD_ID => 66, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'create', \DBD\APITable::FIELD_NAME =>'password', \DBD\APITable::FIELD_ALLOWEDVALUES =>'PASSWORD'),
array(\DBD\APITable::FIELD_ID => 67, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'create', \DBD\APITable::FIELD_NAME =>'email', \DBD\APITable::FIELD_ALLOWEDVALUES =>'EMAIL'),
array(\DBD\APITable::FIELD_ID => 68, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>60, \DBD\APITable::FIELD_PARENTVALUE =>'create', \DBD\APITable::FIELD_NAME =>'hashed', \DBD\APITable::FIELD_ALLOWEDVALUES =>'BOOL'),
array(\DBD\APITable::FIELD_ID => 70, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'analysis', \DBD\APITable::FIELD_NAME =>'action', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 71, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>70, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'mthd', \DBD\APITable::FIELD_ALLOWEDVALUES =>NULL),
array(\DBD\APITable::FIELD_ID => 72, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'within', \DBD\APITable::FIELD_NAME =>'lat', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 73, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'within', \DBD\APITable::FIELD_NAME =>'lng', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 74, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'within', \DBD\APITable::FIELD_NAME =>'when', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 75, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'gettotal', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 76, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'gettotal', \DBD\APITable::FIELD_NAME =>'intval', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 77, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getseries', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 78, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'projection24', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 79, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'projection24', \DBD\APITable::FIELD_NAME =>'intval', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 80, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'get', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 81, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'get', \DBD\APITable::FIELD_NAME =>'acronym', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 82, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'gethist', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 83, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'gethist', \DBD\APITable::FIELD_NAME =>'sort', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 84, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'is', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 85, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'is', \DBD\APITable::FIELD_NAME =>'acronym', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 86, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getbyuser', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 87, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getallcond', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 88, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getallcond', \DBD\APITable::FIELD_NAME =>'acronym', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 89, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getalldefs', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 90, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'getalldefs', \DBD\APITable::FIELD_NAME =>'acronym', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 91, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'all', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 92, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'all', \DBD\APITable::FIELD_NAME =>'last', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 93, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'own', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 94, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'own', \DBD\APITable::FIELD_NAME =>'last', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 95, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'register', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 96, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'register', \DBD\APITable::FIELD_NAME =>'regid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 97, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'register', \DBD\APITable::FIELD_NAME =>'deviceid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 98, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'fetch', \DBD\APITable::FIELD_NAME =>'useruid', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 99, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'fetch', \DBD\APITable::FIELD_NAME =>'last', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 100, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'explore', \DBD\APITable::FIELD_NAME =>'lat', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 101, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'explore', \DBD\APITable::FIELD_NAME =>'lng', \DBD\APITable::FIELD_ALLOWEDVALUES =>'LATLONCOORD'),
array(\DBD\APITable::FIELD_ID => 102, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'explore', \DBD\APITable::FIELD_NAME =>'radius', \DBD\APITable::FIELD_ALLOWEDVALUES =>'UINT'),
array(\DBD\APITable::FIELD_ID => 103, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'explore', \DBD\APITable::FIELD_NAME =>'endtime', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 104, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>71, \DBD\APITable::FIELD_PARENTVALUE =>'citybyzip', \DBD\APITable::FIELD_NAME =>'zip', \DBD\APITable::FIELD_ALLOWEDVALUES =>'ALL'),
array(\DBD\APITable::FIELD_ID => 112, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>110, \DBD\APITable::FIELD_PARENTVALUE =>'data', \DBD\APITable::FIELD_NAME =>'json', \DBD\APITable::FIELD_ALLOWEDVALUES =>'JSON'),
array(\DBD\APITable::FIELD_ID => 113, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>110, \DBD\APITable::FIELD_PARENTVALUE =>'deviceinfo', \DBD\APITable::FIELD_NAME =>'json', \DBD\APITable::FIELD_ALLOWEDVALUES =>'JSON'),
array(\DBD\APITable::FIELD_ID => 133, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>130, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'email', \DBD\APITable::FIELD_ALLOWEDVALUES =>'EMAIL'),
array(\DBD\APITable::FIELD_ID => 134, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>130, \DBD\APITable::FIELD_PARENTVALUE =>NULL, \DBD\APITable::FIELD_NAME =>'hashed', \DBD\APITable::FIELD_ALLOWEDVALUES =>'BOOL'),
array(\DBD\APITable::FIELD_ID => 135, \DBD\APITable::FIELD_FLAG =>1, \DBD\APITable::FIELD_PARENTID =>0, \DBD\APITable::FIELD_PARENTVALUE =>'log', \DBD\APITable::FIELD_NAME =>'json', \DBD\APITable::FIELD_ALLOWEDVALUES =>'JSON'),
array(\DBD\APITable::FIELD_ID => 46, \DBD\APITable::FIELD_FLAG =>0, \DBD\APITable::FIELD_PARENTID =>1, \DBD\APITable::FIELD_PARENTVALUE =>'geopoint', \DBD\APITable::FIELD_NAME =>'explore', \DBD\APITable::FIELD_ALLOWEDVALUES =>'FLAG'));*/
$api = new SYSTEM\API\Api($call, new ApiVerify(), new ApiClass());
$json = json_decode(file_get_contents("php://input"), true);
$starttime = microtime(true);
try {
if($json){
echo $api->CALL($json);
} else {
echo $api->CALL(array_merge($_POST,$_GET));}
} catch(Exception $e){
echo JsonResult::error($starttime, $e);
}

View File

@ -0,0 +1,36 @@
<?php
require_once 'system/autoload.inc.php';
require_once 'dbd/autoload.inc.php';
require_once 'dasense/autoload.inc.php';
//Debug
error_reporting(E_ALL);
ini_set('display_errors', TRUE); // evtl. hilfreich
$call = new DBD\dasensedata();
/*$call = array( array(\DBD\PAGETable::FIELD_ID=>6, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>5, \DBD\PAGETable::FIELD_PARENTVALUE=>'sensor', \DBD\PAGETable::FIELD_NAME=>'sensorIDs', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>5, \DBD\PAGETable::FIELD_FLAG=>0, \DBD\PAGETable::FIELD_PARENTID=>-1, \DBD\PAGETable::FIELD_PARENTVALUE=>NULL, \DBD\PAGETable::FIELD_NAME=>'action', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>0, \DBD\PAGETable::FIELD_FLAG=>0, \DBD\PAGETable::FIELD_PARENTID=>-1, \DBD\PAGETable::FIELD_PARENTVALUE=>NULL, \DBD\PAGETable::FIELD_NAME=>'module', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>1, \DBD\PAGETable::FIELD_FLAG=>0, \DBD\PAGETable::FIELD_PARENTID=>0, \DBD\PAGETable::FIELD_PARENTVALUE=>NULL, \DBD\PAGETable::FIELD_NAME=>'action', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>2, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'sensor', \DBD\PAGETable::FIELD_NAME=>'sensorIDs', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>3, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'login', \DBD\PAGETable::FIELD_NAME=>'old_module', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>4, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'login', \DBD\PAGETable::FIELD_NAME=>'old_action', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>7, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'coord', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>8, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'datatype', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>9, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>1, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'radius', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>10, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>5, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'coord', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>11, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>5, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'datatype', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'),
array(\DBD\PAGETable::FIELD_ID=>12, \DBD\PAGETable::FIELD_FLAG=>1, \DBD\PAGETable::FIELD_PARENTID=>5, \DBD\PAGETable::FIELD_PARENTVALUE=>'geopoint', \DBD\PAGETable::FIELD_NAME=>'radius', \DBD\PAGETable::FIELD_ALLOWEDVALUES=>'ALL'));*/
$page = new \SYSTEM\PAGE\PageApi( $call, new SYSTEM\verifyclass(), new PageApi());
try{
echo $page->CALL(array_merge($_POST,$_GET))->html();
} catch(Exception $e) {
echo $e;
$page = new default_page();
echo $page->html();
}
?>

7
system/page/Page.php Normal file
View File

@ -0,0 +1,7 @@
<?php
namespace SYSTEM\PAGE;
abstract class Page {
abstract public function html();
}

133
system/page/PageApi.php Normal file
View File

@ -0,0 +1,133 @@
<?php
/*
* Table:
* ID FLAG C/P PARENTCOMMANDID ISCHACHED ALLOWEDVALUES (cache only for commands, null on command = dont care)
* 0 C 'CALL' -1 null null (calculated by the api for commands)
* 1 C 'ALGO' 0 true null
* 2 P 'x' 1 null GOOGLEMAPXY (function in MYVERIFY::func)
* 3 P 'y' 1 null GOOGLEMAPXY
* 4 P 'zoom' 1 null GOOGLEMAPZOOM
* 5 P 'from' 1 null TIMEWIERDFORMAT
* 6 P 'to' 1 null TIMEWIERDFORMAT
* 7 P 'type' 1 null SENSORTYPE
* 8 P 'provider' 1 null SENSORPROVIDER
* 9 P 'visibility' 1 null SENSORVISIBILITY
* 10 C 'markers' 1 null BOOL
*
* MYAPI::map_heatmap($PARAMS,$OPTIONS)
* MYAPI::map_heatmap_key
*/
namespace SYSTEM\PAGE;
class PageApi {
private $m_dbinfo = null;
private $m_verifyclass = null;
private $m_pageclass = null;
public function __construct($DBInfo,\SYSTEM\verifyclass $VerifyClass, \SYSTEM\PAGE\PageClass $PageClass){
$this->m_dbinfo = $DBInfo;
$this->m_verifyclass = $VerifyClass;
$this->m_pageclass = $PageClass;
}
// $call = post + get params
// returns resultstring
public function CALL($call = array()){
//Get the Databasetree
$tree = array();
if($this->m_dbinfo instanceof \SYSTEM\DB\DBInfo){
$tree = self::getPageTree();}
else {
if(!is_array($this->m_dbinfo)){
throw new Exception('No Connectioninfo and no call table given to the api');}
$tree = $this->m_dbinfo;
}
//Commands
$commands = array();
$parentid = -1;
foreach($tree as $item){
if( $item[\DBD\PAGETable::FIELD_FLAG] == \DBD\PAGETable::VALUE_FLAG_COMMAND &&
$item[\DBD\PAGETable::FIELD_PARENTID] == $parentid &&
isset($call[$item[\DBD\PAGETable::FIELD_NAME]])){
if( isset($item[\DBD\PAGETable::FIELD_PARENTVALUE]) &&
$commands[count($commands)-1][1] != $item[\DBD\PAGETable::FIELD_PARENTVALUE]){
continue;}
$commands[] = array($item,$call[$item[\DBD\PAGETable::FIELD_NAME]]);
$parentid = $item[\DBD\PAGETable::FIELD_ID];
}
}
//Parameters
$command_call = '';
$parameters = array();
if(count($commands) > 0){
$lastCommand = $commands[count($commands) -1 ][0];
foreach($tree as $item){
if( $item[\DBD\PAGETable::FIELD_FLAG] == \DBD\PAGETable::VALUE_FLAG_PARAM &&
$item[\DBD\PAGETable::FIELD_PARENTID] == $lastCommand[\DBD\PAGETable::FIELD_ID]){
if( isset($item[\DBD\PAGETable::FIELD_PARENTVALUE]) &&
$commands[count($commands)-1][1] != $item[\DBD\PAGETable::FIELD_PARENTVALUE]){
continue;}
if(!isset($call[$item[\DBD\PAGETable::FIELD_NAME]])){
throw new \Exception('Parameter missing: '.$item[\DBD\PAGETable::FIELD_NAME]);}
if( !method_exists($this->m_verifyclass, $item[\DBD\PAGETable::FIELD_ALLOWEDVALUES]) ||
!$this->m_verifyclass->$item[\DBD\PAGETable::FIELD_ALLOWEDVALUES]($call[$item[\DBD\PAGETable::FIELD_NAME]])){
throw new \Exception('Parameter type missmacht or Missing Verifier. Param: '.$item[\DBD\PAGETable::FIELD_NAME].' Verifier: '.$item[\DBD\PAGETable::FIELD_ALLOWEDVALUES]);}
$parameters[] = array($item, $call[$item[\DBD\PAGETable::FIELD_NAME]]);
}
}
//Function Name
foreach($commands as $com){
if(!\preg_match('^[0-9A-Za-z_]+$^', $com[1])){
throw new \Exception("Call Command can only have letters!");}
if($com[0][\DBD\PAGETable::FIELD_ALLOWEDVALUES] == 'FLAG'){
$command_call .= '_flag_'.$com[0][\DBD\PAGETable::FIELD_NAME];
} else {
$command_call .= '_'.$com[0][\DBD\PAGETable::FIELD_NAME].'_'.\strtolower($com[1]);}
}
$command_call = substr($command_call, 1);
}
$command_call = $command_call == '' ? 'default_page': $command_call;
//Function parameters
$parameter_call = array();
if(count($parameters) > 0){
foreach($parameters as $param){
$parameter_call[] = $param[1];}
}
if(!\method_exists($this->m_pageclass, $command_call)){
throw new \Exception("Page call is not implemented in PageApi: ".$command_call);}
//Call Function
return \call_user_func_array(array($this->m_pageclass,$command_call),$parameter_call);
}
private function getPageTree(){
$con = new \SYSTEM\DB\Connection($this->m_dbinfo);
$res = $con->query("SELECT * FROM ".\DBD\PAGETable::NAME." ORDER BY ".\DBD\PAGETable::FIELD_ID);
if(!$res){
throw new \Exception("Sql Error ".mysqli_error());}
$result = array();
while($row = $res->next()){
$result[] = $row;}
return $result;
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace SYSTEM\PAGE;
abstract class PageClass {
public abstract static function default_page();
}

32
system/page/replace.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace SYSTEM\PAGE;
class replace
{
public static function replace($text, $vars){
$search = array();
$replace = array();
foreach(array_keys($vars) as $var){
$search[] = '/\${'.$var.'}/';
}
foreach($vars as $var){
$replace[] = $var;
}
return @preg_replace($search, $replace, $text);
}
public static function replaceFile($path, $vars){
$buffer = file_get_contents($path);
return self::replace($buffer, $vars);
}
}

8
system/sai/index.php Normal file
View File

@ -0,0 +1,8 @@
<?php
require_once 'saigui.php';
//TODO database
$sai = new \SYSTEM\SAI\saigui(/*new \DBD\system()*/ new \DBD\dasenseuser());
echo $sai->html();

28
system/sai/sai.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace SYSTEM\SAI;
class sai {
private $modules = array(); //only strings!
//SINGLETON!
static private $instance = null;
static public function getInstance(){
if (null === self::$instance) {
self::$instance = new self;}
return self::$instance;
}
private function __construct(){}
private function __clone(){}
public function register($module){
if( !\class_exists($module) ||
!\is_array($parents = \class_parents($module)) ||
!\array_search('SYSTEM\SAI\SaiModule', $parents)){
throw new \Exception('Problem with your Sysmodule class: '.$module);}
$this->modules[] = $module;}
public function getModules(){
return $this->modules;}
}

12
system/sai/sai/SaiApi.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace SYSTEM\SAI;
class SaiApi extends \SYSTEM\PAGE\PageClass {
public static function action_module($module){
return new \SYSTEM\SAI\default_page($module);}
public static function default_page(){
return new \SYSTEM\SAI\default_page();}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
abstract class SaiModule {
public static abstract function html_js();
public static abstract function html_css();
public static abstract function html_content();
public static abstract function html_li_menu();
}

View File

@ -0,0 +1,12 @@
<?php
$autoload = SYSTEM\autoload::getInstance();
$autoload->registerFolder(dirname(__FILE__),'SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/page','SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/page/action_test','SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/page/default_page','SYSTEM\SAI');
$autoload->registerFolder(dirname(__FILE__).'/modules','SYSTEM\SAI');
require_once dirname(__FILE__).'/modules/register_modules.php';

View File

@ -0,0 +1,16 @@
<?php
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_sys');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_api');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_page');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_error');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_security');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_docu');
//TODO extern, namespace
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_api_reference');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_badge_creator');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_bonusarea_creator');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_monitoring');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_push_message');
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_text_handler');

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_api_reference extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'API Reference';}
public static function html_li_menu(){return '<li><a href="#" id="apireference">API Reference</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_badge_creator extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="badgecreator">Badge Creator</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_bonusarea_creator extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="bonusareacreator">BonusArea Creator</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_monitoring extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="monitoring">Monitoring</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_push_message extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="pushmessage">Push Message</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_dasense_text_handler extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="texthandler">Text Handler</a></li>';}
}

View File

@ -0,0 +1,95 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){
$con = new \SYSTEM\DB\Connection(new \DBD\system());
$res = $con->query('SELECT * FROM '.\DBD\APITable::NAME);
$tree = array();
while($row = $res->next()){
$tree[] = $row;}
$tree = self::buildTree($tree, -1);
$html = self::htmltree($tree,'http://www.da-sense.de/test/api.php?');
return $html;
}
private static function htmlTree($tree,$url, $url_rec = null){
/*echo "<pre>";
print_r($tree);
echo "</pre>";
die();*/
$result = '';
if( \is_array($tree) &&
\count($tree) > 0 &&
\is_array($tree['com'])){
foreach($tree['com'] as $root){
//print_r($root);
$url_rec_new = ($root['node'][\DBD\APITable::FIELD_PARENTVALUE] ? $root['node'][\DBD\APITable::FIELD_PARENTVALUE].'&' : '').
$root['node'][\DBD\APITable::FIELD_NAME].'=';
//print_r($url_rec_new);
//echo '</br>';
$result .= '<ul><li>'.
$root['node'][\DBD\APITable::FIELD_NAME].' '.
'</br>'.
'<a href="'.$url.$url_rec.$url_rec_new.($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}').'">'.
$url.$url_rec.$url_rec_new.($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}').'</a>';
if(\is_array($root['par'])){
foreach($root['par'] as $parentval => $param){
$url_rec_new_par = ($parentval ? $parentval : ($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}'));
foreach($param as $par){
$url_rec_new_par .= '&'.$par[\DBD\APITable::FIELD_NAME].'=${'.$par[\DBD\APITable::FIELD_ALLOWEDVALUES].'}';
}
$result .= '</br>'.
'<a href="'.$url.$url_rec.$url_rec_new.$url_rec_new_par.'">'.$url.$url_rec.$url_rec_new.$url_rec_new_par.'</a>';
}
}
/*echo "<pre>";
print_r($root['tree']);
echo "</pre>";*/
$result .= self::htmlTree($root['tree'],$url, $url_rec.$url_rec_new).
'</li></ul>';
}
}
return $result;
}
private static function buildTree($dbtree, $parentid){
$result = array();
foreach($dbtree as $node){
if( $node[\DBD\APITable::FIELD_PARENTID] == $parentid &&
(!$node[\DBD\APITable::FIELD_FLAG] || $node[\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG')){
/*if($node[\DBD\APITable::FIELD_FLAG] && $node[\DBD\APITable::FIELD_ALLOWEDVALUES] != 'FLAG'){
$result['par'][$node[\DBD\APITable::FIELD_PARENTVALUE]][] = $node;
} else {
$result['com'][] = array('tree' => self::buildTree($dbtree,$node[\DBD\APITable::FIELD_ID]),'node' => $node);}*/
$pars = array();
foreach($dbtree as $node2){
if( $node2[\DBD\APITable::FIELD_PARENTID] == $node[\DBD\APITable::FIELD_ID] &&
$node2[\DBD\APITable::FIELD_FLAG] && $node2[\DBD\APITable::FIELD_ALLOWEDVALUES] != 'FLAG'){
$pars[$node2[\DBD\APITable::FIELD_PARENTVALUE]][] = $node2;
}
}
$result['com'][] = array('tree' => self::buildTree($dbtree,$node[\DBD\APITable::FIELD_ID]),
'node' => $node,
'par' => $pars);
}
}
return $result;
}
public static function html_li_menu(){return '<li><a href="#" id="SYS API">SYS API</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="documentation">Documentation</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_error extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS Error';}
public static function html_li_menu(){return '<li><a href="#" id="SYS Error">SYS Error</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS Page';}
public static function html_li_menu(){return '<li><a href="#" id="SYS PAGE">SYS PAGE</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS Security';}
public static function html_li_menu(){return '<li><a href="#" id="SYS Security">SYS Security</a></li>';}
}

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_sys extends \SYSTEM\SAI\SaiModule {
public static function html_js(){ return '';}
public static function html_css(){return '';}
public static function html_content(){return 'SYS';}
public static function html_li_menu(){return '<li><a href="#" id="SYS">SYS</a></li>';}
}

View File

@ -0,0 +1,9 @@
<?php
namespace SYSTEM\SAI;
class action_test extends \SYSTEM\PAGE\Page {
public function html(){
return "123";
}
}

View File

@ -0,0 +1,49 @@
<div class="masthead">
<h3 class="muted">Design.Simple.Fast.Reliable.Innovative.</h3>
<h4 class="text-info">We write awesome code.</h4>
</div>
<br>
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<img class="carousel-img" src="dasense/page/default_developer/img/carousel/webseite.jpg" alt="">
<div class="carousel-caption">
<h4>TK Forschungspraktikum WS 2012/2013</h4>
<p>Das Team</p>
</div>
</div>
<div class="item">
<img class="carousel-img" src="dasense/page/default_developer/img/carousel/verteidigung_immanuel.jpg" alt="">
<div class="carousel-caption">
<h4>Betreuer: "Hööööy sieee.." ;-D</h4>
<p>Verteidigung Immanuel (Dezember 2012)</p>
</div>
</div>
<div class="item">
<img class="carousel-img" src="dasense/page/default_developer/img/carousel/webseite.jpg" alt="">
<div class="carousel-caption">
<h4>Noisemap 3.0 Release</h4>
<p>Die neue Noisemap Version 3.0 ist jetzt für Android und iOS verfügbar.</p>
</div>
</div>
<div class="item">
<img class="carousel-img" src="dasense/page/default_developer/img/carousel/webseite.jpg" alt="">
<div class="carousel-caption">
<h4>da_sense</h4>
<p>Neues Webseiten Design. Nice.</p>
</div>
</div>
<div class="item">
<img class="carousel-img" src="dasense/page/default_developer/img/carousel/webseite.jpg" alt="">
<div class="carousel-caption">
<h4>Presse: Echo Artikel</h4>
<p>Sogar die Presse hat Interesse ;-P</p>
</div>
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
</div>

View File

@ -0,0 +1,15 @@
/*
Document : index.css
Created on : 31.01.2013, 01:59:37
Author : CHRIS MEURISCH
Description:
Purpose of the stylesheet follows.
*/
.footer{
text-align: right;
}
#div-content{
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,37 @@
/*
Document : index.css
Created on : 31.01.2013, 01:59:37
Author : CHRIS MEURISCH
Description:
Purpose of the stylesheet follows.
*/
#content{
max-width: 1200px;
margin: 0 auto;
}
#content-wrapper{
padding: 20px;
}
.brand-logo{
float: left;
padding-top: 8px;
padding-right: 10px;
}
.footer{
text-align: right;
padding-right: 20px;
color: #777;
}
.footer a{
color: #777;
}
.carousel-img{
width: 1200px;
height: 650px;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,203 @@
/* line 9, ../sass/bootstrap-switch.scss */
.switch {
display: inline-block;
cursor: pointer;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
border: 1px solid;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
background: #e6e6e6;
position: relative;
text-align: left;
overflow: hidden;
line-height: 8px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
min-width: 100px;
}
/* line 31, ../sass/bootstrap-switch.scss */
.switch.switch-mini {
min-width: 70px;
}
/* line 35, ../sass/bootstrap-switch.scss */
.switch.switch-small {
min-width: 80px;
}
/* line 39, ../sass/bootstrap-switch.scss */
.switch.switch-large {
min-width: 120px;
}
/* line 43, ../sass/bootstrap-switch.scss */
.switch.deactivate {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5;
cursor: default !important;
}
/* line 46, ../sass/bootstrap-switch.scss */
.switch.deactivate label, .switch.deactivate span {
cursor: default !important;
}
/* line 50, ../sass/bootstrap-switch.scss */
.switch > div {
display: inline-block;
width: 150%;
position: relative;
top: 0;
}
/* line 56, ../sass/bootstrap-switch.scss */
.switch > div.switch-animate {
-webkit-transition: left 0.5s;
-moz-transition: left 0.5s;
-o-transition: left 0.5s;
transition: left 0.5s;
}
/* line 59, ../sass/bootstrap-switch.scss */
.switch > div.switch-off {
left: -49.5%;
}
/* line 62, ../sass/bootstrap-switch.scss */
.switch > div.switch-on {
left: 0%;
}
/* line 66, ../sass/bootstrap-switch.scss */
.switch input[type=checkbox] {
display: none;
}
/* line 74, ../sass/bootstrap-switch.scss */
.switch span, .switch label {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
position: relative;
display: inline-block;
height: 100%;
padding-bottom: 4px;
padding-top: 4px;
font-size: 14px;
line-height: 20px;
}
/* line 87, ../sass/bootstrap-switch.scss */
.switch span.switch-mini, .switch label.switch-mini {
padding-bottom: 4px;
padding-top: 4px;
font-size: 10px;
line-height: 9px;
}
/* line 94, ../sass/bootstrap-switch.scss */
.switch span.switch-small, .switch label.switch-small {
padding-bottom: 3px;
padding-top: 3px;
font-size: 12px;
line-height: 18px;
}
/* line 101, ../sass/bootstrap-switch.scss */
.switch span.switch-large, .switch label.switch-large {
padding-bottom: 9px;
padding-top: 9px;
font-size: 16px;
line-height: normal;
}
/* line 109, ../sass/bootstrap-switch.scss */
.switch label {
background: white;
margin-top: -1px;
margin-bottom: -1px;
z-index: 100;
width: 34%;
border-left: 1px solid #e6e6e6;
border-right: 1px solid #e6e6e6;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(top, #ffffff, #e6e6e6);
}
/* line 121, ../sass/bootstrap-switch.scss */
.switch span {
color: white;
text-align: center;
z-index: 1;
width: 33%;
}
/* line 127, ../sass/bootstrap-switch.scss */
.switch span.switch-left {
-moz-border-radius-topleft: 4px;
-webkit-border-top-left-radius: 4px;
border-top-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
}
/* line 131, ../sass/bootstrap-switch.scss */
.switch span.switch-right {
color: black;
-moz-border-radius-topright: 4px;
-webkit-border-top-right-radius: 4px;
border-top-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-right-radius: 4px;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
background-image: -webkit-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
}
/* line 138, ../sass/bootstrap-switch.scss */
.switch span.switch-primary, .switch span.switch-left {
color: white;
background: #0088cc;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
background-image: -webkit-linear-gradient(bottom, #0088cc, #0055cc);
background-image: -moz-linear-gradient(bottom, #0088cc, #0055cc);
background-image: -o-linear-gradient(bottom, #0088cc, #0055cc);
background-image: linear-gradient(bottom, #0088cc, #0055cc);
}
/* line 143, ../sass/bootstrap-switch.scss */
.switch span.switch-info {
color: white;
background: #5bc0de;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
background-image: -webkit-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: -moz-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: -o-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
}
/* line 149, ../sass/bootstrap-switch.scss */
.switch span.switch-success {
color: white;
background: #62c462;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #62c462), color-stop(100%, #51a351));
background-image: -webkit-linear-gradient(bottom, #62c462, #51a351);
background-image: -moz-linear-gradient(bottom, #62c462, #51a351);
background-image: -o-linear-gradient(bottom, #62c462, #51a351);
background-image: linear-gradient(bottom, #62c462, #51a351);
}
/* line 155, ../sass/bootstrap-switch.scss */
.switch span.switch-warning {
color: white;
background: #dbb450;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
background-image: -webkit-linear-gradient(bottom, #dbb450, #f89406);
background-image: -moz-linear-gradient(bottom, #dbb450, #f89406);
background-image: -o-linear-gradient(bottom, #dbb450, #f89406);
background-image: linear-gradient(bottom, #dbb450, #f89406);
}
/* line 161, ../sass/bootstrap-switch.scss */
.switch span.switch-danger {
color: white;
background: #ee5f5b;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
background-image: -webkit-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: -moz-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: -o-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: linear-gradient(bottom, #ee5f5b, #bd362f);
}

View File

@ -0,0 +1,10 @@
/*!
* Timepicker Component for Twitter Bootstrap
*
* Copyright 2013 Joris de Wit
*
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/.bootstrap-timepicker{position:relative}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu{left:auto;right:0}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before{left:auto;right:12px}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after{left:auto;right:13px}.bootstrap-timepicker .add-on{cursor:pointer}.bootstrap-timepicker .add-on i{display:inline-block;width:16px;height:16px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu{padding:2px 3px 2px 2px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu.open{display:inline-block}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu:before{border-bottom:7px solid rgba(0,0,0,0.2);border-left:7px solid transparent;border-right:7px solid transparent;content:"";display:inline-block;left:9px;position:absolute;top:-7px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu:after{border-bottom:6px solid #fff;border-left:6px solid transparent;border-right:6px solid transparent;content:"";display:inline-block;left:10px;position:absolute;top:-6px}.bootstrap-timepicker .bootstrap-timepicker-widget.modal{top:30%;margin-top:0;width:200px;margin-left:-100px}.bootstrap-timepicker .bootstrap-timepicker-widget.modal .modal-content{padding:4px}.bootstrap-timepicker .bootstrap-timepicker-widget a.btn,.bootstrap-timepicker .bootstrap-timepicker-widget input{border-radius:4px}.bootstrap-timepicker .bootstrap-timepicker-widget table{width:100%;margin:0}.bootstrap-timepicker .bootstrap-timepicker-widget table td{text-align:center;height:30px;margin:0;padding:2px}.bootstrap-timepicker .bootstrap-timepicker-widget table td:not(.separator){min-width:30px}.bootstrap-timepicker .bootstrap-timepicker-widget table td span{width:100%}.bootstrap-timepicker .bootstrap-timepicker-widget table td a{border:1px transparent solid;width:100%;display:inline-block;margin:0;padding:8px 0;outline:0;color:#333}.bootstrap-timepicker .bootstrap-timepicker-widget table td a:hover{text-decoration:none;background-color:#eee;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border-color:#ddd}.bootstrap-timepicker .bootstrap-timepicker-widget table td a i{margin-top:2px}.bootstrap-timepicker .bootstrap-timepicker-widget table td input{width:25px;margin:0;text-align:center}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/*
Datepicker for Bootstrap
Copyright 2012 Stefan Petre
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
*/
.datepicker { top: 0; left: 0; padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datepicker:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 6px; } .datepicker:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 7px; } .datepicker > div { display: none; } .datepicker table { width: 100%; margin: 0; } .datepicker td, .datepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td.day:hover { background: #eeeeee; cursor: pointer; } .datepicker td.old, .datepicker td.new { color: #999999; } .datepicker td.active, .datepicker td.active:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td.active:hover, .datepicker td.active:hover:hover, .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active, .datepicker td.active.disabled, .datepicker td.active:hover.disabled, .datepicker td.active[disabled], .datepicker td.active:hover[disabled] { background-color: #0044cc; } .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active { background-color: #003399 \9; } .datepicker td span { display: block; width: 47px; height: 54px; line-height: 54px; float: left; margin: 2px; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td span:hover { background: #eeeeee; } .datepicker td span.active { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td span.active:hover, .datepicker td span.active:active, .datepicker td span.active.active, .datepicker td span.active.disabled, .datepicker td span.active[disabled] { background-color: #0044cc; } .datepicker td span.active:active, .datepicker td span.active.active { background-color: #003399 \9; } .datepicker td span.old { color: #999999; } .datepicker th.switch { width: 145px; } .datepicker th.next, .datepicker th.prev { font-size: 19.5px; } .datepicker thead tr:first-child th { cursor: pointer; } .datepicker thead tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i { display: block; cursor: pointer; width: 16px; height: 16px; }

View File

@ -0,0 +1,206 @@
.minicolors {
position: relative;
display: inline-block;
z-index: 1;
}
.minicolors-focus {
z-index: 2;
}
.minicolors INPUT {
margin-right: 3px;
border: solid 1px #CCC;
font: 14px sans-serif;
width: 65px;
height: 16px;
vertical-align: middle;
border-radius: 0;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, .04);
outline: none;
padding: 2px;
margin-right: -1px;
}
.minicolors-swatch-left INPUT {
margin-left: -1px;
margin-right: auto;
}
.minicolors-focus INPUT,
.minicolors-focus .minicolors-swatch {
border-color: #999;
}
.minicolors-hidden {
position: absolute;
left: -9999em;
}
.minicolors-swatch {
position: relative;
width: 20px;
height: 20px;
background: url(jquery.minicolors.png) -80px 0;
border: solid 1px #CCC;
display: inline-block;
vertical-align: middle;
}
.minicolors-swatch SPAN {
position: absolute;
width: 100%;
height: 100%;
background: none;
box-shadow: inset 0 9px 0 rgba(255, 255, 255, .1);
display: inline-block;
}
/* Panel */
.minicolors-panel {
position: absolute;
top: 26px;
left: 0;
width: 173px;
height: 152px;
background: white;
border: solid 1px #CCC;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
display: none;
}
.minicolors-position-top .minicolors-panel {
top: -156px;
}
.minicolors-position-left .minicolors-panel {
left: -83px;
}
.minicolors-position-left.minicolors-with-opacity .minicolors-panel {
left: -104px;
}
.minicolors-with-opacity .minicolors-panel {
width: 194px;
}
.minicolors .minicolors-grid {
position: absolute;
top: 1px;
left: 1px;
width: 150px;
height: 150px;
background: url(jquery.minicolors.png) -120px 0;
cursor: crosshair;
}
.minicolors .minicolors-grid-inner {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: none;
}
.minicolors-slider-saturation .minicolors-grid {
background-position: -420px 0;
}
.minicolors-slider-saturation .minicolors-grid-inner {
background: url(jquery.minicolors.png) -270px 0;
}
.minicolors-slider-brightness .minicolors-grid {
background-position: -570px 0;
}
.minicolors-slider-brightness .minicolors-grid-inner {
background: black;
}
.minicolors-slider-wheel .minicolors-grid {
background-position: -720px 0;
}
.minicolors-slider,
.minicolors-opacity-slider {
position: absolute;
top: 1px;
left: 152px;
width: 20px;
height: 150px;
background: white url(jquery.minicolors.png) 0 0;
cursor: crosshair;
}
.minicolors-slider-saturation .minicolors-slider {
background-position: -60px 0;
}
.minicolors-slider-brightness .minicolors-slider {
background-position: -20px 0;
}
.minicolors-slider-wheel .minicolors-slider {
background-position: -20px 0;
}
.minicolors-opacity-slider {
left: 173px;
background-position: -40px 0;
display: none;
}
.minicolors-with-opacity .minicolors-opacity-slider {
display: block;
}
/* Pickers */
.minicolors-grid .minicolors-picker {
position: absolute;
top: 70px;
left: 70px;
width: 10px;
height: 10px;
border: solid 1px black;
border-radius: 10px;
margin-top: -6px;
margin-left: -6px;
background: none;
}
.minicolors-grid .minicolors-picker SPAN {
position: absolute;
top: 0;
left: 0;
width: 6px;
height: 6px;
border-radius: 6px;
border: solid 2px white;
}
.minicolors-picker {
position: absolute;
top: 0;
left: 0;
width: 18px;
height: 2px;
background: white;
border: solid 1px black;
margin-top: -2px;
}
/* Inline controls */
.minicolors-inline INPUT,
.minicolors-inline .minicolors-swatch {
display: none;
}
.minicolors-inline .minicolors-panel {
position: relative;
top: auto;
left: auto;
display: inline-block;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,20 @@
<?php
/**
* Represents the 'about' menu with the necessary information in relation to the project
*/
class default_developer extends SYSTEM\PAGE\Page {
/**
* assign placeholder with the corresponding values
*
* @tested => true
* @return type template-content with substituted placeholders
*/
public function html(){
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace SYSTEM\SAI;
class default_page extends \SYSTEM\PAGE\Page {
private $module = NULL;
public function __construct($module = NULL){
$this->module = \str_replace('%', '\\', $module);}
private function menu(){
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
$result = '<li><a href="#" id="SAI">SAI</a></li>';
foreach($mods as $mod){
$result .= \call_user_func(array($mod, 'html_li_menu'));}
return $result.'</ul>';
}
private function content(){
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
if( $this->module &&
\array_search($this->module, $mods) !== false){
return \call_user_func(array($this->module, 'html_content'));}
return 'Welcome to the System Admin Interface.';
}
private function css(){
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/libs/bootstrap.min.css').'" type="text/css" />'.
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/index.css').'" type="text/css" />';;
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
if( $this->module &&
\array_search($this->module, $mods) !== false){
$result .= \call_user_func(array($this->module, 'html_css'));}
return $result;
}
private function js(){
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/index.js').'" type="text/javascript"></script>';
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
if( $this->module &&
\array_search($this->module, $mods) !== false){
$result .= \call_user_func(array($this->module, 'html_js'));}
return $result;
}
public function html(){
$vars = array();
$vars['css'] = $this->css();
$vars['js'] = $this->js();
$vars['menu'] = $this->menu();
//$vars['content'] = $this->content();
//$vars['PATH_IMG'] = SYSTEM\WEBPATH(new PPAGE(),'default_developer/img/');
//$vars['PATH_LIB'] = SYSTEM\WEBPATH(new PLIB());
//$vars['PATH_JS'] = SYSTEM\WEBPATH(new PJS());
//$vars = array_merge($vars, SYSTEM\locale::getStrings(\DBD\locale_string::VALUE_CATEGORY_DASENSE));
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/page/default_page/sai.tpl'), $vars);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,41 @@
var baseURL = "http://www.da-sense.de";
var endpoint = "api.php";
var url = baseURL + "/" + endpoint;
/** jQuery on document ready */
function init(){
// initialize content
loadContent('overview_request');
/**
* generic navigation control
*/
$('div.main div#div-nav ul.nav li a').click(function () {
var id = $(this).attr("id");
if(id !== undefined){
console.log("Action: "+id);
$('div.main div#div-nav ul.nav li').each(function(){
$(this).removeClass('active');
});
$(this).parent().addClass('active');
loadContent(id);
}
});
};
/**
* Load content
* @param {type} id
* @returns {undefined} */
function loadContent(id){
var splitID = id.split("_");
if(splitID.length > 1){
var folder = splitID[0];
var file = splitID[1] + ".html";
$('div#div-content').load('dasense/page/default_developer/modules/apireference/'+folder+'/'+file);
}
}

View File

@ -0,0 +1,151 @@
/* global variables */
var fill = "#c7cee0";
var stroke = "#112761";
var strokeWidth = 0.7;
var shape = "circle"; // shield,circle
var icon = "dasense/page/default_developer/icons/red_dark/xhdpi/ic_action_achievement.png";
var iconX = 19;
var iconY = 20;
/* jQuery on document ready */
$(document).ready(function() {
$("input[name=background-color]").val(fill);
$("input[name=stroke-color]").val(stroke);
$("input[name=stroke-width]").val(strokeWidth);
$("input[name=file-url]").val(icon);
$("input[name=iconx]").val(iconX);
$("input[name=icony]").val(iconY);
$("input[name=shape]").filter("[value="+shape+"]").attr('checked', true);
drawBadge();
$("form input").change(function() {
updateValues();
drawBadge();
});
$("form .btn-submit").click(function() {
updateValues();
drawBadge();
});
});
function updateValues() {
fill = $("input[name=background-color]").val();
stroke = $("input[name=stroke-color]").val();
strokeWidth = $("input[name=stroke-width]").val();
shape = $("input[name=shape]:checked").val();
icon = $("input[name=file-url]").val();
iconX = $("input[name=iconx]").val();
iconY = $("input[name=icony]").val();
}
function drawBadge() {
var c = $("#badge")[0];
var ctx = c.getContext("2d");
if(shape == 'shield') {
//iconY = 30;
//iconY = parseInt(iconY) + 10;
drawShield(ctx);
}
else if (shape == 'circle') {
//iconY = 20;
//iconY = parseInt(iconY) - 10;
strokeWidth *= 12;
drawCircle(ctx);
strokeWidth /= 12;
}
$("input[name=iconx]").val(iconX);
$("input[name=icony]").val(iconY);
var img = new Image();
img.onload = function() {
ctx.drawImage(img, iconX, iconY);
onFinish();
}
img.src = icon;
}
function onFinish() {
var c = $("#badge")[0];
var ctx = c.getContext("2d");
ctx.restore();
ctx.restore();
ctx.save();
$("a.btn-submit").attr('href', c.toDataURL());
}
function drawShield(ctx) {
ctx.canvas.height = 120;
ctx.canvas.width = 105;
clearCanvas(ctx);
ctx.save();
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(543,0);
ctx.lineTo(543,623);
ctx.lineTo(0,623);
ctx.closePath();
ctx.clip();
ctx.translate(0,-5);
ctx.scale(12,12);
ctx.save();
ctx.fillStyle = fill;
ctx.beginPath();
ctx.moveTo(4.25,1.34);
//ctx.bezierCurveTo(2.9985,1.7142367,1.747,2.0902233,0.4955,2.46621);
//ctx.bezierCurveTo(0.58758835,5.2587502,1.2884488,8.6654921,4.25,9.66175);
//ctx.bezierCurveTo(7.2442172,8.6940151,7.8773651,5.2291438,8.0045,2.46621);
//ctx.bezierCurveTo(6.753,2.0902233,5.5015,1.7142367,4.25,1.33825);
ctx.bezierCurveTo(3,1.7,1.75,2,0.5,2.5);
ctx.bezierCurveTo(0.6,5.26,1.29,8.67,4.25,9.66);
ctx.bezierCurveTo(7.24,8.69,7.88,5.23,8,2.47);
ctx.bezierCurveTo(6.75,2,5.5,1.71,4.25,1.34);
ctx.closePath();
ctx.fill();
ctx.strokeStyle = stroke;
ctx.lineWidth = strokeWidth;
ctx.stroke();
ctx.restore();
ctx.restore();
}
function drawCircle(ctx) {
ctx.canvas.height = 100;
clearCanvas(ctx);
ctx.save();
//ctx.translate(20,0);
ctx.beginPath();
ctx.arc(50,50,40,0,2*Math.PI);
ctx.fillStyle = fill;
ctx.fill();
ctx.strokeStyle = stroke;
ctx.lineWidth = strokeWidth;
ctx.stroke();
ctx.restore();
ctx.restore();
}
function clearCanvas(ctx) {
var c = $("#badge")[0];
// Store the current transformation matrix
ctx.save();
// Use the identity matrix while clearing the canvas
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, c.width, c.height);
// Restore the transform
ctx.restore();
}

View File

@ -0,0 +1,315 @@
var service_url = "http://www.da-sense.de/productive/analysis.php";
var map;
var latlng;
var radius; // [meters]
var active = true;
var currentAngle;
var resizeMarker;
var marker;
var circle;
var storedBonusAreas = [];
var myOptions;
var storedCircleOptions;
var circleOptions;
/** jQuery on document ready */
function init() {
$('#datepicker').datepicker({
format: 'dd-mm-yyyy',
weekStart: 1
});
$('#timepicker').timepicker();
latlng = new google.maps.LatLng(49.87367, 8.65105);
radius = 500;
// map initialization
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
circleOptions = {
strokeColor: "#61ade7",
strokeOpacity: 0.6,
strokeWeight: 1,
fillColor: "#61ade7",
fillOpacity: 0.45,
map: map,
center: latlng ,
radius: radius,
clickable:false
};
storedCircleOptions = {
strokeColor: "#00ff00",
strokeOpacity: 0.6,
strokeWeight: 1,
fillColor: "#00ff00",
fillOpacity: 0.2,
map: map,
center: latlng ,
radius: radius,
clickable:true
};
myOptions = {
zoom: 15,
maxZoom:18,
minZoom:7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
updateAddress();
updateRadius();
updateExploration();
reload();
// set google maps marker
marker = new google.maps.Marker({
position: latlng,
map: map,
title: 'Center point of bonus area',
icon: new google.maps.MarkerImage("dasense/page/default_developer/img/geo_point.png",new google.maps.Size(16,16),new google.maps.Point(0,0),new google.maps.Point(8,8)),
cursor: "move",
draggable: true
});
google.maps.event.addListener(marker, 'dragstart', function(e) {
currentAngle = GEO_FUNCTIONS.getAngle(e.latLng, resizeMarker.getPosition());
});
google.maps.event.addListener(marker, 'drag', function(e) {
dragCenterPoint(e);
});
google.maps.event.addListener(marker, 'dragend', function(e) {
dragCenterPoint(e);
//fitZoom();
map.setCenter(latlng);
updateAddress();
updateExploration();
});
google.maps.event.addListener(map, 'rightclick', function(e) {
dragCenterPoint(e)
marker.setPosition(latlng);
});
// set google maps overlay: circle with specified radius and 'geopoint-marker' as centerpoint
var resMarkPos = GEO_FUNCTIONS.getDestination(latlng, radius, 0.25*Math.PI);
resizeMarker = new google.maps.Marker({
position: resMarkPos,
map: map,
title: "Radius resizer",
icon: new google.maps.MarkerImage("dasense/page/default_developer/img/geo_resize.png",new google.maps.Size(10,10),new google.maps.Point(0,0),new google.maps.Point(5,5)),
cursor: "move",
draggable: true
});
circle = new google.maps.Circle(circleOptions);
google.maps.event.addListener(resizeMarker, 'dragend', function(e) {
var dist = GEO_FUNCTIONS.getDistance(e.latLng, latlng);
circle.setOptions({radius: dist});
radius = dist;
fitZoom();
updateRadius();
updateExploration();
});
google.maps.event.addListener(resizeMarker, 'drag', function(e) {
var dist = GEO_FUNCTIONS.getDistance(e.latLng, latlng);
radius = dist;
updateRadius();
circle.setOptions({radius: dist});
});
fitZoom();
// send button
/* $('#submit_icon').click(function () {
cleanErrorFields();
// simple validation of input fields
var label = $('#field_label').val();
var multiplier = $('#field_multiplier').val();
var timeSlot = $('#field_timeSlot').val();
var password = $('#field_password').val();
var valid_label = validate(label,true,255,'string');
if(valid_label === false) {
$('#field_error_label').html("Check label field: string (max 255 chars)");
return;
}
var valid_multiplier = validate(multiplier,true,255,'real');
if(valid_multiplier === false){
$('#field_error_multiplier').html("Check multiplier field: double");
return;
}
var valid_timeSlot = validate(timeSlot,true,255,'int');
if(valid_timeSlot === false){
$('#field_error_timeSlot').html("Check time slot field: int [seconds]");
return;
}
var valid_password = validate(password,true,45,'string');
if(valid_password === false){
$('#field_error_password').html("Check password field: string [max 45 chars]");
return;
}
var formatted_address = $('#field_address').html();
$(this).addClass('loader');
marker.setMap(null);
resizeMarker.setMap(null);
circle.setOptions({fillOpacity: 0.3, fillColor: '#ff0000', strokeColor: '#ff0000'});
var json = '{"geo":{"lat":'+latlng.lat()+',"lng":'+latlng.lng()+',"radius":'+radius+',"faddress":"'+encodeURI(JSON.stringify(formatted_address))+'"},"starttime":'+new Date().getTime()+',"slot":'+timeSlot*1000+',"multiplier":'+multiplier+',"label":"'+encodeURI(JSON.stringify(label))+'"}';
// service call
$.post(service_url,
{
ctrl: 'barea',
mthd: 'insert',
pswd: password,
json: json
},
function(data,textStatus,jqXHR) {
$('#submit_icon').removeClass('loader');
// service call response
if(data['result']['status'] != null && data['result']['status'].toLowerCase() == 'ok'){
$('#submit_icon').addClass('clean').html('Bonus area has been pushed to all registered devices.<br>Thank you for using this nice service :-)');
circle.setOptions(storedCircleOptions);
circle.setOptions({radius: radius, center: latlng});
}else if(data['result']['status'] != null){
marker.setMap(map);
resizeMarker.setMap(map);
circle.setOptions(circleOptions);
circle.setOptions({radius: radius, center: latlng});
$('#field_password').val('');
$('#field_error_password').html("Wrong service password");
}
})
.error(function() { alert("An unexpected error occurred, please try again later !"); });
});
// clean all error fields
function cleanErrorFields(){
$('#field_error_label').html("<br>");
$('#field_error_multiplier').html("<br>");
$('#field_error_timeSlot').html("<br>");
$('#field_error_password').html("<br>");
}
// fit button
$('#fit_icon').click(function(){
fitZoom();
});
// get all bonus areas
$('#ref_all').click(function(){
active = false;
$(this).addClass('active');
$('#ref_active').removeClass('active');
reload();
});
// get all active bonus areas
$('#ref_active').click(function(){
active = true;
$(this).addClass('active');
$('#ref_all').removeClass('active');
reload();
});*/
};
function updateAddress(){
$('#field_coords').html("("+latlng.lat() +", " + latlng.lng()+")");
new google.maps.Geocoder().geocode({'latLng': latlng, 'language': 'de_DE'}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
$('#field_address').html(results[0]['formatted_address']);
}
});
}
function updateRadius(){
$('#field_radius').html(radius.toFixed(2)+" m");
}
function updateExploration(){
/*$.getJSON(service_url+'?ctrl=data&mthd=explore&coord='+latlng.lat()+','+latlng.lng()+'&'+'radius='+radius , function(data) {
if(data.result.length > 0){
$("#field_exploration").html(Number((1-Number(data.result[0].explore))* 100).toFixed(2) + " %");
}
});*/
}
function dragCenterPoint(e){
var curPos = e.latLng;
circle.setOptions({center: curPos});
latlng = curPos;
resizeMarker.setPosition(GEO_FUNCTIONS.getDestination(curPos, radius, currentAngle));
$('#field_coords').html("("+latlng.lat() +", " + latlng.lng()+")");
}
function fitZoom(){
map.fitBounds(
new google.maps.LatLngBounds(
GEO_FUNCTIONS.getDestination(latlng, 2.5*radius, 1.25*Math.PI),
GEO_FUNCTIONS.getDestination(latlng, 2.5*radius, 0.25*Math.PI)));
}
// reload markers
function reload(){
clearOverlays();
getStoredBonusAreas();
}
// Removes the overlays from the map, but keeps them in the array
function clearOverlays() {
if (storedBonusAreas) {
for (i in storedBonusAreas) {
storedBonusAreas[i].setMap(null);
}
}
storedBonusAreas = [];
}
function getStoredBonusAreas(){
storedBonusAreas = [];
// service call
/* $.getJSON(service_url,
{
ctrl: 'barea',
mthd: ((active == true)?'getallactive':'getall')
},
function(data,textStatus,jqXHR) {
// >> creat circles + storedCircleOptions + tooltip (!!! replace radius + center !!!)
var i=0;
$.each(data['result'], function(key, value) {
var sCircle = new google.maps.Circle(storedCircleOptions);
sCircle.setOptions({radius: value['radius'], center: new google.maps.LatLng(value['lat'],value['lng'])});
storedBonusAreas[i++] = sCircle;
});
})
.error(function() { alert("An unexpected error occurred, please try again later !"); });*/
}

View File

@ -0,0 +1,37 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
function init(){
// initialize content
loadContent('server_architecture');
/**
* generic navigation control
*/
$('div.main div#div-nav ul.nav li a').click(function () {
var id = $(this).attr("id");
if(id !== undefined){
console.log("Action: "+id);
$('div.main div#div-nav ul.nav li').each(function(){
$(this).removeClass('active');
});
$(this).parent().addClass('active');
loadContent(id);
}
});
}
/**
* Load content
* @param {type} id
* @returns {undefined} */
function loadContent(id){
var splitID = id.split("_");
if(splitID.length > 1){
var folder = splitID[0];
var file = splitID[1] + ".html";
$('div#div-content').load('dasense/page/default_developer/modules/documentation/'+folder+'/'+file);
}
}

View File

@ -0,0 +1,36 @@
/** jQuery on document ready */
$(document).ready(function() {
// initialize content
$('div#content-wrapper').load('./dasense/page/default_developer/carousel.html', function() {
$('.carousel').carousel();
});
/**
* generic navigation control
*/
$('div#developer-navbar ul#developer-nav li a').click(function () {
var id = $(this).attr("id");
if(id !== undefined){
console.log("Module: "+id);
$('div#developer-navbar ul#developer-nav li').each(function(){
$(this).removeClass('active');
});
$(this).parent().addClass('active');
loadModuleContent(id);
}
});
$('.brand').click(function(){
location.reload();
});
});
function loadModuleContent(id){
$('div#content-wrapper').load('./dasense/page/default_developer/modules/'+id+'/main.html', function(){
init();
});
}

View File

@ -0,0 +1,454 @@
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ) {
// Picker object
var Datepicker = function(element, options){
this.element = $(element);
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
this.picker = $(DPGlobal.template)
.appendTo('body')
.on({
click: $.proxy(this.click, this),
mousedown: $.proxy(this.mousedown, this)
});
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
if (this.isInput) {
this.element.on({
focus: $.proxy(this.show, this),
blur: $.proxy(this.hide, this),
keyup: $.proxy(this.update, this)
});
} else {
if (this.component){
this.component.on('click', $.proxy(this.show, this));
} else {
this.element.on('click', $.proxy(this.show, this));
}
}
this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
if (typeof this.minViewMode === 'string') {
switch (this.minViewMode) {
case 'months':
this.minViewMode = 1;
break;
case 'years':
this.minViewMode = 2;
break;
default:
this.minViewMode = 0;
break;
}
}
this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
if (typeof this.viewMode === 'string') {
switch (this.viewMode) {
case 'months':
this.viewMode = 1;
break;
case 'years':
this.viewMode = 2;
break;
default:
this.viewMode = 0;
break;
}
}
this.startViewMode = this.viewMode;
this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
this.fillDow();
this.fillMonths();
this.update();
this.showMode();
};
Datepicker.prototype = {
constructor: Datepicker,
show: function(e) {
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.place();
$(window).on('resize', $.proxy(this.place, this));
if (e ) {
e.stopPropagation();
e.preventDefault();
}
if (!this.isInput) {
$(document).on('mousedown', $.proxy(this.hide, this));
}
this.element.trigger({
type: 'show',
date: this.date
});
},
hide: function(){
this.picker.hide();
$(window).off('resize', this.place);
this.viewMode = this.startViewMode;
this.showMode();
if (!this.isInput) {
$(document).off('mousedown', this.hide);
}
this.set();
this.element.trigger({
type: 'hide',
date: this.date
});
},
set: function() {
var formated = DPGlobal.formatDate(this.date, this.format);
if (!this.isInput) {
if (this.component){
this.element.find('input').prop('value', formated);
}
this.element.data('date', formated);
} else {
this.element.prop('value', formated);
}
},
setValue: function(newDate) {
if (typeof newDate === 'string') {
this.date = DPGlobal.parseDate(newDate, this.format);
} else {
this.date = new Date(newDate);
}
this.set();
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
place: function(){
var offset = this.component ? this.component.offset() : this.element.offset();
this.picker.css({
top: offset.top + this.height,
left: offset.left
});
},
update: function(newDate){
this.date = DPGlobal.parseDate(
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
this.format
);
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
fillDow: function(){
var dowCnt = this.weekStart;
var html = '<tr>';
while (dowCnt < this.weekStart + 7) {
html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '';
var i = 0
while (i < 12) {
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
}
this.picker.find('.datepicker-months td').append(html);
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getFullYear(),
month = d.getMonth(),
currentDate = this.date.valueOf();
this.picker.find('.datepicker-days th:eq(1)')
.text(DPGlobal.dates.months[month]+' '+year);
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
prevMonth.setDate(day);
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setDate(nextMonth.getDate() + 42);
nextMonth = nextMonth.valueOf();
html = [];
var clsName;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getDay() === this.weekStart) {
html.push('<tr>');
}
clsName = '';
if (prevMonth.getMonth() < month) {
clsName += ' old';
} else if (prevMonth.getMonth() > month) {
clsName += ' new';
}
if (prevMonth.valueOf() === currentDate) {
clsName += ' active';
}
html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
if (prevMonth.getDay() === this.weekEnd) {
html.push('</tr>');
}
prevMonth.setDate(prevMonth.getDate()+1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date.getFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear === year) {
months.eq(this.date.getMonth()).addClass('active');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>';
year += 1;
}
yearCont.html(html);
},
click: function(e) {
e.stopPropagation();
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length === 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'switch':
this.showMode(1);
break;
case 'prev':
case 'next':
this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
this.viewDate,
this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
);
this.fill();
this.set();
break;
}
break;
case 'span':
if (target.is('.month')) {
var month = target.parent().find('span').index(target);
this.viewDate.setMonth(month);
} else {
var year = parseInt(target.text(), 10)||0;
this.viewDate.setFullYear(year);
}
if (this.viewMode !== 0) {
this.date = new Date(this.viewDate);
this.element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
this.showMode(-1);
this.fill();
this.set();
break;
case 'td':
if (target.is('.day')){
var day = parseInt(target.text(), 10)||1;
var month = this.viewDate.getMonth();
if (target.is('.old')) {
month -= 1;
} else if (target.is('.new')) {
month += 1;
}
var year = this.viewDate.getFullYear();
this.date = new Date(year, month, day,0,0,0,0);
this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
this.fill();
this.set();
this.element.trigger({
type: 'changeDate',
date: this.date,
viewMode: DPGlobal.modes[this.viewMode].clsName
});
}
break;
}
}
},
mousedown: function(e){
e.stopPropagation();
e.preventDefault();
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
}
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
}
};
$.fn.datepicker = function ( option, val ) {
return this.each(function () {
var $this = $(this),
data = $this.data('datepicker'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
}
if (typeof option === 'string') data[option](val);
});
};
$.fn.datepicker.defaults = {
};
$.fn.datepicker.Constructor = Datepicker;
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
dates:{
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
},
parseFormat: function(format){
var separator = format.match(/[.\/\-\s].*?/),
parts = format.split(/\W+/);
if (!separator || !parts || parts.length === 0){
throw new Error("Invalid date format.");
}
return {separator: separator, parts: parts};
},
parseDate: function(date, format) {
var parts = date.split(format.separator),
date = new Date(),
val;
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
if (parts.length === format.parts.length) {
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
val = parseInt(parts[i], 10)||1;
switch(format.parts[i]) {
case 'dd':
case 'd':
date.setDate(val);
break;
case 'mm':
case 'm':
date.setMonth(val - 1);
break;
case 'yy':
date.setFullYear(2000 + val);
break;
case 'yyyy':
date.setFullYear(val);
break;
}
}
}
return date;
},
formatDate: function(date, format){
var val = {
d: date.getDate(),
m: date.getMonth() + 1,
yy: date.getFullYear().toString().substring(2),
yyyy: date.getFullYear()
};
val.dd = (val.d < 10 ? '0' : '') + val.d;
val.mm = (val.m < 10 ? '0' : '') + val.m;
var date = [];
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
date.push(val[format.parts[i]]);
}
return date.join(format.separator);
},
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev">&lsaquo;</th>'+
'<th colspan="5" class="switch"></th>'+
'<th class="next">&rsaquo;</th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
};
DPGlobal.template = '<div class="datepicker dropdown-menu">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'</div>';
}( window.jQuery )

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,70 @@
/**
* Geographical help functions
*
* @author chris
*/
function GEO_FUNCTIONS(){
}
/* earth radius */
GEO_FUNCTIONS.R = 6371*1000; //[m]
/* transformation factor between deg and meters */
GEO_FUNCTIONS.DEG2MET = Math.PI / 180;
/**
* Calculate the distance between to LatLng-Points
* >> Haversine formula
*
* @param p1 [google.maps.latLng]
* @param p2 [google.maps.latLng]
*
* @returns Distance [m]
*/
GEO_FUNCTIONS.getDistance = function(p1,p2){
var dLat = (p2.lat()-p1.lat()) * GEO_FUNCTIONS.DEG2MET;
var dLon = (p2.lng()-p1.lng()) * GEO_FUNCTIONS.DEG2MET;
var lat1 = p1.lat() * GEO_FUNCTIONS.DEG2MET;
var lat2 = p2.lat() * GEO_FUNCTIONS.DEG2MET;
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
return GEO_FUNCTIONS.R * c; // in meters
};
/**
* Get the destination point from starting point with distance (in meters) and angle (in radians, clockwise from north);
*
* @param start [google.maps.latLng]
* @param dist - distance [m]
* @param angle - clockwise from north [rad]
*
* @returns destination point [google.maps.latLng]
*/
GEO_FUNCTIONS.getDestination = function(start,dist,angle){
var lat1 = start.lat() * GEO_FUNCTIONS.DEG2MET;
var lon1 = start.lng() * GEO_FUNCTIONS.DEG2MET;
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(dist/GEO_FUNCTIONS.R) + Math.cos(lat1)*Math.sin(dist/GEO_FUNCTIONS.R)*Math.cos(angle) );
var lon2 = lon1 + Math.atan2(Math.sin(angle)*Math.sin(dist/GEO_FUNCTIONS.R)*Math.cos(lat1), Math.cos(dist/GEO_FUNCTIONS.R)-Math.sin(lat1)*Math.sin(lat2));
return new google.maps.LatLng(lat2/GEO_FUNCTIONS.DEG2MET,lon2/GEO_FUNCTIONS.DEG2MET); // google maps geopoint [google.maps.latLng]
};
/**
* Get the angle between line of two points and the line to north (clockwise)
*
* @param p1 [google.maps.latLng]
* @param p2 [google.maps.latLng]
*
* @returns angle - clockwise from north [rad]
*/
GEO_FUNCTIONS.getAngle = function(p1,p2){
var dLat = (p2.lat()-p1.lat()) * GEO_FUNCTIONS.DEG2MET;
var dLon = (p2.lng()-p1.lng()) * GEO_FUNCTIONS.DEG2MET;
var lat1 = p1.lat() * GEO_FUNCTIONS.DEG2MET;
var lat2 = p2.lat() * GEO_FUNCTIONS.DEG2MET;
var y = Math.sin(dLon) * Math.cos(lat2);
var x = Math.cos(lat1 )* Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
return Math.atan2(y, x); // in radian
};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,729 @@
/*
* jQuery MiniColors: A tiny color picker built on jQuery
*
* Copyright Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
*
* Dual-licensed under the MIT and GPL Version 2 licenses
*
*/
if(jQuery) (function($) {
// The minicolors object (public methods and settings)
$.minicolors = {
// Default settings
settings: {
defaultSlider: 'hue',
letterCase: 'lowercase',
hideSpeed: 100,
showSpeed: 100,
animationSpeed: 100,
animationEasing: 'swing'
},
// Initialized all controls of type=minicolors
init: function() {
$('INPUT[type=minicolors]').each( function() {
init( $(this) );
});
},
// Remove the specified control from the DOM
remove: function(input) {
$(input).each( function() {
remove($(this));
});
},
// Refresh the controls
refresh: function() {
$('INPUT[type=minicolors]').each( function() {
refresh($(this));
});
},
// Shows the specified control
show: function(input) {
show( $(input).eq(0) );
},
// Hides all controls
hide: function() {
hide();
},
// Utility to convert a hex string to RGB(A) object
rgbObject: function(input) {
var hex = parseHex($(input).val(), true),
rgb = hex2rgb(hex),
opacity = input.attr('data-opacity');
if( !rgb ) return null;
if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
return rgb;
},
// Utility to convert a hex string to an RGB(A) string
rgbString: function(input) {
var hex = parseHex($(input).val(), true),
rgb = hex2rgb(hex),
opacity = input.attr('data-opacity');
if( !rgb ) return null;
if( opacity === undefined ) {
return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
} else {
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
}
}
};
// Initialize all input[type=minicolors] elements
function init(input) {
var minicolors = $('<span class="minicolors" />'),
sliderType = input.attr('data-slider') || $.minicolors.settings.defaultSlider;
if( input.data('initialized') ) return;
// The wrapper
minicolors
.attr('class', input.attr('data-class'))
.attr('style', input.attr('data-style'))
.toggleClass('minicolors-swatch-left', input.attr('data-swatch-position') === 'left' )
.toggleClass('minicolors-with-opacity', input.attr('data-opacity') !== undefined );
// Custom positioning
if( input.attr('data-position') !== undefined ) {
$.each(input.attr('data-position').split(' '), function() {
minicolors.addClass('minicolors-position-' + this);
});
}
// The input
input
.data('initialized', true)
.attr('data-default', input.attr('data-default') || '')
.attr('data-slider', sliderType)
.prop('size', 7)
.prop('maxlength', 7)
.wrap(minicolors)
.after(
'<span class="minicolors-panel minicolors-slider-' + sliderType + '">' +
'<span class="minicolors-slider">' +
'<span class="minicolors-picker"></span>' +
'</span>' +
'<span class="minicolors-opacity-slider">' +
'<span class="minicolors-picker"></span>' +
'</span>' +
'<span class="minicolors-grid">' +
'<span class="minicolors-grid-inner"></span>' +
'<span class="minicolors-picker"><span></span></span>' +
'</span>' +
'</span>'
);
// Prevent text selection in IE
input.parent().find('.minicolors-panel').on('selectstart', function() { return false; }).end();
// Detect swatch position
if( input.attr('data-swatch-position') === 'left' ) {
// Left
input.before('<span class="minicolors-swatch"><span></span></span>');
} else {
// Right
input.after('<span class="minicolors-swatch"><span></span></span>');
}
// Disable textfield
if( input.attr('data-textfield') === 'false' ) input.addClass('minicolors-hidden');
// Inline controls
if( input.attr('data-control') === 'inline' ) input.parent().addClass('minicolors-inline');
updateFromInput(input);
}
// Refresh the specified control
function refresh(input) {
updateFromInput(input);
}
// Removes the specified control
function remove(input) {
var minicolors = input.parent();
if( input.data('initialized') && minicolors.hasClass('minicolors') ) {
minicolors.remove();
}
}
// Shows the specified dropdown panel
function show(input) {
var minicolors = input.parent(),
panel = minicolors.find('.minicolors-panel');
// Do nothing if uninitialized, disabled, or already open
if( !input.data('initialized') || input.prop('disabled') || minicolors.hasClass('minicolors-focus') ) return;
hide();
minicolors.addClass('minicolors-focus');
panel
.stop(true, true)
.fadeIn($.minicolors.settings.showSpeed, function() {
input.trigger('show', input);
});
}
// Hides all dropdown panels
function hide() {
$('.minicolors:not(.minicolors-inline)').each( function() {
var minicolors = $(this),
input = minicolors.find('INPUT');
minicolors.find('.minicolors-panel').fadeOut($.minicolors.settings.hideSpeed, function() {
if(minicolors.hasClass('minicolors-focus')) {
input.trigger('hide', input);
}
minicolors.removeClass('minicolors-focus');
});
});
}
// Moves the selected picker
function move(target, event, animate) {
var input = target.parents('.minicolors').find('INPUT'),
picker = target.find('[class$=-picker]'),
offsetX = target.offset().left,
offsetY = target.offset().top,
x = Math.round(event.pageX - offsetX),
y = Math.round(event.pageY - offsetY),
duration = animate ? $.minicolors.settings.animationSpeed : 0,
wx, wy, r, phi;
// Touch support
if( event.originalEvent.changedTouches ) {
x = event.originalEvent.changedTouches[0].pageX - offsetX;
y = event.originalEvent.changedTouches[0].pageY - offsetY;
}
// Constrain picker to its container
if( x < 0 ) x = 0;
if( y < 0 ) y = 0;
if( x > target.width() ) x = target.width();
if( y > target.height() ) y = target.height();
// Constrain color wheel values to the wheel
if( target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid') ) {
wx = 75 - x;
wy = 75 - y;
r = Math.sqrt(wx * wx + wy * wy);
phi = Math.atan2(wy, wx);
if( phi < 0 ) phi += Math.PI * 2;
if( r > 75 ) {
r = 75;
x = 75 - (75 * Math.cos(phi));
y = 75 - (75 * Math.sin(phi));
}
x = Math.round(x);
y = Math.round(y);
}
// Move the picker
if( target.is('.minicolors-grid') ) {
picker
.stop(true)
.animate({
top: y + 'px',
left: x + 'px'
}, duration, $.minicolors.settings.animationEasing, function() {
updateFromControl(input);
});
} else {
picker
.stop(true)
.animate({
top: y + 'px'
}, duration, $.minicolors.settings.animationEasing, function() {
updateFromControl(input);
});
}
}
// Sets the input based on the color picker values
function updateFromControl(input) {
function getCoords(picker, container) {
var left, top;
if( !picker.length || !container ) return null;
left = picker.offset().left;
top = picker.offset().top;
return {
x: left - container.offset().left + (picker.outerWidth() / 2),
y: top - container.offset().top + (picker.outerHeight() / 2)
};
}
var hue, saturation, brightness, opacity, rgb, hex, x, y, r, phi,
// Helpful references
minicolors = input.parent(),
panel = minicolors.find('.minicolors-panel'),
swatch = minicolors.find('.minicolors-swatch'),
hasOpacity = input.attr('data-opacity') !== undefined,
sliderType = input.attr('data-slider'),
// Panel objects
grid = minicolors.find('.minicolors-grid'),
slider = minicolors.find('.minicolors-slider'),
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
// Picker objects
gridPicker = grid.find('[class$=-picker]'),
sliderPicker = slider.find('[class$=-picker]'),
opacityPicker = opacitySlider.find('[class$=-picker]'),
// Picker positions
gridPos = getCoords(gridPicker, grid),
sliderPos = getCoords(sliderPicker, slider),
opacityPos = getCoords(opacityPicker, opacitySlider);
// Determine HSB values
switch(sliderType) {
case 'wheel':
// Calculate hue, saturation, and brightness
x = (grid.width() / 2) - gridPos.x;
y = (grid.height() / 2) - gridPos.y;
r = Math.sqrt(x * x + y * y);
phi = Math.atan2(y, x);
if( phi < 0 ) phi += Math.PI * 2;
if( r > 75 ) {
r = 75;
gridPos.x = 69 - (75 * Math.cos(phi));
gridPos.y = 69 - (75 * Math.sin(phi));
}
saturation = keepWithin(r / 0.75, 0, 100);
hue = keepWithin(phi * 180 / Math.PI, 0, 360);
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
hex = hsb2hex({
h: hue,
s: saturation,
b: brightness
});
// Update UI
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
break;
case 'saturation':
// Calculate hue, saturation, and brightness
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width())), 0, 360);
saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
hex = hsb2hex({
h: hue,
s: saturation,
b: brightness
});
// Update UI
slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
break;
case 'brightness':
// Calculate hue, saturation, and brightness
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width())), 0, 360);
saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
hex = hsb2hex({
h: hue,
s: saturation,
b: brightness
});
// Update UI
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
break;
default:
// Calculate hue, saturation, and brightness
hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height())), 0, 360);
saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
hex = hsb2hex({
h: hue,
s: saturation,
b: brightness
});
// Update UI
grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
break;
}
// Determine opacity
if( hasOpacity ) {
opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
} else {
opacity = 1;
}
// Update input control
input.val(hex);
if( hasOpacity ) input.attr('data-opacity', opacity);
// Set swatch color
swatch.find('SPAN').css({
backgroundColor: hex,
opacity: opacity
});
// Fire change event
if( hex + opacity !== input.data('last-change') ) {
input
.data('last-change', hex + opacity)
.trigger('change', input);
}
}
// Sets the color picker values from the input
function updateFromInput(input, preserveInputValue) {
var hex,
hsb,
opacity,
x, y, r, phi,
// Helpful references
minicolors = input.parent(),
swatch = minicolors.find('.minicolors-swatch'),
hasOpacity = input.attr('data-opacity') !== undefined,
sliderType = input.attr('data-slider'),
// Panel objects
grid = minicolors.find('.minicolors-grid'),
slider = minicolors.find('.minicolors-slider'),
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
// Picker objects
gridPicker = grid.find('[class$=-picker]'),
sliderPicker = slider.find('[class$=-picker]'),
opacityPicker = opacitySlider.find('[class$=-picker]');
// Determine hex/HSB values
hex = convertCase(parseHex(input.val(), true));
if( !hex ) hex = convertCase(parseHex(input.attr('data-default'), true));
hsb = hex2hsb(hex);
// Update input value
if( !preserveInputValue ) input.val(hex);
// Determine opacity value
if( hasOpacity ) {
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
input.attr('data-opacity', opacity);
swatch.find('SPAN').css('opacity', opacity);
// Set opacity picker position
y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
opacityPicker.css('top', y + 'px');
}
// Update swatch
swatch.find('SPAN').css('backgroundColor', hex);
// Determine picker locations
switch(sliderType) {
case 'wheel':
// Set grid position
r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
phi = hsb.h * Math.PI / 180;
x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
gridPicker.css({
top: y + 'px',
left: x + 'px'
});
// Set slider position
y = 150 - (hsb.b / (100 / grid.height()));
if( hex === '' ) y = 0;
sliderPicker.css('top', y + 'px');
// Update panel color
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
break;
case 'saturation':
// Set grid position
x = keepWithin((5 * hsb.h) / 12, 0, 150);
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
gridPicker.css({
top: y + 'px',
left: x + 'px'
});
// Set slider position
y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
sliderPicker.css('top', y + 'px');
// Update UI
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
break;
case 'brightness':
// Set grid position
x = keepWithin((5 * hsb.h) / 12, 0, 150);
y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
gridPicker.css({
top: y + 'px',
left: x + 'px'
});
// Set slider position
y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
sliderPicker.css('top', y + 'px');
// Update UI
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
break;
default:
// Set grid position
x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
gridPicker.css({
top: y + 'px',
left: x + 'px'
});
// Set slider position
y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
sliderPicker.css('top', y + 'px');
// Update panel color
grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
break;
}
}
// Converts to the letter case specified in $.minicolors.settings.letterCase
function convertCase(string) {
return $.minicolors.settings.letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
}
// Parses a string and returns a valid hex string when possible
function parseHex(string, expand) {
string = string.replace(/[^A-F0-9]/ig, '');
if( string.length !== 3 && string.length !== 6 ) return '';
if( string.length === 3 && expand ) {
string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
}
return '#' + string;
}
// Keeps value within min and max
function keepWithin(value, min, max) {
if( value < min ) value = min;
if( value > max ) value = max;
return value;
}
// Converts an HSB object to an RGB object
function hsb2rgb(hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s * 255 / 100);
var v = Math.round(hsb.b * 255 / 100);
if(s === 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255 - s) * v / 255;
var t3 = (t1 - t2) * (h % 60) / 60;
if( h === 360 ) h = 0;
if( h < 60 ) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
else if( h < 120 ) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
else if( h < 180 ) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
else if( h < 240 ) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
else if( h < 300 ) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
else if( h < 360 ) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
}
return {
r: Math.round(rgb.r),
g: Math.round(rgb.g),
b: Math.round(rgb.b)
};
}
// Converts an RGB object to a hex string
function rgb2hex(rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function(nr, val) {
if (val.length === 1) hex[nr] = '0' + val;
});
return '#' + hex.join('');
}
// Converts an HSB object to a hex string
function hsb2hex(hsb) {
return rgb2hex(hsb2rgb(hsb));
}
// Converts a hex string to an HSB object
function hex2hsb(hex) {
var hsb = rgb2hsb(hex2rgb(hex));
if( hsb.s === 0 ) hsb.h = 360;
return hsb;
}
// Converts an RGB object to an HSB object
function rgb2hsb(rgb) {
var hsb = { h: 0, s: 0, b: 0 };
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
hsb.s = max !== 0 ? 255 * delta / max : 0;
if( hsb.s !== 0 ) {
if( rgb.r === max ) {
hsb.h = (rgb.g - rgb.b) / delta;
} else if( rgb.g === max ) {
hsb.h = 2 + (rgb.b - rgb.r) / delta;
} else {
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
} else {
hsb.h = -1;
}
hsb.h *= 60;
if( hsb.h < 0 ) {
hsb.h += 360;
}
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
}
// Converts a hex string to an RGB object
function hex2rgb(hex) {
hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {
r: hex >> 16,
g: (hex & 0x00FF00) >> 8,
b: (hex & 0x0000FF)
};
}
// A bit of magic...
$(window).on('load', function() {
// Auto-initialize
$.minicolors.init();
$(document)
// Hide on clicks outside of the control
.on('mousedown touchstart', function(event) {
if( !$(event.target).parents().add(event.target).hasClass('minicolors') ) {
hide();
}
})
// Start moving
.on('mousedown touchstart', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
var target = $(this);
event.preventDefault();
$(document).data('minicolors-target', target);
move(target, event, true);
})
// Move pickers
.on('mousemove touchmove', function(event) {
var target = $(document).data('minicolors-target');
if( target ) move(target, event);
})
// Stop moving
.on('mouseup touchend', function() {
$(this).removeData('minicolors-target');
})
// Toggle panel when swatch is clicked
.on('mousedown touchstart', '.minicolors-swatch', function(event) {
var input = $(this).parent().find('INPUT'),
minicolors = input.parent();
if( minicolors.hasClass('minicolors-focus') ) {
hide(input);
} else {
show(input);
}
})
// Show on focus
.on('focus', 'INPUT[type=minicolors]', function(event) {
var input = $(this);
if( !input.data('initialized') ) return;
show(input);
})
// Fix hex and hide on blur
.on('blur', 'INPUT[type=minicolors]', function(event) {
var input = $(this);
if( !input.data('initialized') ) return;
input.val( convertCase(parseHex(input.val() !== '' ? input.val() : convertCase(parseHex(input.attr('data-default'), true)), true)) );
hide(input);
})
// Handle keypresses
.on('keydown', 'INPUT[type=minicolors]', function(event) {
var input = $(this);
if( !input.data('initialized') ) return;
switch(event.keyCode) {
case 9: // tab
hide();
break;
case 27: // esc
hide();
input.blur();
break;
}
})
// Update on keyup
.on('keyup', 'INPUT[type=minicolors]', function(event) {
var input = $(this);
if( !input.data('initialized') ) return;
updateFromInput(input, true);
})
// Update on paste
.on('paste', 'INPUT[type=minicolors]', function(event) {
var input = $(this);
if( !input.data('initialized') ) return;
setTimeout( function() {
updateFromInput(input, true);
}, 1);
});
});
})(jQuery);

View File

@ -0,0 +1,209 @@
!function ($) {
"use strict";
$.fn['switch'] = function (method) {
var methods = {
init:function () {
this.each(function () {
var $element = $(this)
, $div
, $switchLeft
, $switchRight
, $label
, myClasses = ""
, classes = $element.attr('class')
, color
, moving
, onLabel = "ON"
, offLabel = "OFF";
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
if (classes.indexOf(el) >= 0)
myClasses = el;
});
if ($element.data('on') !== undefined)
color = "switch-" + $element.data('on');
if ($element.data('on-label') !== undefined)
onLabel = $element.data('on-label');
if ($element.data('off-label') !== undefined)
offLabel = $element.data('off-label');
$switchLeft = $('<span>')
.addClass("switch-left")
.addClass(myClasses)
.addClass(color)
.html(onLabel);
if ($element.data('off') !== undefined)
color = "switch-" + $element.data('off');
$switchRight = $('<span>')
.addClass("switch-right")
.addClass(myClasses)
.addClass(color)
.html(offLabel);
$label = $('<label>')
.html("&nbsp;")
.addClass(myClasses)
.attr('for', $element.find('input').attr('id'));
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
if ($element.data('animated') !== false)
$div.addClass('switch-animate').data('animated', true);
$div.append($switchLeft);
$div.append($label);
$div.append($switchRight);
$element.find('>div').addClass(
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
);
if ($element.find('input').is(':disabled'))
$(this).addClass('deactivate');
var changeStatus = function ($this) {
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
};
$switchLeft.on('click', function (e) {
changeStatus($(this));
});
$switchRight.on('click', function (e) {
changeStatus($(this));
});
$element.find('input').on('change', function (e) {
var $element = $(this).parent();
e.preventDefault();
e.stopImmediatePropagation();
$element.css('left', '');
if ($(this).is(':checked'))
$element.removeClass('switch-off').addClass('switch-on');
else $element.removeClass('switch-on').addClass('switch-off');
if ($element.data('animated') !== false)
$element.addClass("switch-animate");
$element.parent().trigger('switch-change', {'el':$(this), 'value':$(this).is(':checked')})
});
$element.find('label').on('mousedown touchstart', function (e) {
var $this = $(this);
moving = false;
e.preventDefault();
e.stopImmediatePropagation();
$this.closest('div').removeClass('switch-animate');
if ($this.closest('.switch').is('.deactivate'))
$this.unbind('click');
else {
$this.on('mousemove touchmove', function (e) {
var $element = $(this).closest('.switch')
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
, percent = (relativeX / $element.width()) * 100
, left = 25
, right = 75;
moving = true;
if (percent < left)
percent = left;
else if (percent > right)
percent = right;
$element.find('>div').css('left', (percent - right) + "%")
});
$this.on('click touchend', function (e) {
var $this = $(this)
, $target = $(e.target)
, $myCheckBox = $target.siblings('input');
e.stopImmediatePropagation();
e.preventDefault();
$this.unbind('mouseleave');
if (moving)
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
moving = false;
$myCheckBox.trigger('change');
});
$this.on('mouseleave', function (e) {
var $this = $(this)
, $myCheckBox = $this.siblings('input');
e.preventDefault();
e.stopImmediatePropagation();
$this.unbind('mouseleave');
$this.trigger('mouseup');
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
});
$this.on('mouseup', function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$(this).unbind('mousemove');
});
}
});
}
);
},
toggleActivation:function () {
$(this).toggleClass('deactivate');
},
toggleState:function (skipOnChange) {
var $input = $(this).find('input:checkbox');
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
},
setState:function (value, skipOnChange) {
$(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
},
status:function () {
return $(this).find('input:checkbox').is(':checked');
},
destroy:function () {
var $div = $(this).find('div')
, $checkbox;
$div.find(':not(input:checkbox)').remove();
$checkbox = $div.children();
$checkbox.unwrap().unwrap();
$checkbox.unbind('change');
return $checkbox;
}
};
if (methods[method])
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
else if (typeof method === 'object' || !method)
return methods.init.apply(this, arguments);
else
$.error('Method ' + method + ' does not exist!');
};
}(jQuery);
$(function () {
$('.switch')['switch']();
});

View File

@ -0,0 +1,8 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
function init(){
}

View File

@ -0,0 +1,35 @@
/** jQuery on document ready */
function init(){
selectUsers();
$('#select-to').change(function(e){
$('#select-to option:selected').each(function(){
switch($(this).val()){
case 'users': selectUsers(); break;
case 'os': selectOS(); break;
default: selectAll(); break;
}
});
});
};
function selectUsers(){
$('#element-os').hide();
$('#element-users').show();
// @todo: create table dynamically
}
function selectOS(){
$('#element-os').show();
$('#element-users').hide();
}
function selectAll(){
$('#element-os').hide();
$('#element-users').hide();
}

View File

@ -0,0 +1,32 @@
/** jQuery on document ready */
function init(){
// initialize content
loadContent('import');
/**
* generic navigation control
*/
$('div.main div.tabbable ul.nav li a').click(function () {
var id = $(this).parent().attr("id");
if(id !== undefined){
console.log("Action: "+id);
$('div.main div.tabbable ul.nav li').each(function(){
$(this).removeClass('active');
});
$(this).parent().addClass('active');
loadContent(id);
}
});
};
/**
* Load content
* @param {type} id
* @returns {undefined} */
function loadContent(id){
$('div.tab-content').load('dasense/page/default_developer/modules/texthandler/'+id+'.html');
}

View File

@ -0,0 +1,65 @@
<div class="span8">
<legend>Account: Login</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Account: Push Message</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Account: Registration</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Data: Upload</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Data: Series</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Incentive systems: Achievements</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

View File

@ -0,0 +1,64 @@
<div class="span8">
<legend>Incentive systems: Badges</legend>
ahfgjasdgh sdgs igh sdghso dghjsghjs ghoishg oij
shguioh sowigh sioghsiogh sdghisd ghsg sdbfhgsjdfhgaiosöhfgaOGasdg
asdgoshgdhsdghsudfzhgiedjhioerergr
herheioghweoirgöioeroihgeoi
<p>
<br>
<pre>?ctrl=account&mthd=login</pre>
<br>
</p>
<p><h5>Required parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>username</td>
<td>string</td>
<td>Username</td>
</tr>
<tr>
<td>password</td>
<td>SHA1(string)</td>
<td>SHA1 encoded password</td>
</tr>
<tr>
<td>pswdold</td>
<td>MD5(string)</td>
<td>(Deprecated)<br>
MD5 encoded password</td>
</tr>
</tbody>
</table>
<p><h5>Optional parameters</h5></p>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>locale</td>
<td>string</td>
<td>Update user's default locale.<br>
Available locales: [de,en]
</td>
</tr>
</tbody>
</table>
</div>
<div class="span4">
<legend>Example</legend>
</div>

Some files were not shown because too many files have changed in this diff Show More