diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 6a47f316f..fee6cfad1 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -4,6 +4,9 @@ - Bugfix [ 884375 ] Fix for multiple forum posts applied also to www_viewForum to handle postings that start a new thread. - Added German toolbar icons. + - Added missing SQL Report help. + - Changed the pagination template variables on SQL Report, Article, File + Manager and USS to the standard pagination variables. 6.0.1 diff --git a/docs/upgrades/upgrade_6.0.1-6.0.2.pl b/docs/upgrades/upgrade_6.0.1-6.0.2.pl new file mode 100644 index 000000000..7d5353141 --- /dev/null +++ b/docs/upgrades/upgrade_6.0.1-6.0.2.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Getopt::Long; +use Parse::PlainConfig; +use strict; +use WebGUI::Session; +use WebGUI::International; +use WebGUI::SQL; + + +my $configFile; +my $quiet; + +GetOptions( + 'configFile=s'=>\$configFile, + 'quiet'=>\$quiet +); + +WebGUI::Session::open("../..",$configFile); + +print "\tFixing pagination template variables.\n" unless ($quiet); +my $sth = WebGUI::SQL->read("select * from template where namespace in ('SQLReport','USS','Article','FileManager')"); +while (my $data = $sth->hashRef) { + $data->{template} =~ s/isFirstPage/pagination.isFirstPage/ig; + $data->{template} =~ s/isLastPage/pagination.isLastPage/ig; + $data->{template} =~ s/firstPage/pagination.firstPage/ig; + $data->{template} =~ s/lastPage/pagination.lastPage/ig; + $data->{template} =~ s/nextPage/pagination.nextPage/ig; + $data->{template} =~ s/pageList/pagination.pageList.upTo20/ig; + $data->{template} =~ s/previousPage/pagination.previousPage/ig; + $data->{template} =~ s/multiplePages/pagination.pageCount.isMultiple/ig; + $data->{template} =~ s/numberOfPages/pagination.pageCount/ig; + $data->{template} =~ s/pageNumber/pagination.pageNumber/ig; + WebGUI::SQL->write("update template set template=".quote($data->{template})." where namespace=".quote($data->{namespace})." and templateId=".quote($data->{templateId})); +} +$sth->close; + +WebGUI::Session::close(); + + diff --git a/docs/upgrades/upgrade_6.0.1-6.0.2.sql b/docs/upgrades/upgrade_6.0.1-6.0.2.sql index 10ab853eb..875604274 100644 --- a/docs/upgrades/upgrade_6.0.1-6.0.2.sql +++ b/docs/upgrades/upgrade_6.0.1-6.0.2.sql @@ -1,4 +1,31 @@ insert into webguiVersion values ('6.0.2','upgrade',unix_timestamp()); update language set toolbar='german' where languageId=2; alter table language change toolbar toolbar varchar(35) not null default 'metal'; +delete from help where helpId=1 and namespace='SQLReport'; +insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'SQLReport', 61, 71, '2,SQLReport;21,WebGUI;'); +delete from help where helpId=2 and namespace='SQLReport'; +insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (2, 'SQLReport', 72, 73, '79,WebGUI;1,SQLReport;51,WebGUI;'); +delete from international where languageId=1 and namespace='SQLReport' and internationalId=61; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (61,1,'SQLReport','SQL Report, Add/Edit', 1082365503,NULL); +delete from international where languageId=1 and namespace='SQLReport' and internationalId=71; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (71,1,'SQLReport','SQL Reports are perhaps the most powerful wobject in the WebGUI arsenal. They allow a user to query data from any database that they have access to. This is great for getting sales figures from your Accounting database or even summarizing all the message boards on your web site.\r\n
\r\n\r\n\r\nPreprocess macros on query?
\r\nIf you\'re using WebGUI macros in your query you\'ll want to check this box.\r\n
\r\n\r\n\r\nDebug?
\r\nIf you want to display debugging and error messages on the page, check this box.\r\n
\r\n\r\n\r\nQuery
\r\nThis is a standard SQL query. If you are unfamiliar with SQL then you\'ll likely not want to use this wobject. You can make your queries more dynamic by using the ^FormParam(); macro.\r\n
\r\n\r\nDatabase Link
\r\nThe administrator can configure common databases on which you can run SQL Reports, freeing you from having to know or enter the connectivity information.\r\n
\r\n\r\nPaginate After\r\nHow many rows should be displayed before splitting the results into separate pages? In other words, how many rows should be displayed per page?\r\n
\r\n\r\n\r\n', 1082365503,NULL); +delete from international where languageId=1 and namespace='SQLReport' and internationalId=73; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (73,1,'SQLReport','The following variables are made available from SQL Reports:\r\n
\r\n\r\ncolumns_loop
\r\nA loop containing information about each column.\r\n
\r\n
\r\n\r\ncolumn.number\r\n\r\nrows_loop
\r\nAn integer starting with 1 and counting through the number of columns.\r\n
\r\n\r\ncolumn.name
\r\nThe name of this column as returned by the query.\r\n
\r\n\r\n
\r\n\r\nrow.number\r\n\r\nrows.count
\r\nAn integer starting with 1 and counting through the total list of rows.\r\n
\r\n\r\nrow.field.NAME.value
\r\nThe data for a given field in this row where NAME is the name of the field as it is returned by the query.\r\n
\r\n\r\nrow.field_loop
\r\nA loop containing all of the fields for this row.\r\n
\r\n\r\n\r\nfield.number\r\n\r\n
\r\nAn integer starting with 1 and counting through the number of fields in this row. This is the same as column.number in the column_loop.\r\n
\r\n\r\nfield.name
\r\nThe name of the field as it is returned by the query.\r\n
\r\n\r\nfield.value
\r\nThe data in this field.\r\n
\r\n\r\n
\r\n\r\naddlink.label
\r\nA translated label that prompts the user to add a link to the USS.\r\n
\r\n\r\nsearch.label
\r\nA translated label for the search link.\r\n
\r\n\r\ncanModerate
\r\nA condition indicating whether the current user has the rights to moderate posts in this USS.\r\n
\r\n\r\ntitle.label
\r\nA translated label for the title column.\r\n
\r\n\r\nsubmissions_loop
\r\nA loop containing each submission.\r\n
\r\n\r\nsubmission.id\r\n\r\n\r\n', 1082367203,NULL); +delete from help where helpId=2 and namespace='Article'; +insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (2, 'Article', 72, 73, '1,Article;79,WebGUI;51,WebGUI;'); +delete from help where helpId=3 and namespace='FileManager'; +insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (3, 'FileManager', 75, 76, '1,FileManager;79,WebGUI;51,WebGUI;'); +delete from international where languageId=1 and namespace='FileManager' and internationalId=76; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (76,1,'FileManager','This is the list of template variables available in File Manager templates.\r\n\r\n\r\ntitleColumn.url
\r\nA unique identifier for this submission.\r\n\r\n\r\nsubmission.url
\r\nThe URL to view this submission.\r\n\r\n\r\nsubmission.content
\r\nThe abbreviated text content of this submission.\r\n\r\n\r\nsubmission.content.full
\r\nThe full text content of this submission.\r\n\r\n\r\n\r\nsubmission.responses
\r\nThe number of responses to this submission.\r\n\r\n\r\nsubmission.title
\r\nThe title for this submission.\r\n\r\n\r\nsubmission.userDefined1 - submission.userDefined5
\r\nA series of user defined fields to add custom functionality to the USS.\r\n\r\n\r\nsubmission.userId
\r\n\r\nsubmission.username
\r\nThe user id of the user that posted this submission.\r\n
\r\nThe username of the person that posted this submission.\r\n\r\n\r\nsubmission.status
\r\nThe status of this submission (approved, pending, denied).\r\n\r\n\r\nsubmission.thumbnail
\r\nThe thumbnail of the image uploaded with this submission (if any).\r\n\r\n\r\nsubmission.image
\r\nThe URL of the image attached to this submission.\r\n\r\n\r\n\r\nsubmission.date
\r\n\r\nsubmission.date.updated
\r\nThe that this submission was posted.\r\n
\r\nA human readable date that displays the date and time this submission was last edited.\r\n\r\n\r\nsubmission.currentUser
\r\nA condition indicating whether the current user is the same as the user that posted this submission.\r\n\r\n\r\nsubmission.userProfile
\r\nThe URL to the profile of the user that posted this submission.\r\n\r\n\r\nsubmission.edit.url
\r\nThe URL to edit this submission.\r\n\r\n\r\n\r\nsubmission.secondColumn
\r\n\r\nsubmission.thirdColumn
\r\nA condition indicating whether or not this submission would belong in the second column, in a multi-column layout.\r\n
\r\nA condition indicating whether or not this submission would belong in the third column, in a multi-column layout.\r\n\r\n\r\nsubmission.fourthColumn
\r\nA condition indicating whether or not this submission would belong in the fourth column, in a multi-column layout.\r\n\r\n\r\nsubmission.fifthColumn
\r\nA condition indicating whether or not this submission would belong in the fifth column, in a multi-column layout.\r\n\r\n\r\nsubmission.controls
\r\nThe administrative toolbar for each submission.\r\n\r\n\r\n
\r\nfile.canView\r\n\r\nnoresults.message
\r\nA condition as to whether the current user has the privileges to view this file.\r\n\r\nfile.controls
\r\nThe WebGUI management controls for this file.\r\n\r\nfile.title
\r\nThe title for this file.\r\n\r\nfile.version1.name
\r\nThe filename for the first version of this file.\r\n\r\nfile.version1.url
\r\nThe download URL for the first version of this file.\r\n\r\nfile.version1.icon
\r\nThe URL to the icon for the file type of the first version of this file.\r\n\r\nfile.version1.size
\r\nThe storage size of the first version of this file.\r\n\r\nfile.version1.type
\r\nThe type (or file extension) of the first version of this file.\r\n\r\nfile.version1.thumbnail
\r\nThe URL to the thumbnail for the first version of this file.\r\n\r\nfile.version1.isImage
\r\nA conditional indicating whether the first version of this file is an image or not.\r\n\r\nfile.version2.name
\r\nThe filename for the second version of this file.\r\n\r\nfile.version2.url
\r\nThe download URL for the second version of this file.\r\n\r\nfile.version2.icon
\r\nThe URL to the icon for the file type of the second version of this file.\r\n\r\nfile.version2.size
\r\nThe storage size of the second version of this file.\r\n\r\nfile.version2.type
\r\nThe type (or file extension) of the second version of this file.\r\n\r\nfile.version2.thumbnail
\r\nThe URL to the thumbnail for the second version of this file.\r\n\r\nfile.version2.isImage
\r\nA conditional indicating whether the second version of this file is an image or not.\r\n\r\nfile.version3.name
\r\nThe filename for the third version of this file.\r\n\r\nfile.version3.url
\r\nThe download URL for the third version of this file.\r\n\r\nfile.version3.icon
\r\nThe URL to the icon for the file type of the third version of this file.\r\n\r\nfile.version3.size
\r\nThe storage size of the third version of this file.\r\n\r\nfile.version3.type
\r\nThe type (or file extension) of the third version of this file.\r\n\r\nfile.version3.thumbnail
\r\nThe URL to the thumbnail for the third version of this file.\r\n\r\nfile.version3.isImage
\r\nA conditional indicating whether the third version of this file is an image or not.\r\n\r\nfile.description
\r\nThe description of this file.\r\n\r\nfile.date
\r\nThe date that this file was uploaded.\r\n\r\nfile.time
\r\nThe time that this file was uploaded.\r\n\r\n
\r\n<a href=\"<tmpl_var new.template>999\">Read more...</a>\r\n
\r\ndescription.full
\r\nThe full description without any pagination. (For the paginated description use \"description\" instead.)\r\n
\r\n\r\ndescription.first.100words
\r\nThe first 100 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n
\r\n\r\ndescription.first.75words
\r\nThe first 75 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n
\r\n\r\ndescription.first.50words
\r\nThe first 50 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n
\r\n\r\ndescription.first.25words
\r\nThe first 25 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n
\r\n\r\ndescription.first.10words
\r\nThe first 10 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n
\r\n\r\ndescription.first.paragraph
\r\nThe first paragraph of the description. The first paragraph is determined by the first carriage return found in the text.\r\n
\r\n\r\ndescription.first.2paragraphs
\r\nThe first two paragraphs of the description. A paragraph is determined by counting the carriage returns found in the text.\r\n
\r\n\r\ndescription.first.sentence
\r\nThe first sentence in the description. A sentence is determined by counting the periods found in the text.\r\n
\r\n\r\ndescription.first.2sentences
\r\nThe first two sentences in the description. A sentence is determined by counting the periods found in the text.\r\n
\r\n\r\ndescription.first.3sentences
\r\nThe first three sentences in the description. A sentence is determined by counting the periods found in the text.\r\n
\r\n\r\ndescription.first.4sentences
\r\nThe first four sentences in the description. A sentence is determined by counting the periods found in the text.\r\n
\r\n\r\n\r\n\r\nattachment.box
\r\nOutputs a standard WebGUI attachment box including icon, filename, and attachment indicator.\r\n
\r\n\r\npagination.isFirstPage
\r\nA boolean indicating whether the current page is the first page.\r\n
\r\n\r\n\r\npagination.lastPage
\r\nA link to the last page in the paginator.\r\n
\r\n\r\npagination.isLastPage
\r\nA boolean indicating whether the current page is the last page.\r\n
\r\n\r\npagination.nextPage
\r\nA link to the next page in the paginator relative to the current page.\r\n
\r\n\r\npagination.previousPage
\r\nA link to the previous page in the paginator relative to the current page.\r\n
\r\n\r\npagination.pageNumber
\r\nThe current page number.\r\n
\r\n\r\npagination.pageCount
\r\nThe total number of pages.\r\n
\r\n\r\npagination.pageCount.isMultiple
\r\nA boolean indicating whether there is more than one page.\r\n
\r\n\r\npagination.pageList
\r\nA list of links to every page in the paginator.\r\n
\r\n\r\n\r\npagination.pageList.upTo20
\r\nA list of links to the 20 nearest in the paginator relative to the current page. So if you\'re on page 60, you\'ll see links for 50-70.\r\n
\r\n\r\npagination.pageList.upTo10
\r\nA list of links to the 10 nearest in the paginator relative to the current page. So if you\'re on page 20, you\'ll see links for 15-25.\r\n
\r\n\r\n', 1082370668,NULL); + + + diff --git a/lib/WebGUI/Paginator.pm b/lib/WebGUI/Paginator.pm index 7de491cca..b8885c617 100644 --- a/lib/WebGUI/Paginator.pm +++ b/lib/WebGUI/Paginator.pm @@ -77,6 +77,9 @@ The hash reference to append the variables to. sub appendTemplateVars { my $self = shift; my $var = shift; + $var->{'pagination.isFirstPage'} = ($self->getPageNumber == 1); + $var->{'pagination.isLastPage'} = ($self->getPageNumber == $self->getNumberOfPages); + $var->{'pagination.firstPage'} = $self->getFirstPageLink; $var->{'pagination.firstPage'} = $self->getFirstPageLink; $var->{'pagination.lastPage'} = $self->getLastPageLink; $var->{'pagination.nextPage'} = $self->getNextPageLink; diff --git a/lib/WebGUI/Wobject/Article.pm b/lib/WebGUI/Wobject/Article.pm index 837d6d596..2e62f04ea 100644 --- a/lib/WebGUI/Wobject/Article.pm +++ b/lib/WebGUI/Wobject/Article.pm @@ -164,14 +164,7 @@ sub www_view { my $p = WebGUI::Paginator->new(WebGUI::URL::page("wid=".$_[0]->get("wobjectId")."&func=view"),1); $p->setDataByArrayRef(\@pages); $var{description} = $p->getPage; - $var{firstPage} = $p->getFirstPageLink; - $var{lastPage} = $p->getLastPageLink; - $var{nextPage} = $p->getNextPageLink; - $var{pageList} = $p->getPageLinks; - $var{previousPage} = $p->getPreviousPageLink; - $var{multiplePages} = ($p->getNumberOfPages > 1); - $var{isLastPage} = ($p->getNumberOfPages == $p->getPageNumber); - $var{isFirstPage} = (1 == $p->getPageNumber); + $p->appendTemplateVars(\%var); } if ($_[0]->get("attachment") ne "") { $file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); diff --git a/lib/WebGUI/Wobject/FileManager.pm b/lib/WebGUI/Wobject/FileManager.pm index 139349b20..93c74786b 100644 --- a/lib/WebGUI/Wobject/FileManager.pm +++ b/lib/WebGUI/Wobject/FileManager.pm @@ -401,12 +401,7 @@ sub www_view { $var{"noresults.message"} = WebGUI::International::get(19,$_[0]->get("namespace")); $var{noresults} = !$flag; $var{file_loop} = \@fileloop; - $var{firstPage} = $p->getFirstPageLink; - $var{lastPage} = $p->getLastPageLink; - $var{nextPage} = $p->getNextPageLink; - $var{pageList} = $p->getPageLinks; - $var{previousPage} = $p->getPreviousPageLink; - $var{multiplePages} = ($p->getNumberOfPages > 1); + $p->appendTemplateVars(\%var); return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/SQLReport.pm b/lib/WebGUI/Wobject/SQLReport.pm index fe2806a12..47a174f71 100644 --- a/lib/WebGUI/Wobject/SQLReport.pm +++ b/lib/WebGUI/Wobject/SQLReport.pm @@ -164,14 +164,7 @@ sub www_view { $var{'rows.count'} = $p->getRowCount; $var{'rows.count.isZero'} = ($p->getRowCount < 1); $var{'rows.count.isZero.label'} = WebGUI::International::get(18,$_[0]->get("namespace")); - $var{firstPage} = $p->getFirstPageLink; - $var{lastPage} = $p->getLastPageLink; - $var{nextPage} = $p->getNextPageLink; - $var{pageList} = $p->getPageLinks; - $var{previousPage} = $p->getPreviousPageLink; - $var{multiplePages} = ($p->getNumberOfPages > 1); - $var{numberOfPages} = $p->getNumberOfPages; - $var{pageNumber} = $p->getPageNumber; + $p->appendTemplateVars(\%var); } } else { push(@debug,{'debug.output'=>WebGUI::International::get(10,$_[0]->get("namespace"))}); diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index cb11ed5e2..374853be7 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -736,12 +736,7 @@ sub www_view { $i++; } $var{submissions_loop} = \@submission; - $var{firstPage} = $p->getFirstPageLink; - $var{lastPage} = $p->getLastPageLink; - $var{nextPage} = $p->getNextPageLink; - $var{pageList} = $p->getPageLinks; - $var{previousPage} = $p->getPreviousPageLink; - $var{multiplePages} = ($p->getNumberOfPages > 1); + $p->appendTemplateVars(\%var); return $_[0]->processTemplate($_[0]->get("templateId"),\%var); }