Skip to content

Commit

Permalink
Item14466: disabled auto-column "Author"
Browse files Browse the repository at this point in the history
added publishdate and publishauthor auto-columns
  • Loading branch information
MichaelDaum committed Aug 30, 2017
1 parent 2ecb564 commit c64de85
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 21 deletions.
7 changes: 5 additions & 2 deletions data/System/JQDataTablesPlugin.txt
Expand Up @@ -76,8 +76,10 @@ the formfield. There are however a few column names that have a special meaning
* =Date=, =Changed=, =Modified=, =Created=, =info.date=, =createdate=: these fields are all date fields and treated accordingly
* =Topic=: alias for =topic=
* =TopicTitle=: displays the !TopicTitle of a topic linking to it
* =By=, =Author=: alias for author of recent topic revision
* =Creator=: author if the initial topic revision
* =By=: alias for author of recent topic revision
* =Creator=, =createauthor=, =info.author=: author if the initial topic revision
* =publishauthor=: author that published the topic, defaults to =createauthor= in case there is no explicit =Author= field in the form
* =publishdate=: date when the =publishauthor= created the initial revision, defaults to =createdate= in case there is no explicut =PublishDate= field in the form
* =Worflow=: name of the workflow assigned to a topic
* A column name starting with a =/= (slash) will be excluded from any special treatment, i.e. =/Author= will _not_ be interpreted as the author of the recent topic revision, but as the =Author= formfield of a !DataForm (see below example).

Expand Down Expand Up @@ -191,6 +193,7 @@ Click on the table headers to sort the columns according to their data type.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 30 Aug 2017: | disabled =Author= auto-column; added =publishdate= and =publishauthor= auto-columns |
| 23 Jan 2017: | don't report back an url parameter in the error message |
| 02 Sep 2016: | added default english translation files |
| 13 Jun 2016: | fixed parsing of dates that are already epoch seconds; improved default settings of table layout |
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/JQDataTablesPlugin.pm
Expand Up @@ -12,8 +12,8 @@ use Foswiki::Plugins::JQueryPlugin ();
use Foswiki::Func ();
use Foswiki::AccessControlException ();

our $VERSION = '3.03';
our $RELEASE = '23 Jan 2017';
our $VERSION = '3.10';
our $RELEASE = '30 Aug 2017';
our $SHORTDESCRIPTION = 'JQuery based progressive enhancement of tables';

