- Added keyword tagging to Wiki.

This commit is contained in:
JT Smith 2007-07-07 21:09:39 +00:00
parent 23fa0283b3
commit f36ba1b268
17 changed files with 323 additions and 213 deletions

View file

@ -5,6 +5,7 @@
WebGUI::Operation::Workflow::www_activityHelper for details.
- Added pagination to purchase history in commerce.
- Added keyword tagging api.
- Added keyword tagging to Wiki.
- improved performance of EMS
- upgraded YUI to 2.2.2 and YUI-ext to 1.0.1a
- Improved error handling in Spectre when WebGUI hands it bad data.

View file

@ -1,58 +0,0 @@
#PBtmpl0000000000000207
#title: Article with Files
#url: article-with-files
#menutitle:
<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
<tmpl_if displayTitle>
<h2><tmpl_var title></h2>
</tmpl_if>
<tmpl_if pagination.isFirstPage>
</tmpl_if>
<tmpl_if description>
<tmpl_var description>
</tmpl_if>
<tmpl_if pagination.isLastPage>
<tmpl_if linkUrl>
<tmpl_if linkTitle>
<p />
<a href="<tmpl_var linkUrl>"><tmpl_var linkTitle></a>
</tmpl_if>
</tmpl_if>
<tmpl_loop attachment_loop>
<p style="display:inline;vertical-align:middle;"><a href="<tmpl_var url>"><img src="<tmpl_var iconUrl>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var filename>" /> <tmpl_var filename></a></p><br />
</tmpl_loop>
</tmpl_if>
<tmpl_if pagination.pageCount.isMultiple>
<tmpl_var pagination.previousPage>
&#183;
<tmpl_var pagination.pageList.upTo20>
&#183;
<tmpl_var pagination.nextPage>
</tmpl_if>
<tmpl_if pagination.isFirstPage>
</tmpl_if>
<tmpl_if pagination.isLastPage>
<tmpl_if allowDiscussion>
<p>
<table width="100%" cellspacing="2" cellpadding="1" border="0">
<tr>
<td align="center" width="50%" class="tableMenu"><a href="<tmpl_var replies.URL>"><tmpl_var replies.label> (<tmpl_var replies.count>)</a></td>
<td align="center" width="50%" class="tableMenu"><a href="<tmpl_var post.url>"><tmpl_var post.label></a></td>
</tr>
</table>
</tmpl_if>
</tmpl_if>

View file

@ -0,0 +1,15 @@
#WikiKeyword00000000001
#url: wiki-master-by-keyword-template.tmpl
#title: Wiki Pages By Keyword (default)
#menuTitle: Wiki Pages By Keyword
#namespace:WikiMaster_byKeyword
#create
<h1><tmpl_var keyword></h1>
<ul>
<tmpl_loop pagesLoop>
<li><a href="<tmpl_var url>"><tmpl_var title></a></li>
</tmpl_loop>
</ul>

View file

@ -0,0 +1,33 @@
#WikiFrontTmpl000000001
<tmpl_if session.var.adminOn><p><tmpl_var controls></p></tmpl_if>
<tmpl_if displayTitle><h2><tmpl_var title></h2></tmpl_if>
<tmpl_var description>
<h3><tmpl_var searchLabel></h3>
<tmpl_var searchFormHeader><tmpl_var searchQuery><tmpl_var searchSubmit><tmpl_var searchFormFooter>
<br />
<div style="float: left; width: 50%;">
<h3><a href="<tmpl_var recentChangesUrl>"><tmpl_var recentChangesLabel></a></h3>
<ul><tmpl_loop recentChanges>
<li>
<tmpl_if isAvailable>
<a href="<tmpl_var url>"><tmpl_var title></a>
<tmpl_else>
<tmpl_var title> (<tmpl_var actionTaken>)
</tmpl_if>
</li>
</tmpl_loop></ul>
</div>
<div style="float: left;">
<h3><a href="<tmpl_var mostPopularUrl>"><tmpl_var mostPopularLabel></a></h3>
<ol><tmpl_loop mostPopular>
<li><a href="<tmpl_var url>"><tmpl_var title></a></li>
</tmpl_loop></ol>
</div>
<div style="clear: both;"></div>
<div><tmpl_var keywordCloud></div>

