Renamed several files due to recent changes.
--- a/app/soc/content/css/soc-090627.css Mon Jul 06 16:21:51 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,877 +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
- */
-@import '/soc/content/css/ui.all.css';
-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;
-}
-
-/* Surveys */
-
-
-div #survey_widget {
- margin: 20px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- background-color: #FFFEEB;
- border: 5px solid #F7CA75;
- padding: 15px;
- /*max-width: 700px;*/
-}
-
-
-div #survey_widget.survey_admin {
-/* TODO(ajaksu) remove if unnecessary */
-}
-
-div #survey_widget table {
- width:100%
-}
-
-div #survey_widget th,
-div #survey_widget td {
- padding-top: 15px;
-}
-
-/* fields */
-
-div #survey_widget textarea.long_answer {
- padding: 10px;
- width: 500px;
-}
-
-div #survey_widget textarea.tooltip_entry {
- padding: 10px;
- width: 80%;
-}
-
-div #survey_widget input.text_question {
- width: 320px;
-}
-
-div #survey_widget td.formfieldlabel {
- font-size: medium;
-}
-
-#survey_widget.view input[disabled="disabled"],
-#survey_widget.view textarea[disabled="disabled"],
-#survey_widget.view select[disabled="disabled"],
-#survey_widget.view option {
- color: black;
-}
-
-#survey_widget.quant_radio input,
-#survey_widget.quant_radio label {
- clear: left;
- display: block;
- float: left;
- margin: 4px;
-}
-
-/* options */
-
-div #survey_options button {
- display: block;
- margin: 10px 0 0;
-}
-
-div #survey_options {
- margin: 20px 0 0 0;
-}
-
-div #survey_widget a.delete {
- float:left;
- margin:-1px 7px;
-}
-
-div #survey_widget th label {
- display: block;
- max-width: 180px;
-}
-
-div #survey_widget tr.role-specific label {
- color: #666666;
-}
-
-
-span.formfieldlabel {
- font-weight: bold;
- font-size: small;
-}
-
-.sortable_li {
- border: solid 1px !important;
- padding: 5px !important;
-}
-
-.sortable_li,
-div #survey_widget fieldset {
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
-}
-
-div #survey_widget fieldset,
-div #survey_widget th,
-div #survey_widget td,
-div #survey_widget select {
-}
-
-div #survey_widget td {
-}
-
-div #survey_widget label {
-}
-
-div #survey_widget fieldset select {
-}
-
-div #survey_widget fieldset textarea,
-div #survey_widget fieldset input {
- margin: 10px;
-}
-
-div #survey_widget textarea.comment{
-margin-bottom: 30px;
-}
-
-div #survey_widget td > fieldset > label {
- font-size: 11px;
-}
-
-
-#dialog {
- font-size: 62.5%;
-}
-
-#dialog input {
- margin: 5px;
-}
-
-#dialog label, #dialog input {
- display: block;
-}
-
-#dialog p {
- text-align: center;
- padding-left: 0;
-}
-
-#dialog input.text {
- margin-bottom: 12px;
- width: 95%;
- padding: .4em;
-}
-
-#dialog fieldset {
- padding: 0;
- border: 0;
- margin-top: 25px;
-}
-
-#dialog h1 {
- font-size: 1.2em;
- margin: .6em 0;
-}
-
-.ui-button {
- outline: 0;
- margin: 0;
- padding: .4em 1em .5em;
- text-decoration: none;
- cursor:pointer;
- position: relative;
- text-align: center;
-}
-
-.ui-dialog .ui-state-highlight,
-.ui-dialog .ui-state-error {
- padding: .3em;
-}
-
-.pick_multi input {
- display: inline;
-}
-
-/* NEWS FEED FEEDS */
-.news_feed {
- border: 10px solid #e5ecf9;
- border-top: 1px solid #3366cc;
- float:left;
-}
-
-.news_feed .inner{
- padding:0 20px;
-}
-
-.news_feed h2 {
- margin-top: 0.1em;
- background-color: #e5ecf9;
-}
-
-.news_feed h2 a {
- text-decoration: none;
- color: black;
-}
-
-.news_feed h2 a:visited {
- text-decoration: none;
- color: black;
-}
-
-.news_feed .entry {
- margin:1em 0.3em;
-}
-
-.news_feed .title {
- font-size: medium;
-}
-
-.news_feed .time {
- color: gray;
- margin-bottom: 0.5em;
-}
-
-.news_feed .snippet {
- background-color: white;
-}
-
-a#feed_icon img{
- margin:-1px 0;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/content/css/soc-090706.css Mon Jul 06 16:32:14 2009 +0200
@@ -0,0 +1,877 @@
+/*
+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
+ */
+@import '/soc/content/css/ui.all.css';
+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;
+}
+
+/* Surveys */
+
+
+div #survey_widget {
+ margin: 20px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ background-color: #FFFEEB;
+ border: 5px solid #F7CA75;
+ padding: 15px;
+ /*max-width: 700px;*/
+}
+
+
+div #survey_widget.survey_admin {
+/* TODO(ajaksu) remove if unnecessary */
+}
+
+div #survey_widget table {
+ width:100%
+}
+
+div #survey_widget th,
+div #survey_widget td {
+ padding-top: 15px;
+}
+
+/* fields */
+
+div #survey_widget textarea.long_answer {
+ padding: 10px;
+ width: 500px;
+}
+
+div #survey_widget textarea.tooltip_entry {
+ padding: 10px;
+ width: 80%;
+}
+
+div #survey_widget input.text_question {
+ width: 320px;
+}
+
+div #survey_widget td.formfieldlabel {
+ font-size: medium;
+}
+
+#survey_widget.view input[disabled="disabled"],
+#survey_widget.view textarea[disabled="disabled"],
+#survey_widget.view select[disabled="disabled"],
+#survey_widget.view option {
+ color: black;
+}
+
+#survey_widget.quant_radio input,
+#survey_widget.quant_radio label {
+ clear: left;
+ display: block;
+ float: left;
+ margin: 4px;
+}
+
+/* options */
+
+div #survey_options button {
+ display: block;
+ margin: 10px 0 0;
+}
+
+div #survey_options {
+ margin: 20px 0 0 0;
+}
+
+div #survey_widget a.delete {
+ float:left;
+ margin:-1px 7px;
+}
+
+div #survey_widget th label {
+ display: block;
+ max-width: 180px;
+}
+
+div #survey_widget tr.role-specific label {
+ color: #666666;
+}
+
+
+span.formfieldlabel {
+ font-weight: bold;
+ font-size: small;
+}
+
+.sortable_li {
+ border: solid 1px !important;
+ padding: 5px !important;
+}
+
+.sortable_li,
+div #survey_widget fieldset {
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+
+div #survey_widget fieldset,
+div #survey_widget th,
+div #survey_widget td,
+div #survey_widget select {
+}
+
+div #survey_widget td {
+}
+
+div #survey_widget label {
+}
+
+div #survey_widget fieldset select {
+}
+
+div #survey_widget fieldset textarea,
+div #survey_widget fieldset input {
+ margin: 10px;
+}
+
+div #survey_widget textarea.comment{
+margin-bottom: 30px;
+}
+
+div #survey_widget td > fieldset > label {
+ font-size: 11px;
+}
+
+
+#dialog {
+ font-size: 62.5%;
+}
+
+#dialog input {
+ margin: 5px;
+}
+
+#dialog label, #dialog input {
+ display: block;
+}
+
+#dialog p {
+ text-align: center;
+ padding-left: 0;
+}
+
+#dialog input.text {
+ margin-bottom: 12px;
+ width: 95%;
+ padding: .4em;
+}
+
+#dialog fieldset {
+ padding: 0;
+ border: 0;
+ margin-top: 25px;
+}
+
+#dialog h1 {
+ font-size: 1.2em;
+ margin: .6em 0;
+}
+
+.ui-button {
+ outline: 0;
+ margin: 0;
+ padding: .4em 1em .5em;
+ text-decoration: none;
+ cursor:pointer;
+ position: relative;
+ text-align: center;
+}
+
+.ui-dialog .ui-state-highlight,
+.ui-dialog .ui-state-error {
+ padding: .3em;
+}
+
+.pick_multi input {
+ display: inline;
+}
+
+/* NEWS FEED FEEDS */
+.news_feed {
+ border: 10px solid #e5ecf9;
+ border-top: 1px solid #3366cc;
+ float:left;
+}
+
+.news_feed .inner{
+ padding:0 20px;
+}
+
+.news_feed h2 {
+ margin-top: 0.1em;
+ background-color: #e5ecf9;
+}
+
+.news_feed h2 a {
+ text-decoration: none;
+ color: black;
+}
+
+.news_feed h2 a:visited {
+ text-decoration: none;
+ color: black;
+}
+
+.news_feed .entry {
+ margin:1em 0.3em;
+}
+
+.news_feed .title {
+ font-size: medium;
+}
+
+.news_feed .time {
+ color: gray;
+ margin-bottom: 0.5em;
+}
+
+.news_feed .snippet {
+ background-color: white;
+}
+
+a#feed_icon img{
+ margin:-1px 0;
+}
--- a/app/soc/content/js/survey-edit-090703.js Mon Jul 06 16:21:51 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,772 +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.
- */
-
-/*
-*
-* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
-* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
-*/
-
-(function ($) {
-
- var DEFAULT_LONG_ANSWER_TEXT = 'Write a Custom Prompt For This Question...';
- var DEFAULT_SHORT_ANSWER_TEXT = 'Write a Custom Prompt...';
-
- $(function () {
- /*
- * == Set Selectors ==
- *
- */
- var widget = $('div#survey_widget');
-
- widget.parents('td.formfieldvalue:first').css({
- 'float': 'left',
- 'width': 200
- });
-
- /*
- * == Setup for existing surveys ==
- *
- */
-
- if ($('input#id_title').val() === '' && $('.formfielderror').length < 1) {
- widget.find('tr').remove();
- }
-
- widget.find('table:first').show();
-
- /*
- * Restore survey content html from editPost
- * if POST fails
- */
-
- var SURVEY_PREFIX = 'survey__';
- var del_el = ["<a class='delete'><img '",
- "src='/soc/content/images/minus.gif'/></a>"].join("");
- var del_li = ["<a class='delete_item' id='del_",
- "' ><img src='/soc/content/images/minus.gif'/></a> "];
-
- var survey_html = $('form').find("#id_survey_html").attr('value');
-
- function renderHTML() {
- // render existing survey forms
- widget.find('td > label').prepend(del_el).end();
-
- $('ol').find('li').each(
- function () {
- $(this).prepend(del_li.join($(this).attr('id'))).end();
- }
- );
- widget.find('.short_answer').each(
- function () {
- $(this).attr('name', SURVEY_PREFIX + $(this).getPosition() +
- 'short_answer__' + $(this).attr('name'));
- }
- );
-
- // add index information to choice fields
- widget.find('[name=create-option-button]').each(
- function () {
- $(
- '#index_for_' + $(this).attr('value')
- )
- .val(
- $(this).getPosition()
- );
- }
- );
-
- widget.find('.long_answer').each(
- function () {
- $(this).attr('name', SURVEY_PREFIX + $(this).getPosition() +
- 'long_answer__' + $(this).attr('name'))
- .attr('overflow', 'auto');
- // TODO: replace scrollbar with jquery autogrow
- }
- );
- }
-
- if (survey_html && survey_html.length > 1) {
- widget.html(survey_html); // we don't need to re-render HTML
-
- widget.find('.long_answer,input').each(
- function () {
- $(this).val($(this).attr('val'));
- }
- );
- }
- else {
- renderHTML();
- }
-
- var survey = widget.find('tbody:first');
- var options = widget.find('#survey_options');
-
- /*
- * == Handle Enter key on dialogs ==
- */
- $('form input, form button, form select').keypress(
- function (e) {
- if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
- $(this).parents('.ui-dialog:first').find(":button:first").click();
- return false;
- }
- }
- );
-
- /*
- * == Display survey answers inline ==
- */
- $('a.fetch_answers').click(
- function () {
- var user = this.id.replace('results_for_', '');
- var path = window.location.pathname;
- path = path.replace('/edit/', '/show/').replace('/results/', '/show/');
-
- // TODO(ajaksu) add Date().getTime() to query arg if needed
- var query = '?read_only=true&user_results=' + user;
- var scrollable = ['<div style="overflow-y: auto; ',
- 'margin-bottom: 100px;"></div>'].join("");
- $(scrollable).load(path + query + ' #survey_widget').dialog({
- title: user,
- height: 500,
- width: 700
- });
- }
- );
-
- /*
- * == Initiation ==
- *
- * Runs on PageLoad and Each Time Field is Added to Survey
- *
- */
-
- survey.bind('init',
- function () {
- // TODO(jamslevy) unnecessarily redundant
- // TODO(jamslevy) This should be refactored as a jQuery function that
- // acts on only a single field and it should be merged with renderHTML
- // since they have comparable functionality.
-
- widget.find('input').each(
- function () {
- if (($(this).val().length < 1 ||
- $(this).val() === DEFAULT_SHORT_ANSWER_TEXT) &&
- ($(this).attr('type') !== 'hidden')) {
- $(this).preserveDefaultText(DEFAULT_SHORT_ANSWER_TEXT);
- }
- }
- );
-
- widget.find('.long_answer, .tooltip_entry').each(
- function () {
- if ($(this).val().length < 1 ||
- $(this).val() === DEFAULT_LONG_ANSWER_TEXT) {
- $(this).preserveDefaultText(DEFAULT_LONG_ANSWER_TEXT);
- }
- $(this).growfield();
- }
- );
-
- widget.find('a.delete img').click(
- function () {
- // delete a field
- var this_field = $(this).parents('tr:first');
- var deleted_id = $(this_field).find('label').attr('for');
- var delete_this = confirm(["Deleting this field will remove all ",
- "answers submitted for this field. ",
- "Continue?"].join(""));
- if (delete_this) {
- var edit_form = $('#EditForm');
- var deleted_field = $('#__deleted__');
- if (deleted_field.val()) {
- deleted_field.val(deleted_field.val() + ',' +
- deleted_id.replace('id_', '')).end();
- }
- else {
- var deleted_input = $("<input type='hidden' value='" +
- deleted_id.replace('id_', '') + "' />");
- deleted_input.attr({'id': '__deleted__'}).attr({
- 'name': '__deleted__'
- });
- edit_form.append(deleted_input);
- }
- this_field.next('tr').remove().end()
- .remove();
- }
- }
- );
-
- // Add list/choice-field item to survey
- $('[name=create-option-button]').each(
- function () {
- $(this).click(
- function () {
- var new_option_val = $('#new_item_field_ul_id');
- var new_option_dialog = $("#new_item_dialog");
-
- new_option_val.val($(this).parents('fieldset').children('ol')
- .attr('id'));
-
- new_option_dialog.dialog('open').find('input:first').focus();
- }
- )
- .hover(
- function () {
- $(this).addClass("ui-state-hover");
- },
- function () {
- $(this).removeClass("ui-state-hover");
- }
- )
- .mousedown(
- function () {
- $(this).addClass("ui-state-active");
- }
- )
- .mouseup(
- function () {
- $(this).removeClass("ui-state-active");
- }
- );
- }
- );
-
- options.find('.AddQuestion').click(
- function (e) {
- // Choose a field type
- $("#new_question_button_id").val($(this).attr('id'));
- var question_options_div = $('#question_options_div');
- if ($(this).attr('id') === 'choice') {
- question_options_div.show();
- }
- else {
- question_options_div.hide();
- }
-
- $("#new_question_dialog").dialog('open').find('input:first')
- .focus();
- }
- );
- }).trigger('init')
- .bind('option_init',
- function () {
-
- // Delete list/choice-field item from survey
- widget.find('a.delete_item').click(
- function () {
- var to_delete = this.id.replace('del_', '');
- $('#delete_item_field').val(to_delete);
- $('#delete_item_dialog').dialog('open');
- }
- ).end();
-
- }
- ).trigger('option_init');
-
-
- /* GSOC ROLE-SPECIFIC FIELD PLUGIN
- * Choice between student/mentor renders required GSOC specific fields
- */
-
- var taking_access_field = $('select#id_taking_access');
-
- var addRoleFields = function (role_type) {
- // these should ideally be generated with django forms
- // TODO: apply info tooltips
- var CHOOSE_A_PROJECT_FIELD = [
- '<tr class="role-specific"><th><label>Choose Project:</label></th>',
- '<td> <select disabled=TRUE id="id_survey__NA__selection__project"',
- ' name="survey__1__selection__see"><option>Survey Taker\'s Projects',
- 'For This Program</option></select> </td></tr>'
- ].join("");
-
- var CHOOSE_A_GRADE_FIELD = [
- '<tr class="role-specific"><th><label>Assign Grade:</label></th><td>',
- '<select disabled=TRUE id="id_survey__NA__selection__grade"',
- 'name="survey__1__selection__see"><option>Pass/Fail</option></select>',
- '</td></tr>'
- ].join("");
-
- // flush existing role-specific fields
- var role_specific_fields = survey.find('tr.role-specific');
- role_specific_fields.remove();
-
- switch (role_type) {
- case "mentor evaluation":
- survey.prepend(CHOOSE_A_PROJECT_FIELD);
- survey.append(CHOOSE_A_GRADE_FIELD);
- break;
-
- case "student evaluation":
- survey.prepend(CHOOSE_A_PROJECT_FIELD);
- break;
- }
- };
-
- taking_access_field.change(
- function () {
- var role_type = $(this).val();
- addRoleFields(role_type);
- }
- );
-
- addRoleFields(taking_access_field.val());
-
- /*
- * == Survey Submission Handler ==
- */
- // Bind submit
- $('form').bind('submit',
- function () {
-
- /*
- * get rid of role-specific fields
- */
- survey.find('tr.role-specific').remove();
-
- /*
- * Save survey content html from editPost
- * if POST fails
- */
-
- // save field vals
- widget.find('.long_answer,input').each(
- function () {
- $(this).attr('val', $(this).val());
- }
- );
-
- $(this).find("#id_survey_html").attr('value', widget.html());
-
- // don't save default value
- widget.find('input').each(
- function () {
- if ($(this).val() === DEFAULT_SHORT_ANSWER_TEXT) {
- $(this).val('');
- }
- }
- );
-
- // don't save default value
- widget.find('.long_answer, .tooltip_entry').each(
- function () {
- if ($(this).val() === DEFAULT_LONG_ANSWER_TEXT) {
- $(this).val('');
- }
- }
- );
-
- // get rid of the options
- $('input#id_s_html')
- .val(
- widget
- .find(
- 'div#survey_options'
- )
- .remove()
- .end()
- .html()
- );
- // only needed for HTML
-
- // Get option order per field
- survey.find('.sortable').each(
- function () {
- $('#order_for_' + this.id)
- .val(
- $(this).sortable(
- 'serialize'
- )
- );
- }
- );
- }
- );
- });
-}(jQuery));
-
-
-(function ($) {
- /*
- * == Utils ==
- *
- */
- jQuery.fn.extend({
-
- // get position of survey field
- getPosition: function () {
- var this_fieldset = $(this).parents('fieldset:first');
- var this_table = this_fieldset.parents('table:first');
- var position = this_table.find('fieldset').index(this_fieldset) + '__';
- return position;
- }
- });
-}(jQuery));
-
-
-(function ($) {
- /*
- * == Sortable options ==
- */
- $(function () {
- $(".sortable").each(
- function (i, domEle) {
- $(domEle).sortable().disableSelection().end();
- }
- );
- });
-}(jQuery));
-
-
-(function ($) {
- /*
- * == Editable options ==
- */
- $(function () {
- function onSubmitEditable(content) {
- var id_ = $(this).parent().attr('id').replace('-li-', '_');
- id_ = id_ + '__field';
- $('#' + id_).val(content.current);
- }
- $('.editable_option').editable({
- editBy: 'dblclick',
- submit: 'change',
- cancel: 'cancel',
- onSubmit: onSubmitEditable
- });
- });
-}(jQuery));
-
-
-(function ($) {
- $(function () {
- var del_li = ["<a class='delete_item' id='del_",
- "' ><img src='/soc/content/images/minus.gif'/></a> "];
-
- // Confirmation dialog for deleting list/choice-field item from survey
- $("#delete_item_dialog").dialog({
- autoOpen: false,
- bgiframe: true,
- resizable: false,
- height: 300,
- modal: true,
- overlay: {
- backgroundColor: '#000',
- opacity: 0.5
- },
- buttons: {
- 'Delete this item': function () {
- $('#' + $('#delete_item_field').val()).remove();
- $('#delete_item_field').val('');
- $(this).dialog('close');
- },
- Cancel: function () {
- $('#delete_item_field').val('');
- $(this).dialog('close');
- }
- }
- });
-
-
- // Dialog for adding list/choice-field item to survey
- $("#new_item_dialog").dialog({
- bgiframe: true,
- autoOpen: false,
- height: 300,
- modal: true,
- buttons: {
- 'Add option': function () {
- var ol_id = $('#new_item_field_ul_id').val();
- var ol = $('#' + ol_id);
- var name = $('#new_item_name').val();
- var i = ol.find('li').length;
- var id_ = 'id_' + ol_id + '_' + i;
- var option_html = $([
- '<li id="id-li-', ol_id, '_', i,
- '" class="ui-state-defaolt sortable_li">',
- '<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>',
- '<span id="', id_, '" class="editable_option" name="', id_,
- '__field">', name, '</span>', '<input type="hidden" id="', id_,
- '__field" name="', id_, '__field" value="',
- name.replace(/\"/g,'"'), '" >', '</li>'
- ].join(""));
-
- ol.append(
- option_html
- .prepend(
- del_li.join(
- option_html.attr('id')
- )
- )
- );
- ol.sortable().disableSelection();
- $('#new_item_name').val('');
- $('#new_item_field_ol_id').val('');
- $(this).dialog('close');
- },
- Cancel: function () {
- $('#new_item_name').val('');
- $('#new_item_field_ul_id').val('');
- $(this).dialog('close');
- }
- }
- });
- });
-}(jQuery));
-
-
-(function ($) {
- $(function () {
- // Dialog for adding new question to survey
- var SURVEY_PREFIX = 'survey__';
- var del_el = ["<a class='delete'><img '",
- "src='/soc/content/images/minus.gif'/></a>"].join("");
- var del_li = ["<a class='delete_item' id='del_",
- "' ><img src='/soc/content/images/minus.gif'/></a> "];
-
-
- var widget = $('div#survey_widget');
- var survey = widget.find('tbody:first');
-
- $("#new_question_dialog").dialog({
- bgiframe: true,
- autoOpen: false,
- height: 400,
- modal: true,
- buttons: {
- 'Add question': function () {
- var button_id = $("#new_question_button_id").val();
- var survey_table = $('div#survey_widget').find('tbody:first');
- $("#new_question_button_id").val('');
-
- var field_template = $(["<tr><th><label>", del_el,
- "</label></th><td> </td></tr>"].join(""));
-
- var field_name = $("#new_question_name").val();
- var question_content = $("#new_question_content").val();
- var question_options = $("#new_question_options").val();
-
- if (field_name !== '') {
- $("#new_question_name").val('');
- $("#new_question_content").val('');
- $("#new_question_options").val('');
-
- var new_field = false;
- var type = button_id + "__";
- var field_count = survey_table.find('fieldset').length;
- var new_field_count = field_count + 1 + '__';
-
- var MIN_ROWS = 10;
- var MAX_ROWS = MIN_ROWS * 2;
- var DEFAULT_OPTION_TEXT = 'Add A New Option...';
- var default_option = ["<option>", DEFAULT_OPTION_TEXT,
- "</option>"].join("");
-
- // create the HTML for the field
- switch (button_id) {
- case "short_answer":
- new_field = ["<fieldset>\n",
- '<label for="required_for_',
- field_name, '">Required</label>',
- '<select id="required_for_', field_name,
- '" name="required_for_', field_name,
- '"><option value="True" selected="selected">True',
- '</option>', '<option value="False">False</option>',
- '</select>', '<label for="comment_for_',
- field_name, '">Allow Comments</label>',
- '<select id="comment_for_', field_name,
- '" name="comment_for_', field_name, '">',
- '<option value="True" selected="selected">',
- 'True</option>', '<option value="False">',
- 'False</option>', '</select>',
- "<input type='text' ",
- "class='short_answer'>", "</fieldset>"
- ].join("");
- break;
- case "long_answer":
- field_count = survey_table.find('fieldset').length;
- new_field_count = field_count + 1 + '__';
- new_field = ['<fieldset>\n', '<label for="required_for_',
- field_name, '">Required</label>',
- '<select id="required_for_', field_name,
- '" name="required_for_', field_name,
- '"><option value="True" selected="selected">True',
- '</option>', '<option value="False">False</option>',
- '</select>', '<label for="comment_for_',
- field_name, '">Allow Comments</label>',
- '<select id="comment_for_', field_name,
- '" name="comment_for_', field_name, '">',
- '<option value="True" selected="selected">',
- 'True</option>', '<option value="False">',
- 'False</option>', '</select>',
- "<textarea cols='40' rows='", MIN_ROWS,
- "' class='long_answer'/>", '</fieldset>'
- ].join("");
- break;
- case "selection":
- new_field = ["<select><option></option>", default_option,
- "</select>"].join("");
- break;
- case "pick_multi":
- new_field = ["<fieldset class='fieldset'><input type='button'",
- "value='", DEFAULT_OPTION_TEXT, "' /></fieldset>"]
- .join("");
- break;
- case "choice":
- new_field = ["<fieldset class='fieldset'><input type='button'",
- "value='", DEFAULT_OPTION_TEXT, "' /></fieldset>"]
- .join("");
- break;
- }
-
- if (new_field) {
- var question_for = [
- '\n <input type="hidden" name="NEW_', field_name,
- '" id="NEW_', field_name, '" value="', question_content,
- '"/>'
- ].join("");
-
- field_count = survey_table.find('fieldset').length;
- new_field_count = field_count + 1 + '__';
- var formatted_name = (SURVEY_PREFIX + new_field_count + type +
- field_name);
- if (button_id === 'choice') {
- var name = (field_name);
- new_field = $([
- '<fieldset>\n', '<label for="required_for_', name,
- '">Required</label>',
- '<select id="required_for_', name, '" name="required_for_',
- name, '"><option value="True" selected="selected">True',
- '</option>', '<option value="False">False</option>',
- '</select>', '<label for="comment_for_', name,
- '">Allow Comments</label>', '<select id="comment_for_', name,
- '" name="comment_for_', name, '">',
- '<option value="True" selected="selected">True</option>',
- '<option value="False">False</option>',
- '</select>',
- '<label for="render_for_', name,
- '">Render as</label>', '\n <select id="render_for_', name,
- '" name="render_for_', name, '">', '\n <option',
- 'selected="selected" value="select">select</option>',
- '\n <option value="checkboxes">checkboxes</option>',
- '\n <option value="radio_buttons">radio_buttons</option>',
- '\n </select>', '\n <input type="hidden" id="order_for_',
- name, '\n " name="order_for_', name, '" value=""/>',
- '\n <input type="hidden" id="index_for_', name,
- '\n " name="index_for_', name, '" value="',
- (field_count + 1), '"/>\n <ol id="', name,
- '" class="sortable"></ol>',
- question_for, '\n <button name="create-option-button"',
- 'id="create-option-button__', name,
- '" class="ui-button ui-state-default ui-corner-all" value="',
- name, '" onClick="return false;">Create new option',
- '</button>\n</fieldset>'
- ].join(""));
-
- $(new_field).attr({
- 'id': 'id_' + formatted_name,
- 'name': formatted_name
- });
- field_template
- .find(
- 'label'
- )
- .attr(
- 'for',
- 'NEW_' + name
- )
- .append(question_content).end()
- .find(
- 'td'
- )
- .append(new_field);
- survey_table.append(field_template).end();
-
- if (question_options) {
-
- var options_array = question_options.split('\n');
- var ol = $('#' + name);
- var length = options_array.length;
- var oname = '';
- var id_ = '';
- var option_html = '';
-
- for (var i = 0; i < length; i = i + 1) {
- id_ = 'id_' + name + '_' + i;
- oname = options_array[i];
- option_html = $([
- '<li id="id-li-', name, '_', i,
- '" class="ui-state-defaolt sortable_li">',
- '<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>',
- '<span id="' + id_ + '" class="editable_option" name="',
- id_, '__field">', oname, '</span>', '<input ',
- 'type="hidden" id="', id_, '__field" name="', id_,
- '__field" value="', oname.replace(/\"/g,'"'), '" >', '</li>'
- ].join(""));
- ol.append(option_html.prepend(
- del_li.join(option_html.attr('id'))));
- ol.sortable().disableSelection();
- }
-
- survey.trigger('option_init');
- }
- }
-
- else {
- new_field = $(new_field);
- // maybe the name should be serialized in a more common format
- $(new_field).find('.long_answer, .short_answer').attr({
- 'id': 'id_' + formatted_name,
- 'name': formatted_name
- });
- field_template.find(
- 'label'
- )
- .attr(
- 'for',
- 'id_' + formatted_name
- )
- .append(question_content).end()
- .find(
- 'td'
- )
- .append(new_field).append($(question_for));
-
- survey_table.append(field_template);
- }
-
- survey.trigger('init');
-
- }
- }
- $("#new_question_name").val('');
- $("#new_question_content").val('');
- $("#new_question_options").val('');
- $(this).dialog('close');
- },
-
- Cancel: function () {
- $('#new_question_name').val('');
- $("#new_question_button_id").val('');
- $("#new_question_content").val('');
- $("#new_question_options").val('');
- $(this).dialog('close');
- }
- }
- });
- });
-}(jQuery));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/content/js/survey-edit-090706.js Mon Jul 06 16:32:14 2009 +0200
@@ -0,0 +1,772 @@
+ /* 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.
+ */
+
+/*
+*
+* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
+* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
+*/
+
+(function ($) {
+
+ var DEFAULT_LONG_ANSWER_TEXT = 'Write a Custom Prompt For This Question...';
+ var DEFAULT_SHORT_ANSWER_TEXT = 'Write a Custom Prompt...';
+
+ $(function () {
+ /*
+ * == Set Selectors ==
+ *
+ */
+ var widget = $('div#survey_widget');
+
+ widget.parents('td.formfieldvalue:first').css({
+ 'float': 'left',
+ 'width': 200
+ });
+
+ /*
+ * == Setup for existing surveys ==
+ *
+ */
+
+ if ($('input#id_title').val() === '' && $('.formfielderror').length < 1) {
+ widget.find('tr').remove();
+ }
+
+ widget.find('table:first').show();
+
+ /*
+ * Restore survey content html from editPost
+ * if POST fails
+ */
+
+ var SURVEY_PREFIX = 'survey__';
+ var del_el = ["<a class='delete'><img '",
+ "src='/soc/content/images/minus.gif'/></a>"].join("");
+ var del_li = ["<a class='delete_item' id='del_",
+ "' ><img src='/soc/content/images/minus.gif'/></a> "];
+
+ var survey_html = $('form').find("#id_survey_html").attr('value');
+
+ function renderHTML() {
+ // render existing survey forms
+ widget.find('td > label').prepend(del_el).end();
+
+ $('ol').find('li').each(
+ function () {
+ $(this).prepend(del_li.join($(this).attr('id'))).end();
+ }
+ );
+ widget.find('.short_answer').each(
+ function () {
+ $(this).attr('name', SURVEY_PREFIX + $(this).getPosition() +
+ 'short_answer__' + $(this).attr('name'));
+ }
+ );
+
+ // add index information to choice fields
+ widget.find('[name=create-option-button]').each(
+ function () {
+ $(
+ '#index_for_' + $(this).attr('value')
+ )
+ .val(
+ $(this).getPosition()
+ );
+ }
+ );
+
+ widget.find('.long_answer').each(
+ function () {
+ $(this).attr('name', SURVEY_PREFIX + $(this).getPosition() +
+ 'long_answer__' + $(this).attr('name'))
+ .attr('overflow', 'auto');
+ // TODO: replace scrollbar with jquery autogrow
+ }
+ );
+ }
+
+ if (survey_html && survey_html.length > 1) {
+ widget.html(survey_html); // we don't need to re-render HTML
+
+ widget.find('.long_answer,input').each(
+ function () {
+ $(this).val($(this).attr('val'));
+ }
+ );
+ }
+ else {
+ renderHTML();
+ }
+
+ var survey = widget.find('tbody:first');
+ var options = widget.find('#survey_options');
+
+ /*
+ * == Handle Enter key on dialogs ==
+ */
+ $('form input, form button, form select').keypress(
+ function (e) {
+ if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) {
+ $(this).parents('.ui-dialog:first').find(":button:first").click();
+ return false;
+ }
+ }
+ );
+
+ /*
+ * == Display survey answers inline ==
+ */
+ $('a.fetch_answers').click(
+ function () {
+ var user = this.id.replace('results_for_', '');
+ var path = window.location.pathname;
+ path = path.replace('/edit/', '/show/').replace('/results/', '/show/');
+
+ // TODO(ajaksu) add Date().getTime() to query arg if needed
+ var query = '?read_only=true&user_results=' + user;
+ var scrollable = ['<div style="overflow-y: auto; ',
+ 'margin-bottom: 100px;"></div>'].join("");
+ $(scrollable).load(path + query + ' #survey_widget').dialog({
+ title: user,
+ height: 500,
+ width: 700
+ });
+ }
+ );
+
+ /*
+ * == Initiation ==
+ *
+ * Runs on PageLoad and Each Time Field is Added to Survey
+ *
+ */
+
+ survey.bind('init',
+ function () {
+ // TODO(jamslevy) unnecessarily redundant
+ // TODO(jamslevy) This should be refactored as a jQuery function that
+ // acts on only a single field and it should be merged with renderHTML
+ // since they have comparable functionality.
+
+ widget.find('input').each(
+ function () {
+ if (($(this).val().length < 1 ||
+ $(this).val() === DEFAULT_SHORT_ANSWER_TEXT) &&
+ ($(this).attr('type') !== 'hidden')) {
+ $(this).preserveDefaultText(DEFAULT_SHORT_ANSWER_TEXT);
+ }
+ }
+ );
+
+ widget.find('.long_answer, .tooltip_entry').each(
+ function () {
+ if ($(this).val().length < 1 ||
+ $(this).val() === DEFAULT_LONG_ANSWER_TEXT) {
+ $(this).preserveDefaultText(DEFAULT_LONG_ANSWER_TEXT);
+ }
+ $(this).growfield();
+ }
+ );
+
+ widget.find('a.delete img').click(
+ function () {
+ // delete a field
+ var this_field = $(this).parents('tr:first');
+ var deleted_id = $(this_field).find('label').attr('for');
+ var delete_this = confirm(["Deleting this field will remove all ",
+ "answers submitted for this field. ",
+ "Continue?"].join(""));
+ if (delete_this) {
+ var edit_form = $('#EditForm');
+ var deleted_field = $('#__deleted__');
+ if (deleted_field.val()) {
+ deleted_field.val(deleted_field.val() + ',' +
+ deleted_id.replace('id_', '')).end();
+ }
+ else {
+ var deleted_input = $("<input type='hidden' value='" +
+ deleted_id.replace('id_', '') + "' />");
+ deleted_input.attr({'id': '__deleted__'}).attr({
+ 'name': '__deleted__'
+ });
+ edit_form.append(deleted_input);
+ }
+ this_field.next('tr').remove().end()
+ .remove();
+ }
+ }
+ );
+
+ // Add list/choice-field item to survey
+ $('[name=create-option-button]').each(
+ function () {
+ $(this).click(
+ function () {
+ var new_option_val = $('#new_item_field_ul_id');
+ var new_option_dialog = $("#new_item_dialog");
+
+ new_option_val.val($(this).parents('fieldset').children('ol')
+ .attr('id'));
+
+ new_option_dialog.dialog('open').find('input:first').focus();
+ }
+ )
+ .hover(
+ function () {
+ $(this).addClass("ui-state-hover");
+ },
+ function () {
+ $(this).removeClass("ui-state-hover");
+ }
+ )
+ .mousedown(
+ function () {
+ $(this).addClass("ui-state-active");
+ }
+ )
+ .mouseup(
+ function () {
+ $(this).removeClass("ui-state-active");
+ }
+ );
+ }
+ );
+
+ options.find('.AddQuestion').click(
+ function (e) {
+ // Choose a field type
+ $("#new_question_button_id").val($(this).attr('id'));
+ var question_options_div = $('#question_options_div');
+ if ($(this).attr('id') === 'choice') {
+ question_options_div.show();
+ }
+ else {
+ question_options_div.hide();
+ }
+
+ $("#new_question_dialog").dialog('open').find('input:first')
+ .focus();
+ }
+ );
+ }).trigger('init')
+ .bind('option_init',
+ function () {
+
+ // Delete list/choice-field item from survey
+ widget.find('a.delete_item').click(
+ function () {
+ var to_delete = this.id.replace('del_', '');
+ $('#delete_item_field').val(to_delete);
+ $('#delete_item_dialog').dialog('open');
+ }
+ ).end();
+
+ }
+ ).trigger('option_init');
+
+
+ /* GSOC ROLE-SPECIFIC FIELD PLUGIN
+ * Choice between student/mentor renders required GSOC specific fields
+ */
+
+ var taking_access_field = $('select#id_taking_access');
+
+ var addRoleFields = function (role_type) {
+ // these should ideally be generated with django forms
+ // TODO: apply info tooltips
+ var CHOOSE_A_PROJECT_FIELD = [
+ '<tr class="role-specific"><th><label>Choose Project:</label></th>',
+ '<td> <select disabled=TRUE id="id_survey__NA__selection__project"',
+ ' name="survey__1__selection__see"><option>Survey Taker\'s Projects',
+ 'For This Program</option></select> </td></tr>'
+ ].join("");
+
+ var CHOOSE_A_GRADE_FIELD = [
+ '<tr class="role-specific"><th><label>Assign Grade:</label></th><td>',
+ '<select disabled=TRUE id="id_survey__NA__selection__grade"',
+ 'name="survey__1__selection__see"><option>Pass/Fail</option></select>',
+ '</td></tr>'
+ ].join("");
+
+ // flush existing role-specific fields
+ var role_specific_fields = survey.find('tr.role-specific');
+ role_specific_fields.remove();
+
+ switch (role_type) {
+ case "mentor evaluation":
+ survey.prepend(CHOOSE_A_PROJECT_FIELD);
+ survey.append(CHOOSE_A_GRADE_FIELD);
+ break;
+
+ case "student evaluation":
+ survey.prepend(CHOOSE_A_PROJECT_FIELD);
+ break;
+ }
+ };
+
+ taking_access_field.change(
+ function () {
+ var role_type = $(this).val();
+ addRoleFields(role_type);
+ }
+ );
+
+ addRoleFields(taking_access_field.val());
+
+ /*
+ * == Survey Submission Handler ==
+ */
+ // Bind submit
+ $('form').bind('submit',
+ function () {
+
+ /*
+ * get rid of role-specific fields
+ */
+ survey.find('tr.role-specific').remove();
+
+ /*
+ * Save survey content html from editPost
+ * if POST fails
+ */
+
+ // save field vals
+ widget.find('.long_answer,input').each(
+ function () {
+ $(this).attr('val', $(this).val());
+ }
+ );
+
+ $(this).find("#id_survey_html").attr('value', widget.html());
+
+ // don't save default value
+ widget.find('input').each(
+ function () {
+ if ($(this).val() === DEFAULT_SHORT_ANSWER_TEXT) {
+ $(this).val('');
+ }
+ }
+ );
+
+ // don't save default value
+ widget.find('.long_answer, .tooltip_entry').each(
+ function () {
+ if ($(this).val() === DEFAULT_LONG_ANSWER_TEXT) {
+ $(this).val('');
+ }
+ }
+ );
+
+ // get rid of the options
+ $('input#id_s_html')
+ .val(
+ widget
+ .find(
+ 'div#survey_options'
+ )
+ .remove()
+ .end()
+ .html()
+ );
+ // only needed for HTML
+
+ // Get option order per field
+ survey.find('.sortable').each(
+ function () {
+ $('#order_for_' + this.id)
+ .val(
+ $(this).sortable(
+ 'serialize'
+ )
+ );
+ }
+ );
+ }
+ );
+ });
+}(jQuery));
+
+
+(function ($) {
+ /*
+ * == Utils ==
+ *
+ */
+ jQuery.fn.extend({
+
+ // get position of survey field
+ getPosition: function () {
+ var this_fieldset = $(this).parents('fieldset:first');
+ var this_table = this_fieldset.parents('table:first');
+ var position = this_table.find('fieldset').index(this_fieldset) + '__';
+ return position;
+ }
+ });
+}(jQuery));
+
+
+(function ($) {
+ /*
+ * == Sortable options ==
+ */
+ $(function () {
+ $(".sortable").each(
+ function (i, domEle) {
+ $(domEle).sortable().disableSelection().end();
+ }
+ );
+ });
+}(jQuery));
+
+
+(function ($) {
+ /*
+ * == Editable options ==
+ */
+ $(function () {
+ function onSubmitEditable(content) {
+ var id_ = $(this).parent().attr('id').replace('-li-', '_');
+ id_ = id_ + '__field';
+ $('#' + id_).val(content.current);
+ }
+ $('.editable_option').editable({
+ editBy: 'dblclick',
+ submit: 'change',
+ cancel: 'cancel',
+ onSubmit: onSubmitEditable
+ });
+ });
+}(jQuery));
+
+
+(function ($) {
+ $(function () {
+ var del_li = ["<a class='delete_item' id='del_",
+ "' ><img src='/soc/content/images/minus.gif'/></a> "];
+
+ // Confirmation dialog for deleting list/choice-field item from survey
+ $("#delete_item_dialog").dialog({
+ autoOpen: false,
+ bgiframe: true,
+ resizable: false,
+ height: 300,
+ modal: true,
+ overlay: {
+ backgroundColor: '#000',
+ opacity: 0.5
+ },
+ buttons: {
+ 'Delete this item': function () {
+ $('#' + $('#delete_item_field').val()).remove();
+ $('#delete_item_field').val('');
+ $(this).dialog('close');
+ },
+ Cancel: function () {
+ $('#delete_item_field').val('');
+ $(this).dialog('close');
+ }
+ }
+ });
+
+
+ // Dialog for adding list/choice-field item to survey
+ $("#new_item_dialog").dialog({
+ bgiframe: true,
+ autoOpen: false,
+ height: 300,
+ modal: true,
+ buttons: {
+ 'Add option': function () {
+ var ol_id = $('#new_item_field_ul_id').val();
+ var ol = $('#' + ol_id);
+ var name = $('#new_item_name').val();
+ var i = ol.find('li').length;
+ var id_ = 'id_' + ol_id + '_' + i;
+ var option_html = $([
+ '<li id="id-li-', ol_id, '_', i,
+ '" class="ui-state-defaolt sortable_li">',
+ '<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>',
+ '<span id="', id_, '" class="editable_option" name="', id_,
+ '__field">', name, '</span>', '<input type="hidden" id="', id_,
+ '__field" name="', id_, '__field" value="',
+ name.replace(/\"/g,'"'), '" >', '</li>'
+ ].join(""));
+
+ ol.append(
+ option_html
+ .prepend(
+ del_li.join(
+ option_html.attr('id')
+ )
+ )
+ );
+ ol.sortable().disableSelection();
+ $('#new_item_name').val('');
+ $('#new_item_field_ol_id').val('');
+ $(this).dialog('close');
+ },
+ Cancel: function () {
+ $('#new_item_name').val('');
+ $('#new_item_field_ul_id').val('');
+ $(this).dialog('close');
+ }
+ }
+ });
+ });
+}(jQuery));
+
+
+(function ($) {
+ $(function () {
+ // Dialog for adding new question to survey
+ var SURVEY_PREFIX = 'survey__';
+ var del_el = ["<a class='delete'><img '",
+ "src='/soc/content/images/minus.gif'/></a>"].join("");
+ var del_li = ["<a class='delete_item' id='del_",
+ "' ><img src='/soc/content/images/minus.gif'/></a> "];
+
+
+ var widget = $('div#survey_widget');
+ var survey = widget.find('tbody:first');
+
+ $("#new_question_dialog").dialog({
+ bgiframe: true,
+ autoOpen: false,
+ height: 400,
+ modal: true,
+ buttons: {
+ 'Add question': function () {
+ var button_id = $("#new_question_button_id").val();
+ var survey_table = $('div#survey_widget').find('tbody:first');
+ $("#new_question_button_id").val('');
+
+ var field_template = $(["<tr><th><label>", del_el,
+ "</label></th><td> </td></tr>"].join(""));
+
+ var field_name = $("#new_question_name").val();
+ var question_content = $("#new_question_content").val();
+ var question_options = $("#new_question_options").val();
+
+ if (field_name !== '') {
+ $("#new_question_name").val('');
+ $("#new_question_content").val('');
+ $("#new_question_options").val('');
+
+ var new_field = false;
+ var type = button_id + "__";
+ var field_count = survey_table.find('fieldset').length;
+ var new_field_count = field_count + 1 + '__';
+
+ var MIN_ROWS = 10;
+ var MAX_ROWS = MIN_ROWS * 2;
+ var DEFAULT_OPTION_TEXT = 'Add A New Option...';
+ var default_option = ["<option>", DEFAULT_OPTION_TEXT,
+ "</option>"].join("");
+
+ // create the HTML for the field
+ switch (button_id) {
+ case "short_answer":
+ new_field = ["<fieldset>\n",
+ '<label for="required_for_',
+ field_name, '">Required</label>',
+ '<select id="required_for_', field_name,
+ '" name="required_for_', field_name,
+ '"><option value="True" selected="selected">True',
+ '</option>', '<option value="False">False</option>',
+ '</select>', '<label for="comment_for_',
+ field_name, '">Allow Comments</label>',
+ '<select id="comment_for_', field_name,
+ '" name="comment_for_', field_name, '">',
+ '<option value="True" selected="selected">',
+ 'True</option>', '<option value="False">',
+ 'False</option>', '</select>',
+ "<input type='text' ",
+ "class='short_answer'>", "</fieldset>"
+ ].join("");
+ break;
+ case "long_answer":
+ field_count = survey_table.find('fieldset').length;
+ new_field_count = field_count + 1 + '__';
+ new_field = ['<fieldset>\n', '<label for="required_for_',
+ field_name, '">Required</label>',
+ '<select id="required_for_', field_name,
+ '" name="required_for_', field_name,
+ '"><option value="True" selected="selected">True',
+ '</option>', '<option value="False">False</option>',
+ '</select>', '<label for="comment_for_',
+ field_name, '">Allow Comments</label>',
+ '<select id="comment_for_', field_name,
+ '" name="comment_for_', field_name, '">',
+ '<option value="True" selected="selected">',
+ 'True</option>', '<option value="False">',
+ 'False</option>', '</select>',
+ "<textarea cols='40' rows='", MIN_ROWS,
+ "' class='long_answer'/>", '</fieldset>'
+ ].join("");
+ break;
+ case "selection":
+ new_field = ["<select><option></option>", default_option,
+ "</select>"].join("");
+ break;
+ case "pick_multi":
+ new_field = ["<fieldset class='fieldset'><input type='button'",
+ "value='", DEFAULT_OPTION_TEXT, "' /></fieldset>"]
+ .join("");
+ break;
+ case "choice":
+ new_field = ["<fieldset class='fieldset'><input type='button'",
+ "value='", DEFAULT_OPTION_TEXT, "' /></fieldset>"]
+ .join("");
+ break;
+ }
+
+ if (new_field) {
+ var question_for = [
+ '\n <input type="hidden" name="NEW_', field_name,
+ '" id="NEW_', field_name, '" value="', question_content,
+ '"/>'
+ ].join("");
+
+ field_count = survey_table.find('fieldset').length;
+ new_field_count = field_count + 1 + '__';
+ var formatted_name = (SURVEY_PREFIX + new_field_count + type +
+ field_name);
+ if (button_id === 'choice') {
+ var name = (field_name);
+ new_field = $([
+ '<fieldset>\n', '<label for="required_for_', name,
+ '">Required</label>',
+ '<select id="required_for_', name, '" name="required_for_',
+ name, '"><option value="True" selected="selected">True',
+ '</option>', '<option value="False">False</option>',
+ '</select>', '<label for="comment_for_', name,
+ '">Allow Comments</label>', '<select id="comment_for_', name,
+ '" name="comment_for_', name, '">',
+ '<option value="True" selected="selected">True</option>',
+ '<option value="False">False</option>',
+ '</select>',
+ '<label for="render_for_', name,
+ '">Render as</label>', '\n <select id="render_for_', name,
+ '" name="render_for_', name, '">', '\n <option',
+ 'selected="selected" value="select">select</option>',
+ '\n <option value="checkboxes">checkboxes</option>',
+ '\n <option value="radio_buttons">radio_buttons</option>',
+ '\n </select>', '\n <input type="hidden" id="order_for_',
+ name, '\n " name="order_for_', name, '" value=""/>',
+ '\n <input type="hidden" id="index_for_', name,
+ '\n " name="index_for_', name, '" value="',
+ (field_count + 1), '"/>\n <ol id="', name,
+ '" class="sortable"></ol>',
+ question_for, '\n <button name="create-option-button"',
+ 'id="create-option-button__', name,
+ '" class="ui-button ui-state-default ui-corner-all" value="',
+ name, '" onClick="return false;">Create new option',
+ '</button>\n</fieldset>'
+ ].join(""));
+
+ $(new_field).attr({
+ 'id': 'id_' + formatted_name,
+ 'name': formatted_name
+ });
+ field_template
+ .find(
+ 'label'
+ )
+ .attr(
+ 'for',
+ 'NEW_' + name
+ )
+ .append(question_content).end()
+ .find(
+ 'td'
+ )
+ .append(new_field);
+ survey_table.append(field_template).end();
+
+ if (question_options) {
+
+ var options_array = question_options.split('\n');
+ var ol = $('#' + name);
+ var length = options_array.length;
+ var oname = '';
+ var id_ = '';
+ var option_html = '';
+
+ for (var i = 0; i < length; i = i + 1) {
+ id_ = 'id_' + name + '_' + i;
+ oname = options_array[i];
+ option_html = $([
+ '<li id="id-li-', name, '_', i,
+ '" class="ui-state-defaolt sortable_li">',
+ '<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>',
+ '<span id="' + id_ + '" class="editable_option" name="',
+ id_, '__field">', oname, '</span>', '<input ',
+ 'type="hidden" id="', id_, '__field" name="', id_,
+ '__field" value="', oname.replace(/\"/g,'"'), '" >', '</li>'
+ ].join(""));
+ ol.append(option_html.prepend(
+ del_li.join(option_html.attr('id'))));
+ ol.sortable().disableSelection();
+ }
+
+ survey.trigger('option_init');
+ }
+ }
+
+ else {
+ new_field = $(new_field);
+ // maybe the name should be serialized in a more common format
+ $(new_field).find('.long_answer, .short_answer').attr({
+ 'id': 'id_' + formatted_name,
+ 'name': formatted_name
+ });
+ field_template.find(
+ 'label'
+ )
+ .attr(
+ 'for',
+ 'id_' + formatted_name
+ )
+ .append(question_content).end()
+ .find(
+ 'td'
+ )
+ .append(new_field).append($(question_for));
+
+ survey_table.append(field_template);
+ }
+
+ survey.trigger('init');
+
+ }
+ }
+ $("#new_question_name").val('');
+ $("#new_question_content").val('');
+ $("#new_question_options").val('');
+ $(this).dialog('close');
+ },
+
+ Cancel: function () {
+ $('#new_question_name').val('');
+ $("#new_question_button_id").val('');
+ $("#new_question_content").val('');
+ $("#new_question_options").val('');
+ $(this).dialog('close');
+ }
+ }
+ });
+ });
+}(jQuery));
--- a/app/soc/content/js/survey-take-090705.js Mon Jul 06 16:21:51 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +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.
- */
-
-/*
-*
-* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
-* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
-*/
-
-(function ($) {
- $(function () {
-
- /*
- * == Setup Survey on Page Load ==
- *
- */
-
- var widget = $('div#survey_widget');
- widget.parents('td.formfieldvalue:first').css({
- 'float': 'left',
- 'width': 200
- });
-
- // TODO(ajaksu) survey below is unused, remove if no known use is predicted
- var survey = widget.find('tbody:first');
-
- if (widget.hasClass('create')) {
-
- /*
- * == Set Custom Field Rules ==
- *
- */
- widget.find('textarea').each(
- function () {
- $(this).attr('overflow', 'auto').growfield();
- }
- );
- }
-
- else { // survey has saved results
- widget.find('textarea').each(
- function () {
- $(this).attr('overflow', 'auto').growfield();
- }
- ).end()
- .find('.pick_multi').each(
- function () {
- $(this).find('input').each(
- function () {
- // if $(this).attr('checked', 'true');});
- }
- );
- }
- );
- }
-
- /*
- * == Configure Project ==
- *
- */
-
- // remember if form has been touched
- $('input,textarea,select').change(
- function () {
- if ($(this).attr('id') === 'id_project') {
- return;
- }
- $('form:first').data('touched', true);
- }
- );
-
- // remember initially chosen project choice
- $('select#id_project').blur(
- function () {
- $(this).data('selected', $(this).find('option:first'));
- }
- ).change(
- function () {
- if ($('form:first').data('touched') === true) {
- // if form has been touched, send confirmation dialog
- var save_check = confirm(["Switching projects will lose unsaved ",
- "edits made to this survey."].join(""));
- if (!save_check) {
- $(this).data('selected').attr('selected', 'selected');
- return false;
- }
- }
-
- if ($(this).val() !== 'None') {
- // redirect with new project GET param
- window.location = [window.location.href.split('?')[0], "?project=",
- $(this).val()].join("");
- }
- }
- );
-
- // insert project link after project select field
- $('div#project_link').insertAfter($('select#id_project')).show();
-
- /*
- * == Survey Submission Handler ==
- *
- */
-
- // validate form
- $('input[type=submit]').bind(
- 'click',
- function (e) {
- e.preventDefault();
-
- // validate project and grade choice fields
- if ($('select#id_project') &&
- $('select#id_project').val() === 'None') {
- return alert('Please Choose a Project');
- }
-
- if ($('select#id_grade') && $('select#id_grade').val() === 'None') {
- return alert('Please Choose a Grade');
- }
- $('form').trigger('submit');
-
- }
- );
-
- $('form').bind('submit',
- function () {
- $('input#id_s_html').val(
- widget.find('div#survey_options').remove().end().html()
- );
- }
- );
-
- /*
- * == Customize Comment Appearance ==
- */
-
- var comments = widget.find('td > .comment');
- comments.each(function(){
- $(this).parents('tr:first')
- .prev().css({'margin-top': '-10px'})
- .find('label').css({'font-size': '11px'});
- });
-
- });
-}(jQuery));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/content/js/survey-take-090706.js Mon Jul 06 16:32:14 2009 +0200
@@ -0,0 +1,157 @@
+/* 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.
+ */
+
+/*
+*
+* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a>
+* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a>
+*/
+
+(function ($) {
+ $(function () {
+
+ /*
+ * == Setup Survey on Page Load ==
+ *
+ */
+
+ var widget = $('div#survey_widget');
+ widget.parents('td.formfieldvalue:first').css({
+ 'float': 'left',
+ 'width': 200
+ });
+
+ // TODO(ajaksu) survey below is unused, remove if no known use is predicted
+ var survey = widget.find('tbody:first');
+
+ if (widget.hasClass('create')) {
+
+ /*
+ * == Set Custom Field Rules ==
+ *
+ */
+ widget.find('textarea').each(
+ function () {
+ $(this).attr('overflow', 'auto').growfield();
+ }
+ );
+ }
+
+ else { // survey has saved results
+ widget.find('textarea').each(
+ function () {
+ $(this).attr('overflow', 'auto').growfield();
+ }
+ ).end()
+ .find('.pick_multi').each(
+ function () {
+ $(this).find('input').each(
+ function () {
+ // if $(this).attr('checked', 'true');});
+ }
+ );
+ }
+ );
+ }
+
+ /*
+ * == Configure Project ==
+ *
+ */
+
+ // remember if form has been touched
+ $('input,textarea,select').change(
+ function () {
+ if ($(this).attr('id') === 'id_project') {
+ return;
+ }
+ $('form:first').data('touched', true);
+ }
+ );
+
+ // remember initially chosen project choice
+ $('select#id_project').blur(
+ function () {
+ $(this).data('selected', $(this).find('option:first'));
+ }
+ ).change(
+ function () {
+ if ($('form:first').data('touched') === true) {
+ // if form has been touched, send confirmation dialog
+ var save_check = confirm(["Switching projects will lose unsaved ",
+ "edits made to this survey."].join(""));
+ if (!save_check) {
+ $(this).data('selected').attr('selected', 'selected');
+ return false;
+ }
+ }
+
+ if ($(this).val() !== 'None') {
+ // redirect with new project GET param
+ window.location = [window.location.href.split('?')[0], "?project=",
+ $(this).val()].join("");
+ }
+ }
+ );
+
+ // insert project link after project select field
+ $('div#project_link').insertAfter($('select#id_project')).show();
+
+ /*
+ * == Survey Submission Handler ==
+ *
+ */
+
+ // validate form
+ $('input[type=submit]').bind(
+ 'click',
+ function (e) {
+ e.preventDefault();
+
+ // validate project and grade choice fields
+ if ($('select#id_project') &&
+ $('select#id_project').val() === 'None') {
+ return alert('Please Choose a Project');
+ }
+
+ if ($('select#id_grade') && $('select#id_grade').val() === 'None') {
+ return alert('Please Choose a Grade');
+ }
+ $('form').trigger('submit');
+
+ }
+ );
+
+ $('form').bind('submit',
+ function () {
+ $('input#id_s_html').val(
+ widget.find('div#survey_options').remove().end().html()
+ );
+ }
+ );
+
+ /*
+ * == Customize Comment Appearance ==
+ */
+
+ var comments = widget.find('td > .comment');
+ comments.each(function(){
+ $(this).parents('tr:first')
+ .prev().css({'margin-top': '-10px'})
+ .find('label').css({'font-size': '11px'});
+ });
+
+ });
+}(jQuery));
--- a/app/soc/templates/soc/base.html Mon Jul 06 16:21:51 2009 +0200
+++ b/app/soc/templates/soc/base.html Mon Jul 06 16:32:14 2009 +0200
@@ -16,7 +16,7 @@
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
{% block stylesheet %}
- <link rel="stylesheet" href="/soc/content/css/soc-090627.css" type="text/css"/>
+ <link rel="stylesheet" href="/soc/content/css/soc-090706.css" type="text/css"/>
<!--[if IE]>
<link rel="stylesheet" href="/soc/content/css/soc-090418-ie.css" type="text/css"/>
<![endif]-->
--- a/app/soc/templates/soc/survey/edit.html Mon Jul 06 16:21:51 2009 +0200
+++ b/app/soc/templates/soc/survey/edit.html Mon Jul 06 16:32:14 2009 +0200
@@ -23,7 +23,7 @@
<script type="text/javascript" src="/jquery/jquery-ui.dialog.js"></script>
<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
<script type="text/javascript" src="/jquery/jquery-editable-1.3.3.js"></script>
-<script type="text/javascript" src="/soc/content/js/survey-edit-090703.js"></script>
+<script type="text/javascript" src="/soc/content/js/survey-edit-090706.js"></script>
{% endblock %}
--- a/app/soc/templates/soc/survey/public.html Mon Jul 06 16:21:51 2009 +0200
+++ b/app/soc/templates/soc/survey/public.html Mon Jul 06 16:32:14 2009 +0200
@@ -16,7 +16,7 @@
{% block scripts %}
{{ block.super }}
<script type="text/javascript" src="/soc/content/js/survey-default-text-090627.js"></script>
-<script type="text/javascript" src="/soc/content/survey-take-090705.js"></script>
+<script type="text/javascript" src="/soc/content/survey-take-090706.js"></script>
<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
{% endblock %}
--- a/app/soc/templates/soc/survey/results_page.html Mon Jul 06 16:21:51 2009 +0200
+++ b/app/soc/templates/soc/survey/results_page.html Mon Jul 06 16:32:14 2009 +0200
@@ -23,7 +23,7 @@
<script type="text/javascript" src="/jquery/jquery-ui.dialog.js"></script>
<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
<script type="text/javascript" src="/jquery/jquery-editable-1.3.3.js"></script>
-<script type="text/javascript" src="/soc/content/js/survey-edit-090703.js"></script>
+<script type="text/javascript" src="/soc/content/js/survey-edit-090706.js"></script>
{% endblock %}
--- a/app/soc/templates/soc/survey/take.html Mon Jul 06 16:21:51 2009 +0200
+++ b/app/soc/templates/soc/survey/take.html Mon Jul 06 16:32:14 2009 +0200
@@ -16,7 +16,7 @@
{% block scripts %}
{{ block.super }}
<script type="text/javascript" src="/soc/content/js/survey-default-text-090627.js"></script>
-<script type="text/javascript" src="/soc/content/js/survey-take-090705.js"></script>
+<script type="text/javascript" src="/soc/content/js/survey-take-090706.js"></script>
<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
{% endblock %}