Skip to content

Commit

Permalink
XWIKI-21492: Underline inline links (#2694)
Browse files Browse the repository at this point in the history
* Add an underline option to the XWiki and user preferences.
* Remove the old accessibility preference from the user profile
* Added backwards compatibility: if the old parameter is set to 'accessible' on the profile, it will set the old preferences
* Removed the SSX
* Added style directly in general.less
* Added logic related to preferences in the template htmlheader.vm
* Added an unsetter for the accessibility parameter, and defaults for the new parameters that would get changed if the accessibility parameter is already set.
* Underline inline links by default
  • Loading branch information
Sereza7 authored Apr 18, 2024
1 parent c0fa0f9 commit f67730e
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,30 @@
#if($xcontext.action == "admin" || $xcontext.action == "import" || $xcontext.action == "export")
#set($bodyAction = "view")
#end
## Query user preferences for UI customization
## Get the legacy preference for backward compatibility
#set ($a11y = "$!{xwiki.getUserPreference('accessibility')}")
#set ($underlining = "$!{xwiki.getUserPreference('underline')}")
## Underlining of links
## This preference will take the values: preference-underlining-yes, preference-underlining-only-inline-links and
## preference-underlining-no
#set ($preferenceUnderlining = "preference-underlining-")
#if ($underlining == 'Yes' || $a11y == '1')
#set ($preferenceUnderlining = $preferenceUnderlining + "yes")
#elseif($underlining == 'No')
## The legacy a11y preference is never ON when reaching here
#set ($preferenceUnderlining = $preferenceUnderlining + "no")
#else
## The default value `OnlyInlineLinks` has the same behavior as the fallback
#set ($preferenceUnderlining = $preferenceUnderlining + "only-inline-links")
#end
## These elements will be closed in the htmlfooter.vm file
<$bodyTagName id="body" class="skin-flamingo wiki-${xcontext.database} #if("$!doc.space" != "")space-${escapetool.xml($doc.space.replaceAll(' ', '_'))}#end ${bodyAction}body #if($showLeftPanels == "0")hideleft#end#if($showRightPanels == "0")hideright#end#if($hidecolumns && ($!hidecolumns == 1))hidelefthideright#end #if($showLeftPanels != "0" && $showRightPanels != "0" && $!hidecolumns != 1)content#end panel-left-width-${leftPanelsWidth} panel-right-width-${rightPanelsWidth} drawer drawer--right">
## We put a space before each class added in #if, to avoid losing them because of velocity line stripping
<$bodyTagName id="body" class="skin-flamingo wiki-${xcontext.database} ${bodyAction}body panel-left-width-${leftPanelsWidth} panel-right-width-${rightPanelsWidth} drawer drawer--right ${preferenceUnderlining}
#if("$!doc.space" != "") space-${escapetool.xml($doc.space.replaceAll(' ', '_'))}#end
#if($showLeftPanels == "0") hideleft#end
#if($showRightPanels == "0") hideright#end
#if($hidecolumns && ($!hidecolumns == 1)) hidelefthideright#end
#if($showLeftPanels != "0" && $showRightPanels != "0" && $!hidecolumns != 1) content#end">
<div id="xwikimaincontainer">
<div id="xwikimaincontainerinner">
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,64 @@ img {
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}

// User preferences ===========================================================
body.content {
/* We apply various user preference related styles to the content of the page.
We use classes that are added to the body itself in htmlheader.vm */
// Link underlining preference
&.preference-underlining-yes {
a {
text-decoration: underline;
}
}

&.preference-underlining-only-inline-links {
// Main rule for the content
#xwikicontent a {
text-decoration: underline;
}

// UIs where we want to underline outside of content.
.xdocLastModification,
.panel.HelpTipsPanel,
.commentauthor {
& a {
text-decoration: underline;
}
}

/* UIs in content where we want to not underline by default.
Those elements usually contain only links that are not inline (and a lot of links). */
#xwikicontent {
&.xwiki-livetable-container,
&.xtree,
&.xwikitabbar,
&.buttonwrapper {
& a {
text-decoration: none;
// Make sure we don't take over the default behaviour on hover with too much specificity.
&:hover, &:focus {
text-decoration: underline
}
}
}
}

// Helper classes for easier content customization. Note that those only work for this preference.
#xwikicontent .force-no-underline a {
text-decoration: none;
}

.force-underline a {
text-decoration: underline;
}
}

&.preference-underlining-no {
a {
text-decoration: none;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected void createClass(BaseClass xclass)
xclass.addTextField("imaccount", "imaccount", 30);
xclass.addStaticListField("editor", "Default Editor", "Text|Wysiwyg");
xclass.addStaticListField("usertype", "User type", "Simple|Advanced", "Simple");
xclass.addBooleanField("accessibility", "Enable extra accessibility features", "yesno");
xclass.addStaticListField("underline", "Underline links", "OnlyInlineLinks|Yes|No", "OnlyInlineLinks");
xclass.addBooleanField("displayHiddenDocuments", "Display Hidden Documents", "yesno");
xclass.addTimezoneField(TIMEZONE_FIELD, "Time Zone", 30);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,10 @@ platform.core.profile.phone=Phone
platform.core.profile.address=Address
platform.core.profile.editor=Default editor to use
platform.core.profile.userType=User Type
platform.core.profile.enableAccessibility=Enable extra accessibility features
platform.core.profile.displayHiddenDocuments=Display hidden pages
platform.core.profile.timezone=Timezone
platform.core.profile.extensionConflictSetup=Enable extension conflict setup
platform.core.profile.accessibility.underline=Underline links

platform.core.profile.category.settings=Settings
platform.core.profile.category.profile=Profile
Expand All @@ -728,6 +728,7 @@ platform.core.profile.section.sendMessage=Send Message
platform.core.profile.section.activity=My Activity Stream
platform.core.profile.section.activityof=Activity stream of {0}
platform.core.profile.section.displayPreferences=Display Preferences
platform.core.profile.section.accessibilityPreferences=Accessibility preferences
platform.core.profile.section.localizationPreferences=Localization Preferences
platform.core.profile.section.editorPreferences=Editor Preferences
platform.core.profile.section.extensionPreferences=Extensions Preferences
Expand Down Expand Up @@ -3459,6 +3460,10 @@ XWiki.XWikiUsers_usertype_Advanced=Advanced
XWiki.XWikiUsers_phone=Phone
XWiki.XWikiUsers_address=Address
XWiki.XWikiUsers_extensionConflictSetup=Enable extension conflict setup
XWiki.XWikiUsers_underline=Underline links
XWiki.XWikiUsers_underline_Yes=Yes
XWiki.XWikiUsers_underline_OnlyInlineLinks=Only Inline Links
XWiki.XWikiUsers_underline_No=No

### XWiki.XWikiSkins (core)
XWiki.XWikiSkins_name=Name
Expand Down Expand Up @@ -5641,6 +5646,7 @@ core.viewers.diff.previousChange=Previous change
## until 16.3.0RC1
#######################################
xe.admin.passwordReset.step2.error.wrongParameters=Wrong parameters! Another link was already sent or this one was already accessed!
platform.core.profile.enableAccessibility=Enable extra accessibility features

## Used to indicate where deprecated keys end
#@deprecatedend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<syntaxId>plain/1.0</syntaxId>
<hidden>true</hidden>
<content>XWiki.XWikiUsers_displayHiddenDocuments.hint=The wiki contains documents that are not displayed by default. These hidden documents represent technical content, like application classes, configuration pages, macros, styles, scripts, etc.
XWiki.XWikiUsers_accessibility.hint=Extra accessibility will enable various visual enhancements like: bigger fonts, underlined links, etc.
XWiki.XWikiUsers_underline.hint=Choose if links should be underlined.
XWiki.XWikiUsers_timezone.hint=Use a specific timezone so that the dates reflect your current location.
XWiki.XWikiUsers_editor.hint=Choose what editor will be the default one, overriding the default editor set globally. If not defined, a default editor is chosen, depending on what is being edited.
XWiki.XWikiUsers_usertype.hint=Choose what type of user will be the default one. Advanced users will have access to multiple editing features, terminal page creation, etc.
Expand All @@ -60,7 +60,16 @@ user.profile.network.saving=Saving...
user.profile.network.error=Error saving the notification setting
user.profile.status.done=Done
user.profile.status.saving=Saving...
user.profile.status.error=Error saving the user status</content>
user.profile.status.error=Error saving the user status

## Used to indicate where deprecated keys start
#@deprecatedstart

## Deprecated since 16.3.0RC1
XWiki.XWikiUsers_accessibility.hint=Extra accessibility will enable various visual enhancements like: bigger fonts, underlined links, etc.

## Used to indicate where deprecated keys end
#@deprecatedend</content>
<object>
<name>XWiki.UserProfileTranslations</name>
<number>0</number>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,22 @@
&lt;h2&gt;$escapetool.xml($services.localization.render('platform.core.profile.section.displayPreferences'))&lt;/h2&gt;
&lt;dl&gt;
#displayField('displayHiddenDocuments', 'platform.core.profile.displayHiddenDocuments', '0')
#displayField('accessibility' , 'platform.core.profile.enableAccessibility' , '0')
&lt;/dl&gt;
&lt;h2&gt;$escapetool.xml($services.localization.render('platform.core.profile.section.accessibilityPreferences'))&lt;/h2&gt;
#set ($defaultLegacyValue = $xwiki.getXWikiPreference('accessibility'))
&lt;dl&gt;
#set ($defaultValue = $xwiki.getXWikiPreference('underline'))
#if ("$!defaultValue" == '' &amp;&amp; "$!defaultLegacyValue" == '1')
#set ($defaultValue = 'Yes')
#end
#if ("$!defaultValue" == '')
#set ($defaultValue = 'OnlyInlineLinks')
#end
#displayField('underline', 'platform.core.profile.accessibility.underline', $defaultValue)
&lt;/dl&gt;
&lt;dl hidden&gt;
## Unset the legacy 'accessibility' parameter
#displayField('accessibility', 'platform.core.profile.enableAccessibility', '')
&lt;/dl&gt;
&lt;h2&gt;$escapetool.xml($services.localization.render('platform.core.profile.section.localizationPreferences'))&lt;/h2&gt;
&lt;dl&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ $originalUrl?$queryString## prevent line break in output

<link href="#concatenateQueryParameter($defaultStyleURL, $urlParameters)" rel="stylesheet" type="text/css" media="all" />
<link href="#concatenateQueryParameter($escapetool.xml($xwiki.getSkinFile('print.css', true)), $urlParameters)" rel="stylesheet" type="text/css" media="#if ($printss)all#{else}print#{end}" />
#set ($a11y = "$!{request.getCookie('a11y').getValue()}")
#if ($a11y == '')
#set ($a11y = "$!{xwiki.getUserPreference('accessibility')}")
#end
#if ($a11y == '1')
<link href="$escapetool.xml($xwiki.getSkinFile('css/accessibility.css', true))" rel="stylesheet" type="text/css" media="all" />
#end
## The stylesheets configuration option allows to override the alternate stylesheets
## style1.css, style2.css and style3.css
#set ($stylesheets = $xwiki.getSpacePreference('stylesheets'))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,30 @@
<validationRegExp/>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</title>
<underline>
<cache>0</cache>
<customDisplay/>
<disabled>0</disabled>
<displayType>select</displayType>
<freeText>forbidden</freeText>
<largeStorage>0</largeStorage>
<multiSelect>0</multiSelect>
<name>underline</name>
<number>12</number>
<picker>1</picker>
<prettyName>Underline links</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators>|, </separators>
<size>1</size>
<sort>none</sort>
<tooltip/>
<unmodifiable>0</unmodifiable>
<validationMessage/>
<validationRegExp/>
<values>OnlyInlineLinks|Yes|No</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</underline>
<upload_maxsize>
<customDisplay/>
<disabled>0</disabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,30 @@
<validationRegExp/>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</title>
<underline>
<cache>0</cache>
<customDisplay/>
<disabled>0</disabled>
<displayType>select</displayType>
<freeText>forbidden</freeText>
<largeStorage>0</largeStorage>
<multiSelect>0</multiSelect>
<name>underline</name>
<number>12</number>
<picker>1</picker>
<prettyName>Underline links</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators>|, </separators>
<size>1</size>
<sort>none</sort>
<tooltip/>
<unmodifiable>0</unmodifiable>
<validationMessage/>
<validationRegExp/>
<values>OnlyInlineLinks|Yes|No</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</underline>
<upload_maxsize>
<customDisplay/>
<disabled>0</disabled>
Expand Down Expand Up @@ -2652,6 +2676,30 @@
<validationRegExp/>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</title>
<underline>
<cache>0</cache>
<customDisplay/>
<disabled>0</disabled>
<displayType>select</displayType>
<freeText>forbidden</freeText>
<largeStorage>0</largeStorage>
<multiSelect>0</multiSelect>
<name>underline</name>
<number>12</number>
<picker>1</picker>
<prettyName>Underline links</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators>|, </separators>
<size>1</size>
<sort>none</sort>
<tooltip/>
<unmodifiable>0</unmodifiable>
<validationMessage/>
<validationRegExp/>
<values>OnlyInlineLinks|Yes|No</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</underline>
<upload_maxsize>
<customDisplay/>
<disabled>0</disabled>
Expand Down Expand Up @@ -2973,6 +3021,9 @@ Your account on ${wikiname} has been successfully activated. You can now login a
<property>
<title>$tdoc.getRenderedTitle('plain/1.0') - XWiki</title>
</property>
<property>
<underline>OnlyInlineLinks</underline>
</property>
<property>
<upload_maxsize>107374182400</upload_maxsize>
</property>
Expand Down

0 comments on commit f67730e

Please sign in to comment.