Commit 89344a9b authored by tombombadilom's avatar tombombadilom

added libs

parent 74b48a7f
......@@ -1638,6 +1638,10 @@ _mods/features/kamap/kamap/xhr.js -text
_mods/features/kamap/lib/map/maplib.php -text
_mods/features/kamap/templates/map/tiki-kamap.tpl -text
_mods/features/kamap/tiki-kamap.php -text
_mods/features/mapeditor/README -text
_mods/features/mapeditor/db/local2.php -text
_mods/features/mapeditor/lib/map/editorlib.php -text
_mods/features/mapeditor/lib/tree/layer_list_tree.php -text
_mods/features/mapeditor/templates/tiki-mapeditor_edit.tpl -text
_mods/features/mapeditor/templates/tiki-mapeditor_edit_layer.tpl -text
_mods/features/mapeditor/templates/tiki-mapeditor_edit_layergroup.tpl -text
......@@ -1646,6 +1650,7 @@ _mods/features/mapeditor/templates/tiki-mapeditor_layers.tpl -text
_mods/features/mapeditor/templates/tiki-mapeditor_maps.tpl -text
_mods/features/mapeditor/tiki-mapeditor_edit.php -text
_mods/features/mapeditor/tiki-mapeditor_edit_layer.php -text
_mods/features/mapeditor/tiki-mapeditor_edit_layergroup.php -text
_mods/features/mapeditor/tiki-mapeditor_layers.php -text
_mods/features/mapeditor/tiki-mapeditor_maps.php -text
_mods/features/phpcas/COPYRIGHT -text
......
! Readme
!! History
This mods has been written to achieve a successfull and easy way to manage collaborativly a community through a full featured SIG .
As mapserver use a mapfile to draw the map, I have added 2 tables into tikiwiki (mysql5) for easy maps and layers management
Each project map managed by those 2 tables will store points , lines and polygons in a postgres 8.1 database
At creation , each postgres mapproject database is full postgis enabled and formated for points, lines and polygon storage .
!! Prerequisite
!!! Prerequisite Tikiwiki
* Apache 1.3.x or 2.x
* Php5 or Php4
* Mysql 4.x ou 5.x
!!! Prerequisite Cartoweb || kamap || tikiwikimap
* Apache 1.3.x or 2.x
* Php 5
* Postgresql 8.1.x
* Postgis
* Mapserver
*php5mapscript
!! Install
!!! Fast mapserver install on debian sarge [http://www.cartoweb.org/doc/cw3.2/xhtml/appendix.debian_mapserver.html|debian mapserver install ]
**** Script Sh [http://84.207.3.217/ds-mapserver-postgis.script2 |ds-mapserver-postgis.script2 ]
**** Script Sh [http://84.207.3.217/ds-tw-cartoweb.script|ds-tw-cartoweb.script]
!!! Cartoweb install [http://www.cartoweb.org/doc/cw3.2/xhtml/user.install.html|Cartoweb installation ]
!!! Tikiwiki Install
Install Tikiwiki root inside the cartoweb htdocs directory
{CODE()}
alibalo# tree -L 1 cartoweb3
cartoweb3
...
|-- htdocs/tiki-install.php
...
{CODE}
!! Howto
* Add a map project [tiki-edit_map.php]
** Fields to fill in tiki-edit_map form
*** Nom: -> name of the mapfile
*** Type: -> Type of map rendering (tikimap|cartoweb)
*** Path -> Path where is stored the mapfile
*** Project Name -> name of the project and the directory where will be placed the mapfiles for cartoweb
*** Base de données -> Name of the postgres db
*** Categorize -> name of the categories
*** Gateway -> name of a wiki page that will display by default the default template
*** Copyright -> Copyright or Copyleft type of the map
*** Description ->short description of the mapfile
* List maps [tiki-list_maps.php]
* Add a layer to map project
[tiki-edit_layer.php?mapId=1]
**Fields
***Nom: -> Name of the layer
***Type: -> type of layer_items (Line|Points|Polygon)
***Parent LayerGroup Name of the Parent layer
***Base de données -> Postgres database
***Project Name -> name of the project and the directory where will be placed the mapfiles for cartoweb
***Table:-> name of the table in the postgresql db where are stored layer_item
***Catégorize -> categorize layer
***Gateway -> name of a wiki page that will display by default the default template
***Copyright Copyright or Copyleft type of the map
***CLASS: CLASS of the mapfile , automaticly created at first creation
***Description:-> short description of the layer
* List layers of a mapproject [tiki-list_layers.php?mapId=1]
!!! Set permissions
[http://dev.sigfreed.net/tiki-index.php?page=user+permissions|user permissions]
!Map permissions:
* [tiki-objectpermissions.php?objectName=World&objectType=maps&permType=maps&objectId=1|Assign permission to map]
-> tiki_p_map_view Can view mapfiles basic maps
-> tiki_p_map_edit Can edit mapfiles editors maps
-> tiki_p_map_delete Can delete mapfiles admin maps
-> tiki_p_map_create Can create new mapfile admin maps
-> tiki_p_map_view_mapfiles Can view contents of mapfiles registered maps
!New layer permissions:
* [tiki-objectpermissions.php?objectName=World&objectType=layers&permType=layers&objectId=76|Assign permission to layer]
-> tiki_p_layer_view Can view layer basic layers
-> tiki_p_layer_edit Can edit layer editors layers
-> tiki_p_layer_delete Can delete layer admin layers
-> tiki_p_layer_create Can create new layer admin layers
!New item_layer permissions:
-> tiki_p_item_layer_view Can view item_layer basic layers
-> tiki_p_item_layer_edit Can edit item_layer editors layers
-> tiki_p_item_layer_delete Can delete item_layer admin layers
-> tiki_p_item_layer_create Can create new item_layer admin layers
!!! Phplayers and crossbrowser.com incompatibilities
às the x lib is used by cartoweb there is a big probleme between tabpanel coexistency for those 2 libs
!! Todo's
!!! Automatique Map and layer generation
at this point of the developpement , the cartoweb mods tikiwiki backoffice is functionnal but still need to be coded the layer.ini and .map generation using datas stored in tw db
!!! Dynamic postgres db and tables creation
i put the sql scripts for db creation and layer type add
!! Mods Package
{CODE()}
alibalo# tree
.
|-- README
|-- db
| `-- local2.php
|-- lib
| |-- map
| | |-- CVS
| | | |-- Entries
| | | |-- Repository
| | | `-- Root
| | `-- editorlib.php
| |-- mapeditor
| `-- tree
| `-- layer_list_tree.php
|-- templates
| |-- tiki-mapeditor_edit.tpl
| |-- tiki-mapeditor_edit_layer.tpl
| |-- tiki-mapeditor_edit_layergroup.tpl
| |-- tiki-mapeditor_layer.tpl
| |-- tiki-mapeditor_layers.tpl
| `-- tiki-mapeditor_maps.tpl
|-- tiki-mapeditor_edit.php
|-- tiki-mapeditor_edit_layer.php
|-- tiki-mapeditor_edit_layergroup.php
|-- tiki-mapeditor_layers.php
`-- tiki-mapeditor_maps.php
{CODE}
[mods/Packages/features-cartoweb.info.txt|features-cartoweb.info.txt]
[cartoweb.tar.gz]
This diff is collapsed.
<?php
require_once ('lib/tree/tree.php');
/**
* \brief Class to render layer list browse tree
*/
class layerTreeMaker extends TreeMaker {
/// Collect javascript cookie set code (internaly used after make_tree() method)
var $jsscriptblock;
/// Generated ID (private usage only)
var $itemID;
/// Constructor
function CatLayerTreeMaker($prefix) {
$this->TreeMaker($prefix);
$this->jsscriptblock = '';
}
/// Generate HTML code for tree. Need to redefine to add javascript cookies block
function make_tree($rootid, $ar) {
global $debugger;
$r = $this->make_tree_r($rootid, $ar);
// $debugger->var_dump('$r');
// return tree with java script block that opens the nodes as remembered in cookies
return $r . "<script language='Javascript' type='text/javascript'> " . $this->jsscriptblock . " </script>\n";
}
//
// Change default (no code 'cept user data) generation behaviour
//
// Need to generate:
//
// [node start = <div class="treenode"><table><tr>]
// [flipper] user data [edit][del]
// [node data end = </div>]
// [node child start = <div class="tree">]
// [childs code]
// [node child end = </div>]
//
// Unsymmetrical calls is not important :)
//
function node_start_code($nodeinfo) {
return '<div class="treenode"><table width=100%><tr>';
}
//
function node_flipper_code($nodeinfo) {
$this->itemID = $this->prefix . 'id' . $nodeinfo["id"];
$this->jsscriptblock .= "setFlipWithSign('" . $this->itemID . "'); ";
return '<td align="left" width="20"><a class="catname" title="' . tra(
'child categories'). ': ' . $nodeinfo["layergroup"] . ', ' . tra('layers in category'). ': ' . $nodeinfo["layers"] . '" id="flipper' . $this->itemID . '" href="javascript:flipWithSign(\'' . $this->itemID . '\')">[+]</a></td>';
}
//
function node_data_start_code($nodeinfo) {
return '<td align="left">';
}
//
function node_data_end_code($nodeinfo) {
return '</td><td width=20% align="right">' .$nodeinfo["perm"] ."&nbsp;".$nodeinfo["edit"] ."&nbsp;". $nodeinfo["remove"] . '</td></tr></table></div>';
}
//
function node_child_start_code($nodeinfo) {
return '<div class="tree" id="' . $this->itemID . '" style=" text-align: left; display: none;">';
}
//
function node_child_end_code($nodeinfo) {
return '</div>';
}
//
function node_end_code($nodeinfo) {
return '';
}
}
?>
<?php
// Initialization
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php'); # httpScheme()
include_once ('lib/map/editorlib.php');
if (!isset($layerlib)) {
$layerlib = new LayerLib($dbTiki,$dbTiki2);
}
// CHECK FEATURE MAPS AND ADMIN PERMISSION HERE
if ($feature_maps != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_layers");
$smarty->display("error.tpl");
die;
}
if ($tiki_p_map_edit != 'y') {
$smarty->assign('msg', tra("You do not have permissions to edit layers"));
$smarty->display("error.tpl");
die;
}
if (isset($_REQUEST["cat_restrict_child"])) {
$cat_restrict_child = $_REQUEST["cat_restrict_child"];
} else {
$cat_restrict_child = 0;
}
if (isset($_REQUEST["layerId"])) {
$cat_objid = $_REQUEST["layerId"];
$layerId=$_REQUEST["layerId"];
} else {
$cat_objid ="";
}
if (isset($_REQUEST["description"])) {
$cat_desc = $_REQUEST["description"];
} else {
$cat_desc ="";
}
if (isset($_REQUEST["cat_type"])) {
$cat_type = $_REQUEST["cat_type"];
} else {
$cat_type ="layer";
}
$smarty->assign('individual', 'n');
include_once ('lib/categories/categlib.php');
//if(isset($_REQUEST["layerId"])) {
// $categories=$categlib->get_object_categories('layer', $layerId);
// if($categories) {
// $gateways=$categlib->list_category_objects($categories[0],0,$maxRecords,'','wiki page');
// $smarty->assign('gateways', $gateways['data']);
// }
//}
if (isset($_REQUEST["layerId"]) && $_REQUEST["layerId"] > 0) {
$info = $layerlib->get_layergroup($_REQUEST["layerId"]);
$mapinfo = $layerlib->get_map($info["mapId"]);
//$map_categories=$categlib->get_object_categories('map', $info["mapId"]);
$cat_restrict_child=$map_categories[0];
$smarty->assign('cat_restrict_child',$cat_restrict_child);
$layerId=$_REQUEST["layerId"];
if (!$info) {
$smarty->assign('msg', tra("Map not found"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('individual', 'n');
if ($userlib->object_has_one_permission($layerId, 'layer')) {
$smarty->assign('individual', 'y');
if ($tiki_p_admin != 'y') {
// Now get all the permissions that are set for this type of permissions 'image gallery'
$perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'layer');
foreach ($perms["data"] as $perm) {
$permName = $perm["permName"];
if ($userlib->object_has_permission($user, $layerId, 'layer', $permName)) {
$$permName = 'y';
$smarty->assign("$permName", 'y');
} else {
$$permName = 'n';
$smarty->assign("$permName", 'n');
}
}
} else {
$gateway='';
}
}
// Check user is admin or the name
if (($user != $info["author"]) && ($tiki_p_map_edit != 'y')) {
$smarty->assign('msg', tra("You do not have permission to edit this layer"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('layerId', $info["layerId"]);
$smarty->assign('mapId', $info["mapId"]);
$smarty->assign('name', $info["name"]);
$smarty->assign('projectName', $mapinfo["projectName"]);
$smarty->assign('layerGroupId', $info["layerGroupId"]);
$smarty->assign('islayerGroup', $info["islayerGroup"]);
$smarty->assign('layerAggregate', $info["layerAggregate"]);
$smarty->assign('author', $info["author"]);
$smarty->assign('type', $info["type"]);
$parentgroup=$layerlib->list_layerGroups($info["mapId"], -1);
$smarty->assign('copyright', $info["copyright"]);
$smarty->assign('parentgroup', $parentgroup["data"]);
$smarty->assign("copyrightUrl", $info["copyrightUrl"]);
$smarty->assign("gateway", $info["gateway"]);
$smarty->assign("layerRendering", $info["layerRendering"]);
$smarty->assign("description", $info["description"]);
} else {
$smarty->assign('name', '');
$smarty->assign('mapId', $_REQUEST["mapId"]);
$map=$layerlib->get_map($_REQUEST["mapId"]);
$parentgroup=$layerlib->list_layerGroups($_REQUEST["mapId"], -1);
$smarty->assign('layerId', '');
$smarty->assign('projectName', $map["projectName"]);
$smarty->assign('author', $user);
$smarty->assign('islayerGroup', 1);
$smarty->assign('layerRendering', '');
$smarty->assign('layerAggregate', 0);
$smarty->assign('parentgroup', $parentgroup["data"]);
$smarty->assign('parent', '');
$smarty->assign('type', 'POINT');
$smarty->assign('gateway', '');
$smarty->assign('description', '');
}
include_once("categorize_list.php");
// Now assign if the set button was pressed
if (isset($_REQUEST["save"])) {
check_ticket('edit-layergroup');
if ($_REQUEST["name"]=='' || $_REQUEST["islayerGroup"] == '' || $_REQUEST["projectName"] == '' || $_REQUEST["layerAggregate"] == '' || $_REQUEST["layerGroupId"] == ''){
$smarty->assign('msg', tra("Please fill Name, Layer options, ProjectName, Parent Layer fields from the form"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('name', $_REQUEST["name"]);
$smarty->assign('layerId', $_REQUEST["layerId"]);
//prepare data array for database
$data=array();
$data["name"]=$_REQUEST["name"];
$data["islayerGroup"]=$_REQUEST["islayerGroup"];
$data["layerGroupId"]=$_REQUEST["layerGroupId"];
$data["author"]=$_REQUEST["author"];
$data["layerRendering"]=$_REQUEST["layerRendering"];
$data["copyright"]=$_REQUEST["copyright"];
$data["copyrightUrl"]="tiki-index.php?page=".$_REQUEST["copyright"];
$data["layerAggregate"]=$_REQUEST["layerAggregate"];
$data["mapId"]=$_REQUEST["mapId"];
$data["description"]=$_REQUEST["description"];
if ($layerId) {
$data["layerId"]=$_REQUEST["layerId"];
if(isset($_REQUEST["gateway"])) {
$data["gateway"]=$_REQUEST["gateway"];
} else {
$data["gateway"]='';
}
$layerlib->replace_layergroup($layerId,$data);
} else {
$data["gateway"]='';
$layerId=$layerlib->add_layergroup($data);
}
$cat_type = 'layer';
$cat_objid = $layerId;
$cat_desc = substr($_REQUEST["description"], 0, 200);
$cat_name = $_REQUEST["name"];
$cat_href = "tiki-mapeditor_layers.php?layerId=" . $cat_objid;
include_once ("categorize.php");
header ("location: tiki-mapeditor_layers.php?layerId=$layerId");
die;
}
$names = $userlib->get_users(0, -1, 'login_desc', '');
$smarty->assign_by_ref('names', $names["data"]);
ask_ticket('edit-layer');
// Display the template
$smarty->assign('mid', 'tiki-mapeditor_edit_layergroup.tpl');
$smarty->display("tiki.tpl");
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment