Skip to content

Commit

Permalink
manx : Fixed #50 : Add help text to input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
LegalizeAdulthood committed Jul 8, 2012
1 parent 2f614da commit 948560e
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 56 deletions.
7 changes: 7 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion PublicationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected function getMenuType()
protected function renderHeaderContent()
{
print <<<EOH
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="PartLookup.js"></script>
EOH;
}
Expand Down
2 changes: 1 addition & 1 deletion UrlWizard.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
width: 10em;
white-space: nowrap
}
#wizard input, #wizard select
#wizard input, #wizard select, #wizard li > div
{
margin-left: 5em
}
Expand Down
12 changes: 12 additions & 0 deletions UrlWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,16 @@ $(function()
event.preventDefault();
}
});

var help_shown = { };
$('img[id$="_help_button"]').each(function()
{
var id = $(this).attr('id').replace('_button', '');
help_shown[id] = false;
$(this).click(function()
{
(help_shown[id] ? hide : show)(id);
help_shown[id] = !help_shown[id];
});
});
});
115 changes: 80 additions & 35 deletions UrlWizardPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function renderHeaderContent()
{
$this->renderLink("stylesheet", "text/css", "UrlWizard.css");
print <<<EOH
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="UrlWizard.js"></script>
EOH;
}
Expand All @@ -130,15 +130,29 @@ private function renderTextInput($label, $id, $options)
<li id="${id}_field"$className>
<label for="$id">$label</label>
<input type="text" id="$id" name="$id"$width$maxLength value="" />
EOH;
if (array_key_exists('help', $options))
{
$help = $options['help'];
print <<<EOH
<img id="${id}_help_button" src="help.png" width="16" height="16" />
<div id="${id}_help" class="hidden"><p>$help</p></div>
EOH;
}
print <<<EOH
</li>
EOH;
}

private function renderTextInputMaxSize($label, $id, $size, $maxLength)
private function renderTextInputMaxSize($label, $id, $size, $maxLength, $help)
{
$this->renderTextInput($label, $id, array('size' => $size, 'maxlength' => $maxLength));
$this->renderTextInput($label, $id,
array('size' => $size, 'maxlength' => $maxLength,
'help' => $help));
}

