Merging changes from rel-1.0-maint branch.

This commit is contained in:
rjy7 2010-04-13 14:44:31 +00:00
parent fd98969be3
commit c95976fbc6
2 changed files with 26 additions and 59 deletions

View file

@ -11,7 +11,7 @@
<j.0:dayLimit rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:dayLimit> <j.0:dayLimit rdf:datatype="http://www.w3.org/2001/XMLSchema#int">-1</j.0:dayLimit>
<j.0:tabBody rdf:datatype="http://www.w3.org/2001/XMLSchema#string">&lt;h3&gt;Welcome! You have successfully installed VIVO!&lt;/h3&gt; <j.0:tabBody rdf:datatype="http://www.w3.org/2001/XMLSchema#string">&lt;h3&gt;Welcome! You have successfully installed VIVO!&lt;/h3&gt;
&lt;p&gt;Your next step is to &lt;a href="siteAdmin?home=1&amp;login=block"&gt;login&lt;/a&gt; and change your password. You can find the login link in the header on the right above.&lt;/p&gt; &lt;p&gt;Your next step is to &lt;a href="siteAdmin?home=1&amp;login=block"&gt;log in&lt;/a&gt; and change your password. You can find the login link in the header on the right above.&lt;/p&gt;
&lt;p&gt;Please see the &lt;a href="http://vivoweb.org/support/user-guide" target="_blank"&gt;VIVO User Guide&lt;/a&gt; for help. The user guide includes information on &lt;a href="siteAdmin?home=1"&gt;Site Administration&lt;/a&gt;. You may want to read about the &lt;a href="http://vivoweb.org/support/user-guide/site-configuration" target="_blank"&gt;Site Configuration&lt;/a&gt; topics next:&lt;/p&gt; &lt;p&gt;Please see the &lt;a href="http://vivoweb.org/support/user-guide" target="_blank"&gt;VIVO User Guide&lt;/a&gt; for help. The user guide includes information on &lt;a href="siteAdmin?home=1"&gt;Site Administration&lt;/a&gt;. You may want to read about the &lt;a href="http://vivoweb.org/support/user-guide/site-configuration" target="_blank"&gt;Site Configuration&lt;/a&gt; topics next:&lt;/p&gt;
&lt;ul&gt; &lt;ul&gt;

View file

@ -100,6 +100,8 @@ var customForm = {
selectExistingLabel.html(selectExistingLabel.html().replace(/Select (Existing )?/, '')); selectExistingLabel.html(selectExistingLabel.html().replace(/Select (Existing )?/, ''));
this.existingOrNew.hide(); this.existingOrNew.hide();
this.addRequiredHints();
}, },
initForm: function() { initForm: function() {
@ -113,6 +115,20 @@ var customForm = {
} }
}, },
addRequiredHints: function() {
var requiredHintText = '<span class="requiredHint"> *</span>',
labels = this.existing.find('label.required').add(this.addNew.find('label.required'));
labels.each(function() {
var el = $(this),
labelText = el.html(),
newLabelText = labelText + requiredHintText;
el.html(newLabelText);
});
},
/***** ADD form *****/ /***** ADD form *****/
// Set up add form on page load, or when returning to initial state from step 2 // Set up add form on page load, or when returning to initial state from step 2
@ -148,6 +164,7 @@ var customForm = {
} }
customForm.existing.show(); customForm.existing.show();
customForm.existing.find('span.requiredHint').hide();
customForm.addNewLink.show(); customForm.addNewLink.show();
customForm.addNew.hide(); customForm.addNew.hide();
customForm.entry.hide(); customForm.entry.hide();
@ -286,57 +303,9 @@ var customForm = {
el.find('.validationError').remove(); el.find('.validationError').remove();
}, },
// Add required hints to required fields in a list of elements.
// Use when the non-Javascript version should not show the required hint,
// because the field is not required in that version (e.g., it's one of two
// fields, where one of the two must be filled in but neither one is required).
// Showing the asterisks cannot simply be done once on page load, because in
// step 1 the select existing field should not be marked required.
// Arguments: action = 'add' or 'remove'
// Varargs: element(s)
toggleRequiredHints: function(action /* elements */) {
var labelText,
newLabelText,
requiredHintText = '<span class="requiredHint"> *</span>',
numArgs = arguments.length,
element,
el;
for (var i = 1; i < numArgs; i++) {
element = arguments[i];
if (action == 'add') {
element.find('label.required').each(function(){
el = $(this);
labelText = el.html();
newLabelText = labelText + requiredHintText;
el.html(newLabelText);
});
}
else {
/* NB IE modifies the html text when it's inserted. E.g.,
* the requiredHintText becomes <SPAN class=requiredHint> *</SPAN>
* So a replace of the text with an empty string won't work, unless
* we first convert to a regexp such as /<span class="?requiredHint"?> \*<\/span>/i
* However, the remove() call is simpler anyway.
*/
element.find('span.requiredHint').remove();
}
}
},
showFields: function(el) {
el.show();
customForm.toggleRequiredHints('add', el);
},
hideFields: function(el) { hideFields: function(el) {
// Clear any input, so if we reshow the element the input won't still be there. // Clear any input, so if we reshow the element the input won't still be there.
customForm.clearFields(el); customForm.clearFields(el);
customForm.toggleRequiredHints('remove', el);
el.hide(); el.hide();
}, },
@ -371,7 +340,7 @@ var customForm = {
// And we'll need to figure out the button text based on which // And we'll need to figure out the button text based on which
// div we're opening. // div we're opening.
customForm.hideFields(customForm.existing); customForm.hideFields(customForm.existing);
customForm.showFields(customForm.addNew); customForm.addNew.show();
customForm.button.val(customForm.addNewButtonText); customForm.button.val(customForm.addNewButtonText);
customForm.doClose(); customForm.doClose();
return false; return false;
@ -386,7 +355,7 @@ var customForm = {
customForm.close.bind('click', function() { customForm.close.bind('click', function() {
// RY When we have multiple existing and addNew divs, we won't // RY When we have multiple existing and addNew divs, we won't
// show/hide them all, only the siblings of the addNewLink. // show/hide them all, only the siblings of the addNewLink.
customForm.showFields(customForm.existing); customForm.existing.show();
customForm.hideFields(customForm.addNew); customForm.hideFields(customForm.addNew);
customForm.addNewLink.show(); customForm.addNewLink.show();
customForm.button.val(customForm.defaultButtonText); customForm.button.val(customForm.defaultButtonText);
@ -427,14 +396,12 @@ var customForm = {
// Remove previously bound event handlers // Remove previously bound event handlers
customForm.unbindEventListeners(); customForm.unbindEventListeners();
// Remove required field hints
customForm.toggleRequiredHints('remove', customForm.addNew, customForm.existing);
}, },
showSelectExistingFields: function() { showSelectExistingFields: function() {
customForm.showFields(customForm.existing); customForm.existing.show();
customForm.existing.find('span.requiredHint').show();
customForm.addNewLink.hide(); customForm.addNewLink.hide();
customForm.addNew.hide(); customForm.addNew.hide();
customForm.showFieldsForAllViews(); customForm.showFieldsForAllViews();
@ -444,7 +411,7 @@ var customForm = {
customForm.existing.hide(); customForm.existing.hide();
customForm.addNewLink.hide(); customForm.addNewLink.hide();
customForm.showFields(customForm.addNew); customForm.addNew.show();
customForm.showFieldsForAllViews(); customForm.showFieldsForAllViews();
}, },
@ -454,7 +421,7 @@ var customForm = {
// the submission. // the submission.
showCombinedFields: function() { showCombinedFields: function() {
customForm.showFields(customForm.existing); customForm.existing.show();
customForm.addNewLink.show(); customForm.addNewLink.show();
customForm.addNewLink.css('margin-bottom', '1em'); customForm.addNewLink.css('margin-bottom', '1em');
customForm.addNew.hide(); customForm.addNew.hide();