[Mapbender-commits] r2623 - branches/dev_lenkne/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jul 8 18:11:35 EDT 2008
Author: lenkne
Date: 2008-07-08 18:11:35 -0400 (Tue, 08 Jul 2008)
New Revision: 2623
Added:
branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php
branches/dev_lenkne/http/php/mod_adminEditGuiElement.php
branches/dev_lenkne/http/php/mod_adminFrame.php
Log:
Added: branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php
===================================================================
--- branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php (rev 0)
+++ branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php 2008-07-08 22:11:35 UTC (rev 2623)
@@ -0,0 +1,228 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/<wiki modul page name>
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+function showAllFilteredUsers($owner) {
+
+ $admin = new administration();
+ $allUsers = $admin->getAllFilteredUsers($owner);
+
+ $i=0;
+ while($row = db_fetch_array($allUsers)){
+ echo "<li onclick='showUser(\"".$_REQUEST["module"]."\",\"".$row["mb_user_id"]."\")'>".$row["mb_user_name"];
+ if ($row["mb_user_email"]) {
+ echo " (".$row["mb_user_email"].")";
+ }
+ echo "</li>";
+ $i++;
+ }
+ echo "</ul></div>";
+
+}
+
+switch ($_REQUEST["action"]) {
+
+case "showUser":
+
+ $admin = new administration();
+ echo $admin->getAllUserColumns($_REQUEST["mb_user_id"]);
+
+break;
+
+case "update":
+
+ $admin = new administration();
+ $dbUserId = $admin->getUserIdByUserName($_REQUEST["mb_user_name"]);
+
+ if($dbUserId != $_REQUEST["mb_user_id"]){
+//TODO Need to figure out how to get this alert to work - javascript test for JSON or array??
+ echo "<script language='JavaScript'>alert('Username must be unique!');</script>";
+ }
+ else{
+ $admin = new administration();
+ $sqlArray = $admin->getTableColumns(mb_user,mb_user_id,$_REQUEST["mb_user_id"]);
+
+ $res = "";
+ $sql = "UPDATE mb_user SET ";
+ $i = 0;
+ $j = 1;
+ foreach ($sqlArray as $key => $value) {
+ if ($value[1]) {
+ if ($j == 1) {
+ $sql.= $key . "=$" . $j;
+ }
+ else {
+ $sql.= "," . $key . "=$" . $j;
+ }
+ $t[$i] = $value[0];
+ if ($j == 3) { // for password
+ $v[$i] = md5($value[1]);
+ }
+ else {
+ $v[$i] = $value[1];
+ }
+ $i++;
+ $j++;
+ }
+ }
+ $sql.= " WHERE mb_user_id = $1";
+ $res = db_prep_query($sql,$v,$t);
+
+ $admin = new administration();
+ echo $admin->getAllUserColumns($_REQUEST["mb_user_id"]);
+ }
+
+break;
+
+case "deleteUser":
+
+ $admin = new administration();
+ $result = $admin->deleteTableRecord(mb_user,mb_user_id,$_REQUEST["mb_user_id"]);
+ echo $result;
+
+break;
+
+default:
+
+header("Content-type: text/html;");
+
+?>
+
+<div id="main">
+ <h2>Create and edit user</h2>
+ <form id="form" name="form" action="" method="post">
+ <fieldset>
+ <p>
+ <input type="button" id="action" name="action" value="update" onclick="updateUser('mod_adminEditFilteredUser')" />
+ <input type="button" id="delete" name="save" value="Delete" onclick="deleteUser('mod_adminEditFilteredUser')" />
+ <input type="button" id="cancel" name="cancel" value="Cancel" onclick="loadAction('mod_adminEditFilteredUser',this);" />
+ </p>
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="mb_user_id">User ID:</label>
+ <input type="text" id="mb_user_id" name="mb_user_id" value="" disabled="disabled" />
+ </p>
+ <p>
+ <label for="mb_user_name">Name:</label>
+ <input type="text" id="mb_user_name" name="mb_user_name" value="" />
+ </p>
+ <p>
+ <label for="mb_user_password">Password:</label>
+ <input type="password" id="mb_user_password" name="mb_user_password" value="" />
+ </p>
+ <p>
+ <label for="confirm_password">Confirm password:</label>
+ <input type="password" id="confirm_password" name="confirm_password" value="" />
+ </p>
+
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="mb_user_description">Description:</label>
+ <input type="text" id="mb_user_description" name="mb_user_description" value="" />
+ </p>
+ <p>
+ <label for="mb_user_email">E-mail:</label>
+ <input type="text" id="mb_user_email" name="mb_user_email" value="" />
+ </p>
+ <p>
+ <label for="mb_user_phone">Phone:</label>
+ <input type="text" id="mb_user_phone" name="mb_user_phone" value="" />
+ </p>
+ <p>
+ <label for="mb_user_phone1">Phone 1:</label>
+ <input type="text" id="mb_user_phone1" name="mb_user_phone1" value="" />
+ </p>
+ <p>
+ <label for="mb_user_facsimile">Facsimile:</label>
+ <input type="text" id="mb_user_facsimile" name="mb_user_facsimile" value="" />
+ </p>
+ <p>
+ <label for="mb_user_organization">Organization:</label>
+ <input type="text" id="mb_user_organisation_name" name="mb_user_organisation_name" value="" />
+ </p>
+ <p>
+ <label for="mb_user_department">Department:</label>
+ <input type="text" id="mb_user_department" name="mb_user_department" value="" />
+ </p>
+ <p>
+ <label for="mb_user_position_name">Position:</label>
+ <input type="text" id="mb_user_position_name" name="mb_user_position_name" value="" />
+ </p>
+ <p>
+ <label for="mb_user_delivery_point">Delivery point:</label>
+ <input type="text" id="mb_user_delivery_point" name="mb_user_delivery_point" value="" />
+ </p>
+ <p>
+ <label for="mb_user_city">City:</label>
+ <input type="text" id="mb_user_city" name="mb_user_city" value="" />
+ </p>
+ <p>
+ <label for="mb_user_postal_code">Postal code:</label>
+ <input type="text" id="mb_user_postal_code" name="mb_user_postal_code" value="" />
+ </p>
+ <p>
+ <label for="mb_user_country">Country:</label>
+ <input type="text" id="mb_user_country" name="mb_user_country" value="" />
+ </p>
+ <p>
+ <label for="mb_user_online_resource">Web site:</label>
+ <input type="text" id="mb_user_online_resource" name="mb_user_online_resource" value="" />
+ </p>
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="mb_user_resolution">Resolution:</label>
+ <input type="text" id="mb_user_resolution" name="mb_user_resolution" value="" />
+ </p>
+ <p>
+ <label for="mb_user_login_count">Login count:</label>
+ <input type="text" id="mb_user_login_count" name="mb_user_login_count" value="" />
+ </p>
+ <p>
+ <label for="mb_user_owner">Owner:</label>
+ <input type="text" id="mb_user_owner" name="mb_user_owner" value="" />
+ </p>
+ </fieldset>
+ </form>
+</div>
+<div id="options">
+ <h2>Current users</h2>
+
+<h3>Search by name</h3>
+<input type="text" id="searchText" name="searchText" value="" style="width:200" />
+<input type="button" id="search" name="search" value="Go" onclick="search();" />
+<h3>Current users</h3>
+<ul>
+
+<?php
+
+showAllFilteredUsers($_SESSION["mb_user_id"]);
+//TODO - This works to populate the initial page with users, but cannot be updated with changes, deletion, and addition of new users
+
+break; //for default case
+} // end switch
+?>
\ No newline at end of file
Added: branches/dev_lenkne/http/php/mod_adminEditGuiElement.php
===================================================================
--- branches/dev_lenkne/http/php/mod_adminEditGuiElement.php (rev 0)
+++ branches/dev_lenkne/http/php/mod_adminEditGuiElement.php 2008-07-08 22:11:35 UTC (rev 2623)
@@ -0,0 +1,195 @@
+<?php
+switch ($action) {
+
+case "user_edit":
+echo $action;
+break;
+
+default:
+?>
+
+<div id="main">
+ <h2>Edit GUI elements</h2>
+
+ <form action="" method="post">
+ <fieldset>
+ <p>
+ <input type="button" id="save" name="save" value="Save" />
+ <input type="button" id="delete" name="save" value="Delete" />
+ <input type="button" id="show" name="save" value="Show" />
+ <input type="button" id="sql" name="save" value="SQL" />
+ </p>
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="gui_name">Name:</label>
+ <input type="text" id="gui_name" name="gui_name" value="<?=$dummy_data["gui_name"]?>" disabled="disabled" class="wide" />
+ </p>
+ <p>
+ <label for="gui_description">Description:</label>
+ <input type="text" id="gui_description" name="gui_description" value="<?=$dummy_data["gui_description"]?>" disabled="disabled" class="wide" />
+ <input type="button" id="edit_gui_description" name="edit_gui_description" value="Edit" onclick="editGUIDescription();" />
+ </p>
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="element_id">ID:</label>
+ <input type="text" id="element_id" name="element_id" value="" />
+ </p>
+ <p>
+ <label for="element_position">Position:</label>
+ <input type="text" id="element_position" name="element_position" value="" class="numeric" />
+ </p>
+ <p>
+ <label>On/Off:</label>
+ <label for="gui_element_on" class="inline">On</label>
+ <input type="radio" id="gui_element_on" name="gui_element_onoff" value="1" />
+ <label for="gui_element_off" class="inline">Off</label>
+ <input type="radio" id="gui_element_off" name="gui_element_onoff" value="0" />
+ </p>
+ <p>
+ <label for="element_comment">Comment:</label>
+ <textarea cols="20" rows="5" id="element_comment" name="element_comment"></textarea>
+ </p>
+ <p>
+ <label for="element_title">Title:</label>
+ <input type="text" id="element_title" name="element_title" value="" />
+ </p>
+ <p>
+ <label for="element_htmltagopen">HTML-Tag (open):</label>
+ <input type="text" id="element_htmltagopen" name="element_htmltagopen" value="" />
+ </p>
+ <p>
+ <label for="element_htmltagclose">HTML-Tag (close):</label>
+ <input type="text" id="element_htmltagclose" name="element_htmltagclose" value="" />
+ </p>
+ <p>
+ <label for="element_content">Content:</label>
+ <textarea cols="20" rows="5" id="element_content" name="element_content"></textarea>
+ </p>
+ <p>
+ <label for="element_src">Source:</label>
+ <input type="text" id="element_src" name="element_src" value="" />
+ </p>
+ <p>
+ <label for="element_attributes">Attributes:</label>
+ <textarea cols="20" rows="5" id="element_attributes" name="element_attributes"></textarea>
+ </p>
+ <p>
+ <label for="element_width">Width:</label>
+ <input type="text" id="element_width" name="element_width" value="" class="numeric" /> Pixels
+ </p>
+ <p>
+ <label for="element_height">Height:</label>
+ <input type="text" id="element_height" name="element_height" value="" class="numeric" /> Pixels
+ </p>
+ <p>
+ <label for="element_top">Top:</label>
+ <input type="text" id="element_top" name="element_top" value="" class="numeric" /> Pixels
+ </p>
+ <p>
+ <label for="element_left">Left:</label>
+ <input type="text" id="element_left" name="element_left" value="" class="numeric" /> Pixels
+ </p>
+ <p>
+ <label for="element_zindex">Z-Index:</label>
+ <input type="text" id="element_zindex" name="element_zindex" value="" class="numeric" />
+ </p>
+ <p>
+ <label for="element_inlinecss">Inline CSS:</label>
+ <input type="text" id="element_inlinecss" name="element_inlinecss" value="" />
+ </p>
+ <p>
+ <label for="element_javascript">Javascript:</label>
+ <input type="text" id="element_javascript" name="element_javascript" value="" />
+ </p>
+ <p>
+ <label for="element_module">Module:</label>
+ <input type="text" id="element_module" name="element_module" value="" />
+ </p>
+ <p>
+ <label for="element_requires">Requires:</label>
+ <input type="text" id="element_requires" name="element_requires" value="" />
+ </p>
+ <p>
+ <label for="element_url">URL:</label>
+ <input type="text" id="element_url" name="element_url" value="" />
+ </p>
+ <p>
+ <label for="element_target">Target:</label>
+ <input type="text" id="element_target" name="element_target" value="" />
+ </p>
+ </fieldset>
+ </form>
+</div>
+
+<div id="options">
+ <h2>Select element</h2>
+
+ <form action="" method="post">
+ <h3>Foreign GUI elements</h3>
+ <p>
+ <select id="foreign_gui_list" name="foreign_gui_list">
+ <option value="">Foreign GUI …</option>
+ <option value="">Another GUI One</option>
+ <option value="">Another GUI Two</option>
+ <option value="">Another GUI Three</option>
+ </select>
+ <input type="button" id="grab_element" name="grab_element" value="Grab" onclick="grabElementFromForeignGUI();" />
+ </p>
+
+ <h3>Current GUI elements</h3>
+ <ul>
+ <li title="add a WMS to the running application">
+ <input type="button" id="edit_element_0" name="edit_element_0" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_0" name="element_status_0" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">addWFS</a>
+ </li>
+ <li title="add a WMS to the running application from a filtered list">
+ <input type="button" id="edit_element_1" name="edit_element_1" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_1" name="element_status_1" onclick="toggleElementStatus();" />
+ <a href="#">addWMSfromfilteredList_ajax</a>
+ </li>
+ <li title="History.back()">
+ <input type="button" id="edit_element_2" name="edit_element_2" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_2" name="element_status_2" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">back</a>
+ </li>
+ <li title="body (obligatory)">
+ <input type="button" id="edit_element_3" name="edit_element_3" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_3" name="element_status_3" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">body</a>
+ </li>
+ <li title="Center button">
+ <input type="button" id="edit_element_4" name="edit_element_4" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_4" name="element_status_4" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">center1</a>
+ </li>
+ <li title="button: change password of logged user">
+ <input type="button" id="edit_element_5" name="edit_element_5" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_5" name="element_status_5" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">changePassword_button</a>
+ </li>
+ <li title="close Polygon">
+ <input type="button" id="edit_element_6" name="edit_element_6" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_6" name="element_status_6" onclick="toggleElementStatus();" />
+ <a href="#">closePolygon</a>
+ </li>
+ <li title="a Copyright in the map">
+ <input type="button" id="edit_element_7" name="edit_element_7" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_7" name="element_status_7" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">copyright</a>
+ </li>
+ <li title="displays infos in a sticky div-tag">
+ <input type="button" id="edit_element_8" name="edit_element_8" value="Edit" onclick="editGUIElement();" />
+ <input type="checkbox" id="element_status_8" name="element_status_8" checked="checked" onclick="toggleElementStatus();" />
+ <a href="#">dependentDiv</a>
+ </li>
+ </ul>
+ </form>
+</div>
+<?php
+break; //for default case
+} // end switch
\ No newline at end of file
Added: branches/dev_lenkne/http/php/mod_adminFrame.php
===================================================================
--- branches/dev_lenkne/http/php/mod_adminFrame.php (rev 0)
+++ branches/dev_lenkne/http/php/mod_adminFrame.php 2008-07-08 22:11:35 UTC (rev 2623)
@@ -0,0 +1,3 @@
+<?php
+require_once(dirname(__FILE__)."/../../lib/mb_admin_functions.js");
+?>
More information about the Mapbender_commits
mailing list