Changeset 695
- Timestamp:
- 08/21/05 17:27:03 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 2 added
- 21 modified
-
ChangeLog (modified) (1 diff)
-
sql/wifidog-postgres-initial-data.sql (modified) (1 diff)
-
sql/wifidog-postgres-schema.sql (modified) (7 diffs)
-
wifidog/admin/hotspot_location_map.php (added)
-
wifidog/classes/AbstractGeocoder.php (modified) (1 diff)
-
wifidog/classes/Geocoders/GeocoderCanada.php (modified) (1 diff)
-
wifidog/classes/Geocoders/GeocoderUsa.php (modified) (1 diff)
-
wifidog/classes/GisPoint.php (modified) (1 diff)
-
wifidog/classes/Locale.php (modified) (1 diff)
-
wifidog/classes/MainUI.php (modified) (1 diff)
-
wifidog/classes/Node.php (modified) (27 diffs)
-
wifidog/classes/Security.php (modified) (1 diff)
-
wifidog/classes/User.php (modified) (1 diff)
-
wifidog/hotspot_status.php (modified) (3 diffs)
-
wifidog/hotspots_map.php (modified) (1 diff)
-
wifidog/include/common.php (modified) (1 diff)
-
wifidog/include/schema_validate.php (modified) (2 diffs)
-
wifidog/js/gmaps_hotspots_status_map.js (modified) (3 diffs)
-
wifidog/lib (modified) (1 prop)
-
wifidog/lib/.cvsignore (modified) (1 diff)
-
wifidog/lib/smarty (modified) (1 prop)
-
wifidog/lib/smarty/.cvsignore (modified) (1 diff)
-
wifidog/update.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r694 r695 1 2005-08-21 Francois Proulx <francois.proulx@gmail.com> 2 * Node admin UI should now be completed. 3 * Minor bug fixes in Geocoder 4 * Merged node_owners and node_tech_officers table into node_stakeholders 5 1 6 2005-08-19 Benoit Grégoire <bock@step.polymtl.ca> 2 7 * New schema version -
trunk/wifidog-auth/sql/wifidog-postgres-initial-data.sql
r694 r695 119 119 -- 120 120 121 INSERT INTO schema_info (tag, value) VALUES ('schema_version', '2 4');121 INSERT INTO schema_info (tag, value) VALUES ('schema_version', '25'); 122 122 123 123 -
trunk/wifidog-auth/sql/wifidog-postgres-schema.sql
r694 r695 294 294 295 295 296 SET default_with_oids = false; 297 298 -- 299 -- Name: node_owners; Type: TABLE; Schema: public; Owner: wifidog; Tablespace: 300 -- 301 302 CREATE TABLE node_owners ( 296 -- 297 -- Name: node_stakeholders; Type: TABLE; Schema: public; Owner: wifidog; Tablespace: 298 -- 299 300 CREATE TABLE node_stakeholders ( 303 301 node_id character varying(32) NOT NULL, 304 user_id character varying(45) NOT NULL 305 ); 306 307 308 SET default_with_oids = true; 309 310 -- 311 -- Name: node_tech_officers; Type: TABLE; Schema: public; Owner: wifidog; Tablespace: 312 -- 313 314 CREATE TABLE node_tech_officers ( 315 node_id character varying(32) NOT NULL, 316 user_id character varying(45) NOT NULL 302 user_id character varying(45) NOT NULL, 303 is_owner boolean DEFAULT false NOT NULL, 304 is_tech_officer boolean DEFAULT false NOT NULL 317 305 ); 318 306 … … 580 568 581 569 -- 582 -- Name: node_owners_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 583 -- 584 585 ALTER TABLE ONLY node_owners 586 ADD CONSTRAINT node_owners_pkey PRIMARY KEY (node_id, user_id); 587 588 589 -- 590 -- Name: node_tech_officers_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 591 -- 592 593 ALTER TABLE ONLY node_tech_officers 594 ADD CONSTRAINT node_tech_officers_pkey PRIMARY KEY (node_id, user_id); 570 -- Name: node_stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 571 -- 572 573 ALTER TABLE ONLY node_stakeholders 574 ADD CONSTRAINT node_stakeholders_pkey PRIMARY KEY (node_id, user_id); 595 575 596 576 … … 784 764 785 765 -- 766 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 767 -- 768 769 ALTER TABLE ONLY iframes 770 ADD CONSTRAINT "$1" FOREIGN KEY (iframes_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 771 772 773 -- 774 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 775 -- 776 777 ALTER TABLE ONLY content_rss_aggregator 778 ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 779 780 781 -- 782 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 783 -- 784 785 ALTER TABLE ONLY content_rss_aggregator_feeds 786 ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content_rss_aggregator(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 787 788 789 -- 786 790 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 787 791 -- … … 896 900 897 901 -- 898 -- Name: content_rss_aggregator_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog899 --900 901 ALTER TABLE ONLY content_rss_aggregator902 ADD CONSTRAINT content_rss_aggregator_content_id_fkey FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;903 904 905 --906 -- Name: content_rss_aggregator_feeds_content_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog907 --908 909 ALTER TABLE ONLY content_rss_aggregator_feeds910 ADD CONSTRAINT content_rss_aggregator_feeds_content_id_fkey FOREIGN KEY (content_id) REFERENCES content_rss_aggregator(content_id) ON UPDATE CASCADE ON DELETE CASCADE;911 912 913 --914 902 -- Name: fk_node_deployment_status; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 915 903 -- … … 928 916 929 917 -- 930 -- Name: fk_nodes; Type: FK CONSTRAINT; Schema: public; Owner: wifidog931 --932 933 ALTER TABLE ONLY node_owners934 ADD CONSTRAINT fk_nodes FOREIGN KEY (node_id) REFERENCES nodes(node_id) ON UPDATE CASCADE ON DELETE CASCADE;935 936 937 --938 918 -- Name: fk_users; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 939 919 -- … … 944 924 945 925 -- 946 -- Name: fk_users; Type: FK CONSTRAINT; Schema: public; Owner: wifidog947 --948 949 ALTER TABLE ONLY node_owners950 ADD CONSTRAINT fk_users FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE;951 952 953 --954 926 -- Name: fk_venue_types; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 955 927 -- … … 968 940 969 941 -- 970 -- Name: iframes_iframes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 971 -- 972 973 ALTER TABLE ONLY iframes 974 ADD CONSTRAINT iframes_iframes_id_fkey FOREIGN KEY (iframes_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE; 975 976 977 -- 978 -- Name: node_tech_officers_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 979 -- 980 981 ALTER TABLE ONLY node_tech_officers 982 ADD CONSTRAINT node_tech_officers_node_id_fkey FOREIGN KEY (node_id) REFERENCES nodes(node_id); 983 984 985 -- 986 -- Name: node_tech_officers_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 987 -- 988 989 ALTER TABLE ONLY node_tech_officers 990 ADD CONSTRAINT node_tech_officers_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id); 942 -- Name: node_stakeholders_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 943 -- 944 945 ALTER TABLE ONLY node_stakeholders 946 ADD CONSTRAINT node_stakeholders_node_id_fkey FOREIGN KEY (node_id) REFERENCES nodes(node_id); 947 948 949 -- 950 -- Name: node_stakeholders_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 951 -- 952 953 ALTER TABLE ONLY node_stakeholders 954 ADD CONSTRAINT node_stakeholders_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id); 991 955 992 956 -
trunk/wifidog-auth/wifidog/classes/AbstractGeocoder.php
r686 r695 182 182 abstract public function getLongitude(); 183 183 abstract public function getAltitude(); 184 abstract public function getGisLocation(); 184 185 185 186 } // End class -
trunk/wifidog-auth/wifidog/classes/Geocoders/GeocoderCanada.php
r686 r695 166 166 return null; 167 167 } 168 169 /** Get a GIS Point instance 170 * @return GisPoint 171 */ 172 public function getGisLocation() 173 { 174 $lat = $this->getLatitude(); 175 $long = $this->getLongitude(); 176 177 if($lat !== null && $long !== null) 178 return new GisPoint($lat, $long, 0); 179 return null; 180 } 168 181 169 182 } // End class -
trunk/wifidog-auth/wifidog/classes/Geocoders/GeocoderUsa.php
r686 r695 133 133 // Not supported by geocoder.us 134 134 return null; 135 } 135 } 136 137 /** Get a GIS Point instance 138 * @return GisPoint 139 */ 140 public function getGisLocation() 141 { 142 $lat = $this->getLatitude(); 143 $long = $this->getLongitude(); 144 145 if($lat !== null && $long !== null) 146 return new GisPoint($lat, $long, 0); 147 return null; 148 } 149 136 150 } // End class 137 151 -
trunk/wifidog-auth/wifidog/classes/GisPoint.php
r687 r695 66 66 $this->altitude = $alt; 67 67 } 68 69 68 } 70 69 -
trunk/wifidog-auth/wifidog/classes/Locale.php
r645 r695 115 115 if ($current_locale != $locale_id) 116 116 { 117 echo "Warning : language.php: Unable to setlocale() to ".$locale_id.", return value: $current_locale, current locale: ".setlocale(LC_ALL, 0);117 echo "Warning in /classes/Locale.php : Unable to setlocale() to ".$locale_id.", return value: $current_locale, current locale: ".setlocale(LC_ALL, 0); 118 118 $retval = false; 119 119 } -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r694 r695 125 125 $sql_additional_where = ''; 126 126 else 127 $sql_additional_where = "AND node_id IN (SELECT node_id from node_ owners WHEREuser_id='".$current_user->getId()."')";127 $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; 128 128 $html .= "<div id='NodeSelector'>\n"; 129 129 $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); -
trunk/wifidog-auth/wifidog/classes/Node.php
r694 r695 1 1 <?php 2 2 3 3 4 /********************************************************************\ … … 297 298 return new GisPoint($this->mRow['latitude'], $this->mRow['longitude'], 0); 298 299 } 299 300 300 301 function setGisLocation($pt) 301 302 { 302 if (!empty($pt))303 if (!empty ($pt)) 303 304 { 304 305 $lat = $this->mDb->EscapeString($pt->getLatitude()); 305 306 $long = $this->mDb->EscapeString($pt->getLongitude()); 306 307 $this->mDb->ExecSqlUpdate("UPDATE nodes SET latitude = $lat, longitude = $long WHERE node_id = '{$this->getId()}'"); 307 308 if (!empty ($lat) && !empty ($long)) 309 $this->mDb->ExecSqlUpdate("UPDATE nodes SET latitude = $lat, longitude = $long WHERE node_id = '{$this->getId()}'"); 310 else 311 $this->mDb->ExecSqlUpdate("UPDATE nodes SET latitude = NULL, longitude = NULL WHERE node_id = '{$this->getId()}'"); 308 312 $this->refresh(); 309 313 } … … 359 363 $this->refresh(); 360 364 } 361 365 362 366 public function getCivicNumber() 363 367 { … … 554 558 $html .= "</div>\n"; 555 559 $html .= "</div>\n"; 556 560 557 561 // Street name 558 562 $html .= "<div class='admin_section_container'>\n"; … … 564 568 $html .= "</div>\n"; 565 569 $html .= "</div>\n"; 566 570 567 571 // City 568 572 $html .= "<div class='admin_section_container'>\n"; … … 574 578 $html .= "</div>\n"; 575 579 $html .= "</div>\n"; 576 580 577 581 // Province 578 582 $html .= "<div class='admin_section_container'>\n"; … … 584 588 $html .= "</div>\n"; 585 589 $html .= "</div>\n"; 586 590 587 591 // Postal Code 588 592 $html .= "<div class='admin_section_container'>\n"; … … 594 598 $html .= "</div>\n"; 595 599 $html .= "</div>\n"; 596 600 597 601 // Country 598 602 $html .= "<div class='admin_section_container'>\n"; … … 644 648 $html .= "</div>\n"; 645 649 650 // End of information section 651 $html .= "</div>\n"; 652 646 653 // Node GIS data 647 654 $html .= "<div class='admin_section_container'>\n"; 648 655 $html .= "<div class='admin_section_title'>"._("GIS data")." : </div>\n"; 649 656 650 657 // Build HTML form fields names & values 651 658 $gis_point = $this->getGisLocation(); … … 654 661 $gis_long_name = "node_".$this->getId()."_gis_longitude"; 655 662 $gis_long_value = htmlspecialchars($gis_point->getLongitude(), ENT_QUOTES); 656 657 $html .= "<div class='admin_section_container'>\n"; 663 664 $html .= "<div class='admin_section_container'>\n"; 658 665 $html .= "<div class='admin_section_title'>"._("Latitude")." : </div>\n"; 659 666 $html .= "<div class='admin_section_data'>\n"; 660 $html .= "<input type='text' size ='50' value='$gis_lat_value' name='$gis_lat_name'>\n";661 $html .= "</div>\n"; 662 $html .= "</div>\n"; 663 664 $html .= "<div class='admin_section_container'>\n"; 667 $html .= "<input type='text' size ='50' value='$gis_lat_value' id='$gis_lat_name' name='$gis_lat_name'>\n"; 668 $html .= "</div>\n"; 669 $html .= "</div>\n"; 670 671 $html .= "<div class='admin_section_container'>\n"; 665 672 $html .= "<div class='admin_section_title'>"._("Longitude")." : </div>\n"; 666 673 $html .= "<div class='admin_section_data'>\n"; 667 $html .= "<input type='text' size ='50' value='$gis_long_value' name='$gis_long_name'>\n";668 $html .= "</div>\n"; 669 $html .= "</div>\n"; 670 674 $html .= "<input type='text' size ='50' value='$gis_long_value' id='$gis_long_name' name='$gis_long_name'>\n"; 675 $html .= "</div>\n"; 676 $html .= "</div>\n"; 677 671 678 /* 672 679 * If Google Maps is enabled, call the geocoding service, … … 677 684 * Simply use a geocoding service. 678 685 */ 679 680 if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED === true)681 { 682 $html .= "<div class='admin_section_container'>\n"; 686 687 if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED === true) 688 { 689 $html .= "<div class='admin_section_container'>\n"; 683 690 $html .= "<div class='admin_section_data'>\n"; 684 $html .= "<input type='button' name='google_maps_geocode' value='"._("Geocode location")."' onClick='alert();'>\n"; 685 $html .=" ("._("Use a geocoding service + Google Maps to extract precise GIS data").")"; 691 $html .= "<input type='submit' name='geocode_only' value='"._("Geocode only")."'>\n"; 692 $html .= "<input type='button' name='google_maps_geocode' value='"._("Check using Google Maps")."' onClick='window.open(\"hotspot_location_map.php?node_id={$this->getId()}\", \"hotspot_location\", \"toolbar=0,scrollbars=1,resizable=1,location=0,statusbar=0,menubar=0,width=600,height=600\");'>\n"; 693 $html .= " ("._("Use a geocoding service, then use Google Maps to pinpoint the exact location.").")"; 686 694 $html .= "</div>\n"; 687 695 $html .= "</div>\n"; … … 689 697 else 690 698 { 691 $html .= "<div class='admin_section_container'>\n"; 699 $html .= "<div class='admin_section_container'>\n"; 692 700 $html .= "<div class='admin_section_data'>\n"; 693 701 $html .= "<input type='submit' name='geocode_only' value='"._("Geocode location")."'>\n"; 694 $html .= " ("._("Use a geocoding service").")";702 $html .= " ("._("Use a geocoding service").")"; 695 703 $html .= "</div>\n"; 696 704 $html .= "</div>\n"; 697 705 } 698 706 699 707 // End of GIS data 700 $html .= "</div>\n";701 702 // End of information section703 708 $html .= "</div>\n"; 704 709 … … 728 733 $html .= "</div>\n"; 729 734 $html .= "</div>\n"; 730 735 731 736 // Tech officers management 732 737 $html .= "<div class='admin_section_container'>\n"; … … 788 793 $html .= "</ul>\n"; 789 794 $html .= "</div>\n"; 790 $html .= "</div>\n"; 795 791 796 return $html; 792 797 } … … 819 824 $name = "node_".$this->getId()."_map_url"; 820 825 $this->setMapUrl($_REQUEST[$name]); 821 826 822 827 // Civic number 823 828 $name = "node_".$this->getId()."_civic_number"; 824 829 $this->setCivicNumber($_REQUEST[$name]); 825 830 826 831 // Street name 827 832 $name = "node_".$this->getId()."_street_name"; 828 833 $this->setStreetName($_REQUEST[$name]); 829 834 830 835 // City 831 836 $name = "node_".$this->getId()."_city"; 832 837 $this->setCity($_REQUEST[$name]); 833 838 834 839 // Province 835 840 $name = "node_".$this->getId()."_province"; 836 841 $this->setProvince($_REQUEST[$name]); 837 842 838 843 // Postal Code 839 844 $name = "node_".$this->getId()."_postal_code"; 840 845 $this->setPostalCode($_REQUEST[$name]); 841 846 842 847 // Country 843 848 $name = "node_".$this->getId()."_country"; … … 859 864 $name = "node_".$this->getId()."_deployment_status"; 860 865 $this->setDeploymentStatus(self :: processSelectDeploymentStatus($name)); 861 866 862 867 // GIS data 863 868 // Get a geocoder for a given country 864 if (!empty($_REQUEST['geocode_only']))865 { 866 $geocoder = AbstractGeocoder ::getGeocoder($this->getCountry());867 if ($geocoder != null)869 if (!empty ($_REQUEST['geocode_only'])) 870 { 871 $geocoder = AbstractGeocoder :: getGeocoder($this->getCountry()); 872 if ($geocoder != null) 868 873 { 869 874 $geocoder->setCivicNumber($this->getCivicNumber()); 870 875 $geocoder->setStreetName($this->getStreetName()); 871 876 $geocoder->setCity($this->getCity()); 872 $geocoder->setProvince($this->getProvince()); 877 $geocoder->setProvince($this->getProvince()); 873 878 $geocoder->setPostalCode($this->getPostalCode()); 874 if($geocoder->validateAddress() === true) 875 $this->setGisLocation(new GisPoint($geocoder->getLatitude(), $geocoder->getLongitude(), .0)); 879 if ($geocoder->validateAddress() === true) 880 { 881 if (($point = $geocoder->getGisLocation()) !== null) 882 $this->setGisLocation($point); 883 else 884 echo _("It appears that the Geocoder could not be reached or could not geocode the given address."); 885 } 876 886 else 877 887 echo _("You must enter a valid address."); … … 883 893 $gis_lat_name = "node_".$this->getId()."_gis_latitude"; 884 894 $gis_long_name = "node_".$this->getId()."_gis_longitude"; 885 $this->setGisLocation(new GisPoint($_REQUEST[$gis_lat_name], $_REQUEST[$gis_long_name], .0)); 895 $this->setGisLocation(new GisPoint($_REQUEST[$gis_lat_name], $_REQUEST[$gis_long_name], .0)); 886 896 } 887 897 … … 905 915 } 906 916 917 $name = "node_{$this->getId()}_new_owner_submit"; 918 if (!empty ($_REQUEST[$name])) 919 { 920 $name = "node_{$this->getId()}_new_owner"; 921 $owner = User :: processSelectUserUI($name); 922 if ($owner) 923 { 924 if ($this->isOwner($owner)) 925 echo _("The user is already an owner of this node."); 926 else 927 $this->addOwner($owner); 928 } 929 } 930 907 931 // Technical officers processing 908 932 // Rebuild user id, and delete if it was selected … … 1106 1130 global $db; 1107 1131 $retval = array (); 1108 $db->ExecSql("SELECT user_id FROM node_ owners WHEREnode_id='{$this->id}'", $owners, false);1132 $db->ExecSql("SELECT user_id FROM node_stakeholders WHERE is_owner = true AND node_id='{$this->id}'", $owners, false); 1109 1133 if ($owners != null) 1110 1134 { … … 1116 1140 return $retval; 1117 1141 } 1118 1142 1119 1143 function getTechnicalOfficers() 1120 1144 { 1121 1145 global $db; 1122 1146 $retval = array (); 1123 $db->ExecSql("SELECT user_id FROM node_ tech_officers WHEREnode_id='{$this->id}'", $officers, false);1147 $db->ExecSql("SELECT user_id FROM node_stakeholders WHERE is_tech_officer = true AND node_id='{$this->id}'", $officers, false); 1124 1148 if ($officers != null) 1125 1149 { … … 1138 1162 { 1139 1163 global $db; 1140 if (!$db->ExecSqlUpdate("INSERT INTO node_owners (node_id, user_id) VALUES ('{$this->getId()}','{$user->getId()}')", false)) 1141 throw new Exception(_('Could not add owner')); 1142 } 1143 1164 $db->ExecSql("SELECT * FROM node_stakeholders WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}'", $rows, false); 1165 if (!$rows) 1166 { 1167 if (!$db->ExecSqlUpdate("INSERT INTO node_stakeholders (node_id, user_id, is_owner) VALUES ('{$this->getId()}','{$user->getId()}', true)", false)) 1168 throw new Exception(_('Could not add owner')); 1169 } 1170 else 1171 if (!$db->ExecSqlUpdate("UPDATE node_stakeholders SET is_owner = true WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}';", false)) 1172 throw new Exception(_('Could not add owner')); 1173 } 1174 1144 1175 /** Associates a technical officer ( tech support ) to this node 1145 1176 * @param User … … 1148 1179 { 1149 1180 global $db; 1150 if (!$db->ExecSqlUpdate("INSERT INTO node_tech_officers (node_id, user_id) VALUES ('{$this->getId()}','{$user->getId()}')", false)) 1151 throw new Exception(_('Could not add technical officer')); 1181 $db->ExecSql("SELECT * FROM node_stakeholders WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}'", $rows, false); 1182 if (!$rows) 1183 { 1184 if (!$db->ExecSqlUpdate("INSERT INTO node_stakeholders (node_id, user_id, is_tech_officer) VALUES ('{$this->getId()}','{$user->getId()}', true)", false)) 1185 throw new Exception(_('Could not add tech officer')); 1186 } 1187 else 1188 if (!$db->ExecSqlUpdate("UPDATE node_stakeholders SET is_tech_officer = true WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}';", false)) 1189 throw new Exception(_('Could not add tech officer')); 1152 1190 } 1153 1191 … … 1158 1196 { 1159 1197 global $db; 1160 if (!$db->ExecSqlUpdate(" DELETE FROM node_owners WHERE node_id='{$this->getId()}' AND user_id='{$user->getId()}'", false))1198 if (!$db->ExecSqlUpdate("UPDATE node_stakeholders SET is_owner = false WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}';", false)) 1161 1199 throw new Exception(_('Could not remove owner')); 1162 1200 } 1163 1201 1164 1202 /** Remove a technical officer ( tech support ) from this node 1165 1203 * @param User … … 1168 1206 { 1169 1207 global $db; 1170 if (!$db->ExecSqlUpdate(" DELETE FROM node_tech_officers WHERE node_id='{$this->getId()}' AND user_id='{$user->getId()}'", false))1171 throw new Exception(_('Could not remove owner'));1208 if (!$db->ExecSqlUpdate("UPDATE node_stakeholders SET is_tech_officer = false WHERE node_id = '{$this->getId()}' AND user_id = '{$user->getId()}';", false)) 1209 throw new Exception(_('Could not remove tech officer')); 1172 1210 } 1173 1211 … … 1181 1219 $user_id = $user->getId(); 1182 1220 $retval = false; 1183 $db->ExecSqlUniqueRes("SELECT * FROM node_ owners WHEREnode_id='{$this->id}' AND user_id='{$user_id}'", $row, false);1221 $db->ExecSqlUniqueRes("SELECT * FROM node_stakeholders WHERE is_owner = true AND node_id='{$this->id}' AND user_id='{$user_id}'", $row, false); 1184 1222 if ($row != null) 1185 1223 { … … 1189 1227 return $retval; 1190 1228 } 1191 1229 1192 1230 /** Is the user a technical officer of the Node? 1193 1231 * @return true our false*/ … … 1199 1237 $user_id = $user->getId(); 1200 1238 $retval = false; 1201 $db->ExecSqlUniqueRes("SELECT * FROM node_ tech_officers WHEREnode_id='{$this->id}' AND user_id='{$user_id}'", $row, false);1239 $db->ExecSqlUniqueRes("SELECT * FROM node_stakeholders WHERE is_tech_officer = true AND node_id='{$this->id}' AND user_id='{$user_id}'", $row, false); 1202 1240 if ($row != null) 1203 1241 { -
trunk/wifidog-auth/wifidog/classes/Security.php
r638 r695 76 76 $password_hash = $this->session->get(SESS_PASSWORD_HASH_VAR); 77 77 78 $db->ExecSqlUniqueRes("SELECT * FROM users NATURAL JOIN node_ owners WHERE (users.user_id='$user') AND pass='$password_hash' AND node_owners.node_id='$node_id'", $user_info, false);78 $db->ExecSqlUniqueRes("SELECT * FROM users NATURAL JOIN node_stakeholders WHERE is_owner = true AND (users.user_id='$user') AND pass='$password_hash' AND node_stakeholders.node_id='$node_id'", $user_info, false); 79 79 if(empty($user_info)) { 80 80 echo '<p class=error>'._("You do not have owner privileges")."</p>\n"; -
trunk/wifidog-auth/wifidog/classes/User.php
r686 r695 410 410 { 411 411 global $db; 412 $db->ExecSqlUniqueRes("SELECT * FROM node_ owners WHEREuser_id='{$this->getId()}'", $row, false);412 $db->ExecSqlUniqueRes("SELECT * FROM node_stakeholders WHERE is_owner = true AND user_id='{$this->getId()}'", $row, false); 413 413 if ($row != null) 414 414 return true; -
trunk/wifidog-auth/wifidog/hotspot_status.php
r686 r695 203 203 } 204 204 205 // Civic number 206 if (!empty ($node_row['civic_number'])) 207 { 208 $civic_nbr = $xmldoc->createElement("civicNumber", $node_row['civic_number']); 209 $hotspot->appendChild($civic_nbr); 210 } 211 205 212 // Street address 206 213 if (!empty ($node_row['street_name'])) … … 208 215 $street_addr = $xmldoc->createElement("streetAddress", $node_row['street_name']); 209 216 $hotspot->appendChild($street_addr); 217 } 218 219 // City 220 if (!empty ($node_row['city'])) 221 { 222 $city = $xmldoc->createElement("city", $node_row['city']); 223 $hotspot->appendChild($city); 224 } 225 226 227 // Province 228 if (!empty ($node_row['province'])) 229 { 230 $province = $xmldoc->createElement("province", $node_row['province']); 231 $hotspot->appendChild($province); 232 } 233 234 // Postal code 235 if (!empty ($node_row['postal_code'])) 236 { 237 $postal_code = $xmldoc->createElement("postalCode", $node_row['postal_code']); 238 $hotspot->appendChild($postal_code); 239 } 240 241 // Country 242 if (!empty ($node_row['country'])) 243 { 244 $country = $xmldoc->createElement("country", $node_row['country']); 245 $hotspot->appendChild($country); 210 246 } 211 247 … … 435 471 $description_text .= "</p>\n"; 436 472 $description_text .= "<p>\n"; 437 if (!empty ($node_row['street_address'])) 438 { 439 $description_text .= ""._("Address:")." ".$node_row['street_address']." "; 440 } 473 $description_text .= ""._("Address:")." "; 474 475 // Civic number 476 if (!empty ($node_row['civic_number'])) 477 { 478 $description_text .= $node_row['civic_number'].", "; 479 } 480 481 if (!empty ($node_row['street_name'])) 482 { 483 $description_text .= $node_row['street_name'].", "; 484 } 485 486 // City 487 if (!empty ($node_row['city'])) 488 { 489 $description_text .= $node_row['city'].", "; 490 } 491 492 493 // Province 494 if (!empty ($node_row['province'])) 495 { 496 $description_text .= $node_row['province'].", "; 497 } 498 499 // Postal code 500 if (!empty ($node_row['postal_code'])) 501 { 502 $description_text .= $node_row['postal_code'].", "; 503 } 504 505 // Country 506 if (!empty ($node_row['country'])) 507 { 508 $description_text .= $node_row['country']; 509 } 510 441 511 if (!empty ($node_row['map_url'])) 442 512 { -
trunk/wifidog-auth/wifidog/hotspots_map.php
r686 r695 49 49 50 50 // The onLoad code should only be called once all DIV are created. 51 $script = "<script type=\"text/javascript\"> onLoad('".GMAPS_XML_SOURCE_URL."', ".GMAPS_INITIAL_LATITUDE.", ".GMAPS_INITIAL_LONGITUDE.", ".GMAPS_INITIAL_ZOOM_LEVEL.");</script>\n";51 $script = "<script type=\"text/javascript\">loadHotspotsMap('".GMAPS_XML_SOURCE_URL."', ".GMAPS_INITIAL_LATITUDE.", ".GMAPS_INITIAL_LONGITUDE.", ".GMAPS_INITIAL_ZOOM_LEVEL.");</script>\n"; 52 52 $ui->addFooterScript($script); 53 53 -
trunk/wifidog-auth/wifidog/include/common.php
r686 r695 103 103 define('COMMON_CONTENT_URL', BASE_URL_PATH.LOCAL_CONTENT_REL_PATH.'common/'); 104 104 105 define('GENERIC_OBJECT_ADMIN_ABS_HREF', BASE_URL_PATH.' /admin/generic_object_admin.php');106 define('CONTENT_ADMIN_ABS_HREF', BASE_URL_PATH.' /admin/content_admin.php');105 define('GENERIC_OBJECT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/generic_object_admin.php'); 106 define('CONTENT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/content_admin.php'); 107 107 108 108 /** Convert a password hash form a NoCat passwd file into the same format as get_password_hash(). -
trunk/wifidog-auth/wifidog/include/schema_validate.php
r694 r695 28 28 require_once BASEPATH.'classes/AbstractDb.php'; 29 29 require_once BASEPATH.'classes/Session.php'; 30 define('REQUIRED_SCHEMA_VERSION', 2 4);30 define('REQUIRED_SCHEMA_VERSION', 25); 31 31 32 32 /** Check that the database schema is up to date. If it isn't, offer to update it. */ … … 553 553 $sql .= "ALTER TABLE content_rss_aggregator_feeds ADD COLUMN title text; \n"; 554 554 } 555 556 $new_schema_version = 25; 557 if ($schema_version < $new_schema_version) 558 { 559 echo "<h2>Preparing SQL statements to update schema to version $new_schema_version</h2>\n"; 560 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 561 $sql .= "CREATE TABLE node_stakeholders ( \n"; 562 $sql .= " node_id VARCHAR(32) REFERENCES nodes (node_id),\n"; 563 $sql .= " user_id VARCHAR(45) REFERENCES users (user_id),\n"; 564 $sql .= " is_owner BOOLEAN NOT NULL DEFAULT FALSE,\n"; 565 $sql .= " is_tech_officer BOOLEAN NOT NULL DEFAULT FALSE,\n"; 566 $sql .= "PRIMARY KEY (node_id, user_id)\n"; 567 $sql .= ");\n"; 568 $sql .= "INSERT INTO node_stakeholders (node_id, user_id) SELECT node_id, user_id FROM node_owners UNION SELECT node_id, user_id FROM node_tech_officers;\n"; 569 $sql .= "UPDATE node_stakeholders SET is_owner = true FROM node_owners WHERE node_stakeholders.node_id = node_owners.node_id AND node_stakeholders.user_id = node_owners.user_id;\n"; 570 $sql .= "UPDATE node_stakeholders SET is_tech_officer = true FROM node_tech_officers WHERE node_stakeholders.node_id = node_tech_officers.node_id AND node_stakeholders.user_id = node_tech_officers.user_id;"; 571 $sql .= "DROP TABLE node_owners;\n"; 572 $sql .= "DROP TABLE node_tech_officers;\n"; 573 } 574 555 575 $db->ExecSqlUpdate("BEGIN;\n$sql\nCOMMIT;\n", true); 556 576 //$db->ExecSqlUpdate("BEGIN;\n$sql\nROLLBACK;\n", true); -
trunk/wifidog-auth/wifidog/js/gmaps_hotspots_status_map.js
r674 r695 20 20 /**@file gmaps_hotspots_status_map.js 21 21 * JavaScript functions to display a hotspot status map using Google Maps 22 * @author Copyright (C) 2005 Fran çois Proulx22 * @author Copyright (C) 2005 Francois Proulx <francois.proulx@gmail.com> 23 23 */ 24 24 … … 26 26 var markers = Array(); 27 27 28 function onLoad(hotspots_status_xml_url, lat, lng, zoom)28 function loadHotspotsMap(hotspots_status_xml_url, lat, lng, zoom) 29 29 { 30 30 // Create the map 31 var map = createMap(new GPoint(lng, lat), zoom); 31 if(lat != null && lng != null) 32 point = new GPoint(lng, lat); 33 else 34 point = null; 35 var map = createMap(point, zoom); 32 36 var hotspotsList = document.getElementById("map_hotspots_list"); 33 loadHotspotsStatus(map, hotspotsList, hotspots_status_xml_url); 37 if(hotspots_status_xml_url != null) 38 loadHotspotsStatus(map, hotspotsList, hotspots_status_xml_url); 39 return map; 34 40 } 35 41 … … 40 46 map.addControl(new GLargeMapControl()); 41 47 map.addControl(new GMapTypeControl()); 42 map.centerAndZoom(centerPoint, zoomLevel); 48 if(centerPoint != null && zoomLevel != null) 49 map.centerAndZoom(centerPoint, zoomLevel); 43 50 return map; 44 51 } 45 52 46 // Debug function 47 function activateShowCoords(map) 53 function setMapClickCallback(map, callback) 48 54 { 49 GEvent.addListener(map, 'click', function(overlay, point) { 50 if (point) 51 { 52 var marker = new GMarker(point); 53 marker.open 54 GEvent.addListener(marker, "click", function() { 55 marker.openInfoWindowHtml(point.x + " " + point.y); 56 }); 57 map.addOverlay(marker); 58 } 59 }); 55 GEvent.addListener(map, 'click', callback); 60 56 } 61 57 -
trunk/wifidog-auth/wifidog/lib
- Property svn:ignore
-
old new 1 1 *~ 2 2 .directory 3 magpie 4 smarty 5 Phlickr
-
- Property svn:ignore
-
trunk/wifidog-auth/wifidog/lib/.cvsignore
r152 r695 1 1 *~ 2 2 .directory 3 magpie 4 smarty 5 Phlickr -
trunk/wifidog-auth/wifidog/lib/smarty
- Property svn:ignore
-
old new 1 * 1 plugins 2 internals 3 Smarty.class.php 4 Smarty_Compiler.class.php 5 debug.tpl 6 Config_File.class.php
-
- Property svn:ignore
-
trunk/wifidog-auth/wifidog/lib/smarty/.cvsignore
r157 r695 1 * 2 1 plugins 2 internals 3 Smarty.class.php 4 Smarty_Compiler.class.php 5 debug.tpl 6 Config_File.class.php
