added import node
This commit is contained in:
parent
7ac3ec9cc7
commit
a369e16935
3 changed files with 49 additions and 38 deletions
|
|
@ -99,7 +99,7 @@ foreach my $namespace (@allWobjects) {
|
|||
}
|
||||
$sth->finish;
|
||||
}
|
||||
walkTree('0','PBasset000000000000001','000001','1');
|
||||
walkTree('0','PBasset000000000000001','000001','2');
|
||||
print "\t\tMaking second round of table structure changes\n" unless ($quiet);
|
||||
my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject where namespace is not null");
|
||||
while (my ($namespace) = $sth->array) {
|
||||
|
|
@ -168,14 +168,15 @@ WebGUI::SQL->write("alter table USS_submission drop column image");
|
|||
WebGUI::SQL->write("alter table USS_submission drop column attachment");
|
||||
|
||||
|
||||
# start migrating non-wobject stuff into assets
|
||||
my %migration;
|
||||
|
||||
WebGUI::SQL->write("insert into wobject (assetId, styleTemplateId, printableStyleTemplateId) values ('PBasset000000000000002','1','3')");
|
||||
WebGUI::SQL->write("insert into Folder (assetId, templateId) values ('PBasset000000000000002','PBtmpl0000000000000078')");
|
||||
|
||||
|
||||
|
||||
print "\tConverting navigation system to asset tree\n" unless ($quiet);
|
||||
my ($navRootLineage) = WebGUI::SQL->quickArray("select lineage from asset where length(lineage)=12 order by lineage desc limit 1");
|
||||
$navRootLineage = sprintf("%012d",($navRootLineage+1));
|
||||
my $navRootLineage = getNextLineage('PBasset000000000000002');
|
||||
my $navRootId = WebGUI::SQL->setRow("asset","assetId",{
|
||||
assetId=>"new",
|
||||
isHidden=>1,
|
||||
|
|
@ -185,10 +186,10 @@ my $navRootId = WebGUI::SQL->setRow("asset","assetId",{
|
|||
ownerUserId=>"3",
|
||||
groupIdView=>"4",
|
||||
groupIdEdit=>"4",
|
||||
parentId=>"PBasset000000000000001",
|
||||
parentId=>"PBasset000000000000002",
|
||||
lineage=>$navRootLineage,
|
||||
lastUpdated=>time(),
|
||||
className=>"WebGUI::Asset::Wobject::Navigation",
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
state=>"published"
|
||||
});
|
||||
WebGUI::SQL->setRow("wobject","assetId",{
|
||||
|
|
@ -196,14 +197,9 @@ WebGUI::SQL->setRow("wobject","assetId",{
|
|||
styleTemplateId=>"1",
|
||||
printableStyleTemplateId=>"3"
|
||||
},undef,$navRootId);
|
||||
WebGUI::SQL->setRow("Navigation","assetId",{
|
||||
WebGUI::SQL->setRow("Folder","assetId",{
|
||||
assetId=>$navRootId,
|
||||
startType=>"relativeToCurrentUrl",
|
||||
templateId=>"1",
|
||||
startPoint=>"0",
|
||||
endPoint=>"55",
|
||||
assetsToInclude=>"descendants",
|
||||
showHiddenPages=>1
|
||||
templateId=>"PBtmpl0000000000000078"
|
||||
},undef,$navRootId);
|
||||
my %macroCache;
|
||||
my $navRankCounter = 1;
|
||||
|
|
@ -335,8 +331,7 @@ $sth->finish;
|
|||
|
||||
|
||||
print "\tConverting collateral manager items into assets\n" unless ($quiet);
|
||||
my ($collateralRootLineage) = WebGUI::SQL->quickArray("select lineage from asset where length(lineage)=12 order by lineage desc limit 1");
|
||||
$collateralRootLineage = sprintf("%012d",($collateralRootLineage+1));
|
||||
my $collateralRootLineage = getNextLineage('PBasset000000000000002');
|
||||
my $collateralRootId = WebGUI::SQL->setRow("asset","assetId",{
|
||||
assetId=>"new",
|
||||
isHidden=>1,
|
||||
|
|
@ -346,10 +341,10 @@ my $collateralRootId = WebGUI::SQL->setRow("asset","assetId",{
|
|||
ownerUserId=>"3",
|
||||
groupIdView=>"4",
|
||||
groupIdEdit=>"4",
|
||||
parentId=>"PBasset000000000000001",
|
||||
parentId=>"PBasset000000000000002",
|
||||
lineage=>$collateralRootLineage,
|
||||
lastUpdated=>time(),
|
||||
className=>"WebGUI::Asset::Wobject::Navigation",
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
state=>"published"
|
||||
});
|
||||
WebGUI::SQL->setRow("wobject","assetId",{
|
||||
|
|
@ -359,12 +354,7 @@ WebGUI::SQL->setRow("wobject","assetId",{
|
|||
},undef,$collateralRootId);
|
||||
WebGUI::SQL->setRow("Navigation","assetId",{
|
||||
assetId=>$collateralRootId,
|
||||
startType=>"relativeToCurrentUrl",
|
||||
templateId=>"1",
|
||||
startPoint=>"0",
|
||||
endPoint=>"55",
|
||||
assetsToInclude=>"descendants",
|
||||
showHiddenPages=>1
|
||||
templateId=>"PBtmpl0000000000000078"
|
||||
},undef,$collateralRootId);
|
||||
my %folderCache = ('0'=>$collateralRootId);
|
||||
my %folderNameCache;
|
||||
|
|
@ -459,8 +449,7 @@ WebGUI::SQL->write("drop table collateral");
|
|||
print "\tConverting template system to asset tree\n" unless ($quiet);
|
||||
WebGUI::SQL->write("update template set namespace='Layout' where namespace='page'");
|
||||
WebGUI::SQL->write("alter table template add column assetId varchar(22) not null");
|
||||
my ($tempRootLineage) = WebGUI::SQL->quickArray("select lineage from asset where length(lineage)=12 order by lineage desc limit 1");
|
||||
$tempRootLineage = sprintf("%012d",($tempRootLineage+1));
|
||||
my $tempRootLineage = sprintf("%018d",($collateralRootLineage+1));
|
||||
my $tempRootId = WebGUI::SQL->setRow("asset","assetId",{
|
||||
assetId=>"new",
|
||||
isHidden=>1,
|
||||
|
|
@ -470,10 +459,10 @@ my $tempRootId = WebGUI::SQL->setRow("asset","assetId",{
|
|||
ownerUserId=>"3",
|
||||
groupIdView=>"4",
|
||||
groupIdEdit=>"4",
|
||||
parentId=>"PBasset000000000000001",
|
||||
parentId=>"PBasset000000000000002",
|
||||
lineage=>$tempRootLineage,
|
||||
lastUpdated=>time(),
|
||||
className=>"WebGUI::Asset::Wobject::Navigation",
|
||||
className=>"WebGUI::Asset::Wobject::Folder",
|
||||
state=>"published"
|
||||
});
|
||||
WebGUI::SQL->setRow("wobject","assetId",{
|
||||
|
|
@ -481,14 +470,9 @@ WebGUI::SQL->setRow("wobject","assetId",{
|
|||
styleTemplateId=>"1",
|
||||
printableStyleTemplateId=>"3"
|
||||
},undef,$tempRootId);
|
||||
WebGUI::SQL->setRow("Navigation","assetId",{
|
||||
WebGUI::SQL->setRow("Folder","assetId",{
|
||||
assetId=>$tempRootId,
|
||||
templateId=>"1",
|
||||
startType=>"relativeToCurrentUrl",
|
||||
startPoint=>"0",
|
||||
endPoint=>"55",
|
||||
assetsToInclude=>"descendants",
|
||||
showHiddenPages=>1
|
||||
templateId=>"PBtmpl0000000000000078"
|
||||
},undef,$tempRootId);
|
||||
my $tempRankCounter = 1;
|
||||
my %templateCache;
|
||||
|
|
@ -1072,6 +1056,15 @@ sub copyFile {
|
|||
return $id;
|
||||
}
|
||||
|
||||
sub getNextLineage {
|
||||
my $assetId = shift;
|
||||
my ($startLineage) = WebGUI::SQL->quickArray("select lineage from asset where parentId='".$assetId."' order by lineage desc limit 1");
|
||||
$startLineage = '000001000001000000' unless ($startLineage);
|
||||
my $rank = substr($startLineage,12,6);
|
||||
my $parentLineage = substr($startLineage,0,12);
|
||||
return $parentLineage.sprintf("%06d",($rank+1));
|
||||
}
|
||||
|
||||
sub getFileSize {
|
||||
my $id = shift;
|
||||
my $filename = shift;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ create table asset (
|
|||
index (parentId)
|
||||
);
|
||||
|
||||
insert into asset (assetId, parentId, lineage, state, className, title, menuTitle, url, isSystem, ownerUserId, groupIdView, groupIdEdit) values ('PBasset000000000000001', 'infinity', '000001','published','WebGUI::Asset','Root','Root','root',1,'3','3','3');
|
||||
insert into asset (assetId, parentId, lineage, state, className, title, menuTitle, url, isSystem, ownerUserId, groupIdView, groupIdEdit, isHidden) values ('PBasset000000000000001', 'infinity', '000001','published','WebGUI::Asset','Root','Root','root',1,'3','3','3',1);
|
||||
insert into asset (assetId, parentId, lineage, state, className, title, menuTitle, url, isSystem, ownerUserId, groupIdView, groupIdEdit, isHidden) values ('PBasset000000000000002', 'PBasset000000000000001', '000001000001','published','WebGUI::Asset::Wobject::Folder','Import Node','Import','root/import',1,'3','3','3',1);
|
||||
|
||||
create table assetHistory (
|
||||
assetId varchar(22) not null,
|
||||
|
|
@ -101,6 +102,7 @@ create table Folder (
|
|||
templateId varchar(22) not null
|
||||
);
|
||||
|
||||
|
||||
create table FileAsset (
|
||||
assetId varchar(22) not null primary key,
|
||||
storageId varchar(22) not null,
|
||||
|
|
@ -223,7 +225,7 @@ INSERT INTO template VALUES ('1','Default Page','<a href=\"<tmpl_var assetId>\">
|
|||
INSERT INTO template VALUES ('1','File','<tmpl_if session.var.adminOn>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n<a href=\"<tmpl_var fileUrl>\"><img src=\"<tmpl_var fileIcon>\" alt=\"<tmpl_var title>\" border=\"0\" /><tmpl_var filename></a>','FileAsset',1,1);
|
||||
INSERT INTO template VALUES ('2','Image','<tmpl_if session.var.adminOn>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n<img src=\"<tmpl_var fileUrl>\" <tmpl_var parameters> />','ImageAsset',1,1);
|
||||
|
||||
INSERT INTO template VALUES ('15','File Folder','<a name=\"<tmpl_var assetId>\"></a><tmpl_if session.var.adminOn>\r\n <p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"content\">\r\n<tmpl_loop subfolder_loop>\r\n<tr>\r\n <td class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a></td>\r\n <td colspan=\"4\" class=\"tableData\"><a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n</tr>\r\n</tmpl_loop>\r\n<tmpl_loop file_loop>\r\n<tr>\r\n <td class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a></td>\r\n <td class=\"tableData\"><a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n <td class=\"tableData\"><tmpl_var type></td>\r\n <td class=\"tableData\">^D(\"%z %Z\",<tmpl_var date.epoch>);</td>\r\n <td class=\"tableData\"><tmpl_var size></td>\r\n</tr>\r\n</tmpl_loop>\r\n\r\n</table>', 'Folder',1,1);
|
||||
INSERT INTO template VALUES ('15','File Folder','<a name=\"<tmpl_var assetId>\"></a><tmpl_if session.var.adminOn>\r\n <p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"content\">\r\n<tmpl_loop subfolder_loop>\r\n<tr>\r\n <td class=\"tableData\" valign=\"top\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n<td valign=\"top\" colspan=\"3\"><tmpl_var synopsis></td></tr>\r\n</tmpl_loop>\r\n<tmpl_loop file_loop>\r\n<tr>\r\n <td valign=\"top\" class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var type></td>\r\n <td class=\"tableData\" valign=\"top\">^D(\"%z %Z\",<tmpl_var date.epoch>);</td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var size></td>\r\n</tr>\r\n</tmpl_loop>\r\n\r\n</table>', 'Folder',1,1);
|
||||
|
||||
alter table HttpProxy add column cookieJarStorageId varchar(22);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ These methods are available from this class:
|
|||
=cut
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 addChild ( properties )
|
||||
=head2 addChild ( properties [, id ] )
|
||||
|
||||
Adds a child asset to a parent. Creates a new AssetID for child. Makes the parent know that it has children. Adds a new asset to the asset table. Returns the newly created Asset.
|
||||
|
||||
|
|
@ -156,12 +156,16 @@ Adds a child asset to a parent. Creates a new AssetID for child. Makes the paren
|
|||
|
||||
A hash reference containing a list of properties to associate with the child. The only used property value is "className"
|
||||
|
||||
=head3 id
|
||||
|
||||
A unique 22 character ID. By default WebGUI will generate this and you should almost never specify it. This is mainly here for developers that want to include default templates in their plug-ins.
|
||||
|
||||
=cut
|
||||
|
||||
sub addChild {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $id = WebGUI::Id::generate();
|
||||
my $id = WebGUI::Id::generate() || shift;
|
||||
my $lineage = $self->get("lineage").$self->getNextChildRank;
|
||||
$self->{_hasChildren} = 1;
|
||||
WebGUI::SQL->beginTransaction;
|
||||
|
|
@ -1066,6 +1070,18 @@ sub getId {
|
|||
return $self->get("assetId");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getImportNode ()
|
||||
|
||||
Returns the import node asset object. This is where developers will templates, files, etc to the asset tree that have no other obvious attachment point.
|
||||
|
||||
=cut
|
||||
|
||||
sub getImportNode {
|
||||
return WebGUI::Asset->newByDynamicClass("PBasset000000000000002");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getIndexerParams ( )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue