diff --git a/docs/upgrades/templates-7.3.0/default-wiki-front-page.tmpl b/docs/upgrades/templates-7.3.0/default-wiki-front-page.tmpl index 98b1fb266..052ff6ffc 100644 --- a/docs/upgrades/templates-7.3.0/default-wiki-front-page.tmpl +++ b/docs/upgrades/templates-7.3.0/default-wiki-front-page.tmpl @@ -9,11 +9,11 @@

-

Search

-Search: +

+
-
+

  • diff --git a/docs/upgrades/templates-7.3.0/default-wiki-page-edit.tmpl b/docs/upgrades/templates-7.3.0/default-wiki-page-edit.tmpl index 238795c50..036355b41 100644 --- a/docs/upgrades/templates-7.3.0/default-wiki-page-edit.tmpl +++ b/docs/upgrades/templates-7.3.0/default-wiki-page-edit.tmpl @@ -9,6 +9,9 @@ + + + @@ -17,15 +20,15 @@
    • -
    • -
    • +
    • +
    -
    + -
    | |
    +
    | |
    ~~~ diff --git a/docs/upgrades/templates-7.3.0/default-wiki-recent-changes.tmpl b/docs/upgrades/templates-7.3.0/default-wiki-recent-changes.tmpl index 8a4dd8f53..23dc18190 100644 --- a/docs/upgrades/templates-7.3.0/default-wiki-recent-changes.tmpl +++ b/docs/upgrades/templates-7.3.0/default-wiki-recent-changes.tmpl @@ -15,5 +15,5 @@ by
-
| |
+
| |
diff --git a/docs/upgrades/templates-7.3.0/default-wiki-search.tmpl b/docs/upgrades/templates-7.3.0/default-wiki-search.tmpl index 32d45ed9a..d00ebe01c 100644 --- a/docs/upgrades/templates-7.3.0/default-wiki-search.tmpl +++ b/docs/upgrades/templates-7.3.0/default-wiki-search.tmpl @@ -5,33 +5,37 @@ #title:Default Wiki Search #menuTitle:Default Wiki Search

-

+

-: -

Results

-
-

-

- -

-

+ + +

+ +
+

+

+ +

+

