Commit ff2da31b authored by Liuba Kazakov's avatar Liuba Kazakov Committed by Hugh Davenport
Browse files

Device detection - layouts for mobile devices



Bug #1041645

Change-Id: I6517352abbc888af961dabd8a1c3077bca1a214c
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent 70346dad
......@@ -109,4 +109,8 @@ $urls = array(
$smarty->assign('url', $urls);
$smarty->assign('page_content', get_site_page_content($pagename));
// handheld device flag
$smarty->assign('handheld_device', $SESSION->get('handheld_device'));
$smarty->display('index.tpl');
......@@ -7,11 +7,11 @@
<li{if $item.selected} class="selected"{/if}><span><a href="{$WWWROOT}{$item.url}"{if $item.accesskey} accesskey="{$item.accesskey}"{/if} class="{if $item.path}{$item.path}{else}dashboard{/if}">{$item.title}</a></span></li>
{/foreach}
{if $ADMIN || $INSTITUTIONALADMIN || $STAFF || $INSTITUTIONALSTAFF}
<li><span><a href="{$WWWROOT}" accesskey="h" class="return-site">{str tag="returntosite"}</a></span></li>
{elseif $USER->get('admin')}
<li><span><a href="{$WWWROOT}admin/" accesskey="a" class="admin-site">{str tag="siteadministration"}</a></span></li>
{elseif $USER->is_institutional_admin()}
<li><span><a href="{$WWWROOT}admin/users/search.php" accesskey="a" class="admin-user">{str tag="institutionadministration"}</a></span></li>
<li class="returntosite"><span><a href="{$WWWROOT}" accesskey="h" class="return-site">{str tag="returntosite"}</a></span></li>
{elseif $USER->get('admin') && !$MOBILE}
<li class="siteadmin"><span><a href="{$WWWROOT}admin/" accesskey="a" class="admin-site">{str tag="siteadministration"}</a></span></li>
{elseif $USER->is_institutional_admin() && !$MOBILE}
<li class="instituteadmin"><span><a href="{$WWWROOT}admin/users/search.php" accesskey="a" class="admin-user">{str tag="institutionadministration"}</a></span></li>
{elseif $USER->get('staff')}
<li><span><a href="{$WWWROOT}admin/users/search.php" accesskey="a" class="admin-user">{str tag="siteinformation"}</a></span></li>
{elseif $USER->is_institutional_staff()}
......
{include file="header.tpl"}
{$page_content|clean_html|safe}
{if get_config('homepageinfo') && (!$USER->is_logged_in() || $USER->get_account_preference('showhomeinfo'))}
{if get_config('homepageinfo') && (!$USER->is_logged_in() || $USER->get_account_preference('showhomeinfo')) && !$handheld_device}
{include file="homeinfo.tpl" url=$url}
{/if}
{if $dashboardview}
......
......@@ -8,7 +8,7 @@
<td><h1>{$pageheadinghtml|safe}</h1></td>
{/if}
</tr></table>
{if $ownprofile}
{if $ownprofile && !$MOBILE}
<div class="rbuttons">
<a title="{str tag=editthisview section=view}" href="{$WWWROOT}view/blocks.php?profile=1" class="btn">{str tag=editthisview section=view}</a>
</div>
......
<div class="tabswrap"><ul class="in-page-tabs edit-view-tabs">
{if $edittitle}<li {if $selected == 'title'} class="current-tab"{/if}><a{if $selected == 'title'} class="current-tab"{/if} href="{$WWWROOT}view/edit.php?id={$viewid}{if $new}&new=1{/if}">{str tag=edittitleanddescription section=view}</a></li>{/if}
<li {if $selected == 'layout'} class="current-tab"{/if}><a{if $selected == 'layout'} class="current-tab"{/if} href="{$WWWROOT}view/layout.php?id={$viewid}{if $new}&new=1{/if}">{str tag=editlayout section=view}</a></li>
<li {if $selected == 'content'} class="current-tab"{/if}><a{if $selected == 'content'} class="current-tab"{/if} href="{$WWWROOT}view/blocks.php?id={$viewid}{if $new}&new=1{/if}">{str tag=editcontent section=view}</a></li>
{if !$MOBILE}<li {if $selected == 'layout'} class="current-tab"{/if}><a{if $selected == 'layout'} class="current-tab"{/if} href="{$WWWROOT}view/layout.php?id={$viewid}{if $new}&new=1{/if}">{str tag=editlayout section=view}</a></li>{/if}
{if !$MOBILE}<li {if $selected == 'content'} class="current-tab"{/if}><a{if $selected == 'content'} class="current-tab"{/if} href="{$WWWROOT}view/blocks.php?id={$viewid}{if $new}&new=1{/if}">{str tag=editcontent section=view}</a></li>{/if}
<li class="displaypage"><a href="{$displaylink}">{str tag=displayview section=view} &raquo;</a></li>
{if $edittitle || $viewtype == 'profile'}<li class="sharepage"><a href="{$WWWROOT}view/access.php?id={$viewid}{if $new}&new=1{/if}">{str tag=shareview section=view} &raquo;</a></li>{/if}
{if ($edittitle || $viewtype == 'profile') && !$MOBILE}<li class="sharepage"><a href="{$WWWROOT}view/access.php?id={$viewid}{if $new}&new=1{/if}">{str tag=shareview section=view} &raquo;</a></li>{/if}
</ul></div>
......@@ -37,7 +37,10 @@
{/if}
</td>
<td class="right buttonscell btns2">
{if !$view.submittedto && (!$view.locked || $editlocked)}
{if
!$view.submittedto && (!$view.locked || $editlocked)
&& !($MOBILE && ($view.type == 'profile' || $view.type == 'dashboard'))
}
<a href="{$WWWROOT}view/blocks.php?id={$view.id}" title="{str tag ="editcontentandlayout" section="view"}"><img src="{theme_url filename='images/edit.gif'}" alt="{str tag=edit}"></a>
{/if}
{if !$view.submittedto && $view.removable && (!$view.locked || $editlocked)}
......
......@@ -64,6 +64,14 @@ if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
}
// is mobile detected?
$mobile = $SESSION->get('mobile');
// do not show edit content page for mobiles
if ($mobile && $view->get('type') != 'profile' && $view->get('type') != 'dashboard') {
redirect('/view/edit.php?id=' . $view->get('id'));
}
// If the view has been submitted, disallow editing
if ($view->is_submitted()) {
$submittedto = $view->submitted_to();
......
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