Skip to content

Commit

Permalink
Item12481: removed js browser detection - doing it all server-side al…
Browse files Browse the repository at this point in the history
…ready

also:
- added a webdav folder template
- fixed styling of input[type=search] formfields
- fixed clicking on the top panel toggle
- fixed "Restart" link for 404 in case a web was not found
- making "New topic" dialog width configurable via tmpl-def
- removed old slideshow-plugin-2.0 view template




git-svn-id: http://svn.foswiki.org/trunk/NatSkin@17707 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed May 28, 2014
1 parent 32ec67a commit 64667a4
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 90 deletions.
8 changes: 3 additions & 5 deletions data/System/SiteMenu.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1356278779" format="1.1" version="6"}%
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1399391186" format="1.1" reprev="8" version="8"}%
%META:TOPICPARENT{name="NatSkin"}%
---+ %TOPIC%
Definition of site wide horizontal menu
Expand Down Expand Up @@ -26,7 +26,7 @@ Definition of site wide horizontal menu
format="[[$web.%HOMETOPIC%][%JQICON{
"%URLPARAM{"icon"
default="%IF{"defined icon" then="%icon%" else="bullet_white"}%"
}%"}% $name]]"
}%"}% $title]]"
separator="</li><li>"
subfooter="</li></ul>"
footer="</li>"
Expand Down Expand Up @@ -66,6 +66,7 @@ Definition of site wide horizontal menu
<ul class=\"ajaxMenu {url:'%SCRIPTURL{"view"}%/%SYSTEMWEB%/SiteMenu?skin=text;section=subwebs;theweb=Applications;icon=application%IF{"defined EXCLUDEWIKIAPPS" then=";excludeweb=%EXCLUDEWIKIAPPS%"}%'}\"></ul>
</li>"
}%<!-- -->
<li>[[%TRASHWEB%.%HOMETOPIC%][%JQICON{"bin"}% %MAKETEXT{"Trash"}%]]</li>
<li>[[%BASEWEB%.%WEBPREFSTOPIC%][%JQICON{"wrench"}% %MAKETEXT{"Web preferences"}%]]</li>
<li>[[%LOCALSITEPREFS%][%JQICON{"wrench_orange"}% %MAKETEXT{"Site preferences"}%]]</li>
<li>[[%SYSTEMWEB%.SitePermissions][%JQICON{"key"}% %MAKETEXT{"Site permissions"}%]]</li>
Expand All @@ -80,6 +81,3 @@ Definition of site wide horizontal menu
</li>
</noautolink>%ENDSECTION{"adminmenu"}%
</verbatim>

%META:PREFERENCE{name="DENYTOPICVIEW" title="DENYTOPICVIEW" type="Set" value=" "}%
%META:PREFERENCE{name="PERMSET_VIEW" title="PERMSET_VIEW" type="Local" value="everybody"}%
1 change: 1 addition & 0 deletions data/System/WebCreateNewWeb.txt
Expand Up @@ -4,6 +4,7 @@
<form id="createNewWeb" name="admin" action="%SCRIPTURLPATH{manage}%/%WEB%/%TOPIC%" method="post" class="jqValidate">
<input name="newtopic" type="hidden" value="%URLPARAM{"newtopic"}%" />
<input name="action" type="hidden" value="createweb" />
<input name="WEBBGCOLOR" type="hidden" value="#efefef" size="20" />
<div class="foswikiFormSteps">
<div class="foswikiFormStep">
<h3>%MAKETEXT{"Name"}%:</h3>
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Contrib/NatSkin.pm
Expand Up @@ -3,8 +3,8 @@ package Foswiki::Contrib::NatSkin;
use strict;
use warnings;

our $VERSION = '3.99_017';
our $RELEASE = '3.99_017';
our $VERSION = '3.99_019';
our $RELEASE = '3.99_019';
our $SHORTDESCRIPTION = 'Modern web design for Foswiki';

