Commit 65575555 authored by tombombadilom's avatar tombombadilom

alpha package

parent 000cbb7f
......@@ -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/tiki-mapeditor_edit.php -text
_mods/features/mapeditor/tiki-mapeditor_edit_layer.php -text
_mods/features/mapeditor/tiki-mapeditor_layers.php -text
_mods/features/mapeditor/tiki-mapeditor_maps.php -text
_mods/features/phpcas/COPYRIGHT -text
_mods/features/phpcas/README -text
_mods/features/phpcas/source/CAS/CAS.php -text
......
<?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_maps");
$smarty->display("error.tpl");
die;
}
if ($tiki_p_map_edit != 'y') {
$smarty->assign('msg', tra("You do not have permissions to edit maps"));
$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["mapId"])) {
$mapId=$_REQUEST["mapId"];
$cat_objid = $_REQUEST["mapId"];
} else {
$mapId='';
$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 ="map";
}
$smarty->assign('individual', 'n');
//include_once ('lib/categories/categlib.php');
//$categories=$categlib->get_object_categories('map', $mapId);
//if($categories) {
//$gateways=$categlib->list_category_objects($categories[0],0,$maxRecords,'','wiki page');
//$smarty->assign('gateways', $gateways['data']);
//}
if ($userlib->object_has_one_permission($mapId, 'map')) {
$smarty->assign('individual', 'y');
if ($tiki_p_admin != 'y') {
// Now get all the permissions that are set for this type of permissions 'map'
$perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'map');
foreach ($perms["data"] as $perm) {
$permName = $perm["permName"];
if ($userlib->object_has_permission($user, $mapId, 'map', $permName)) {
$$permName = 'y';
$smarty->assign("$permName", 'y');
} else {
$$permName = 'n';
$smarty->assign("$permName", 'n');
}
}
}
}
if (isset($_REQUEST["mapId"]) && $_REQUEST["mapId"] > 0) {
$info = $layerlib->get_map($_REQUEST["mapId"]);
$mapId=$info["mapId"];
if (!$info) {
$smarty->assign('msg', tra("Map not found"));
$smarty->display("error.tpl");
die;
}
// 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 map"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('mapId', $mapId);
$smarty->assign('name', $info["name"]);
$smarty->assign('projectName', $info["projectName"]);
$smarty->assign('db', $info["db"]);
$smarty->assign('author', $info["author"]);
$smarty->assign('type', $info["type"]);
$smarty->assign('path', $info["path"]);
$smarty->assign('copyright', $info["copyright"]);
$smarty->assign('copyrightUrl', $info["copyrightUrl"]);
$smarty->assign('gateway', $info["gateway"]);
$smarty->assign('description', $info["description"]);
$smarty->assign('cat_type', $cat_type);
$smarty->assign('cat_objid', $cat_objid);
} else {
$smarty->assign('name', '');
$smarty->assign('mapId', '');
$smarty->assign('projectName', $_ENV['CW3_PROJECT']);
$smarty->assign('db', '');
$smarty->assign('author', $user);
$smarty->assign('type', 'cartoweb');
$smarty->assign('path', '');
$smarty->assign('description', '');
$smarty->assign('cat_type', '');
$smarty->assign('cat_objid', '');
}
include_once("categorize_list.php");
// Now assign if the set button was pressed
if (isset($_REQUEST["save"])) {
check_ticket('edit-map');
$mapId=$_REQUEST["mapId"];
$smarty->assign('name', $_REQUEST["name"]);
$smarty->assign('path', $_REQUEST["path"]);
$smarty->assign('type', $_REQUEST["type"]);
$smarty->assign('projectName', $_REQUEST["projectName"]);
$smarty->assign('db', $_REQUEST["db"]);
$smarty->assign('mapId', $_REQUEST["mapId"]);
$smarty->assign('gateway', $_REQUEST["gateway"]);
$smarty->assign('description', $_REQUEST["description"]);
// check post data
if ($_REQUEST["name"]=='' || $_REQUEST["path"] == '' || $_REQUEST["projectName"] == '' || $_REQUEST["db"] == '' ){
$smarty->assign('msg', tra("Please fill Name, Path, ProjectName, Database fields from the form"));
$smarty->display("error.tpl");
die;
}
//prepare data array for database
$data=array();
$data["name"]=$_REQUEST["name"];
$data["projectName"]=$_REQUEST["projectName"];
$data["author"]=$_REQUEST["author"];
$data["type"]=$_REQUEST["type"];
$data["path"]=$_REQUEST["path"];
$data["copyright"]=$_REQUEST["copyright"];
$data["copyrightUrl"]="tiki-index.php?page=".$_REQUEST["copyright"];
$data["db"]=$_REQUEST["db"];
$data["description"]=$_REQUEST["description"];
if ($mapId) {
$data["mapId"]=$_REQUEST["mapId"];
$data["gateway"]=$_REQUEST["gateway"];
$layerlib->replace_map($mapId,$data);
} else {
$data["gateway"]='';
$mapId=$layerlib->add_map($data);
}
$cat_type = 'map';
$cat_objid = $mapId;
$cat_desc = substr($_REQUEST["description"], 0, 200);
$cat_name = $_REQUEST["name"];
$cat_href = "tiki-list_maps.php?mapId=" . $cat_objid;
include_once ("categorize.php");
header ("location: tiki-mapeditor_maps.php?mapId=$mapId");
die;
}
$names = $userlib->get_users(0, -1, 'login_desc', '');
$smarty->assign_by_ref('names', $names["data"]);
ask_ticket('edit-map');
// Display the template
$smarty->assign('mid', 'tiki-mapeditor_edit.tpl');
$smarty->display("tiki.tpl");
?>
<?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_layer($_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('layerGroupId', $info["layerGroupId"]);
$smarty->assign('projectName', $mapinfo["projectName"]);
$smarty->assign('db', $info["db"]);
$smarty->assign('table', $info["table"]);
$parentgroup=$layerlib->list_layerGroups($info["mapId"], -1);
$smarty->assign('parentgroup', $parentgroup["data"]);
$smarty->assign('author', $info["author"]);
$smarty->assign('type', $info["type"]);
$smarty->assign('copyright', $info["copyright"]);
$smarty->assign("copyrightUrl", $info["copyrightUrl"]);
$smarty->assign("gateway", $info["gateway"]);
$smarty->assign("config", $info["config"]);
$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('parentgroup', $parentgroup["data"]);
$smarty->assign('layerGroupId', 0);
$smarty->assign('layerId', '');
$smarty->assign('projectName', $map["projectName"]);
$smarty->assign('db', $map["db"]);
$smarty->assign('author', $user);
$smarty->assign('type', 'POINT');
$smarty->assign('gateway', '');
$smarty->assign('table', '');
$smarty->assign('description', '');
}
include_once("categorize_list.php");
// Now assign if the set button was pressed
if (isset($_REQUEST["save"])) {
check_ticket('edit-layer');
if ($_REQUEST["name"]=='' || $_REQUEST["table"] == '' || $_REQUEST["projectName"] == '' || $_REQUEST["db"] == '' ){
$smarty->assign('msg', tra("Please fill Name, Table, ProjectName, Database 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["table"]=$_REQUEST["table"];
$data["layerGroupId"]=$_REQUEST["layerGroupId"];
$data["author"]=$_REQUEST["author"];
$data["type"]=$_REQUEST["type"];
$data["copyright"]=$_REQUEST["copyright"];
$data["copyrightUrl"]="tiki-index.php?page=".$_REQUEST["copyright"];
$data["db"]=$_REQUEST["db"];
$data["mapId"]=$_REQUEST["mapId"];
$data["description"]=$_REQUEST["description"];
if ($layerId) {
$data["config"]=$_REQUEST["config"];
$data["layerId"]=$_REQUEST["layerId"];
if(isset($_REQUEST["gateway"])) {
$data["gateway"]=$_REQUEST["gateway"];
} else {
$data["gateway"]='';
}
$layerlib->replace_layer($layerId,$data);
} else {
if ($_REQUEST["type"]=="POINT") {
$data["config"]=$layerlib->write_class_point($data);
} else if ($_REQUEST["type"]=="lINE") {
$data["config"]=$layerlib->write_class_line($data);
} else if ($_REQUEST["type"]=="POLYGON") {
$data["config"]=$layerlib->write_class_polygon($data);
}
$data["gateway"]='';
$layerId=$layerlib->add_layer($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?mapId=".$data['mapId']);
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_layer.tpl');
$smarty->display("tiki.tpl");
?>
<?php
// Initialization
require_once ('tiki-setup.php');
include_once ('lib/map/editorlib.php');
include_once('lib/tree/layer_list_tree.php');
// CHECK FEATURE MAP HERE
if ($feature_maps != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_maps");
$smarty->display("error.tpl");
die;
}
// IF NOT LOGGED aND NOT ADMIN BAIL OUT
if (!$user) {
$smarty->assign('msg', tra("You are not logged in"));
$smarty->display("error.tpl");
die;
}
if (isset($_REQUEST["remove"])) {
if ($tiki_p_admin_layers != 'y') {
$smarty->assign('msg', tra("Permission denied you cannot remove layers"));
$smarty->display("error.tpl");
die;
}
$area = 'delbanner';
if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$layerlib->remove_banner($_REQUEST["remove"]);
} else {
key_get($area);
}
}
// This script can receive the thresold
// for the information as the number of
// days to get in the log 1,3,4,etc
// it will default to 1 recovering information for today
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'name_desc';
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
// If offset is set use it if not then use offset =0
// use the maxRecords php variable to set the limit
// if sortMode is not set then use lastModif_desc
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
if (isset($_REQUEST["layerId"])) {
$layerId = $_REQUEST["layerId"];
} else {
$layerId='';
}
if (isset($_REQUEST["mapId"])) {
$mapId = $_REQUEST["mapId"];
$smarty->assign('mapId',$mapId);
} else {
$mapId=0;
}
// display get_layer_by_group
$ctall=$layerlib->get_all_layers_ext($mapId);
if ($ctall) {
$tree_nodes = array();
foreach ($ctall as $c) {
if ($c["islayerGroup"] ==1) {
$editlink="tiki-mapeditor_edit_layergroup.php";
$layertitle=$c["name"];
} else {
$editlink="tiki-mapeditor_edit_layer.php";
$layertitle='<img src="generated/icons/Sigfreed/World/'.$c["table"].'_class_0.png" />&nbsp;'.$c["name"];
}
$tree_nodes[] = array(
"id" => $c["layerId"],
"parent" => $c["layerGroupId"],
"data" => $layertitle,
"edit" =>'<a class="link" href="'.$editlink.'?layerId=' . $c["layerId"] . '" title="' . tra('edit'). '"><img border="0" src="pics/icons/page_edit.png" /></a>',
"remove" =>'<a class="link" href="tiki-mapeditor_layers.php?layerId=' . $c["layerId"] . '&amp;removeCat=' . $c["layerId"] . '" title="' . tra('remove'). '"><img border="0" src="img/icons2/delete.gif" /></a>',
"perm" =>'<a class="link" href="tiki-objectpermissions.php?objectName=' . $c["name"].'&objectType=layers&permType=layers&objectId=' . $c["layerId"].' "title="' . tra('set permissions'). '"><img border="0" src="img/icons/key.gif" /></a>',
"layergroup" => $c["layergroup"],
"layers" => $c["layers"]
);
}
$debugger->var_dump('$tree_nodes');
$tm = new layerTreeMaker("mapeditor_layer");
$res = $tm->make_tree(0, $tree_nodes);
$smarty->assign('tree', $res);
}
$layergroups=$layerlib->list_layerGroups($mapId,$layerId, $offset, $maxRecords, $sort_mode, $find);
$smarty->assign('layergroups',$layergroups["data"]);
// end display
$listpages = $layerlib->list_layers($offset, $maxRecords, $sort_mode, $find, $mapId,$layerId);
// If there're more records then assign next_offset
$cant_pages = ceil($listpages["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($listpages["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('listpages', $listpages["data"]);
ask_ticket('list-layers');
// Display the template
$smarty->assign('mid', 'tiki-mapeditor_layers.tpl');
$smarty->display("tiki.tpl");
?>
<?php
// Initialization
require_once ('tiki-setup.php');
include_once ('lib/map/editorlib.php');
// CHECK FEATURE MAP HERE
if ($feature_maps != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_maps");
$smarty->display("error.tpl");
die;
}
// IF NOT LOGGED aND NOT ADMIN BAIL OUT
if (!$user) {
$smarty->assign('msg', tra("You are not logged in"));
$smarty->display("error.tpl");
die;
}
if (isset($_REQUEST["remove"])) {
if ($tiki_p_admin_maps != 'y') {
$smarty->assign('msg', tra("Permission denied you cannot remove maps"));
$smarty->display("error.tpl");
die;
}
$area = 'delbanner';
if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$layerlib->remove_banner($_REQUEST["remove"]);
} else {
key_get($area);
}
}
// This script can receive the thresold
// for the information as the number of
// days to get in the log 1,3,4,etc
// it will default to 1 recovering information for today
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'name_desc';
} else {
$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
// If offset is set use it if not then use offset =0
// use the maxRecords php variable to set the limit
// if sortMode is not set then use lastModif_desc
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
// Get a list of last changes to the Wiki database
$who = 'admin';
/*
if($tiki_p_admin_maps == 'y') {
$who = 'admin';
} else {
$who = $user;
}
*/
$listpages = $layerlib->list_maps($offset, $maxRecords, $sort_mode, $find, $who);
// If there're more records then assign next_offset
$cant_pages = ceil($listpages["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($listpages["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('listpages', $listpages["data"]);
//print_r($listpages["data"]);
ask_ticket('list-maps');
// Display the template
$smarty->assign('mid', 'tiki-mapeditor_maps.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