sub initPlugin {
Expand Down
24 changes: 13 additions & 11 deletions lib/Foswiki/Plugins/JQDataTablesPlugin/DBCacheConnector.pm
Expand Up @@ -64,7 +64,7 @@ sub new {
'info.date' => 'Changed',
'Changed' => 'info.date',
'By' => 'info.author',
'Author' => 'info.author',
# 'Author' => 'info.author', SMELL: this may be in conflict with any formfield of that name
'Workflow' => 'workflow.name',
'workflow.name' => 'Workflow',
'Created' => 'createdate',
Expand Down Expand Up @@ -236,7 +236,7 @@ sub search {
"display" => "<span class='rowNumber'>$index</span>",
"raw" => $index,
};
} elsif (!$isEscaped && $propertyName =~ /^(Date|Changed|Modified|Created|info\.date|createdate)$/) {
} elsif (!$isEscaped && $propertyName =~ /^(Date|Changed|Modified|Created|info\.date|createdate|publishdate)$/) {
my $html =
$cell
? "<span style='white-space:nowrap'>" . Foswiki::Time::formatTime($cell) . "</span>"
Expand All @@ -256,25 +256,27 @@ sub search {
"display" => "<a href='" . Foswiki::Func::getViewUrl($params{web}, $topic) . "'>$cell</a>",
"raw" => $cell,
};
} elsif (!$isEscaped && $propertyName =~ /^(Author|Creator|info\.author|createauthor)$/) {
my $topicTitle = Foswiki::Plugins::DBCachePlugin::getTopicTitle($Foswiki::cfg{UsersWebName}, $cell)
|| $cell;
my $html =
$cell
? "<a href='" . Foswiki::Func::getViewUrl($Foswiki::cfg{UsersWebName}, $cell) . "' style='white-space:nowrap'>$topicTitle</a>"
: "";
} elsif (!$isEscaped && $propertyName =~ /^(Author|Creator|info\.author|createauthor|publishauthor)$/) {
my @html = ();
foreach my $item (split(/\s*,\s*/, $cell)) {
my $topicTitle = Foswiki::Plugins::DBCachePlugin::getTopicTitle($Foswiki::cfg{UsersWebName}, $item);
push @html,
$topicTitle eq $item ?
$item :
"<a href='" . Foswiki::Func::getViewUrl($Foswiki::cfg{UsersWebName}, $item) . "' style='white-space:nowrap'>$topicTitle</a>";
}
$cell = {
"display" => $html,
"display" => join(", ", @html),
"raw" => $cell || "",
};
} elsif (!$isEscaped && $propertyName =~ /(Image|Photo|Logo)/) {
my $url = $cell;

unless ($url =~ /^(http:)|\//) {
$url = Foswiki::Func::getPubUrlPath($params{web}, $topic, $cell);
}
$url =~ s/%PUBURLPATH%/$Foswiki::cfg{PubUrlPath}/g;

#$url =~ s/^https?://g;
my $html =
$cell
? "<img src='$url' style='max-width:100%;max-height:5em' />"
Expand Down
5 changes: 4 additions & 1 deletion lib/Foswiki/Plugins/JQDataTablesPlugin/DataTables.pm
Expand Up @@ -65,8 +65,11 @@ sub handleDataTable {
$theWidth = defined($theWidth) ? "width='$theWidth'" : "";

my $theWeb = $params->{web} || $web;
my $theTopic = $params->{topic} || $topic;
my $theForm = $params->{form} || '';

my ($thisWeb, $thisTopic) = Foswiki::Func::normalizeWebTopicName($theWeb, $theTopic);

my $thePaging =
Foswiki::Func::isTrue($params->{paging} || $params->{pager}, 0)
? 'true'
Expand Down Expand Up @@ -300,7 +303,7 @@ sub handleDataTable {
data => {
t => $time,
form => $formParam,
topic => "$theWeb.WebHome",
topic => "$thisWeb.$thisTopic",
web => $theWeb,
connector => $connector,
},
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/JQDataTablesPlugin/MANIFEST
@@ -1,3 +1,4 @@
!noci
data/System/JQDataTablesPlugin.txt 0644
lib/Foswiki/Plugins/JQDataTablesPlugin/Config.spec 0644
lib/Foswiki/Plugins/JQDataTablesPlugin/Connector.pm 0644
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/JQDataTablesPlugin/SearchConnector.pm
Expand Up @@ -108,7 +108,7 @@ sub buildQuery {
$form =~ s/\//./g;

my @query = ();
push @query, "form='$form'" if $form;
push @query, "form.name='$form'" if $form;

my @columns = $this->getColumnsFromRequest($request);

Expand Down
2 changes: 1 addition & 1 deletion pub/System/JQDataTablesPlugin/i18n/de.js
Expand Up @@ -6,6 +6,6 @@
"next": "weiter",
"previous": "zurück",
"processing": "In Bearbeitung ...",
"search": "Suchen:",
"filter": "Filter:",
"zeroRecords": "Keine passenden Daten gefunden"
}
2 changes: 1 addition & 1 deletion pub/System/JQDataTablesPlugin/i18n/en.js
Expand Up @@ -6,7 +6,7 @@
"next": "Next",
"previous": "Previous",
"processing": "Processing",
"search": "Search",
"filter": "Filter:",
"zeroRecords": "No records found"
}

Expand Up @@ -203,7 +203,7 @@ jQuery(function($) {
"stripeClasses": ['foswikiTableEven', 'foswikiTableOdd'],

"language": {
"search": "<b class='i18n' data-i18n-message='search'>Search:</b>",
"search": "<b class='i18n' data-i18n-message='filter'>Filter:</b>",
"info": "_START_ - _END_ of <b>_TOTAL_</b>",
"infoEmpty": "<span class='foswikiAlert i18n' data-i18n-message='infoEmpty'>nothing found</span>",
"infoFiltered": "",
Expand Down
Expand Up @@ -14,7 +14,7 @@ jQuery(function($) {
"stripeClasses": ['foswikiTableEven', 'foswikiTableOdd'],

"language": {
"search": "<b class='i18n' data-i18n-message='search'>Search:</b>",
"search": "<b class='i18n' data-i18n-message='filter'>Filter:</b>",
"info": "_START_ - _END_ of <b>_TOTAL_</b>",
"infoEmpty": "<span class='foswikiAlert i18n' data-i18n-message='infoEmpty'>nothing found</span>",
"infoFiltered": "",
Expand Down

0 comments on commit c64de85

Please sign in to comment.