1;
3 changes: 2 additions & 1 deletion lib/Foswiki/Contrib/NatSkin/MANIFEST
Expand Up @@ -47,9 +47,9 @@ pub/System/CustomatoTheme/customato-colors.css.gz 0644
pub/System/CustomatoTheme/customato-colors.uncompressed.css 0644
pub/System/CustomatoTheme/customato.css 0644
pub/System/CustomatoTheme/customato.css.gz 0644
pub/System/CustomatoTheme/customato.uncompressed.css 0644
pub/System/CustomatoTheme/customato.js 0644
pub/System/CustomatoTheme/customato.js.gz 0644
pub/System/CustomatoTheme/customato.uncompressed.css 0644
pub/System/CustomatoTheme/customato.uncompressed.js 0644
pub/System/CustomatoTheme/foswiki-logo.png 0644
pub/System/CustomatoTheme/Makefile 0644
Expand Down Expand Up @@ -291,3 +291,4 @@ templates/view.print.nat.tmpl 0644
templates/viewprint.nat.tmpl 0644
templates/viewraw.nat.tmpl 0644
templates/viewtopicactions.nat.tmpl 0644
templates/webdav_folder.nat.tmpl 0644
3 changes: 2 additions & 1 deletion pub/System/CustomatoTheme/customato-base.uncompressed.css
Expand Up @@ -680,9 +680,10 @@ a.jqButton:link {
top:18px;
font-size:24px;
right:10px;
z-index:999999;
z-index:9999;
}


.natTopLeft {
padding-bottom:1em;
}
Expand Down
3 changes: 3 additions & 0 deletions pub/System/CustomatoTheme/customato-colors.uncompressed.css
Expand Up @@ -164,6 +164,7 @@ h2.marked,
color:#777;
}

