# HG changeset patch # User Lennard de Rijk # Date 1244146091 -7200 # Node ID c9283c3102cee2cdf56c3099a5a96301e9488c2f # Parent eb1a6abdb05666dad446f61f38a20eba70f8c8ae# Parent 723dfa4811e868f18cd5220af776e64e8477b7cc Merge with Pawel's tip. diff -r eb1a6abdb056 -r c9283c3102ce app/soc/content/css/soc-090421.css --- a/app/soc/content/css/soc-090421.css Thu Jun 04 22:02:14 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,646 +0,0 @@ -/* -Copyright 2009 the Melange authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - */ - -/* - * STANDARD HTML TAGS - */ - -body { - background-color: white; - color: black; - - font-family: Arial, sans-serif; - font-size: medium; - - margin: 8px; - margin-top: 3px; -} - -img { - border: 0; -} - -form { - margin: 0; - padding: 0; -} - -li { - margin-bottom: 0.25em; -} - -/* HEADERS */ -h1 { - font-size: x-large; - margin-top: 0px; -} - -h2 { - font-size: large; -} - -h3 { - font-size: medium; -} - -h4 { - font-size: small; -} - -/* PRE-FORMATTED TEXT */ -pre, code { - color: #007000; - font-family: "bogus font here", monospace; - font-size: 100%; -} - -pre { - border: 1px solid silver; - background-color: #f5f5f5; - padding: 0.5em; - overflow: auto; - margin: 2em; -} - -pre ins { - color: #cc0000; - font-weight: bold; - text-decoration: none; -} - -/* LINKS AND ANCHORS */ -a:link { - color: #0000cc; -} - -a:active { - color: #cc0000; -} - -a:visited { - color: #551a8b; -} - -a.selected, .selected a, .selected { - color: black; - font-weight: bold; - text-decoration: none; -} - -a.novisit { - color: #2a55a3; -} - -a.noul, a.noulv { - color: #4182fa; /* #93b7fa; */ - text-decoration: none; -} - -a:hover.noul { - text-decoration: underline; -} - -a:visited.noul { - color: #a32a91; /* #2a55a3; */ -} - - -/* Styles used by Django Forms */ -ul.errorlist { - color: #FF0000; - font-size: small; -} - - -/* TABLES */ -table { - border-collapse: collapse; -} - -th, td { - /*padding: 0;*/ - padding:2px 5px; - vertical-align: top; - text-align: left; -} - -/* FORM FIELDS */ -td.formfieldrequired { - font-style: italic; - font-size: small; - text-align: center; -} - -td.formfieldhelptext { - font-style: italic; - font-size: small; - padding: 5px; -} - -td.formfielderror { - color: #FF0000; - font-size: small; -} - -td.formfieldheading { - font-weight: bold; - font-size: small; -} - -td.formfieldlabel { - font-weight: bold; - font-size: small; - text-align: right; -} - -td.twolineformfieldlabel { - font-weight: bold; - font-size: small; - text-align: left; -} - -td.twolineformfieldlabel { - font-weight: bold; - font-size: small; -} - -td.twolineformfielderrorlabel { - font-weight: bold; - color: #FF0000; - font-size: small; -} - -td.formfieldvalue { - text-align: left; -} - -td.formfieldvalue input { - width: 100%; -} - -td.formfieldvalue input[type=checkbox] { - width: auto; -} - -td.formfieldvalue input:focus { - background-color: #FFFF99; - font-weight: bold; -} - -td.formfieldvalue textarea { - width: 100%; -} - -td.formfieldvalue select { - width: 100%; -} - -td.formfielderrorlabel, td.warning, span.formfielderrorlabel { - font-weight: bold; - color: #FF0000; - font-size: small; - text-align: right; -} - -/* TABLE QUEUES (used with .list) */ -table#queues { - border-collapse: collapse; - width: 100%; -} - -table#queues tr { - border-bottom: thin solid lightgray; -} - -table#queues td { - padding: 2px; -} - -/* TOOLTIPS */ - -#purr-container { - position: fixed; - bottom: 0; - right: 0; -} - -.tooltip { - position: relative; - width: 300px; -} - -.tooltip .close { - position: absolute; - top: 12px; - right: 12px; - display: block; - width: 18px; - height: 17px; - text-indent: -9999px; - background: url('/soc/content/images/purrClose.png') no-repeat 0 10px; -} - -.tooltip-body { - min-height: 50px; - padding: 22px 22px 0 22px; - background: url('/soc/content/images/purrTop.png') no-repeat left top; - color: #f9f9f9; -} - -.tooltip-body img { - width: 50px; - margin: 0 10px 0 0; - float: left; -} - -.tooltip-body h3 { - margin: 0; - font-size: 1.1em; -} - -.tooltip-body p { - margin: 5px 0 0 60px; - font-size: 0.8em; - line-height: 1.4em; -} - -.tooltip-bottom { - height: 22px; - background: url('/soc/content/images/purrBottom.png') no-repeat left top; -} - -/* - * PAGE ELEMENTS - */ - -#title { - border-top: 1px solid #3366cc; - background-color: #e5ecf9; - font-size: large; - font-weight: bold; - margin: 0; - padding: 0; - padding-top: 1px; - padding-bottom: 1px; - margin-top: 5px; - margin-left: 200px; - padding-left: 3px; -} - -#notice { - margin-left: 200px; - padding: 3px; -} - -#logo { - padding-right: 18px; - position: absolute; - left: 0; - top: -5px; -} - -#login { - text-align: right; -} - -#badge { - clear: both; - margin-top: 3.5em; - margin-bottom: 1em; - height: 53px; - font-style: italic; -} - -#body { - border-left: 1px dotted silver; - margin-left: 200px; - margin-right: 25px; - padding-left: 18px; - padding-bottom: 25px; -} - -#body .buttons { - margin-right: 4px; - margin-top: 20px; -} - -#body a.button, input[type^="submit"], input[type^="button"] { - margin: 0; - padding: 2px 5px 2px 5px; - font-family: Arial, Sans-serif; - font-size: 12px; - text-decoration: none; - color: #222; - cursor: default; - background: #ddd url("/soc/content/images/button-background.gif") repeat-x 0 0; - border: 1px solid #aaa; -} - -#body a.button:hover, input[type^="submit"]:hover, input[type^="button"]:hover { - border-color: #9cf #69e #69e #7af; -} - -#header { - height: 50px; - margin-bottom: 11px; - position: relative; -} - -#footer { - clear: both; - text-align: center; - margin-top: 3.5em; - margin-bottom: 1em; - background-image: url("http://www.google.com/images/art.gif"); - height: 53px; - background-repeat: no-repeat; - background-position: left center; - padding-left: 125px; -} - -#footer .text { - padding-top: 20px; -} - -#created { - font-size: x-small; - color:#C0C0C0; - text-align: right; -} - -/* Google Map */ -#role_profile_map { - height: 240px; - width: 320px; -} - -#org_home_extras { - position: relative; - margin:2em 0em 2em; - min-height:500px; -} - -#extras_left { - position: absolute; - width: 55%; - left: 0px; -} - -#extras_right { - position: absolute; - width: 43%; - right: 0px; - float: right; -} - -/* Organization home gmap */ -#org_home_map { - height: 500px; - width: 500px; -} - -/* SIDEBAR MENU */ -#side { - width: 200px; - margin-bottom: 3em; - float: left; - font-size: small; -} - -#menu ul { - margin: 0; - padding: 0; - list-style-type: none; - margin-bottom: 1em; - font-size: 95%; -} - -#menu ul ul { - margin-left: 10px; - margin-bottom: 0; -} - -#menu li { - margin-top: 4px; - list-style-type: none; - list-style-image: none; -} - -#menu img { - margin-right: 4px; -} - -#menu li.leaf { - padding-left: 14px; -} - -#menu h4 { - margin: 0; - padding: 0; - margin-bottom: 1em; -} - -/* */ - -span.unread { - font-weight: bold; - color: #FF0000; -} - -span.edited { - color: #808080; -} - -/* SEARCH FIELD */ -#search { - margin-top: 2em; -} - -#search .header { - font-weight: bold; - font-size: 90%; - margin-bottom: 1px; -} - -#search .button { - margin-top: 1px; -} - -#search .input input { - width: 125px; -} - -/* BLOG FEEDS */ -.blog { - border: 10px solid #e5ecf9; - border-top: 1px solid #3366cc; -} - -.blog h2 { - margin-top: 0.1em; - background-color: #e5ecf9; -} - -.blog h2 a { - text-decoration: none; - color: black; -} - -.blog h2 a:visited { - text-decoration: none; - color: black; -} - - -.blog .entry { - margin-bottom: 1em; -} - -.blog .title { - font-size: medium; -} - -.blog .author { - color: gray; - margin-bottom: 0.5em; -} - -.blog .snippet { - background-color: white; -} - -/* LIST */ -.list { - background-color: #E5ECF9; - border: 1px solid #93b7fa; - border-bottom: 2px solid #93b7fa; - padding: 3px; - -moz-border-radius: 5px 5px 0px 0px; -} - -.list .pagination { - text-align: right; - padding: 3px; -} - -.list table{ - background-color: white; -} - -.list table th { - background-color: #eeeeec; - border-right: 1px solid lightgray; - border-top: 1px solid lightgray; -} - -.list table tr.on { - background-color: #ff9; - cursor: hand; - cursor: pointer; -} - -.list table tr.off { - background-color: #fff; -} - -.list table td.last { - border-right: 1px solid lightgray; -} - -.list table .first { - border-left: 1px solid lightgray; -} - -.list table td.no_hand { - cursor: default; -} - -/* - * STUDENT PROPOSAL REVIEWS - */ -.studentproposalreview { - font-size: small; -} - -.studentproposalreview .title { - background-color: #e5ecf9; -} - -.studentproposalreview .student{ - background: #d0f5a9; -} - -.studentproposalcomment-public, -.studentproposalreview-public .other { - background: #f5f6ce; -} - -.studentproposalcomment-private, -.studentproposalreview-private .other { - background: #D2EDF6; -} - -/* - * CUSTOM CLASSES - */ - -.assignedslot { - background-color: #d0f5a9; -} - -.todo { - color: #cc0000; - font-size: 80%; -} - -.newmark { - color: red; - font-size: 80%; - vertical-align: top; -} - -.error { - color: red; -} - -.notice { - background:#fad163; - font-size: small; - font-weight: bold; -} - -.fieldhelptext { - width: 450px; - background:#fad163; - font-size: small; - border: 1px solid black; -} - -.rounded_ul { background: url(/soc/content/images/ul.gif) no-repeat top left; } -.rounded_ur { background: url(/soc/content/images/ur.gif) no-repeat top right; } -.rounded_ll { background: url(/soc/content/images/ll.gif) no-repeat bottom left; } -.rounded_lr { background: url(/soc/content/images/lr.gif) no-repeat bottom right; } - -/* Disabled text. */ -.disabled { - color: gray; -} - -.plaintext { - background:transparent none repeat scroll 0 0; - border:0 none; - color:black; -} diff -r eb1a6abdb056 -r c9283c3102ce app/soc/content/css/soc-090602.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/content/css/soc-090602.css Thu Jun 04 22:08:11 2009 +0200 @@ -0,0 +1,644 @@ +/* +Copyright 2009 the Melange authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +/* + * STANDARD HTML TAGS + */ + +body { + background-color: white; + color: black; + + font-family: Arial, sans-serif; + font-size: medium; + + margin: 8px; + margin-top: 3px; +} + +img { + border: 0; +} + +form { + margin: 0; + padding: 0; +} + +li { + margin-bottom: 0.25em; +} + +/* HEADERS */ +h1 { + font-size: x-large; + margin-top: 0px; +} + +h2 { + font-size: large; +} + +h3 { + font-size: medium; +} + +h4 { + font-size: small; +} + +/* PRE-FORMATTED TEXT */ +pre, code { + color: #007000; + font-family: "bogus font here", monospace; + font-size: 100%; +} + +pre { + border: 1px solid silver; + background-color: #f5f5f5; + padding: 0.5em; + overflow: auto; + margin: 2em; +} + +pre ins { + color: #cc0000; + font-weight: bold; + text-decoration: none; +} + +/* LINKS AND ANCHORS */ +a:link { + color: #0000cc; +} + +a:active { + color: #cc0000; +} + +a:visited { + color: #551a8b; +} + +a.selected, .selected a, .selected { + color: black; + font-weight: bold; + text-decoration: none; +} + +a.novisit { + color: #2a55a3; +} + +a.noul, a.noulv { + color: #4182fa; /* #93b7fa; */ + text-decoration: none; +} + +a:hover.noul { + text-decoration: underline; +} + +a:visited.noul { + color: #a32a91; /* #2a55a3; */ +} + + +/* Styles used by Django Forms */ +ul.errorlist { + color: #FF0000; + font-size: small; +} + + +/* TABLES */ +table { + border-collapse: collapse; +} + +th, td { + /*padding: 0;*/ + padding:2px 5px; + vertical-align: top; + text-align: left; +} + +/* FORM FIELDS */ +td.formfieldrequired { + font-style: italic; + font-size: small; + text-align: center; +} + +td.formfieldhelptext { + font-style: italic; + font-size: small; + padding: 5px; +} + +td.formfielderror { + color: #FF0000; + font-size: small; +} + +td.formfieldheading { + font-weight: bold; + font-size: small; +} + +td.formfieldlabel { + font-weight: bold; + font-size: small; + text-align: right; +} + +td.twolineformfieldlabel { + font-weight: bold; + font-size: small; + text-align: left; +} + +td.twolineformfieldlabel { + font-weight: bold; + font-size: small; +} + +td.twolineformfielderrorlabel { + font-weight: bold; + color: #FF0000; + font-size: small; +} + +td.formfieldvalue { + text-align: left; +} + +td.formfieldvalue input { + width: 100%; +} + +td.formfieldvalue input[type=checkbox] { + width: auto; +} + +td.formfieldvalue input:focus { + background-color: #FFFF99; + font-weight: bold; +} + +td.formfieldvalue textarea { + width: 100%; +} + +td.formfieldvalue select { + width: 100%; +} + +td.formfielderrorlabel, td.warning, span.formfielderrorlabel { + font-weight: bold; + color: #FF0000; + font-size: small; + text-align: right; +} + +/* TABLE QUEUES (used with .list) */ +table#queues { + border-collapse: collapse; + width: 100%; +} + +table#queues tr { + border-bottom: thin solid lightgray; +} + +table#queues td { + padding: 2px; +} + +/* TOOLTIPS */ + +#purr-container { + position: fixed; + bottom: 0; + right: 0; +} + +.tooltip { + position: relative; + width: 300px; +} + +.tooltip .close { + position: absolute; + top: 12px; + right: 12px; + display: block; + width: 18px; + height: 17px; + text-indent: -9999px; + background: url('/soc/content/images/purrClose.png') no-repeat 0 10px; +} + +.tooltip-body { + min-height: 50px; + padding: 22px 22px 0 22px; + background: url('/soc/content/images/purrTop.png') no-repeat left top; + color: #f9f9f9; +} + +.tooltip-body img { + width: 50px; + margin: 0 10px 0 0; + float: left; +} + +.tooltip-body h3 { + margin: 0; + font-size: 1.1em; +} + +.tooltip-body p { + margin: 5px 0 0 60px; + font-size: 0.8em; + line-height: 1.4em; +} + +.tooltip-bottom { + height: 22px; + background: url('/soc/content/images/purrBottom.png') no-repeat left top; +} + +/* + * PAGE ELEMENTS + */ + +#title { + border-top: 1px solid #3366cc; + background-color: #e5ecf9; + font-size: large; + font-weight: bold; + margin: 0; + padding: 0; + padding-top: 1px; + padding-bottom: 1px; + margin-top: 5px; + margin-left: 200px; + padding-left: 3px; +} + +#notice { + margin-left: 200px; + padding: 3px; +} + +#logo { + padding-right: 18px; + position: absolute; + left: 0; + top: -5px; +} + +#login { + text-align: right; +} + +#badge { + clear: both; + margin-top: 3.5em; + margin-bottom: 1em; + height: 53px; + font-style: italic; +} + +#body { + border-left: 1px dotted silver; + margin-left: 200px; + margin-right: 25px; + padding-left: 18px; + padding-bottom: 25px; +} + +#body .buttons { + margin-right: 4px; + margin-top: 20px; +} + +#body a.button, input[type^="submit"], input[type^="button"] { + margin: 0; + padding: 2px 5px 2px 5px; + font-family: Arial, Sans-serif; + font-size: 12px; + text-decoration: none; + color: #222; + cursor: default; + background: #ddd url("/soc/content/images/button-background.gif") repeat-x 0 0; + border: 1px solid #aaa; +} + +#body a.button:hover, input[type^="submit"]:hover, input[type^="button"]:hover { + border-color: #9cf #69e #69e #7af; +} + +#header { + height: 50px; + margin-bottom: 11px; + position: relative; +} + +#footer { + clear: both; + text-align: center; + margin-top: 3.5em; + margin-bottom: 1em; + background-image: url("http://www.google.com/images/art.gif"); + height: 53px; + background-repeat: no-repeat; + background-position: left center; + padding-left: 125px; +} + +#footer .text { + padding-top: 20px; +} + +#created { + font-size: x-small; + color:#C0C0C0; + text-align: right; +} + +/* Google Map */ +#role_profile_map { + height: 240px; + width: 320px; +} + +#org_home_extras { + margin:2em 0em 2em; + min-height:500px; +} + +#extras_left { + width: 55%; + left: 0px; + float: left; +} + +#extras_right { + width: 43%; + right: 0px; + float: right; +} + +/* Organization home gmap */ +#org_home_map { + height: 500px; + width: 500px; +} + +/* SIDEBAR MENU */ +#side { + width: 200px; + margin-bottom: 3em; + float: left; + font-size: small; +} + +#menu ul { + margin: 0; + padding: 0; + list-style-type: none; + margin-bottom: 1em; + font-size: 95%; +} + +#menu ul ul { + margin-left: 10px; + margin-bottom: 0; +} + +#menu li { + margin-top: 4px; + list-style-type: none; + list-style-image: none; +} + +#menu img { + margin-right: 4px; +} + +#menu li.leaf { + padding-left: 14px; +} + +#menu h4 { + margin: 0; + padding: 0; + margin-bottom: 1em; +} + +/* */ + +span.unread { + font-weight: bold; + color: #FF0000; +} + +span.edited { + color: #808080; +} + +/* SEARCH FIELD */ +#search { + margin-top: 2em; +} + +#search .header { + font-weight: bold; + font-size: 90%; + margin-bottom: 1px; +} + +#search .button { + margin-top: 1px; +} + +#search .input input { + width: 125px; +} + +/* BLOG FEEDS */ +.blog { + border: 10px solid #e5ecf9; + border-top: 1px solid #3366cc; +} + +.blog h2 { + margin-top: 0.1em; + background-color: #e5ecf9; +} + +.blog h2 a { + text-decoration: none; + color: black; +} + +.blog h2 a:visited { + text-decoration: none; + color: black; +} + + +.blog .entry { + margin-bottom: 1em; +} + +.blog .title { + font-size: medium; +} + +.blog .author { + color: gray; + margin-bottom: 0.5em; +} + +.blog .snippet { + background-color: white; +} + +/* LIST */ +.list { + background-color: #E5ECF9; + border: 1px solid #93b7fa; + border-bottom: 2px solid #93b7fa; + padding: 3px; + -moz-border-radius: 5px 5px 0px 0px; +} + +.list .pagination { + text-align: right; + padding: 3px; +} + +.list table{ + background-color: white; +} + +.list table th { + background-color: #eeeeec; + border-right: 1px solid lightgray; + border-top: 1px solid lightgray; +} + +.list table tr.on { + background-color: #ff9; + cursor: hand; + cursor: pointer; +} + +.list table tr.off { + background-color: #fff; +} + +.list table td.last { + border-right: 1px solid lightgray; +} + +.list table .first { + border-left: 1px solid lightgray; +} + +.list table td.no_hand { + cursor: default; +} + +/* + * STUDENT PROPOSAL REVIEWS + */ +.studentproposalreview { + font-size: small; +} + +.studentproposalreview .title { + background-color: #e5ecf9; +} + +.studentproposalreview .student{ + background: #d0f5a9; +} + +.studentproposalcomment-public, +.studentproposalreview-public .other { + background: #f5f6ce; +} + +.studentproposalcomment-private, +.studentproposalreview-private .other { + background: #D2EDF6; +} + +/* + * CUSTOM CLASSES + */ + +.assignedslot { + background-color: #d0f5a9; +} + +.todo { + color: #cc0000; + font-size: 80%; +} + +.newmark { + color: red; + font-size: 80%; + vertical-align: top; +} + +.error { + color: red; +} + +.notice { + background:#fad163; + font-size: small; + font-weight: bold; +} + +.fieldhelptext { + width: 450px; + background:#fad163; + font-size: small; + border: 1px solid black; +} + +.rounded_ul { background: url(/soc/content/images/ul.gif) no-repeat top left; } +.rounded_ur { background: url(/soc/content/images/ur.gif) no-repeat top right; } +.rounded_ll { background: url(/soc/content/images/ll.gif) no-repeat bottom left; } +.rounded_lr { background: url(/soc/content/images/lr.gif) no-repeat bottom right; } + +/* Disabled text. */ +.disabled { + color: gray; +} + +.plaintext { + background:transparent none repeat scroll 0 0; + border:0 none; + color:black; +} diff -r eb1a6abdb056 -r c9283c3102ce app/soc/content/js/map-090420.js --- a/app/soc/content/js/map-090420.js Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/content/js/map-090420.js Thu Jun 04 22:08:11 2009 +0200 @@ -180,14 +180,13 @@ // HTML div tag where map needs to be inserted var map_div = "org_home_map"; + // Geo Data to be displayed on Google Maps + var geo_data = null; + var geo_data_keys = []; + // Geocoder object for obtaining locations from city/country var geocoder = new GClientGeocoder(); - - // Lat/lng pairs stored for drawing polylines. - var student_lat = 0; - var student_lng = 0; - var mentor_lat = 0; - var mentor_lng = 0; + var numGeocoded = 0; // Setup required icons var base_icon = new GIcon(); @@ -202,92 +201,91 @@ var mentor_icon = new GIcon(base_icon); mentor_icon.image = "/soc/content/images/mentor-marker.png"; - // Mark mentor marker if he has published the location and call - // drawStudentMarker function. - function drawMarkers(map_elem) { - function iterateStudents(students, mentor_name, mentor_published) { - for (student in students) { - drawStudentMarker(students[student], mentor_name, mentor_published); - } + Object.prototype.keys = function () + { + var keys = []; + for(i in this) if (this.hasOwnProperty(i)) + { + keys.push(i); } - if (map_elem.type == 'mentor') { - geocoder.setBaseCountryCode(map_elem.ccTLD); - geocoder.getLatLng( - map_elem.city, - function(point) { - if (point) { - var marker = new GMarker(point, mentor_icon); - mentor_lat = marker.getPoint().lat(); - mentor_lng = marker.getPoint().lng(); - var html = "" + map_elem.name + "
Mentor"; + return keys; + } + + + // Mark student and enable a popup box upon click + function drawMarker(person) { + geocoder.setBaseCountryCode(person.ccTLD); + geocoder.getLocations( + person.city, + function(response) { + var delay = 0; + if (response.Status.code == 620) { + // Too fast, try again, with a small pause + delay = 100; + } else { + if (response.Status.code == 200) { + // Success; do something with the address. + var html = ""; + var marker = null; + + place = response.Placemark[0]; + point = new GLatLng(place.Point.coordinates[1], + place.Point.coordinates[0]); + if (person.type == 'mentor') { + marker = new GMarker(point, mentor_icon); + html = "" + person.name + "
Mentor"; + } else if (person.type == 'student') { + marker = new GMarker(point, student_icon); + html = "" + person.name + "
"; + html += "" + person.summary + "
"; + html += "Mentor: " + person.mentor; + } + GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(html); + marker.openInfoWindowHtml(html); }); + map.addOverlay(marker); - } else { - mentor_lat = null; - mentor_lng = null; } - iterateStudents(map_elem.students, map_elem.name, true); + + // Move onto the next address; this skips bad addresses, too. + numGeocoded += 1; } - ); - } else if (map_elem.type == 'none') { - drawStudentMarker(map_elem.student, map_elem.name, false); - } - } - - // Mark student and enable a popup box upon click - function drawStudentMarker(student, mname, mentor_published) { - geocoder.setBaseCountryCode(student.ccTLD); - geocoder.getLatLng( - student.city, - function(point) { - if (point) { - var marker = new GMarker(point, student_icon); - var html = "" + student.name + "
"; - html += "" + student.summary + "
"; - html += "Mentor: " + mname; - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(html); - }); - student_lat = marker.getPoint().lat(); - student_lng = marker.getPoint().lng(); - map.addOverlay(marker); - } else { - student_lat = null; - student_lng = null; - } - if (mentor_published) { - drawPolyLine(); - } + + window.setTimeout(geocodeAll, delay); } ); } - // Draw a polyline between the student and his mentor - drawPolyLine = function() { - var polyline = new GPolyline([ - new GLatLng(mentor_lat, mentor_lng), - new GLatLng(student_lat, student_lng) - ], "#ff0000", 3); + // Draw a polyline between two points + drawPolyLine = function(from, to) { + var polyline = new GPolyline([from, to], "#ff0000", 3); map.addOverlay(polyline); } - + + function geocodeAll() { + if (numGeocoded < geo_data_keys.length) { + drawMarker(geo_data[geo_data_keys[numGeocoded]]) + } + } + // Map load function this.map_load = function(map_data) { // Check if browser is gmap compatible. if (GBrowserIsCompatible()) { + geo_data = map_data; + // Create the map and add small controls map = new GMap2(document.getElementById(map_div)); map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); + map.addControl(new GMapTypeControl()); // Set map center and initial zoom level map.setCenter(new GLatLng(0, 0), 1); + geocoder.setCache(null); + geo_data_keys = geo_data.keys() + window.setTimeout(geocodeAll, 50); - for (elem in map_data) { - drawMarkers(map_data[elem]) - } } } }; diff -r eb1a6abdb056 -r c9283c3102ce app/soc/templates/soc/base.html --- a/app/soc/templates/soc/base.html Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/templates/soc/base.html Thu Jun 04 22:08:11 2009 +0200 @@ -16,7 +16,7 @@ {% block stylesheet %} - + diff -r eb1a6abdb056 -r c9283c3102ce app/soc/templates/soc/organization/home.html --- a/app/soc/templates/soc/organization/home.html Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/templates/soc/organization/home.html Thu Jun 04 22:08:11 2009 +0200 @@ -37,8 +37,13 @@ {% endif %} {% endblock %} - {% block home_extras %} +{% for list_number in list.lists %} +