+
-
-
| |
+ +
|
~~~ - - - + + diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index d9f6a493e..21dcf2d22 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -153,6 +153,36 @@ sub duplicate { } +#------------------------------------------------------------------- +sub getEditForm { + my $self = shift; + my $i18n = WebGUI::International->new($self->session, "Asset_WikiPage"); + my $newPage = 0; + my $wiki = $self->getWiki; + my $var = { + title=> $i18n->get("editing")." ".(defined($self->get('title'))? $self->get('title') : $i18n->get("assetName")), + formHeader => WebGUI::Form::formHeader($self->session, { action => $wiki->getUrl }) .WebGUI::Form::hidden($self->session, { name => 'func', value => 'editSave' }) .WebGUI::Form::hidden($self->session, { name => 'class', value => ref $self }), + formTitle => WebGUI::Form::text($self->session, { name => 'title', maxlength => 255, size => 40, value => $self->get('title') }), + formContent => WebGUI::Form::HTMLArea($self->session, { name => 'content', richEditId => $wiki->get('richEditor'), value => $self->get('content') }), + formSubmit => WebGUI::Form::submit($self->session, { value => 'Save' }), + formAttachment => '', + allowsAttachments => $wiki->get("maxAttachments"), + formFooter => WebGUI::Form::formFooter($self->session), + isNew => ($self->getId eq "new"), + canAdminister => $wiki->canAdminister, + titleLabel => $i18n->get("titleLabel"), + contentLabel => $i18n->get("contentLabel"), + protectLabel => $i18n->get("attachmentLabel"), + attachmentLabel => $i18n->get("attachmentLabel"), + unprotectLabel => $i18n->get("attachmentLabel"), + protectUrl => $self->get("func=protect"), + unprotectUrl => $self->get("func=unprotect"), + isProtected => $self->isProtected + }; + $self->_appendFuncTemplateVars($var); + return $self->processTemplate($var, $wiki->getValue('pageEditTemplateId')); +} + #------------------------------------------------------------------- sub getStorageLocation { my $self = shift; @@ -313,28 +343,7 @@ sub www_delete { sub www_edit { my $self = shift; return $self->session->privilege->insufficient unless $self->canEdit; - - my $template = WebGUI::Asset::Template->new($self->session, $self->getWiki->get('pageEditTemplateId')); - my $var = {}; - my $newPage = 0; - $template->prepare; - $var->{'form.header'} = WebGUI::Form::formHeader($self->session, { action => $self->getWiki->getUrl }) - .WebGUI::Form::hidden($self->session, { name => 'func', value => 'editSave' }) - .WebGUI::Form::hidden($self->session, { name => 'class', value => ref $self }); - $var->{'form.title'} = WebGUI::Form::text - ($self->session, { name => 'title', maxlength => 255, - size => 40, value => $self->get('title') }); - $var->{'form.content'} = WebGUI::Form::HTMLArea - ($self->session, { name => 'content', richEditId => $self->getWiki->get('richEditor'), - value => $self->get('content') }); - $var->{'form.submit'} = WebGUI::Form::submit - ($self->session, { value => 'Save' }); - $var->{'form.footer'} = WebGUI::Form::formFooter($self->session); - $self->_appendFuncTemplateVars($var); - - $var->{title} = "Editing ".(defined($self->get('title'))? $self->get('title') : 'new page'); - - return $self->getWiki->processStyle( $self->processPageTemplate($self->processTemplate($var, undef, $template), 'edit')); + return $self->getEditForm; } #------------------------------------------------------------------- @@ -356,7 +365,6 @@ sub www_protect { my $self = shift; return $self->session->privilege->insufficient unless $self->canProtect; return $self->www_view if $self->isProtected; - $self->session->db->write("DELETE FROM WikiPage_protected WHERE assetId = ?", [$self->getId]); $self->session->db->write("INSERT INTO WikiPage_protected (assetId) VALUES (?)", [$self->getId]); $self->{_isProtected} = 1; @@ -369,7 +377,6 @@ sub www_unprotect { my $self = shift; return $self->session->privilege->insufficient unless $self->canProtect; return $self->www_view if !$self->isProtected; - $self->session->db->write("DELETE FROM WikiPage_protected WHERE assetId = ?", [$self->getId]); $self->{_isProtected} = 0; $self->updateWikiHistory('unprotected'); diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index f616d544e..3bf5c1429 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -67,10 +67,9 @@ sub _appendSearchBoxVars { my $self = shift; my $var = shift; my $queryText = shift; - my $submitText = WebGUI::International->new($self->session, 'Asset_WikiMaster')->get('search submit'); - + my $submitText = WebGUI::International->new($self->session, 'Asset_WikiMaster')->get('searchLabel'); $var->{'searchFormHeader'} = join '', - (WebGUI::Form::formHeader($self->session, { action => $self->getUrl, method => 'GET' }), + (WebGUI::Form::formHeader($self->session, { action => $self->getUrl}), WebGUI::Form::hidden($self->session, { name => 'func', value => 'search' })); $var->{'searchQuery'} = WebGUI::Form::text($self->session, { name => 'query', value => $queryText }); $var->{'searchSubmit'} = WebGUI::Form::submit($self->session, { value => $submitText }); @@ -78,23 +77,6 @@ sub _appendSearchBoxVars { return $self; } -#------------------------------------------------------------------- -sub _appendSearchResultVars { - my $self = shift; - my $var = shift; - my $rs = shift; - my @results = (); - my $dt = $self->session->datetime; - - while (defined(my $row = $rs->hashRef)) { - push @results, $self->_templateSubvarOfPage($row->{assetId}); - } - - $var->{'searchResults'} = \@results; - - return $self; -} - #------------------------------------------------------------------- sub _appendVarsOfDate { my $self = shift; @@ -377,6 +359,13 @@ sub definition { hoverHelp => $i18n->get('searchTemplateId hoverHelp'), label => $i18n->get('searchTemplateId label') }, + pageEditTemplateId => { fieldType => 'template', + namespace => 'WikiPage_edit', + defaultValue => 'WikiPageEditTmpl000001', + tab => 'display', + hoverHelp => $i18n->get('pageEditTemplateId hoverHelp'), + label => $i18n->get('pageEditTemplateId label') }, + recentChangesCount => { fieldType => 'integer', defaultValue => 50, tab => 'display', @@ -481,9 +470,16 @@ sub updateTitleIndex { #------------------------------------------------------------------- sub view { my $self = shift; - my $var = {}; + my $i18n = WebGUI::International->new($self->session, "Asset_WikiMaster"); + my $var = { + description => $self->autolinkHtml($self->get('description')), + searchLabel=>$i18n->get("searchLabel"), + mostPopularUrl=>$self->getUrl("func=mostPopular"), + mostPopularLabel=>$i18n->get("mostPopularLabel"), + recentChangesUrl=>$self->getUrl("func=recentChanges"), + recentChangesLabel=>$i18n->get("recentChangesLabel"), + }; my $template = $self->{_frontPageTemplate}; - $var->{'description'} = $self->autolinkHtml($self->get('description')); $self->_appendSearchBoxVars($var); $self->_appendRecentChangesVars($var, [0, $self->get('recentChangesCountFront')]); $self->_appendFuncTemplateVars($var, qw/recentChanges/); @@ -505,7 +501,19 @@ sub www_recentChanges { #------------------------------------------------------------------- sub www_search { my $self = shift; - my $var = {}; + my $i18n = WebGUI::International->new($self->session, "Asset_WikiMaster"); + my $var = { + resultsLabel=>$i18n->get("resultsLabel"), + notWhatYouWanted=>$i18n->get("notWhatYouWantedLabel"), + nothingFoundLabel=>$i18n->get("nothingFoundLabel"), + addPageLabel=>$i18n->get("addPageLabel"), + wikiHomeLabel=>$i18n->get("wikiHomeLabel"), + searchLabel=>$i18n->get("searchLabel"), + recentChangesUrl=>$self->getUrl("func=recentChanges"), + recentChangesLabel=>$i18n->get("recentChangesLabel"), + wikiHomeUrl=>$self->getUrl, + getEditFormUrl=>$self->getUrl("func=add;class=WebGUI::Asset::WikiPage"), + }; my $queryString = $self->session->form->process('query', 'text'); $self->_appendSearchBoxVars($var, $queryString); if (length $queryString) { @@ -514,12 +522,14 @@ sub www_search { lineage => [$self->get('lineage')], classes => ['WebGUI::Asset::WikiPage'] }); my $rs = $search->getResultSet; - $self->_appendSearchResultVars($var, $rs); + my @results = (); + while (defined(my $row = $rs->hashRef)) { + push @results, $self->_templateSubvarOfPage($row->{assetId}); + } + $var->{'searchResults'} = \@results; + $var->{'performSearch'} = 1; } - $var->{title} = WebGUI::International->new($self->session, 'Asset_WikiMaster')->get('search title'); - my $template = WebGUI::Asset::Template->new($self->session, $self->get('searchTemplateId')); - $template->prepare; - return $self->processStyle($self->processTemplate($var, undef, $template)); + return $self->processStyle($self->processTemplate($var, $self->get('searchTemplateId'))); } 1; diff --git a/lib/WebGUI/i18n/English/Asset_WikiMaster.pm b/lib/WebGUI/i18n/English/Asset_WikiMaster.pm index ec3f1ccbf..0d96eeb52 100644 --- a/lib/WebGUI/i18n/English/Asset_WikiMaster.pm +++ b/lib/WebGUI/i18n/English/Asset_WikiMaster.pm @@ -5,6 +5,15 @@ our $I18N = 'assetName' => { lastUpdated => 1160157064, message => 'Wiki' }, + mostPopularLabel => {message=>q|Most Popular|, lastUpdated=>0}, + recentChangesLabel => {message=>q|Recent Changes|, lastUpdated=>0}, + searchLabel=>{message=>q|Search|, lastUpdated=>0}, + resultsLabel=>{message=>q|Results|, lastUpdated=>0}, + notWhatYouWanted=>{message=>q|Didn't find what you were looking for?|, lastUpdated=>0}, + nothingFoundLabel=>{message=>q|Your search returned no results.|, lastUpdated=>0}, + addPageLabel=>{message=>q|Add a new page.|, lastUpdated=>0}, + wikiHomeLabel=>{message=>q|Wiki Home|, lastUpdated=>0}, + 'approval workflow description' => { message => q|Choose a workflow to be executed on each page as it gets submitted.|, lastUpdated => 0, @@ -54,10 +63,10 @@ our $I18N = 'richEditor label' => { lastUpdated => 1160157064, message => q|Rich Editor| }, - 'pageTemplateId hoverHelp' => - { lastUpdated => 1160157064, message => q|Which template to use to display pages.| }, - 'pageTemplateId label' => - { lastUpdated => 1160157064, message => q|Page Template| }, + 'pageTemplateId hoverHelp' => { lastUpdated => 1160157064, message => q|Which template to use to display pages?| }, + 'pageTemplateId label' => { lastUpdated => 1160157064, message => q|Page Template| }, + 'pageEditTemplateId hoverHelp' => { lastUpdated => 1160157064, message => q|Which template to use to edit pages?| }, + 'pageEditTemplateId label' => { lastUpdated => 1160157064, message => q|Page Edit Template| }, 'frontPageTemplateId hoverHelp' => { lastUpdated => 1161031607, message => q|Which template to use for the front page.| }, @@ -112,12 +121,6 @@ our $I18N = 'actionN created' => { lastUpdated => 1160505291, message => q|Created| }, - 'recentChanges title' => - { lastUpdated => 1161116593, message => q|Recent changes| }, - 'search submit' => - { lastUpdated => 1161031607, message => q|Search| }, - 'search title' => - { lastUpdated => 1161031607, message => q|Search| }, }; 1; diff --git a/lib/WebGUI/i18n/English/Asset_WikiPage.pm b/lib/WebGUI/i18n/English/Asset_WikiPage.pm index 1a8412ab8..7d13ecd30 100644 --- a/lib/WebGUI/i18n/English/Asset_WikiPage.pm +++ b/lib/WebGUI/i18n/English/Asset_WikiPage.pm @@ -2,30 +2,23 @@ package WebGUI::i18n::English::Asset_WikiPage; our $I18N = { - 'assetName' => - { lastUpdated => 1160157064, message => 'Wiki Page' }, + 'titleLabel' => { lastUpdated => 1160157064, message => 'Title' }, + 'contentLabel' => { lastUpdated => 1160157064, message => 'Content' }, + 'attachmentLabel' => { lastUpdated => 1160157064, message => 'Attachment(s)' }, + 'editing' => { lastUpdated => 1160157064, message => 'Editing' }, + 'assetName' => { lastUpdated => 1160157064, message => 'Wiki Page' }, - 'func edit link text' => - { lastUpdated => 1160157064, message => q|Edit this page| }, - 'func view link text' => - { lastUpdated => 1160157064, message => q|View this page| }, - 'func pageHistory link text' => - { lastUpdated => 1160425002, message => q|View this page's history| }, - 'func protect link text' => - { lastUpdated => 1160425002, message => q|Protect this page| }, - 'func unprotect link text' => - { lastUpdated => 1160425002, message => q|Unprotect this page| }, - 'func delete link text' => - { lastUpdated => 1161121377, message => q|Delete this page| }, - 'func wikiPurgeRevision link text' => - { lastUpdated => 1161121377, message => q|Delete this revision of this page| }, - 'func delete link confirm' => - { lastUpdated => 1161121377, message => q|Are you sure you want to delete this page? Deletions cannot be stored within version tags and take place immediately.| }, - 'func wikiPurgeRevision link confirm' => - { lastUpdated => 1161121377, message => q|Are you sure you want to delete this revision of this page? The revision will be permanently erased.| }, + 'editLabel' => { lastUpdated => 1160157064, message => q|Edit| }, + 'viewLabel' => { lastUpdated => 1160157064, message => q|View| }, + 'historyLabel' => { lastUpdated => 1160425002, message => q|History| }, + 'protectLabel' => { lastUpdated => 1160425002, message => q|Protect| }, + 'unprotectLabel' => { lastUpdated => 1160425002, message => q|Unprotect| }, + 'deleteLabel' => { lastUpdated => 1161121377, message => q|Delete| }, + 'func wikiPurgeRevision link text' => { lastUpdated => 1161121377, message => q|Delete this revision of this page| }, + 'func delete link confirm' => { lastUpdated => 1161121377, message => q|Are you sure you want to delete this page? Deletions cannot be stored within version tags and take place immediately.| }, + 'func wikiPurgeRevision link confirm' => { lastUpdated => 1161121377, message => q|Are you sure you want to delete this revision of this page? The revision will be permanently erased.| }, - 'pageHistory title' => - { lastUpdated => 1161113157, message => q|History of "%s"| }, + 'pageHistory title' => { lastUpdated => 1161113157, message => q|History of "%s"| }, }; 1;