input[type=search],
input[type=text],
input[type=password],
.foswikiInputField,
Expand All @@ -177,6 +178,7 @@ select,
box-shadow:none;
box-shadow:inset 2px 2px 4px #f4f4f4;
}
input[type=search],
input[type=text],
input[type=password],
.foswikiInputField,
Expand All @@ -194,6 +196,7 @@ input::-ms-clear {
select.ui-pg-selbox:focus, /* jqgrid */
select:focus,
.foswikiSelect:focus,
input[type=search]:focus,
input[type=text]:focus,
input[type=password]:focus,
.foswikiInputField:focus {
Expand Down
6 changes: 5 additions & 1 deletion pub/System/CustomatoTheme/customato.uncompressed.css
Expand Up @@ -681,9 +681,10 @@ a.jqButton:link {
top:18px;
font-size:24px;
right:10px;
z-index:999999;
z-index:9999;
}


.natTopLeft {
padding-bottom:1em;
}
Expand Down Expand Up @@ -939,6 +940,7 @@ h2.marked,
color:#777;
}

input[type=search],
input[type=text],
input[type=password],
.foswikiInputField,
Expand All @@ -952,6 +954,7 @@ select,
box-shadow:none;
box-shadow:inset 2px 2px 4px #f4f4f4;
}
input[type=search],
input[type=text],
input[type=password],
.foswikiInputField,
Expand All @@ -969,6 +972,7 @@ input::-ms-clear {
select.ui-pg-selbox:focus, /* jqgrid */
select:focus,
.foswikiSelect:focus,
input[type=search]:focus,
input[type=text]:focus,
input[type=password]:focus,
.foswikiInputField:focus {
Expand Down
2 changes: 1 addition & 1 deletion pub/System/CustomatoTheme/customato.uncompressed.js
Expand Up @@ -2,7 +2,7 @@
jQuery(function($) {
"use strict";

$(".natPanelToggle").click(function() {
$(".natPanelToggle a").click(function() {
var $toggle = $(this);
$toggle.toggleClass("active");
$(".natTopPanel").slideToggle(200, "shagga");
Expand Down
14 changes: 4 additions & 10 deletions pub/System/NatSkin/BaseStyle.uncompressed.css
Expand Up @@ -19,7 +19,7 @@ embed, object {
z-index: 0;
}

.DISnatHtml {
.natHtml {
overflow-y: scroll; /* force a vertical scrollbar to prevent a jumpy page */
}

Expand Down Expand Up @@ -641,6 +641,7 @@ h2.marked,
padding:0px;
}

input[type=search],
input[type=text],
input[type=password],
.foswikiInputField,
Expand All @@ -658,6 +659,7 @@ select,
select:focus,
.foswikiSelect:focus,
select:focus.ui-pg-selbox, /* jqgrid */
input[type=search]:focus,
input[type=text]:focus,
input[type=password]:focus,
.foswikiInputField:focus {
Expand Down Expand Up @@ -900,10 +902,6 @@ img.foswikiLeft,
margin-bottom:1em;
}

.foswikiIndent {
margin-left:3em;
}

/* http://sonspring.com/journal/clearing-floats */
.clear,
.foswikiClear {
Expand Down Expand Up @@ -1003,15 +1001,10 @@ img.foswikiLeft,
color:red;
}
.natBrowserSupportWarning {
display:none;
padding:1em;
width:100%;
background-color:yellow;
color:black;
}
.natDeprecatedBrowser .natBrowserSupportWarning {
display:block;
}

.natBrowserSupportWarning a {
color:red;
Expand All @@ -1036,6 +1029,7 @@ img.foswikiLeft,
.natSearchHit {
margin:1em 0em 2em;
}
.natSearchRevision,
.natSearchRevision a {
text-decoration:none;
color:#64B000;
Expand Down
52 changes: 5 additions & 47 deletions pub/System/NatSkin/natskin.uncompressed.js
Expand Up @@ -15,52 +15,6 @@
}
});

/**************************************************************************
* browser detection
*/
function uaMatch(ua) { // borrowed from jQuery
ua = ua.toLowerCase();

var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
/(trident).*; rv:([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];

if (match[1] == 'trident') {
match[1] = 'msie';
}

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
}

/**************************************************************************
* flag browser deprecation on body element
*/
function initBrowserDeprecation() {
var deprecatedBrowsers,
agent = uaMatch(window.navigator.userAgent),
i;

// simplify
agent = agent.browser + agent.version.replace(/\..*$/, '');

if (agent) {
deprecatedBrowsers = foswiki.getPreference("NatSkin.deprecatedBrowsers") || [];
for (i = 0; i < deprecatedBrowsers.length; i++) {
if (agent === deprecatedBrowsers[i]) {
$("body").addClass("natDeprecatedBrowser");
break;
}
}
}
}

/**************************************************************************
* fix revision position by moving it under the first h1 found in the
* content area
Expand Down Expand Up @@ -245,6 +199,11 @@
});
}

$(document).on("click", ".natBodyNavToggleActive", function() {
toggleSidebar();
return true;
});

$(".natNavToggle").livequery(function() {
var $this = $(this);

Expand Down Expand Up @@ -335,7 +294,6 @@
*/
$(function() {

initBrowserDeprecation();
initMobile();

if (foswiki.getPreference("NatSkin.initWebMenu")) {
Expand Down
2 changes: 1 addition & 1 deletion templates/404.nat.tmpl
Expand Up @@ -54,7 +54,7 @@
</tr>%TMPL:END%

%TMPL:DEF{"restart::action"}%<tr>
<th>%BUTTON{"%MAKETEXT{"Restart"}%" class="simple" icon="house" target="%BASEWEB%.%HOMETOPIC%"}%</th>
<th>%BUTTON{"%MAKETEXT{"Restart"}%" class="simple" icon="house" target="%IF{"istopic '%BASEWEB%.%HOMETOPIC%'" then="%BASEWEB%.%HOMETOPIC%" else="%USERSWEB%.%HOMETOPIC%"}%"}%</th>
<td>%MAKETEXT{"Or just start from the beginning in case you got lost somehow."}%</td>
</tr>%TMPL:END%

Expand Down
2 changes: 1 addition & 1 deletion templates/attachtables.nat.tmpl
Expand Up @@ -84,7 +84,7 @@

%TMPL:DEF{"ATTACH:files:url"}%%TMPL:P{context="FilesysVirtualPluginEnabled" then="ATTACH:files:url:webdav" else="ATTACH:files:url:default"}%%TMPL:END%
%TMPL:DEF{"ATTACH:files:url:default"}%%PUBURLPATH%/%WEB%/%TOPIC%/%ENCODE{%A_FILE%}%%TMPL:END%
%TMPL:DEF{"ATTACH:files:url:webdav"}%/dav/%WEB%/%TOPIC%_files/%ENCODE{%A_FILE%}%%TMPL:END%
%TMPL:DEF{"ATTACH:files:url:webdav"}%/dav/%WEB%/%TOPIC%/%ENCODE{%A_FILE%}%%TMPL:END%

<!-- Header definition for top table in attach screen -->
<!-- Header definition for topic attachments and top table in attach screen -->
Expand Down
18 changes: 10 additions & 8 deletions templates/foswiki.nat.tmpl
Expand Up @@ -167,7 +167,7 @@

%TMPL:DEF{"WEBDAVDIR_SHORT"}%<span class='natTopicActionShortLabel'>%MAKETEXT{"<nop>WebDAV Directory"}%</span>%TMPL:END%
%TMPL:DEF{"WEBDAVDIR_LONG"}%<span class='natTopicActionLongLabel'>%MAKETEXT{"Open <nop>WebDAV Directory"}%</span>%TMPL:END%
%TMPL:DEF{"WEBDAVDIR_ACTION"}%<a class='natTopicAction webdav natWebdavDirAction' rel='nofollow' href='webdavs://%USERINFO{format="$username"}%@%HTTP_HOST%/dav/%BASEWEB%/%BASETOPIC%_files/'>%JQICON{"folder"}%$label</a>%TMPL:END%
%TMPL:DEF{"WEBDAVDIR_ACTION"}%<a class='natTopicAction webdav natWebdavDirAction' rel='nofollow' href='webdavs://%USERINFO{format="$username"}%@%HTTP_HOST%/dav/%BASEWEB%/%BASETOPIC%/'>%JQICON{"folder"}%$label</a>%TMPL:END%
%TMPL:DEF{"WEBDAVDIR_ACTION_RESTRICTED"}%<span class='natTopicAction natDisabledTopicAction natWebdavDirAction'>%JQICON{"folder_link"}%$label</span>%TMPL:END%

%TMPL:DEF{"HARVEST_SHORT"}%<span class='natTopicActionShortLabel'>%MAKETEXT{"Download"}%</span>%TMPL:END%
Expand Down Expand Up @@ -238,14 +238,14 @@

%TMPL:DEF{"poweredby"}%<a class='natPoweredBy nop' href='http://foswiki.org' title='foswiki.org'><span><img src='%PUBURLPATH%/%SYSTEMWEB%/NatSkin/foswiki-logo.png' height='40' /></span>%MAKETEXT{"Powered by Foswiki"}%</a>%TMPL:END%

%TMPL:DEF{"useractions"}%<!-- useractions -->
%TMPL:DEF{"useractions"}%<!-- -->
%USERACTIONS{
guest="<div class='natGreeter natGuestGreeter'>$login$sep$register</div>"
format="<div class='natGreeter natUserGreeter'>$account$sep$logout</div>"
}%
<!-- //useractions -->%TMPL:END%
<!-- -->%TMPL:END%

%TMPL:DEF{"hiddenform"}%<!-- hiddenform -->
%TMPL:DEF{"hiddenform"}%<!-- -->
<form id='EditForm' name='EditForm' action='%SCRIPTURLPATH{"save"}%/%WEB%/%TOPIC%' method='post'>
<input type='hidden' name='action_addform' value='' />
<input type='hidden' name='action_cancel' value='' />
Expand All @@ -266,7 +266,7 @@
<input type='hidden' name='rev' value='%URLPARAM{"rev"}%' />
<input type='hidden' name='text' value='%HIDDENTEXT%' />
</form>
<!-- //hiddenform-->%TMPL:END%
<!-- -->%TMPL:END%

%TMPL:DEF{"topictitle"}%%TMPL:P{context="DBCachePluginEnabled" then="topictitle_dbcache" else="topictitle_default"}%%TMPL:END%
%TMPL:DEF{"topictitle_default"}%%IF{"defined 'TOPICTITLE'" then="%TOPICTITLE%" else="%BASETOPIC%"}%%TMPL:END%
Expand Down Expand Up @@ -312,10 +312,12 @@
%TMPL:DEF{"JavascriptFiles/foswikiString"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiString" requires="JQUERYPLUGIN::FOSWIKI"}%%TMPL:END%
%TMPL:DEF{"JavascriptFiles/foswikiStringUnicodeChars"}%%TMPL:P{"LIBJS" id="JavascriptFiles/foswikiStringUnicodeChars" requires="JQUERYPLUGIN::FOSWIKI,JavascriptFiles/foswikiString"}%%TMPL:END%

%TMPL:DEF{"browsersupport"}%<div class='natBrowserSupportWarning'>
%X%
%MAKETEXT{"Warning: your browser isn't supported. Please install a modern one, like [_1], [_2], [_3], [_4] or the latest [_5]."
%TMPL:DEF{"browsersupport"}%%TMPL:P{context="UnsupportedBrowser" then="browsersupport::warning"}%%TMPL:END%

%TMPL:DEF{"browsersupport::warning"}%<div class='natBrowserSupportWarning'>
%MAKETEXT{"<b>Warning</b>: Your browser isn't supported. Please install a modern one, like [_1], [_2], [_3], [_4] or the latest [_5]."
args="<a href='http://getfirefox.com'>Firefox</a>, <a href='http://www.opera.com/download/'>Opera</a>, <a href='http://www.apple.com/safari/'>Safari</a>, <a href='https://www.google.com/chrome/'>Chrome</a>, <a href='http://www.microsoft.com/windows/downloads/ie/getitnow.mspx'>Internet Explorer</a>"
}%
%MAKETEXT{"Thank you!"}%
</div>%TMPL:END%

2 changes: 0 additions & 2 deletions templates/javascript.nat.tmpl
Expand Up @@ -5,7 +5,6 @@
id="NATSKIN::PREFERENCES"
text="<script>
jQuery.extend(foswiki.preferences, {
%TMPL:P{"deprecatedBrowsers"}%
%TMPL:P{"fixRevisionPosition"}%
%TMPL:P{"initWebMenu"}%
%TMPL:P{"initOverflows"}%
Expand All @@ -22,7 +21,6 @@ jQuery.extend(foswiki.preferences, {
%RENDERZONE{"skinjs"}%
<!-- -->%TMPL:END%

%TMPL:DEF{"deprecatedBrowsers"}%'NatSkin.deprecatedBrowsers': [%FORMATLIST{"%DEPRECATEDBROWSERS{default=""}%" split="\s*,\s*" format="'$1'" separator=", "}%],%TMPL:END%
%TMPL:DEF{"fixRevisionPosition"}%'NatSkin.fixRevisionPosition': true,%TMPL:END%
%TMPL:DEF{"initWebMenu"}%'NatSkin.initWebMenu': true,%TMPL:END%
%TMPL:DEF{"initOverflows"}%'NatSkin.initOverflows': false,%TMPL:END%
Expand Down
16 changes: 9 additions & 7 deletions templates/newtopic.nat.tmpl
Expand Up @@ -16,19 +16,21 @@

%{ ################################################################################ }%
%TMPL:DEF{"dialog"}%<noautolink>
<div class="jqUIDialog foswikiFormSteps {width:500, modal:true, draggable:true}" title="%TMPL:P{"formtitle"}%">
<div class="jqUIDialog foswikiFormSteps {width:%TMPL:P{"dialog::width"}%, modal:true, draggable:true}" title="%TMPL:P{"formtitle"}%">
%TMPL:P{"createform"}%
</div>
</noautolink>%TMPL:END%

%TMPL:DEF{"dialog::width"}%500%TMPL:END%

%{ ################################################################################ }%
%TMPL:DEF{"createform"}%<!-- -->
%TMPL:P{"formstartstep"}%<!-- -->
%TMPL:P{"topictitlestep"}%<!-- -->
%TMPL:P{"topictemplatestep"}%<!-- -->
%TMPL:P{"hiddenoptionsstep"}%<!-- -->
%TMPL:P{"formbuttons::dialog"}%<!-- -->
%TMPL:P{"formendstep"}%<!-- -->
%TMPL:P{"formstartstep"}%<!-- -->
%TMPL:P{"topictitlestep"}%<!-- -->
%TMPL:P{"topictemplatestep"}%<!-- -->
%TMPL:P{"hiddenoptionsstep"}%<!-- -->
%TMPL:P{"formbuttons::dialog"}%<!-- -->
%TMPL:P{"formendstep"}%<!-- -->
<!-- -->%TMPL:END%

%{ ################################################################################ }%
Expand Down
3 changes: 0 additions & 3 deletions templates/viewslideshow.nat.tmpl

This file was deleted.

0 comments on commit 64667a4

Please sign in to comment.