+ {% include list.nextList %} +

+{% endfor %} +{% comment %}
{% for list_number in list.lists %} @@ -53,4 +58,5 @@ {% endif %}
+{% endcomment %} {% endblock %} diff -r eb1a6abdb056 -r c9283c3102ce app/soc/templates/soc/organization/list/row.html --- a/app/soc/templates/soc/organization/list/row.html Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/templates/soc/organization/list/row.html Thu Jun 04 22:08:11 2009 +0200 @@ -21,7 +21,9 @@ {% endif %} {{ list.item.ideas|urlizetrunc:35|removetags:"a" }} + {% if list.item.ideas %} + {% endif %} diff -r eb1a6abdb056 -r c9283c3102ce app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/views/helper/params.py Thu Jun 04 22:08:11 2009 +0200 @@ -152,71 +152,77 @@ new_params['extra_django_patterns'] = [] new_params['django_patterns_defaults'] = [] + # Defines the module package that the view is in. If it is not + # already defined in the respective view, it defaults to + # soc.views.models + if not params.get('module_package'): + new_params['module_package'] = 'soc.views.models' + if not params.get('no_edit'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pedit)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.edit', 'Edit %(name_short)s')] + '%(module_package)s.%(module_name)s.edit', 'Edit %(name_short)s')] if not params.get('no_delete'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pdelete)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.delete', 'Delete %(name_short)s')] + '%(module_package)s.%(module_name)s.delete', 'Delete %(name_short)s')] if not params.get('no_show'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pshow)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.public', 'Show %(name_short)s')] + '%(module_package)s.%(module_name)s.public', 'Show %(name_short)s')] if not params.get('no_admin'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Padmin)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.admin', + '%(module_package)s.%(module_name)s.admin', 'Show %(name_short)s (admin)')] if not params.get('no_create_raw'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_create_with_scope'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(scope)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_create_with_key_fields'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_list_raw'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist)$', - 'soc.views.models.%(module_name)s.list', 'List %(name_plural)s')] + '%(module_package)s.%(module_name)s.list', 'List %(name_plural)s')] if params.get('pickable'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Ppick)$', - 'soc.views.models.%(module_name)s.pick', 'Pick %(name_short)s')] + '%(module_package)s.%(module_name)s.pick', 'Pick %(name_short)s')] if params.get('export_content_type'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pexport)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.export', 'Export %(name_short)s')] + '%(module_package)s.%(module_name)s.export', 'Export %(name_short)s')] if params.get('sans_link_id_create'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if params.get('sans_link_id_list'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.list', 'List %(name_plural)s')] + '%(module_package)s.%(module_name)s.list', 'List %(name_plural)s')] if params.get('sans_link_id_public_list'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist_public)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.list_public', + '%(module_package)s.%(module_name)s.list_public', 'List %(name_plural)s')] new_params['public_template'] = 'soc/%(module_name)s/public.html' % params diff -r eb1a6abdb056 -r c9283c3102ce app/soc/views/models/organization.py --- a/app/soc/views/models/organization.py Thu Jun 04 22:02:14 2009 +0200 +++ b/app/soc/views/models/organization.py Thu Jun 04 22:08:11 2009 +0200 @@ -421,40 +421,20 @@ return self._list(request, params, contents, page_name) def _getMapData(self, student_project_params, filter=None): - """Constructs the JSON object required to generate a - Google map on organization home page. + """Constructs the JSON object required to generate + Google Maps on organization home page. Args: student_project_params: params for student project view filter: a dict for the properties that the entities should have Returns: - A JSON object containing map data with the following structure. - [ - { - 'type': 'mentor', - 'name': MentorName, - 'city': CityName, - 'ccTLD': ccTLD, - 'students': [{'name': Name, 'city': CityName, 'ccTLD': ccTLD, - 'summary': Summary, 'url': URL}, - {'name': Name, 'city': CityName, 'ccTLD': ccTLD, - 'summary': Summary, 'url': URL}, ] - }, - { - 'type': 'none', - 'name': MentorName, - 'student': {'name': Name, 'city': CityName, 'ccTLD': ccTLD, - 'summary': Summary, 'url': URL} - } - ] + A JSON object containing map data. """ from soc.logic.models.student_project import logic as student_project_logic - map_data = [] - mentors = {} - student_only = [] + people = {} # get all the student_project entities for this organization student_project_entities = student_project_logic.getForFields(filter=filter) @@ -465,67 +445,31 @@ # have allowed to publish their locations. for entity in student_project_entities: - if entity.mentor.publish_location and entity.mentor not in mentors: + if entity.mentor.publish_location and (entity.mentor.key().name() not in people.keys()): # if mentor has allowed to publish his location add it to the # mentors dictionary - mentors[entity.mentor] = [] + people[entity.mentor.key().name()] = { + 'type': 'mentor', + 'name': entity.mentor.name(), + 'city': entity.mentor.res_city, + 'ccTLD': entity.mentor.ccTld(), + 'students': [] + } if entity.student.publish_location: - # if student has allowed to publish his location, add it to the - # corresponding mentor list, otherwise add it to the 'none' list - if entity.mentor in mentors: - mentors[entity.mentor].append( - (entity.student, entity.title, - redirects.getPublicRedirect(entity, student_project_params))) - else: - student_only.append( - (entity.student, entity.title, - redirects.getPublicRedirect(entity, student_project_params), - entity.mentor)) - - # from the index built in the form of mentors dictionary we now build - # the map_data for all the mentors who have allowed to publish their - # location - for mentor in mentors: - mentor_map = { - 'type': 'mentor', - 'name': mentor.name(), - 'city': mentor.res_city, - 'ccTLD': mentor.ccTld(), - 'students': [] + if entity.mentor.publish_location: + people[entity.mentor.key().name()]['students'].append(entity.student.key().name()) + people[entity.student.key().name()] = { + 'type': 'student', + 'name': entity.student.name(), + 'city': entity.student.res_city, + 'ccTLD': entity.student.ccTld(), + 'summary': entity.title, + 'url': redirects.getPublicRedirect(entity, student_project_params), + 'mentor': entity.mentor.name() } - for student, summary, url in mentors[mentor]: - student_map = { - 'name': student.name(), - 'city': student.res_city, - 'ccTLD': student.ccTld(), - 'summary': summary, - 'url': url - } - - mentor_map['students'].append(student_map) - - map_data.append(mentor_map) - - # construct the 'type': 'none' dictionary for those students, whose - # mentors haven't allowed to publish location - for student, summary, url, mentor in student_only: - nomentor_map = { - 'type': 'none', - 'name': mentor.name(), - 'student': { - 'name': student.name(), - 'city': student.res_city, - 'ccTLD': student.ccTld(), - 'summary': summary, - 'url': url - } - } - - map_data.append(nomentor_map) - - return simplejson.dumps(map_data) + return simplejson.dumps(people) def _public(self, request, entity, context): """See base.View._public().