View file

@ -0,0 +1,110 @@
#WikiPageTmpl0000000001
<tmpl_if session.var.adminOn><p><tmpl_var controls></p></tmpl_if>
<h2><tmpl_var title></h2>
<div id="wikipage" class="yui-navset">
<ul class="yui-nav">
<li class="selected"><a href="#wikipagecontent"><em><tmpl_var viewLabel></em></a></li>
<li><a href="#wikipageedit"><em><tmpl_var editLabel></em></a></li>
</ul>
<div class="yui-content">
<div id="wikipagecontent">
<tmpl_var content>
<p>^International("keywords","Asset");: <tmpl_loop keywordsLoop><a href="<tmpl_var url>"><tmpl_var keyword></a> </tmpl_loop></p>
</div>
<div id="wikipageedit">
<tmpl_var editContent>
</div>
</div>
</div>
<script type="text/javascript">
initWikiTabs = function() {
var tabView = new YAHOO.widget.TabView('wikipage');
tabView.addTab(new YAHOO.widget.Tab({
label: '<tmpl_var historyLabel>',
dataSrc: '<tmpl_var historyUrl>',
cacheData: true
}));
};
initWikiTabs();
</script>
<div style="padding: 8px;"><a href="<tmpl_var searchUrl>"><tmpl_var searchLabel></a> | <a href="<tmpl_var
mostPopularUrl>"><tmpl_var mostPopularLabel></a> | <a href="<tmpl_var recentChangesUrl>"><tmpl_var
recentChangesLabel></a> | <a href="<tmpl_var wikiHomeUrl>"><tmpl_var wikiHomeLabel></a></div>
~~~
<link rel="stylesheet" type="text/css" href="^Extras(yui/build/tabview/assets/tabs.css);">
<script type="text/javascript" src="^Extras(yui/build/yahoo/yahoo.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/event/event.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/dom/dom.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/connection/connection.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/tabview/tabview.js);"></script>
<style type="text/css">
#wikipage.yui-navset .yui-nav li a {
border:1px solid #000; /* label and content borders */
}
#wikipage.yui-navset .yui-content {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
background-color:#f6f7ee; /* active tab, tab hover, and content bgcolor */
}
#wikipage.yui-navset .yui-nav .selected a {
background-color:black; /* active tab, tab hover, and content bgcolor */
color: white;
}
#wikipage.yui-navset-top .yui-nav .selected a {
border-bottom:0; /* no bottom border for active tab */
padding-bottom:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-top .yui-content {
margin-top:-1px; /* for active tab overlap */
}
#wikipage.yui-navset-bottom .yui-nav .selected a {
border-top:0; /* no bottom border for active tab */
padding-top:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-bottom .yui-content {
margin-bottom:-1px; /* for active tab overlap */
}
#wikipage.yui-navset-left .yui-nav li.selected a {
border-right:0; /* no bottom border for active tab */
padding-right:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-left .yui-content {
margin-left:-1px; /* for active tab overlap */
}
#wikipage.yui-navset-right .yui-nav li.selected a {
border-left:0; /* no bottom border for active tab */
padding-left:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-right .yui-content {
margin-right:-1px; /* for active tab overlap */
*margin-right:0; /* except IE */
}
#wikipage .yui-content {
padding-top:1em;
padding-bottom:1em;
}
#wikipage .loading {
background-image:url(^Extras(yui/build/tabview/img/loading.gif););
background-position:center center;
background-repeat:no-repeat;
}
#wikipage .loading * {
display:none;
}
</style>

View file

@ -0,0 +1,28 @@
#WikiPageEditTmpl000001
<tmpl_var formHeader>
<table>
<tbody>
<tr><td><label for="title_formId"><tmpl_var titleLabel></label></td><td><tmpl_var formTitle></td></tr>
<tr><td><label for="content_formId"><tmpl_var contentLabel></label></td><td><tmpl_var formContent></td></tr>
<tr><td><label for="keywords_formId">^International("keywords","Asset");</label></td><td><tmpl_var formKeywords></td></tr>
<tmpl_if canAdminister>
<tr><td><label for="isProtected_formId"><tmpl_var protectQuestionLabel></label></td><td><tmpl_var
formProtect></td></tr>
</tmpl_if>
<tmpl_if allowsAttachments>
<tr><td><label for="storageId_formId"><tmpl_var attachmentLabel></label></td><td><tmpl_var
formAttachment></td></tr>
</tmpl_if>
</tbody>
</table>
<tmpl_var formSubmit>
<tmpl_var formFooter>
<tmpl_if canAdminister><tmpl_unless isNew>
<ul>
<li><a href="<tmpl_var deleteUrl>" onclick="return confirm('<tmpl_var deleteConfirm
ESCAPE="JS">');"><tmpl_var deleteLabel></a></li>
</ul>
</tmpl_unless></tmpl_if>
~~~

