[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm /localize/localize de.pm zh.pm
bisitz
bisitz@source.lon-capa.org
Fri, 31 Jul 2009 16:01:56 -0000
This is a MIME encoded message
--bisitz1249056116
Content-Type: text/plain
bisitz Fri Jul 31 16:01:56 2009 EDT
Modified files:
/loncom/interface lonsearchcat.pm
/loncom/localize/localize de.pm zh.pm
Log:
Optimized options and search result navigation:
- Separate display options and navigation
- Wrapped display options in fieldset
- Replaced navigation button texts by "<" and ">"; added title with text
- Optimized &mt() usage; Added text "Type"; Consistent option layout (first description, followed by option)
- Optimized nowrap behavior and simplified spacing
Basic search page:
- Display options in normal font size
- Moved Search button to bottom of each search area
- Moved Close button down, right next to Search button
- Close text only lower case
Other optimizations:
- Replaced deprecated center tag and font tag by appropriate styles
- Error page "Unable to retrieve search results...": added start_page call, localization
XHTML:
- lower case "onclick" attribute
- Properly include javascript
- Added type attribute to script tags
Updated translation files (de.pm, zh.pm)
--bisitz1249056116
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20090731160156.txt"
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.312 loncom/interface/lonsearchcat.pm:1.313
--- loncom/interface/lonsearchcat.pm:1.312 Fri Jul 31 10:58:57 2009
+++ loncom/interface/lonsearchcat.pm Fri Jul 31 16:01:48 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.312 2009/07/31 10:58:57 bisitz Exp $
+# $Id: lonsearchcat.pm,v 1.313 2009/07/31 16:01:48 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -266,25 +266,25 @@
## Configure dynamic components of interface
##
if ($env{'form.catalogmode'} eq 'interactive') {
- $closebutton="<input type='button' name='close' value='".&mt('CLOSE')."' ";
+ $closebutton="<input type='button' name='close' value='".&mt('Close')."' ";
if ($env{'form.phase'} =~ /(results|run_search)/) {
- $closebutton .="onClick='parent.close()'";
+ $closebutton .="onclick='parent.close()'";
} else {
- $closebutton .="onClick='self.close()'";
+ $closebutton .="onclick='self.close()'";
}
$closebutton .=">\n";
} elsif ($env{'form.catalogmode'} eq 'import') {
- $closebutton="<input type='button' name='close' value='".&mt('CLOSE')."' ";
+ $closebutton="<input type='button' name='close' value='".&mt('Close')."' ";
if ($env{'form.phase'} =~ /(results|run_search)/) {
- $closebutton .="onClick='parent.close()'";
+ $closebutton .="onclick='parent.close()'";
} else {
- $closebutton .="onClick='self.close()'";
+ $closebutton .="onclick='self.close()'";
}
$closebutton .= ">";
my $txt_import = &mt('IMPORT');
$importbutton=<<END;
<input type='button' name='import' value='$txt_import'
-onClick='javascript:select_group()'>
+onclick='javascript:select_group()'>
END
} else {
$closebutton = '';
@@ -798,7 +798,7 @@
$scrout .= '<input type="hidden" name="area" value="'.$area.'" />';
}
#
- $scrout .= '<center>'.$/;
+ $scrout .= '<div align="center">'.$/;
# if ($env{'request.course.id'}) {
$scrout .= '<h1>'.$lt{$area}.'</h1>';
# } else {
@@ -810,23 +810,27 @@
&Apache::lonhtmlcommon::textbox('basicexp',
$env{'form.basicexp'},50).
'<br />'.
- '<font size="-1">'.&searchhelp().'</font>'.'</td>'.
- '<td><font size="-1">'.
+ '<span class="LC_fontsize_small">'.&searchhelp().'</span>'.'</td>'.
+ '<td>'.
'<span class="LC_nobreak">'.(' 'x3).$adv_search_link.'</span>'.'<br />'.
'<span class="LC_nobreak">'.(' 'x1).$userelatedwords.'</span>'.'<br />'.
'<span class="LC_nobreak">'.(' 'x1).$onlysearchdomain.'</span>'.'<br />'.
'<span class="LC_nobreak">'.(' 'x1).$inclext.'</span>'.'<br />'.
- '</font></td>'.
- '</tr>'.$/;
+ '</td>'.
+ '</tr>'.
+ '</table>'.$/;
+ #
+ $scrout .= '<p>'
+ .&viewoptions()
+ .'</p>'
+ .'<p>'
+ .'<input type="submit" name="basicsubmit" '
+ .'value="'.&mt('Search').'" />'
+ .' '
+ .$closebutton
+ .'</p>';
#
- $scrout .= '<tr><td align="center" colspan="2">'.
- '<font size="-1">'.
- '<input type="submit" name="basicsubmit" '.
- 'value="'.&mt('Search').'" />'.
- (' 'x2).$closebutton.(' 'x2). &viewoptions().
- '</font>'.
- '</td></tr>'.$/;
- $scrout .= '</table>'.$/.'</center>'.'</form>';
+ $scrout .= '</div>'.'</form>';
return $scrout;
}
@@ -861,6 +865,7 @@
if ($env{'form.area'} eq 'portfolio') {
$srchtype = 'Portfolio';
$jscript = '<script type="text/javascript">
+// <![CDATA[
function additional_metadata() {
if (document.advsearch.newfield.checked) {
document.advsearch.phase.value = "disp_adv";
@@ -868,6 +873,7 @@
document.advsearch.submit();
}
}
+// ]]>
</script>';
}
my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search",
@@ -1172,21 +1178,23 @@
######################################################################
######################################################################
sub viewoptions {
- my $scrout = '<span class="LC_nobreak">';
+ my $scrout;
if (! defined($env{'form.viewselect'})) {
$env{'form.viewselect'}='detailed';
}
- $scrout.=&Apache::lonmeta::selectbox('viewselect',
- $env{'form.viewselect'},
- \&viewoptiontext,
- sort(keys(%Views)));
- $scrout.= ' ';
+ $scrout .= '<span class="LC_nobreak">'
+ .&mt('Type:').' '
+ .&Apache::lonmeta::selectbox('viewselect',
+ $env{'form.viewselect'},
+ \&viewoptiontext,
+ sort(keys(%Views)))
+ .'</span>';
my $countselect = &Apache::lonmeta::selectbox('show',
$env{'form.show'},
undef,
(10,20,50,100,1000,10000));
- $scrout .= (' 'x2)
- .&mt('[_1] Records per Page',$countselect)
+ $scrout .= ' <span class="LC_nobreak">'
+ .&mt('Records per Page:').' '.$countselect
.'</span>'.$/;
return $scrout;
}
@@ -2167,9 +2175,13 @@
## Sanity check the table id.
##
if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
- $r->print("Unable to retrieve search results. ".
- "Unable to determine the table results were saved in. ".
- &Apache::loncommon::end_page());
+ $r->print(&Apache::loncommon::start_page(&mt('Error'))
+. '<p>table: |'.$table.'|</p>' # SB
+ .'<p class="LC_error">'
+ .&mt('Unable to retrieve search results. '
+ .'Unable to determine the table results were saved in.')
+ .&Apache::loncommon::end_page()
+ );
return undef;
}
##
@@ -2251,6 +2263,7 @@
}
my $js =<<END;
<script type="text/javascript">
+// <![CDATA[
function change_sort() {
var newloc = "/adm/searchcat?phase=results";
newloc += "&persistent_db_id=$env{'form.persistent_db_id'}";
@@ -2258,6 +2271,7 @@
newloc += document.forms.statusform.elements.sortby.value;
parent.resultsframe.location= newloc;
}
+// ]]>
</script>
END
@@ -2400,16 +2414,28 @@
sub update_count_status {
my ($r,$text) = @_;
$text =~ s/\'/\\\'/g;
- $r->print
- ("<script>document.statusform.count.value = ' $text'</script>\n");
+ $r->print(<<SCRIPT);
+<script type="text/javascript">
+// <![CDATA[
+document.statusform.count.value = ' $text'
+// ]]>
+</script>
+SCRIPT
+
$r->rflush();
}
sub update_status {
my ($r,$text) = @_;
$text =~ s/\'/\\\'/g;
- $r->print
- ("<script>document.statusform.status.value = ' $text'</script>\n");
+ $r->print(<<SCRIPT);
+<script type="text/javascript">
+// <![CDATA[
+document.statusform.status.value = ' $text'
+// ]]>
+</script>
+SCRIPT
+
$r->rflush();
}
@@ -2436,9 +2462,14 @@
my ($r) = @_;
my $time = &time_left();
if (($last_time-$time) > 0) {
- $r->print("<script>".
- "document.statusform.seconds.value = '$time'".
- "</script>\n");
+ $r->print(<<SCRIPT);
+<script type="text/javascript">
+// <![CDATA[
+document.statusform.seconds.value = '$time'
+// ]]>
+</script>
+SCRIPT
+
$r->rflush();
}
$last_time = $time;
@@ -2470,7 +2501,7 @@
'&cleargroupsort=1'.
'&phase='.$revise_phase;
my $result = qq{<input type="button" value="$revisetext" name="revise"} .
- qq{ onClick="parent.location='$newloc';" /> };
+ qq{ onclick="parent.location='$newloc';" /> };
return $result;
}
@@ -2691,7 +2722,7 @@
last if ($connection->aborted());
&update_seconds($r);
}
- &update_status($r,&mt('Search Complete [_1]',$server));
+ &update_status($r,&mt('Search Complete on Server [_1]',$server));
&update_seconds($r);
#
&Apache::lonmysql::disconnect_from_db(); # This is unneccessary
@@ -2701,11 +2732,11 @@
# loaded from /adm/searchcat
$r->print(&Apache::loncommon::end_page());
# if ($env{'form.catalogmode'} ne 'import') {
- $r->print("<script>".
- "window.location='/adm/searchcat?".
- "phase=sort&".
- "persistent_db_id=$env{'form.persistent_db_id'}';".
- "</script>");
+ $r->print(<<SCRIPT);
+<script>
+window.location='/adm/searchcat?phase=sort&persistent_db_id=$env{'form.persistent_db_id'}';
+</script>
+SCRIPT
# }
return;
}
@@ -2728,15 +2759,15 @@
return '' if ($show eq 'all'); # No links if you get them all at once.
#
# Create buttons
- my $buttons = '<input type="submit" name="prev" value="'.&mt('Prev').'" ';
- $buttons .= '/>';
- $buttons .= ' 'x3;
- $buttons .= '<input type="submit" name="reload" '.
- 'value="'.&mt('Reload').'" />';
- $buttons .= ' 'x3;
- $buttons .= '<input type="submit" name="next" value="'.&mt('Next').'" ';
- $buttons .= '/>';
- return $buttons;
+ return '<p class="LC_nobreak">'
+ .'<input type="submit" name="prev" value="<"'
+ .' title="'.&mt('Previous').'" />'
+ .' '
+ .'<input type="submit" name="reload" value="'.&mt('Reload').'" />'
+ .' '
+ .'<input type="submit" name="next" value=">"'
+ .' title="'.&mt('Next').'" />'
+ .'</p>';
}
######################################################################
@@ -2905,29 +2936,32 @@
$env{'form.sortorder'}='asc';
}
}
- my $sortform = &mt('Sort by [_1] [_2]',
- &Apache::loncommon::select_form($env{'form.sortfield'},
+ my $sortform = '<span class="LC_nobreak">'
+ .&mt('Sort by:').' '
+ .&Apache::loncommon::select_form($env{'form.sortfield'},
'sortfield',
- %sort_fields),
- &Apache::loncommon::select_form($env{'form.sortorder'},
+ %sort_fields)
+ .' '
+ .&Apache::loncommon::select_form($env{'form.sortorder'},
'sortorder',
(asc =>&mt('Ascending'),
desc=>&mt('Descending')
))
- );
+ .'</span>';
##
- ## Output links (if necessary) for 'prev' and 'next' pages.
- $r->print
- ('<table width="100%"><tr><td width="25%" align="right">'.
- '<span class="LC_nobreak">'.$sortform.'</span>'.
- '</td><td width="25%" align="right">'.
- &prev_next_buttons($min,$env{'form.show'},$total_results).
- '</td><td align="right">'.
- &viewoptions().'</td></tr></table>'
- );
+ ## Display links for 'prev' and 'next' pages (if necessary) and Display Options
+ $r->print('<fieldset>'."\n"
+ .'<legend>'.&mt('Display Options').'</legend>'."\n"
+ .$sortform
+ .' '
+ .&viewoptions()
+ .'</fieldset>'
+ .&prev_next_buttons($min,$env{'form.show'},$total_results)
+ );
+
if ($total_results == 0) {
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2" />'.
- '<p class="LC_info">'.&mt('There are currently no results').'.</p>'.
+ '<p class="LC_info">'.&mt('There are currently no results.').'</p>'.
"</form>".
&Apache::loncommon::end_page());
return;
@@ -2995,15 +3029,13 @@
.&mt('There were no results matching your query.')
.'</p>');
} else {
- $r->print
- ('<center>'.
- &prev_next_buttons($min,$env{'form.show'},$total_results,
+ $r->print(
+ &prev_next_buttons($min,$env{'form.show'},$total_results,
"table=".$env{'form.table'}.
"&phase=results".
"&persistent_db_id=".
$env{'form.persistent_db_id'})
- ."</center>\n"
- );
+ );
}
$r->print("</form>".&Apache::loncommon::end_page());
$r->rflush();
@@ -3033,7 +3065,7 @@
if ($env{'form.catalogmode'} eq 'interactive') {
$output.=<<END
<font size='-1'><input type="button" name="returnvalues" value="select"
-onClick="javascript:select_data('$title','$url')" />
+onclick="javascript:select_data('$title','$url')" />
</font>
END
}
@@ -3043,7 +3075,7 @@
$output.=<<END;
<font size='-1'>
<input type="checkbox" name="returnvalues" value="select"
-onClick="javascript:queue($checkbox_num,$fnum)" />
+onclick="javascript:queue($checkbox_num,$fnum)" />
</font>
END
}
@@ -3212,6 +3244,7 @@
if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') {
$js.=<<SCRIPT;
<script type="text/javascript">
+// <![CDATA[
function select_data(title,url) {
changeTitle(title);
changeURL(url);
@@ -3227,6 +3260,7 @@
parent.opener.inf.document.forms.resinfo.elements.u.value=val;
}
}
+// ]]>
</script>
SCRIPT
} elsif ($env{'form.mode'} eq 'edit') {
@@ -3251,6 +3285,7 @@
$js.=<<SCRIPT;
<script type="text/javascript">
+// <![CDATA[
function select_data(title,url) {
changeURL(url);
changeTitle(title);
@@ -3265,6 +3300,7 @@
alert("Unable to transfer data to "+url);
}
}
+// ]]>
</script>
SCRIPT
}
@@ -3272,6 +3308,7 @@
my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check();
$js.=<<SCRIPT if $env{'form.catalogmode'} eq 'import';
<script type="text/javascript">
+// <![CDATA[
function queue(checkbox_num,val) {
if (document.forms.results.returnvalues.length != "undefined" &&
typeof(document.forms.results.returnvalues.length) == "number") {
@@ -3293,6 +3330,7 @@
"/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import$inhibit_menu&acts="+
parent.statusframe.document.forms.statusform.elements.acts.value;
}
+// ]]>
</script>
SCRIPT
@@ -3324,8 +3362,10 @@
my $results_link = &results_link();
my $js = <<JS;
<script type="text/javascript">
+// <![CDATA[
var targetwin = opener;
var queue = '';
+// ]]>
</script>
JS
@@ -3875,7 +3915,7 @@
<form method="post" action="/adm/searchcat">
$hidden_fields
<input type='button' value='Revise search request'
-onClick='this.form.submit();' />
+onclick='this.form.submit();' />
$closebutton
</form>
<hr />
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.318 loncom/localize/localize/de.pm:1.319
--- loncom/localize/localize/de.pm:1.318 Fri Jul 31 10:59:04 2009
+++ loncom/localize/localize/de.pm Fri Jul 31 16:01:55 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# German Localization Lexicon
#
-# $Id: de.pm,v 1.318 2009/07/31 10:59:04 bisitz Exp $
+# $Id: de.pm,v 1.319 2009/07/31 16:01:55 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1527,8 +1527,8 @@
'Summary View'
=> 'Zusammenfassung',
- 'There are currently no results'
-=> 'Derzeit noch keine Ergebnisse',
+ 'There are currently no results.'
+=> 'Derzeit noch keine Ergebnisse.',
'Search: '
=> 'Suche: ',
@@ -4976,8 +4976,11 @@
'Resources'
=> 'Ressourcen',
- 'Search Complete [_1]'
-=> ' Suche vollständige(n) [_1]',
+ 'Search Complete on Server [_1]'
+=> 'Suche abgeschlossen für Server [_1]',
+
+ 'Unable to retrieve search results. Unable to determine the table results were saved in.'
+=> 'Suchergebnisse konnten nicht abgerufen werden. Es ist nicht möglich festzustellen, in welcher Tabelle die Ergebnisse gespeichert wurden.',
'Search: [_1]'
=> 'Suche: [_1]',
@@ -5156,8 +5159,8 @@
'Currently internally authenticated.'
=> 'Derzeit LON-CAPA-intern authentifiziert.',
- '[_1] Records per Page'
-=> '[_1] Suchergebnisse je Seite',
+ 'Records per Page:'
+=> 'Suchergebnisse je Seite:',
'[_1] minutes'
=> '[_1] Minuten',
@@ -7297,9 +7300,6 @@
'Include'
=> 'Einbinden',
- 'CLOSE'
-=> 'SCHLIESSEN',
-
'LON-CAPA Catalog Search'
=> 'LON-CAPA-Katalog-Suche',
@@ -8234,9 +8234,6 @@
'Revise search'
=> 'Suche ändern',
- 'Sort by [_1] [_2]'
-=> 'Sortiert nach [_1] [_2]',
-
'Internal Error - Bad view selected.'
=> 'Interner Fehler - ungültige Ansicht ausgewählt',
Index: loncom/localize/localize/zh.pm
diff -u loncom/localize/localize/zh.pm:1.71 loncom/localize/localize/zh.pm:1.72
--- loncom/localize/localize/zh.pm:1.71 Fri Jul 31 10:59:04 2009
+++ loncom/localize/localize/zh.pm Fri Jul 31 16:01:55 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Chinese Simplified Localization Lexicon
#
-# $Id: zh.pm,v 1.71 2009/07/31 10:59:04 bisitz Exp $
+# $Id: zh.pm,v 1.72 2009/07/31 16:01:55 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1533,8 +1533,8 @@
'Summary View'
=> '概要',
- 'There are currently no results'
-=> '目前没有任何结果',
+ 'There are currently no results.'
+=> '目前没有任何结果。',
'Search: '
=> '搜索: ',
@@ -5019,8 +5019,8 @@
'Resources'
=> '资源',
- 'Search Complete [_1]'
-=> '搜索完成 [_1]',
+ 'Search Complete on Server [_1]'
+=> 'Suche abgeschlossen für Server [_1]', # '搜索完成 [_1]',
'Search: [_1]'
=> '搜索: [_1]',
@@ -5202,8 +5202,8 @@
'Currently internally authenticated.'
=> '目前 LON-CAPA 内部认证。',
- '[_1] Records per Page'
-=> '[_1] 每页显示结果',
+ 'Records per Page:'
+=> '每页显示结果:',
'[_1] minutes'
=> '[_1] 分',
@@ -7373,9 +7373,6 @@
'Include'
=> 'Einbinden',
- 'CLOSE'
-=> 'SCHLIESSEN',
-
'LON-CAPA Catalog Search'
=> 'LON-CAPA 目录搜索',
@@ -8290,9 +8287,6 @@
'Revise search'
=> '修改搜寻',
- 'Sort by [_1] [_2]'
-=> '排序依据 [_1] [_2]',
-
'Internal Error - Bad view selected.'
=> 'Interner Fehler - ungültige Ansicht ausgewählt',
--bisitz1249056116--