protected function renderBodyContent()
Expand All @@ -154,8 +168,11 @@ protected function renderBodyContent()
<ul>
EOH;
$this->renderTextInputMaxSize('Document URL', 'copy_url', 60, 255);
$this->renderTextInput('Format', 'copy_format', array('class' => 'hidden', 'size' => 10, 'maxlength' => 10));
$this->renderTextInputMaxSize('Document URL', 'copy_url', 60, 255,
'The complete URL for the document.');
$this->renderTextInput('Format', 'copy_format',
array('class' => 'hidden', 'size' => 10, 'maxlength' => 10,
'help' => 'The format of the document at the URL, i.e. PDF.'));
print <<<EOH
<li id="copy_site_field" class="hidden">
<label for="copy_site">Site</label>
Expand All @@ -173,15 +190,17 @@ protected function renderBodyContent()
EOH;
$this->renderTextInputMaxSize('Notes', 'copy_notes', 60, 200);
$this->renderTextInputMaxSize('Notes', 'copy_notes', 60, 200,
'Notes about this copy of the publication.');
print <<<EOH
<input type="hidden" id="copy_size" name="copy_size" value="" />
<input type="hidden" id="copy_md5" name="copy_md5" value="" />
EOH;
$this->renderTextInputMaxSize('Credits', 'copy_credits', 60, 200);
$this->renderTextInputMaxSize('Credits', 'copy_credits', 60, 200,
'Credits for this copy, i.e. Scanned by legalize.');
print <<<EOH
<input type="hidden" id="copy_amend_serial" name="copy_amend_serial" value="" />
Expand All @@ -199,17 +218,23 @@ protected function renderBodyContent()
EOH;
$this->renderTextInput('Name', 'site_name', array('maxlength' => 100));
$this->renderTextInput('URL', 'site_url', array('maxlength' => 200));
$this->renderTextInput('Description', 'site_description', array('maxlength' => 200));
$this->renderTextInput('Copy Base', 'site_copy_base', array('maxlength' => 200));
$this->renderTextInput('Name', 'site_name', array('maxlength' => 100,
'help' => 'The short, mnemonic name for the site.'));
$this->renderTextInput('URL', 'site_url', array('maxlength' => 200,
'help' => 'The main URL for the site.'));
$this->renderTextInput('Description', 'site_description',
array('maxlength' => 200,
'help' => 'The description for the site as used on the About page.'));
$this->renderTextInput('Copy Base', 'site_copy_base', array('maxlength' => 200,
'help' => 'The base URL for documents on the site, which may be different'
. ' from the site URL.'));
print <<<EOH
<li>
<li id="site_low_field">
<label for="site_low">Low Bandwidth?</label>
<input type="checkbox" id="site_low" name="site_low" value="" />
</li>
<li>
<li id="site_live_field">
<label for="site_live">Live?</label>
<input type="checkbox" id="site_live" name="site_live" value="" />
</li>
Expand All @@ -221,7 +246,7 @@ protected function renderBodyContent()
<legend id="company_legend">Company</legend>
<ul>
<li>
<li id="company_id_field">
<label for="company_id">Company</label>
<select id="company_id" name="company_id">
<option value="-1">(New Company)</option>
Expand All @@ -237,10 +262,18 @@ protected function renderBodyContent()
EOH;
$this->renderTextInput('Name', 'company_name', array('class' => 'hidden', 'size' => 50, 'maxlength' => 50));
$this->renderTextInput('Short Name', 'company_short_name', array('class' => 'hidden', 'size' => 50, 'maxlength' => 50));
$this->renderTextInput('Sort Name', 'company_sort_name', array('class' => 'hidden', 'size' => 50, 'maxlength' => 50));
$this->renderTextInput('Notes', 'company_notes', array('class' => 'hidden', 'size' => 60, 'maxlength' => 255));
$this->renderTextInput('Name', 'company_name',
array('class' => 'hidden', 'size' => 50, 'maxlength' => 50,
'help' => 'The full name of the company, i.e. Digital Equipment Corporation. It will be used on the About page and in the company dropdown list on the search page.'));
$this->renderTextInput('Short Name', 'company_short_name',
array('class' => 'hidden', 'size' => 50, 'maxlength' => 50,
'help' => 'A short name for the company, i.e. DEC.'));
$this->renderTextInput('Sort Name', 'company_sort_name',
array('class' => 'hidden', 'size' => 50, 'maxlength' => 50,
'help' => 'A lower case sort key for the company, i.e. dec.'));
$this->renderTextInput('Notes', 'company_notes',
array('class' => 'hidden', 'size' => 60, 'maxlength' => 255,
'help' => 'Notes for the company, i.e. terminal manufacturer'));
print <<<EOH
</ul>
</fieldset>
Expand All @@ -251,9 +284,10 @@ protected function renderBodyContent()
EOH;
$this->renderTextInput('Search Keywords', 'pub_search_keywords', array('size' => 40));
$this->renderTextInput('Search Keywords', 'pub_search_keywords',
array('size' => 40, 'help' => 'Search keywords to locate a known publication.'));
print <<<EOH
<li>
<li id="pub_pub_id_field">
<label for="pub_pub_id">Publication</label>
<select id="pub_pub_id" name="pub_pub_id">
<option value="-1">(New Publication)</option>
Expand All @@ -262,8 +296,10 @@ protected function renderBodyContent()
EOH;
$this->renderTextInputMaxSize('Title', 'pub_history_ph_title', 60, 255);
$this->renderTextInputMaxSize('Revision', 'pub_history_ph_revision', 20, 20);
$this->renderTextInputMaxSize('Title', 'pub_history_ph_title', 60, 255,
'The title of this document; exclude part numbers and publication dates.');
$this->renderTextInputMaxSize('Revision', 'pub_history_ph_revision', 20, 20,
'The revision number or letter of this publication, i.e. B');
print <<<EOH
<li id="pub_history_ph_pubtype_field">
<label for="pub_history_ph_pubtype">Type</label>
Expand All @@ -275,20 +311,27 @@ protected function renderBodyContent()
EOH;
$this->renderTextInputMaxSize('Publication Date', 'pub_history_ph_pubdate', 10, 10);
$this->renderTextInput('Abstract', 'pub_history_ph_abstract', array('maxlength' => 255));
$this->renderTextInput('Part #', 'pub_history_ph_part', array('maxlength' => 50));
$this->renderTextInput('Match Part #', 'pub_history_ph_match_part', array('maxlength' => 50));
$this->renderTextInputMaxSize('Publication Date', 'pub_history_ph_pubdate', 10, 10,
'The date of publication, if any, i.e. 1979-02.');
$this->renderTextInput('Abstract', 'pub_history_ph_abstract',
array('maxlength' => 255, 'help' => 'The abstract for the publication, if any.'));
$this->renderTextInput('Part #', 'pub_history_ph_part',
array('maxlength' => 50, 'help' => 'The part number for this publication, if any.'));
$this->renderTextInput('Match Part #', 'pub_history_ph_match_part',array('maxlength' => 50));
$this->renderTextInput('Sort Part #', 'pub_history_ph_sort_part', array('maxlength' => 50));
$this->renderTextInput('Alternative Part #', 'pub_history_ph_alt_part', array('maxlength' => 50));
$this->renderTextInput('Alternative Part #', 'pub_history_ph_alt_part',
array('maxlength' => 50, 'help' => 'An alternate part number for the publication, if any.'));
$this->renderTextInput('Match Alternative Part #', 'pub_history_ph_match_alt_part', array('maxlength' => 50));
$this->renderTextInput('Keywords', 'pub_history_ph_keywords', array('maxlength' => 100));
$this->renderTextInput('Notes', 'pub_history_ph_notes', array('maxlength' => 255));
$this->renderTextInput('Class', 'pub_history_ph_class', array('maxlength' => 40));
$this->renderTextInput('Keywords', 'pub_history_ph_keywords',
array('maxlength' => 100, 'help' => 'Keywords for this publication, i.e. terminal graphics.'));
$this->renderTextInput('Notes', 'pub_history_ph_notes',
array('maxlength' => 255, 'help' => 'Additional notes for this revision of the publication.'));
$this->renderTextInput('Class', 'pub_history_ph_class',
array('maxlength' => 40, 'help' => 'Class of the publication.'));
$this->renderTextInput('Amends Publication', 'pub_history_ph_amend_pub',
array('class' => 'hidden', 'maxlength' => 10));
array('class' => 'hidden', 'maxlength' => 10, 'help' => 'Publication amended by this publication.'));
$this->renderTextInput('Amendment Serial No.', 'pub_history_ph_amend_serial',
array('class' => 'hidden', 'maxlength' => 10));
array('class' => 'hidden', 'maxlength' => 10, 'help' => 'Serial number of this amendment.'));
print <<<EOH
</ul>
</fieldset>
Expand All @@ -299,9 +342,11 @@ protected function renderBodyContent()
EOH;
$this->renderTextInput('Search keywords', 'supersession_search_keywords', array('size' => 40));
$this->renderTextInput('Search keywords', 'supersession_search_keywords',
array('size' => 40,
'help' => 'Search keywords to locate publications superseded by or superceding this publication.'));
print <<<EOH
<li>
<li id="supersession_old_pub_field">
<label for="supersession_old_pub">Supersedes</label>
<select id="supersession_old_pub" name="supersession_old_pub">
<option value="-1">(None)</option>
Expand All @@ -311,7 +356,7 @@ protected function renderBodyContent()
EOH;
print <<<EOH
<li>
<li id="supersession_new_pub_field">
<label for="supersession_new_pub">Superseded by</label>
<select id="supersession_new_pub" name="supersession_new_pub">
<option value="-1">(None)</option>
Expand Down
Binary file added help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions jquery-1.3.2.min.js

This file was deleted.

4 changes: 4 additions & 0 deletions jquery-1.7.2.min.js

Large diffs are not rendered by default.

0 comments on commit 948560e

Please sign in to comment.