summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/comments.js6
-rw-r--r--js/field.js29
2 files changed, 24 insertions, 11 deletions
diff --git a/js/comments.js b/js/comments.js
index 28ef54397..e9a3e209f 100644
--- a/js/comments.js
+++ b/js/comments.js
@@ -67,13 +67,11 @@ function toggle_all_comments(action) {
function collapse_comment(link, comment) {
link.innerHTML = "[+]";
- link.title = "Expand the comment.";
YAHOO.util.Dom.addClass(comment, 'collapsed');
}
function expand_comment(link, comment) {
link.innerHTML = "[-]";
- link.title = "Collapse the comment";
YAHOO.util.Dom.removeClass(comment, 'collapsed');
}
@@ -127,11 +125,11 @@ function wrapReplyText(text) {
/* This way, we are sure that browsers which do not support JS
* won't display this link */
-function addCollapseLink(count) {
+function addCollapseLink(count, title) {
document.write(' <a href="#" class="bz_collapse_comment"' +
' id="comment_link_' + count +
'" onclick="toggle_comment_display(this, ' + count +
- '); return false;" title="Collapse the comment.">[-]<\/a> ');
+ '); return false;" title="' + title + '">[-]<\/a> ');
}
function goto_add_comments( anchor ){
diff --git a/js/field.js b/js/field.js
index 8353100f0..e3fe460cf 100644
--- a/js/field.js
+++ b/js/field.js
@@ -218,12 +218,12 @@ function setupEditLink(id) {
hideEditableField(link_container, input_container, link);
}
-/* Hide input fields and show the text with (edit) next to it */
+/* Hide input/select fields and show the text with (edit) next to it */
function hideEditableField( container, input, action, field_id, original_value, new_value ) {
YAHOO.util.Dom.removeClass(container, 'bz_default_hidden');
YAHOO.util.Dom.addClass(input, 'bz_default_hidden');
YAHOO.util.Event.addListener(action, 'click', showEditableField,
- new Array(container, input, new_value));
+ new Array(container, input, field_id, new_value));
if(field_id != ""){
YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues,
new Array(container, input, field_id, original_value));
@@ -231,13 +231,14 @@ function hideEditableField( container, input, action, field_id, original_value,
}
/* showEditableField (e, ContainerInputArray)
- * Function hides the (edit) link and the text and displays the input
+ * Function hides the (edit) link and the text and displays the input/select field
*
* var e: the event
* var ContainerInputArray: An array containing the (edit) and text area and the input being displayed
* var ContainerInputArray[0]: the container that will be hidden usually shows the (edit) or (take) text
* var ContainerInputArray[1]: the input area and label that will be displayed
- * var ContainerInputArray[2]: the new value to set the input field to when (take) is clicked
+ * var ContainerInputArray[2]: the input/select field id for which the new value must be set
+ * var ContainerInputArray[3]: the new value to set the input/select field to when (take) is clicked
*/
function showEditableField (e, ContainerInputArray) {
var inputs = new Array();
@@ -250,6 +251,8 @@ function showEditableField (e, ContainerInputArray) {
YAHOO.util.Dom.removeClass(inputArea, 'bz_default_hidden');
if ( inputArea.tagName.toLowerCase() == "input" ) {
inputs.push(inputArea);
+ } else if (ContainerInputArray[2]) {
+ inputs.push(document.getElementById(ContainerInputArray[2]));
} else {
inputs = inputArea.getElementsByTagName('input');
if ( inputs.length == 0 )
@@ -258,12 +261,24 @@ function showEditableField (e, ContainerInputArray) {
if ( inputs.length > 0 ) {
// Change the first field's value to ContainerInputArray[2]
// if present before focusing.
- if (ContainerInputArray[2]) {
- inputs[0].value = ContainerInputArray[2];
+ var type = inputs[0].tagName.toLowerCase();
+ if (ContainerInputArray[3]) {
+ if ( type == "input" ) {
+ inputs[0].value = ContainerInputArray[3];
+ } else {
+ for (var i = 0; inputs[0].length; i++) {
+ if ( inputs[0].options[i].value == ContainerInputArray[3] ) {
+ inputs[0].options[i].selected = true;
+ break;
+ }
+ }
+ }
}
// focus on the first field, this makes it easier to edit
inputs[0].focus();
- inputs[0].select();
+ if ( type == "input" ) {
+ inputs[0].select();
+ }
}
YAHOO.util.Event.preventDefault(e);
}