[Mapbender-commits] r2511 - branches/beck_dev/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jun 19 04:25:04 EDT 2008
Author: christoph
Date: 2008-06-19 04:25:03 -0400 (Thu, 19 Jun 2008)
New Revision: 2511
Modified:
branches/beck_dev/mapbender/http/php/mod_editApplication.php
branches/beck_dev/mapbender/http/php/mod_editApplication_server.php
Log:
added resizable
Modified: branches/beck_dev/mapbender/http/php/mod_editApplication.php
===================================================================
--- branches/beck_dev/mapbender/http/php/mod_editApplication.php 2008-06-18 08:00:18 UTC (rev 2510)
+++ branches/beck_dev/mapbender/http/php/mod_editApplication.php 2008-06-19 08:25:03 UTC (rev 2511)
@@ -26,8 +26,6 @@
<html>
<head>
<style type="text/css">
-.playground { position:static; }
-.wrap { position:static; }
.ui-selecting {
background-color: #eee;
}
@@ -37,6 +35,8 @@
border-color:blue;
background-color: #E6F7D4;
}
+.ui-draggable {
+}
</style>
<link rel='stylesheet' type='text/css' href='../css/popup.css'>
@@ -56,9 +56,15 @@
var dragButton;
var saveButton;
- var $selection;
+ var grid = [12,12];
+
+ var $selection = null;
$(function() {
+ // make images semitransparent
+ $(".collection > img").fadeTo(1, 0.7);
+
+ // create the toolbox
controlPopup = new mb_popup({
left:300,
top:300,
@@ -68,6 +74,8 @@
title:"Toolbox"
});
+ // add tools to the toolbox
+ // select tool
selectButton = new Button({
on:"../img/button_blink_red/selArea_on.png",
over:"../img/button_blink_red/selArea_over.png",
@@ -78,6 +86,7 @@
}
});
+ // drag tool
dragButton = new Button({
on:"../img/button_blink_red/pan_on.png",
over:"../img/button_blink_red/pan_over.png",
@@ -85,6 +94,21 @@
appendTo:"#controls",
});
+ // resize tool
+ resizeButton = new Button({
+ on:"../img/button_blink_red/select_rectangle_on.png",
+ over:"../img/button_blink_red/select_rectangle_over.png",
+ off:"../img/button_blink_red/select_rectangle_off.png",
+ appendTo:"#controls",
+ startParameters:{
+ selector:".collection > div"
+ },
+ stopParameters:{
+ selector:".collection > div"
+ },
+ });
+
+ // save tool
saveButton = new Button({
on:"../img/button_blink_red/wmc_save_on.png",
over:"../img/button_blink_red/wmc_save_over.png",
@@ -93,16 +117,27 @@
});
selectButton.registerStart(dragButton.triggerStop);
selectButton.registerStart(saveButton.triggerStop);
+ selectButton.registerStart(resizeButton.triggerStop);
selectButton.registerStart(makeSelectable);
dragButton.registerStart(selectButton.triggerStop);
dragButton.registerStart(saveButton.triggerStop);
+ dragButton.registerStart(resizeButton.triggerStop);
dragButton.registerStart(makeDraggable);
+ dragButton.registerStop(removeDraggable);
+ resizeButton.registerStart(selectButton.triggerStop);
+ resizeButton.registerStart(dragButton.triggerStop);
+ resizeButton.registerStart(saveButton.triggerStop);
+ resizeButton.registerStart(makeResizable);
+ resizeButton.registerStop(removeResizable);
+
saveButton.registerStart(selectButton.triggerStop);
saveButton.registerStart(dragButton.triggerStop);
+ saveButton.registerStart(resizeButton.triggerStop);
saveButton.registerStart(updateDatabase);
+ // display the toolbox
controlPopup.show();
});
@@ -129,16 +164,28 @@
stop.register(func);
};
+ var startParameters = {};
+ var stopParameters = {};
+
+ if (options.startParameters) {
+ startParameters = options.startParameters
+ }
+ startParameters.callback = function () {
+ stop.trigger();
+ };
+
+ if (options.stopParameters) {
+ stopParameters = options.stopParameters
+ }
+
this.triggerStart = function () {
- start.trigger();
+ start.trigger(startParameters);
};
this.triggerStop = function () {
- stop.trigger();
+ stop.trigger(stopParameters);
};
- var startParameters = {};
-
var srcOn;
var srcOff;
var srcOver;
@@ -152,12 +199,6 @@
if (options.over) {
srcOver = options.over;
}
- if (options.startParameters) {
- startParameters = options.startParameters
- }
- startParameters.callback = function () {
- stop.trigger();
- };
var $node = $("<img style='padding:5px' src='" + srcOff + "'/>");
$node.click(function() {
@@ -167,14 +208,13 @@
if (options.appendTo) {
$(options.appendTo).append($node);
}
-
}
function makeDraggable (options) {
var callback = options.callback;
if ($selection !== null) {
$selection.draggable({
- grid:[20,20],
+ grid:grid,
stop:function () {
var divX;
var divY;
@@ -198,8 +238,17 @@
}
});
}
+ else {
+ $(".collection").children().draggable({
+ grid:grid,
+ });
+ }
}
+ function removeDraggable () {
+ $(".collection").children().draggable("destroy");
+ }
+
function makeSelectable(options) {
var selector = options.selector;
var callback = options.callback;
@@ -219,6 +268,20 @@
});
}
+ function makeResizable (options) {
+ var selector = options.selector;
+ var callback = options.callback;
+ $all = $(selector);
+ $all.resizable();
+ }
+
+ function removeResizable (options) {
+ var selector = options.selector;
+ var callback = options.callback;
+ $all = $(selector);
+ $all.resizable("destroy");
+ }
+
function updateDatabase (options) {
var callback = options.callback;
var data = [];
@@ -227,7 +290,9 @@
data.push({
id:this.id,
top:parseInt(this.style.top),
- left:parseInt(this.style.left)
+ left:parseInt(this.style.left),
+ width:parseInt(this.style.width),
+ height:parseInt(this.style.height)
});
});
var queryObj = {
@@ -276,10 +341,10 @@
}
else {
echo "<div ";
- echo " style = 'border-width:1px;border-style:solid;border-color:black;background-color: #ffffff;";
+ echo " style = 'border-width:1px;border-style:solid;border-color:black;background-color:transparent;font-size:9px;";
}
if (db_result($res,$i,"e_closetag") == "div" ) {
- echo "border-width:1px;border-style:solid;border-color:black;background-color: #ffffff;";
+ echo "border-width:1px;border-style:solid;border-color:black;background-color:transparent;font-size:9px;";
}
// echo "<div class='wrap' ";
if(db_result($res,$i,"e_left") != "" && db_result($res,$i,"e_top") != ""){
@@ -295,7 +360,7 @@
// echo "z-index:".db_result($res,$i,"e_z_index").";";
}
if(db_result($res,$i,"e_more_styles") != ""){
- echo db_result($res,$i,"e_more_styles");
+// echo db_result($res,$i,"e_more_styles");
}
echo "' ";
// echo "' >";
@@ -351,5 +416,5 @@
$i++;
}
?>
-<div></body>
+</div></body>
</html>
\ No newline at end of file
Modified: branches/beck_dev/mapbender/http/php/mod_editApplication_server.php
===================================================================
--- branches/beck_dev/mapbender/http/php/mod_editApplication_server.php 2008-06-18 08:00:18 UTC (rev 2510)
+++ branches/beck_dev/mapbender/http/php/mod_editApplication_server.php 2008-06-19 08:25:03 UTC (rev 2511)
@@ -34,11 +34,14 @@
$id = $currentElement->id;
$top = $currentElement->top;
$left = $currentElement->left;
+ $width = $currentElement->width;
+ $height = $currentElement->height;
$app = $queryObj->parameters->applicationId;
- $sql = "UPDATE gui_element SET e_left = $1, e_top = $2 " .
- "WHERE e_id = $3 AND fkey_gui_id = $4";
- $v = array($left, $top, $id, $app);
- $t = array("i", "i", "s", "s");
+ $sql = "UPDATE gui_element SET e_left = $1, e_top = $2, " .
+ "e_width = $3, e_height = $4 " .
+ "WHERE e_id = $5 AND fkey_gui_id = $6";
+ $v = array($left, $top, $width, $height, $id, $app);
+ $t = array("i", "i", "i", "i", "s", "s");
$res = db_prep_query($sql, $v, $t);
$e = new mb_notice("updating element '" . $id . "'");
}
More information about the Mapbender_commits
mailing list