View file

@ -1,146 +0,0 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2007 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use lib "../../lib";
use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Asset;
use WebGUI::Workflow;
my $toVersion = "7.3.19"; # make this match what version you're going to
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixAssetSizes($session);
resequenceWorkflowActivities($session);
finish($session); # this line required
#-------------------------------------------------
sub fixAssetSizes {
my $session = shift;
print "\tFix the sizes of ALL Image and Size assets. This will take a while.\n" unless ($quiet);
my $root = WebGUI::Asset->getRoot($session);
foreach my $fileAsset ( @{ $root->getLineage(["self","descendants"],{returnObjects=>1,includeOnlyClasses=>['WebGUI::Asset::File','WebGUI::Asset::Image']}) } ) {
$fileAsset->setSize();
}
}
#-------------------------------------------------
sub resequenceWorkflowActivities {
my $session = shift;
print "\tFix sequencing problems in Workflow Activities. This will take a while.\n" unless ($quiet);
my $workflows = WebGUI::Workflow->getList($session, undef, 1); ##Hack to get around non-existant mode column
my ($workflowId, $title);
while ( ($workflowId, $title) = each %{ $workflows } ) {
my $workflow = WebGUI::Workflow->new($session, $workflowId);
next unless defined $workflow;
$workflow->reorderActivities;
}
}
# ---- DO NOT EDIT BELOW THIS LINE ----
#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
my $session = WebGUI::Session->open("../..",$configFile);
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
updateTemplates($session);
return $session;
}
#-------------------------------------------------
sub finish {
my $session = shift;
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->close();
}
#-------------------------------------------------
sub updateTemplates {
my $session = shift;
return undef unless (-d "templates-".$toVersion);
print "\tUpdating templates.\n" unless ($quiet);
opendir(DIR,"templates-".$toVersion);
my @files = readdir(DIR);
closedir(DIR);
my $importNode = WebGUI::Asset->getImportNode($session);
my $newFolder = undef;
foreach my $file (@files) {
next unless ($file =~ /\.tmpl$/);
open(FILE,"<templates-".$toVersion."/".$file);
my $first = 1;
my $create = 0;
my $head = 0;
my %properties = (className=>"WebGUI::Asset::Template");
while (my $line = <FILE>) {
if ($first) {
$line =~ m/^\#(.*)$/;
$properties{id} = $1;
$first = 0;
} elsif ($line =~ m/^\#create$/) {
$create = 1;
} elsif ($line =~ m/^\#(.*):(.*)$/) {
$properties{$1} = $2;
} elsif ($line =~ m/^~~~$/) {
$head = 1;
} elsif ($head) {
$properties{headBlock} .= $line;
} else {
$properties{template} .= $line;
}
}
close(FILE);
if ($create) {
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
my $template = $newFolder->addChild(\%properties, $properties{id});
} else {
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
if (defined $template) {
my $newRevision = $template->addRevision(\%properties);
}
}
}
}
#-------------------------------------------------
sub createNewTemplatesFolder {
my $importNode = shift;
my $newFolder = $importNode->addChild({
className=>"WebGUI::Asset::Wobject::Folder",
title => $toVersion." New Templates",
menuTitle => $toVersion." New Templates",
url=> $toVersion."_new_templates",
groupIdView=>"12"
});
return $newFolder;
}

View file

@ -45,6 +45,8 @@ sub addKeywordTagging {
index keyword (keyword),
index assetId (assetId)
)");
$session->db->write("alter table WikiMaster add column byKeywordTemplateId varchar(22) binary
not null default 'WikiKeyword00000000001'");
}
#-------------------------------------------------