mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-10 22:16:26 +02:00
Initial commit
This commit is contained in:
parent
b686656e88
commit
5e91fe947d
177 changed files with 41037 additions and 0 deletions
184
copri4/main/src/scripts/tests/index.pl
Executable file
184
copri4/main/src/scripts/tests/index.pl
Executable file
|
@ -0,0 +1,184 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
use lib "/var/www/copri4/shareeweb-project/src";
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use CGI ':standard';
|
||||
use CGI::Carp qw(fatalsToBrowser);
|
||||
use CGI::Cookie ();
|
||||
use DBI;
|
||||
use Lib::Config;
|
||||
use Mod::DBtank;
|
||||
|
||||
my $q = new CGI();
|
||||
$q->import_names('R');
|
||||
my $cf = new Config;
|
||||
my $dbt = new DBtank;
|
||||
my %varenv = $cf->envonline();
|
||||
|
||||
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
||||
|
||||
if($q->param('sessionid') && $q->param('sessionid') ne $q->cookie('domcookie')){
|
||||
$coo = $q->param('sessionid');
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"utf-8", -cookie=>$cookie);
|
||||
}else{
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"utf-8", -cookie=>$cookie);
|
||||
}
|
||||
|
||||
die "no configuration available" if(!$varenv{wwwhost});
|
||||
my $lang = "de";
|
||||
my $dyn_js = "
|
||||
function onLoad() {
|
||||
console.log('hallo');
|
||||
|
||||
if ('geolocation' in navigator) {
|
||||
console.log('geon');
|
||||
/* geolocation funktioniert */
|
||||
} else {
|
||||
console.log('geoff');
|
||||
/* geolocation funktioniert NICHT */
|
||||
}
|
||||
\$( '#no_javascript' ).hide();
|
||||
}
|
||||
\n";
|
||||
|
||||
my $dyn_css = "";
|
||||
my $local_style = "$varenv{metahost}/$dbt->{shareeapp_conf}->{local_style}";
|
||||
my $jquery = "$varenv{metahost}/$dbt->{shareeapp_conf}->{jquery}";
|
||||
my $js_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{js_bootstrap}";
|
||||
my $style_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{style_bootstrap}";
|
||||
if($varenv{wwwhost} =~ /shareedms/){
|
||||
$local_style = "$varenv{metahost}/$dbt->{shareedms_conf}->{local_style}";
|
||||
$jquery = "$varenv{metahost}/$dbt->{shareedms_conf}->{jquery}";
|
||||
$js_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{js_bootstrap}";
|
||||
$style_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{style_bootstrap}";
|
||||
}
|
||||
|
||||
|
||||
my $html5 = $q->start_html(
|
||||
-title => "shareetest",
|
||||
-lang => '',
|
||||
-onload => "onLoad();",
|
||||
-encoding => "utf-8",
|
||||
-base => 'true',
|
||||
-head => Link(
|
||||
{
|
||||
-rel => 'shortcut icon',
|
||||
-type => 'image/x-icon',
|
||||
-href => "/css/favicon.ico"
|
||||
}
|
||||
),
|
||||
-meta => {
|
||||
'viewport'=>"width=device-width,initial-scale=1,user-scalable=yes",
|
||||
'author' => "rainer guempelein",
|
||||
'publisher' => "",
|
||||
'copyright' => "",
|
||||
},
|
||||
-script=>[
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$jquery"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_ui}"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_resize}"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jsscript}"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-src=>"$varenv{metahost}/js/shareespecial.js"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-code=>"$dyn_js"}
|
||||
],
|
||||
-STYLE=>{
|
||||
-code=>"$dyn_css",
|
||||
-src=>[
|
||||
"$local_style",
|
||||
"$style_bootstrap",
|
||||
"$varenv{metahost}/$dbt->{copri_conf}->{style_bootstrap_icons}",
|
||||
"$varenv{metahost}/$dbt->{copri_conf}->{style_jquery_ui}"
|
||||
],
|
||||
-verbatim=>"\@import url(\"$local_style\");",
|
||||
-media=>'screen'
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
$html5 =~ s{<!DOCTYPE.*?>}{<!DOCTYPE html>}s;
|
||||
$html5 =~ s{<html.*?>}{<html lang='de'>}s;
|
||||
print $html5;
|
||||
|
||||
##
|
||||
my $uri = "$dbt->{primary}->{sharee_primary}->{primaryApp}/APIjsonserver";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-href=>"/src/scripts/tests/index.pl"},"[ index ]")),"\n";
|
||||
|
||||
print $q->div({-style=>'margin:15px;'}," "),"\n";
|
||||
print $q->div({-style=>'margin:15px;'},"-------------- $uri --------------------"),"\n";
|
||||
my $authorization = "$uri?request=authorization&user_id=ragu\@gnu-systems.de&user_pw=mabel321&merchant_id=oiF2kahH&hw_id=g89g8o7goguzuzug";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$authorization"},"[ authorization ]---> $authorization")),"\n";
|
||||
|
||||
my $authout = "$uri?request=authout&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$authout"},"[ authout ]---> $authout")),"\n";
|
||||
|
||||
my $bikes_all = "$uri?request=bikes_all&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bikes_all"},"[ bikes_all ]---> $bikes_all")),"\n";
|
||||
|
||||
my $bikes_available = "$uri?request=bikes_available&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bikes_available"},"[ bikes_available ]---> $bikes_available")),"\n";
|
||||
|
||||
my $stations_all = "$uri?request=stations_all&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$stations_all"},"[ stations_all ]---> $stations_all")),"\n";
|
||||
|
||||
my $stations_available = "$uri?request=stations_available&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$stations_available"},"[ stations_available ]---> $stations_available")),"\n";
|
||||
|
||||
my $user_bikes_occupied = "$uri?request=user_bikes_occupied&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_bikes_occupied"},"[ user_bikes_occupied ]---> $user_bikes_occupied")),"\n";
|
||||
|
||||
my $user_rentals_history = "$uri?request=user_rentals_history&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_rentals_history"},"[ user_rentals_history ]---> $user_rentals_history")),"\n";
|
||||
|
||||
|
||||
my $user_minianswer = "$uri?request=user_minianswer&q1=opt5&q2=opt4&q3=iuwehfiolbev&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_minianswer"},"[ user_minianswer ]---> $user_minianswer")),"\n";
|
||||
|
||||
|
||||
###
|
||||
print $q->div({-style=>'margin:15px;'}," "),"\n";
|
||||
my $uriop = "$dbt->{operator}->{sharee_operator}->{operatorApp}/APIjsonserver";
|
||||
print $q->div({-style=>'margin:15px;'},"-------------- $uriop --------------------"),"\n";
|
||||
my $booking_request = "$uriop?request=booking_request&bike=FR1003&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request"},"[ booking_request ]---> $booking_request")),"\n";
|
||||
|
||||
my $booking_update_cancel = "$uriop?request=booking_update&bike=FR1003&state=canceled&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_cancel"},"[ booking_update_cancel ]---> $booking_update_cancel")),"\n";
|
||||
|
||||
my $booking_update_locking = "$uriop?request=booking_update&bike=FR1003&lock_state=locking&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locking"},"[ booking_update_locking ]---> $booking_update_locking")),"\n";
|
||||
my $booking_update_locked = "$uriop?request=booking_update&bike=FR1003&lock_state=locked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locked"},"[ booking_update_locked ]---> $booking_update_locked")),"\n";
|
||||
my $booking_update_unlocked = "$uriop?request=booking_update&bike=FR1003&lock_state=unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocked"},"[ booking_update_unlocked ]---> $booking_update_unlocked")),"\n";
|
||||
|
||||
my $booking_update_oc_ul = "$uriop?request=booking_update&bike=FR1003&state=occupied&lock_state=unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_oc_ul"},"[ booking_update_oc_ul ]---> $booking_update_oc_ul")),"\n";
|
||||
|
||||
my $booking_request_oc_ul = "$uriop?request=booking_request&bike=FR1003&state=occupied&lock_state=unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_ul"},"[ booking_request_oc_ul ]---> $booking_request_oc_ul")),"\n";
|
||||
|
||||
my $booking_update_av_lo = "$uriop?request=booking_update&bike=FR1003&state=available&lock_state=locked&latitude=47.927738&longitude=7.973855&gps_age=300&user_device_manufaturer=samsung)&user_device_model=SM-G398FN&user_device_platform=Android&user_device_version=10&user_device_id=90af86831c10374d&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_av_lo"},"[ booking_update_av_lo ]---> $booking_update_av_lo")),"\n";
|
||||
|
||||
my $user_feedback = "$uriop?request=user_feedback&bike=FR1003&bike_broken=1&message=testnachricht äöü&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_feedback"},"[ user_feedback ]---> $user_feedback")),"\n";
|
||||
|
||||
print "<div style='text-align:center;'>";
|
||||
print "<iframe width='750' height='500' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://www.openstreetmap.org/export/embed.html?bbox=7.604942321777345%2C47.923934784536236%2C7.979164123535157%2C48.07005002188767&layer=mapnik' style='border: 1px solid black'></iframe><br/><small><a href='https://www.openstreetmap.org/#map=12/47.9970/7.7921'>Größere Karte anzeigen</a></small>\n";
|
||||
print "</div>\n";
|
||||
|
||||
print $q->end_html;
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue