r4913 - tags/METACAT_1_9_1/lib/style/common/templates
walbridge at ecoinformatics.org
walbridge at ecoinformatics.org
Mon Apr 13 16:05:39 PDT 2009
Author: walbridge
Date: 2009-04-13 16:05:39 -0700 (Mon, 13 Apr 2009)
New Revision: 4913
Modified:
tags/METACAT_1_9_1/lib/style/common/templates/entryForm.js
Log:
Further fixes to handle mixed-file uploads:
- set the fileCount object based on upCount existing files
- use ucount only if it exists; remove debugging
Modified: tags/METACAT_1_9_1/lib/style/common/templates/entryForm.js
===================================================================
--- tags/METACAT_1_9_1/lib/style/common/templates/entryForm.js 2009-04-13 16:36:56 UTC (rev 4912)
+++ tags/METACAT_1_9_1/lib/style/common/templates/entryForm.js 2009-04-13 23:05:39 UTC (rev 4913)
@@ -208,6 +208,13 @@
return count;
}
+function setCount(_count, val) {
+ var countField = document.getElementById(_count);
+ var count = countField.getAttribute("value");
+ countField.setAttribute("value", val);
+ return count;
+}
+
function createImageLink(imgSrc, imgAlt, imgOnClick, cursor) {
var link = document.createElement("a");
var img = document.createElement("img");
@@ -1001,9 +1008,8 @@
this.id = fcount.value;
} else {
// upCount contains pre-existing uploads, check this for editing existing packages
- if (ucount.value > 0) {
+ if (ucount != null && ucount.value > 0) {
this.id = ucount.value;
- alert(this.id);
}
}
@@ -1028,8 +1034,14 @@
// What to do when a file is selected
element.onchange = function() {
- // Increment file counter
- var fileCount = incrementCount("fileCount");
+ // Increment file counter
+ var fileCount = incrementCount("fileCount");
+ // If pre-existing uploads exist, make sure the fileCount is synced
+ if (ucount != null && ucount.value > 0) {
+ fileCount += ucount.value;
+ setCount("fileCount", fileCount);
+ }
+
// Clean up file text
var comment_element = document.getElementById( 'file_comment' );
if (comment_element) {
More information about the Metacat-cvs
mailing list