Commit 288ca9bc authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge changes Ibb035016,I59823548,I2915c6f1

* changes:
  Adding focus to font search (Bug #1267296)
  Admin -> Pages search results are now focused upon (Bug #1267296)
  Setting focus to *_potential field after search (Bug #1267296)
parents a2c09d63 b9526995
......@@ -32,6 +32,7 @@ $fonttype = !is_null($SESSION->get('fonttype')) ? $SESSION->get('fonttype')
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$query = param_integer('query', null);
$previewform = pieform(array(
'name' => 'preview',
......@@ -127,11 +128,36 @@ $pagination = build_pagination(array(
'count' => $data->count,
'limit' => $limit,
'offset' => $offset,
'setlimit' => true,
'resultcounttextsingular' => get_string('font', 'skin'),
'resultcounttextplural' => get_string('fonts', 'skin')
));
$smarty = smarty(array(), $css, array(), array());
$js = <<< EOF
addLoadEvent(function () {
p = {$pagination['javascript']}
EOF;
if ($offset > 0) {
$js .= <<< EOF
if ($('fontlist')) {
getFirstElementByTagAndClassName('a', null, 'fontlist').focus();
}
EOF;
}
else {
$js .= <<< EOF
if ($('searchresultsheading')) {
addElementClass('searchresultsheading', 'hidefocus');
setNodeAttribute('searchresultsheading', 'tabIndex', 0);
$('searchresultsheading').focus();
}
EOF;
}
$js .= '});';
$smarty = smarty(array('paginator'), $css, array(), array());
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('query', $query);
$smarty->assign('sitefonts', $data->data);
$smarty->assign('form', $previewform);
$smarty->assign('preview', $fontpreview); // Transfer $SESSION value into template
......@@ -146,5 +172,5 @@ function preview_submit(Pieform $form, $values) {
$SESSION->set('fontpreview', $values['fontpreview']);
$SESSION->set('fontsize', $values['fontsize']);
$SESSION->set('fonttype', $values['fonttype']);
redirect(get_config('wwwroot') . 'admin/site/fonts.php?offset=' . $values['offset'] . '&limit=' . $values['limit']);
redirect(get_config('wwwroot') . 'admin/site/fonts.php?offset=' . $values['offset'] . '&limit=' . $values['limit'] . '&query=1');
}
......@@ -23,13 +23,31 @@ require_once('pieforms/pieform.php');
$title = get_string('siteviews', 'admin');
define('TITLE', $title);
$offset = param_integer('offset', 0);
list($searchform, $data, $pagination) = View::views_by_owner(null, 'mahara');
$js = <<< EOF
addLoadEvent(function () {
p = {$pagination['javascript']}
});
EOF;
if ($offset > 0) {
$js .= <<< EOF
if ($('myviews')) {
getFirstElementByTagAndClassName('a', null, 'myviews'). focus();
}
EOF;
}
else {
$js .= <<< EOF
if ($('searchresultsheading')) {
addElementClass('searchresultsheading', 'hidefocus');
setNodeAttribute('searchresultsheading', 'tabIndex', -1);
$('searchresultsheading').focus();
}
EOF;
}
$js .= '});';
$createviewform = pieform(create_view_form(null, 'mahara'));
......@@ -39,6 +57,8 @@ $smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('views', $data->data);
$smarty->assign('institution', 'mahara');
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('query', param_variable('query', null));
$smarty->assign('querystring', get_querystring());
$smarty->assign('searchform', $searchform);
$smarty->assign('createviewform', $createviewform);
$smarty->display('view/index.tpl');
......@@ -178,6 +178,7 @@ $string['editfont'] = 'Edit font';
$string['fontedited'] = 'Font edited successfully';
$string['editproperties'] = 'Edit font properties';
$string['viewfontspecimen'] = 'View font specimen';
$string['viewfontspecimenfor'] = ' for \'%s\'';
$string['deletefont'] = 'Delete font';
$string['deletespecifiedfont'] = 'Delete font \'%s\'';
$string['deletefontconfirm'] = 'Do you really want to delete this font? It cannot be undone.';
......
......@@ -40,7 +40,9 @@
}
replaceChildNodes('{{$name}}_potential', results);
if (typeof params.query != 'undefined') {
$('{{$name}}_potential').focus();
}
// work around IE7's magical shrinking select box. Only
// Internet Explorer has the "brilliance" to slowly shrink the
// select box every time you put a new option into it :(
......
......@@ -12,16 +12,23 @@
<p>{str tag=sitefontsdescription section=skin}</p>
{$form|safe}
{if $sitefonts}
{if $query}
<h2 id="searchresultsheading" class="accessible-hidden">{str tag=Results}</h2>
{/if}
<div id="fontlist" class="fullwidth listing">
{foreach from=$sitefonts item=font}
<div class="{cycle values='r0,r1'} listrow">
<h3 class="title">{$font.title}</h3>
<ul class="actionlist">
<li class="notbtn">{str tag="fonttype.$font.fonttype" section="skin"}</li>
{if $font.fonttype == 'google'}<li><a class="btn-display" href="javascript:" onclick="window.open('http://www.google.com/webfonts/specimen/{$font.urlencode}','specimen','width=700,height=800,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no')">{str tag="viewfontspecimen" section="skin"}</a></li>{else}<li><a class="btn-display" href="javascript:" onclick="window.open('{$WWWROOT}admin/site/font/specimen.php?font={$font.name}','specimen','width=700,height=800,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no')">{str tag="viewfontspecimen" section="skin"}</a></li>{/if}
{if $font.fonttype == 'site'}<li><a class="btn-edit" href="{$WWWROOT}admin/site/font/edit.php?font={$font.name}">{str tag="editproperties" section="skin"}</a></li>{/if}
{if $font.fonttype == 'site'}<li><a class="btn-add" href="{$WWWROOT}admin/site/font/add.php?font={$font.name}">{str tag="addfontvariant" section="skin"}</a></li>{/if}
<li><a class="btn-del" href="{$WWWROOT}admin/site/font/delete.php?font={$font.name}">{str tag="deletefont" section="skin"}</a></li>
{if $font.fonttype == 'google'}
<li><a class="btn-display" href="javascript:" onclick="window.open('http://www.google.com/webfonts/specimen/{$font.urlencode}','specimen','width=700,height=800,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no')">{str tag="viewfontspecimen" section="skin"}<span class="accessible-hidden">{str tag=viewfontspecimenfor section=skin arg1=$font.title}</span></a></li>
{else}
<li><a class="btn-display" href="javascript:" onclick="window.open('{$WWWROOT}admin/site/font/specimen.php?font={$font.name}','specimen','width=700,height=800,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no')">{str tag="viewfontspecimen" section="skin"}<span class="accessible-hidden">{str tag=viewfontspecimenfor section=skin arg1=$font.title}</span></a></li>
{/if}
{if $font.fonttype == 'site'}<li><a class="btn-edit" href="{$WWWROOT}admin/site/font/edit.php?font={$font.name}">{str tag="editproperties" section="skin"}<span class="accessible-hidden">{str tag=viewfontspecimenfor section=skin arg1=$font.title}</span></a></li>{/if}
{if $font.fonttype == 'site'}<li><a class="btn-add" href="{$WWWROOT}admin/site/font/add.php?font={$font.name}">{str tag="addfontvariant" section="skin"}<span class="accessible-hidden">{str tag=viewfontspecimenfor section=skin arg1=$font.title}</span></a></li>{/if}
<li><a class="btn-del" href="{$WWWROOT}admin/site/font/delete.php?font={$font.name}">{str tag=deletefont section=skin} <span class="accessible-hidden">{$font.title}</span></a></li>
</ul>
<div style="font-family:'{$font.title|escape_css_string}';font-size:{$size}pt;line-height:{$size}pt;padding:3px 0;">
{if $preview == 10}{$font.title}{/if}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment