Skip to content

Commit

Permalink
Using .htaccess for creating map portal
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Dubrovsky committed Aug 12, 2012
1 parent aa6045f commit fe44033
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 55 deletions.
2 changes: 1 addition & 1 deletion lib/php/LGInstall.php
Expand Up @@ -150,7 +150,7 @@ function installMySQL() {
}
} while ($con->next_result());

echo(mysqli_error($con));
//echo(mysqli_error($con));

//exit("kuk");
mydb_query('insert user set privilege=6,mail="' . $GLOBALS["LGSettings"]->mail . '",password="' . $GLOBALS["LGSettings"]->mail . '",title="' . $GLOBALS["LGSettings"]->mail . '";');
Expand Down
33 changes: 15 additions & 18 deletions lib/php/LGPlanManager.php
Expand Up @@ -49,8 +49,8 @@ function addPlan($array) {

$layerManager = new LGLayerManager($this->user);
$layerManager->addLayerFolderBasic($planId);
$pg = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $GLOBALS["LGSettings"]->postgis_template . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");

$pg = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $GLOBALS["LGSettings"]->postgis_template . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");

if (!$pg) {

Expand All @@ -61,10 +61,8 @@ function addPlan($array) {

pg_query($pg, $sql);

// $sql = "GRANT ALL ON DATABASE ligeo_" . $planName . " TO GROUP ligeo_user;";

// pg_query($pg, $sql);

// $sql = "GRANT ALL ON DATABASE ligeo_" . $planName . " TO GROUP ligeo_user;";
// pg_query($pg, $sql);
//GRANT ALL ON DATABASE ligeo_r TO GROUP ligeo_user;
// close connection
pg_close($pg);
Expand All @@ -73,20 +71,19 @@ function addPlan($array) {
$this->geoserverAPI->api->createWorkspace($gsName);
$this->geoserverAPI->api->createDatastore($gsName, $gsName);


$cd = getcwd();
chdir(dirname(__FILE__));

if (is_dir("../../module/viewer")) {
mkdir('../../module/viewer/' . $planName);
copy('../../data/plan.template.html', '../../module/viewer/' . $planName . '/index.html');
if ($_FILES["fileSplashscreen"]["tmp_name"])
$this->uploadSplashscreen($_FILES["fileSplashscreen"], $planName);
}

/*
$cd = getcwd();
chdir(dirname(__FILE__));
chdir($cd);
if (is_dir("../../module/viewer")) {
mkdir('../../module/viewer/' . $planName);
copy('../../data/plan.template.html', '../../module/viewer/' . $planName . '/index.html');
if ($_FILES["fileSplashscreen"]["tmp_name"])
$this->uploadSplashscreen($_FILES["fileSplashscreen"], $planName);
}
chdir($cd);
*/


return $planId;
Expand Down
18 changes: 0 additions & 18 deletions lib/php/dump.sql
Expand Up @@ -9,7 +9,6 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- Table structure for table `contact`
--

DROP TABLE IF EXISTS `contact`;
CREATE TABLE IF NOT EXISTS `contact` (
`contactId` int(8) NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL,
Expand All @@ -33,7 +32,6 @@ CREATE TABLE IF NOT EXISTS `contact` (
-- Table structure for table `form`
--

DROP TABLE IF EXISTS `form`;
CREATE TABLE IF NOT EXISTS `form` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`txt` varchar(200) COLLATE utf8_czech_ci NOT NULL,
Expand All @@ -54,7 +52,6 @@ CREATE TABLE IF NOT EXISTS `form` (
-- Table structure for table `formData`
--

DROP TABLE IF EXISTS `formData`;
CREATE TABLE IF NOT EXISTS `formData` (
`formId` int(8) NOT NULL,
`userId` int(8) NOT NULL,
Expand All @@ -74,7 +71,6 @@ CREATE TABLE IF NOT EXISTS `formData` (
-- Table structure for table `formElement`
--

DROP TABLE IF EXISTS `formElement`;
CREATE TABLE IF NOT EXISTS `formElement` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`name` varchar(30) COLLATE utf8_czech_ci NOT NULL,
Expand All @@ -96,7 +92,6 @@ CREATE TABLE IF NOT EXISTS `formElement` (
-- Table structure for table `formItem`
--

DROP TABLE IF EXISTS `formItem`;
CREATE TABLE IF NOT EXISTS `formItem` (
`title` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
Expand All @@ -122,7 +117,6 @@ CREATE TABLE IF NOT EXISTS `formItem` (
-- Table structure for table `layer`
--

DROP TABLE IF EXISTS `layer`;
CREATE TABLE IF NOT EXISTS `layer` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`url` varchar(100) COLLATE utf8_czech_ci NOT NULL,
Expand Down Expand Up @@ -174,7 +168,6 @@ INSERT INTO `layer` (`title`, `url`, `namespace`, `name`, `format`, `opacity`, `
-- Table structure for table `layerCol`
--

DROP TABLE IF EXISTS `layerCol`;
CREATE TABLE IF NOT EXISTS `layerCol` (
`name` varchar(30) NOT NULL,
`type` varchar(20) NOT NULL,
Expand All @@ -198,7 +191,6 @@ CREATE TABLE IF NOT EXISTS `layerCol` (
-- Table structure for table `layerFolder`
--

DROP TABLE IF EXISTS `layerFolder`;
CREATE TABLE IF NOT EXISTS `layerFolder` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`txt` varchar(200) COLLATE utf8_czech_ci NOT NULL,
Expand All @@ -221,7 +213,6 @@ INSERT INTO `layerFolder` (`title`, `txt`, `planId`, `layerFolderId`, `basic`) V
-- Table structure for table `layerStyle`
--

DROP TABLE IF EXISTS `layerStyle`;
CREATE TABLE IF NOT EXISTS `layerStyle` (
`title` varchar(30) NOT NULL,
`layerStyleId` int(8) NOT NULL AUTO_INCREMENT,
Expand All @@ -246,7 +237,6 @@ CREATE TABLE IF NOT EXISTS `layerStyle` (
-- Table structure for table `layerWPS`
--

DROP TABLE IF EXISTS `layerWPS`;
CREATE TABLE IF NOT EXISTS `layerWPS` (
`layerId` int(9) unsigned NOT NULL,
`content` text NOT NULL
Expand All @@ -263,7 +253,6 @@ CREATE TABLE IF NOT EXISTS `layerWPS` (
-- Table structure for table `log_login`
--

DROP TABLE IF EXISTS `log_login`;
CREATE TABLE IF NOT EXISTS `log_login` (
`userId` int(8) unsigned NOT NULL,
`mail` varchar(50) NOT NULL,
Expand All @@ -285,7 +274,6 @@ CREATE TABLE IF NOT EXISTS `log_login` (
-- Table structure for table `mobil_stat`
--

DROP TABLE IF EXISTS `mobil_stat`;
CREATE TABLE IF NOT EXISTS `mobil_stat` (
`user` varchar(50) NOT NULL COMMENT 'unikátní identifikátor uživatele',
`sys` varchar(20) NOT NULL COMMENT 'mobilní systém na uživ. zařízení',
Expand All @@ -304,7 +292,6 @@ CREATE TABLE IF NOT EXISTS `mobil_stat` (
-- Table structure for table `modul`
--

DROP TABLE IF EXISTS `modul`;
CREATE TABLE IF NOT EXISTS `modul` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`url` varchar(100) COLLATE utf8_czech_ci NOT NULL,
Expand All @@ -323,7 +310,6 @@ CREATE TABLE IF NOT EXISTS `modul` (
-- Table structure for table `modulinplan`
--

DROP TABLE IF EXISTS `modulinplan`;
CREATE TABLE IF NOT EXISTS `modulinplan` (
`modulId` int(8) unsigned NOT NULL,
`planId` int(8) unsigned NOT NULL,
Expand All @@ -341,7 +327,6 @@ CREATE TABLE IF NOT EXISTS `modulinplan` (
-- Table structure for table `plan`
--

DROP TABLE IF EXISTS `plan`;
CREATE TABLE IF NOT EXISTS `plan` (
`name` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`txt` varchar(200) COLLATE utf8_czech_ci NOT NULL,
Expand Down Expand Up @@ -369,7 +354,6 @@ INSERT INTO `plan` (`name`, `txt`, `ico`, `planId`, `title`, `mapCenterLat`, `ma
-- Table structure for table `privilege`
--

DROP TABLE IF EXISTS `privilege`;
CREATE TABLE IF NOT EXISTS `privilege` (
`userId` int(8) unsigned NOT NULL,
`planId` int(8) unsigned NOT NULL,
Expand All @@ -392,7 +376,6 @@ INSERT INTO `privilege` (`userId`, `planId`, `privilege`, `dateFrom`, `dateTo`)
-- Table structure for table `user`
--

DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`title` varchar(30) COLLATE utf8_czech_ci NOT NULL,
`mail` varchar(50) COLLATE utf8_czech_ci NOT NULL,
Expand All @@ -419,7 +402,6 @@ CREATE TABLE IF NOT EXISTS `user` (
-- Table structure for table `userreset`
--

DROP TABLE IF EXISTS `userreset`;
CREATE TABLE IF NOT EXISTS `userreset` (
`key` varchar(50) COLLATE utf8_czech_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand Down
3 changes: 3 additions & 0 deletions module/viewer/.htaccess
@@ -0,0 +1,3 @@
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^([a-zA-Z0-9_-]+)/$ ./?plan=$1 [NC]
78 changes: 78 additions & 0 deletions module/viewer/index.php
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Mapito</title>

<script src="../lib/js/openlayers/OpenLayers.js"></script>

<?php
$modules = split(",", file_get_contents("settings/mapito_viewer_modules"));
foreach ($modules as $module) {
?>
<script src="../lib/js/ligeo<?php echo($module);?>.js" ></script>
<?php
}
?>

<script src="../lib/js/ligeobaselayers.js" ></script>

<script type="text/javascript" src="../lib/js/jquery.js"></script>
<script type="text/javascript" src="../lib/js/jtree/_lib/jquery.hotkeys.js"></script>
<script type="text/javascript" src="../lib/js/jtree/jquery.jstree.js"></script>
<link type="text/css" rel="stylesheet" href="../lib/js/jtree/_docs/syntax/!style.css"/>
<link type="text/css" rel="stylesheet" href="../lib/js/jtree/_docs/!style.css"/>
<script type="text/javascript" src="../lib/js/jtree/_docs/syntax/!script.js"></script>

<!--script src="../lib/js/prettyPhoto/jquery-1.6.1.min.js" type="text/javascript"></script-->
<!--script src="../lib/js/prettyPhoto/jquery.lint.js" type="text/javascript" charset="utf-8"></script-->
<link rel="stylesheet" href="../lib/css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<script src="../lib/js/prettyPhoto/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>

<script src="../lib/js/proj4js-compressed.js"></script>

<script src="../lib/js/ligeo.js"></script>

<script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>



<link rel="stylesheet" href="../lib/css/style.css" type="text/css" />

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24999566-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</head>


<body onload="ligeoInit('<?php echo($_GET["plan"]); ?>');">
<table id="menu">
<tr>
<td colspan="2" id="toolbar">
<div id="panel" class="olControlPanel"></div>
</td>
</tr>
<tr>
<td id="tabMenuContent">
</td>

<td id="menuList" class="menuItem">

</td>
</tr>
</table>

<div id="map" class="olMap">
</div>
</body>
</html>
30 changes: 29 additions & 1 deletion module/viewer/lib/css/style.css
Expand Up @@ -693,4 +693,32 @@ td#tabMenuContent{
}


a { color:white; }
a { color:white; }






.tabMenuContent table{
width: 95%;
}
.tabMenuContent table, .tabMenuContent table td, .tabMenuContent table th {
border:1px solid #ddd;
background-color: darkBlue;
border-collapse:collapse;
margin:0;
padding:0;
padding:.2em .1em; }
.tabMenuContent th {
padding:.2em .2em;
font-weight:bold;
}
.tabMenuContent td{}
.tabMenuContent tr.odd td{}
.tabMenuContent caption{
text-align:left;
font-size:100%;
font-weight:bold;
text-transform:uppercase;
padding:.2em .2em; }
23 changes: 8 additions & 15 deletions module/viewer/lib/js/ligeo.js
Expand Up @@ -24,18 +24,19 @@ var adminURL;//ziskane z settings.php,



function ligeoInit(){
ligeo = new LiGeo();
function ligeoInit(plan){
ligeo = new LiGeo(plan);


}

function LiGeo(){
function LiGeo(page){
this.modulesTxt=new Array();
this.userHash="";
this.userName = "";

this.page= location.pathname.slice(location.pathname.lastIndexOf("/",location.pathname.lastIndexOf("/")-1)+1,location.pathname.lastIndexOf("/"));
// this.page= location.pathname.slice(location.pathname.lastIndexOf("/",location.pathname.lastIndexOf("/")-1)+1,location.pathname.lastIndexOf("/"));
this.page = page;
this.namespace = "ligeo_"+this.page;
this.baselayerNames = [];
var that = this;
Expand Down Expand Up @@ -152,17 +153,7 @@ function LiGeo(){
//this.modulesTxt = new Array("layers","info","legend","print","measurement","editor","biotopy","login");

this.ligeoMap = new LiGeoMap(this);


/**
*load base layers
*/

this.baselayers = new LiGeobaseLayers(this,this.baselayerNames);
/**
* end load base layers
*/



/**
*definice funkci
Expand Down Expand Up @@ -206,6 +197,8 @@ function LiGeo(){
htmlLi += '<li id="tabMenu'+this.modulesTxt[i]+'" onclick="ligeo.activate(\''+this.modulesTxt[i]+'\',false);" class="'+(i==0 ? 'active' : '')+'">'+this.modules[this.modulesTxt[i]].title()+'</li>';
}

this.baselayers = new LiGeobaseLayers(this,this.baselayerNames);

document.getElementById("menuList").innerHTML = '<ul>'+htmlLi+'</ul>';
htmlLi = "";

Expand Down
2 changes: 2 additions & 0 deletions module/viewer/lib/js/ligeoabout.js
Expand Up @@ -2,6 +2,8 @@
function LiGeoabout(ligeo){
this.name = "about";

$("#tabMenuContent").append('<div class="tabMenuContent" id="tabMenuContentabout"></div>');

document.getElementById("tabMenuContentabout").innerHTML = ligeo.txt;

this.title = function(){
Expand Down
2 changes: 0 additions & 2 deletions module/viewer/lib/js/ligeobaselayers.js
Expand Up @@ -2,8 +2,6 @@ var bLgsat, bLgclasic, bLblank, bLwhite

function LiGeobaseLayers(ligeo,baseLayersNames){



bLgsat = new OpenLayers.Layer.Google(
"Google Satellite",
{
Expand Down

0 comments on commit fe44033

Please sign in to comment.