updated themes to work with all the new stuff
This commit is contained in:
parent
3c58affcd1
commit
5eadb7195b
2 changed files with 51 additions and 73 deletions
|
|
@ -663,6 +663,8 @@ INSERT INTO template VALUES (3,'Search in Help','<tmpl_if displayTitle>\r\n <
|
|||
INSERT INTO template VALUES (1,'Default Search','<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description><p />\r\n</tmpl_if>\r\n\r\n<table class=\"tableMenu\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" width=\"15%\">\r\n <h1><tmpl_var int.search></h1>\r\n </td>\r\n <td vAlign=\"top\" align=\"middle\">\r\n <table>\r\n <form method=\"post\">\r\n <input type=\"hidden\" name=\"func\" value=\"view\">\r\n <input type=\"hidden\" name=\"wid\" value=\"<tmpl_var wid>\">\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" class=\"tableData\">\r\n <input maxLength=\"255\" size=\"30\" value=\'<tmpl_var query>\' name=\"query\">\r\n </td>\r\n <td class=\"tableData\"><tmpl_var submit></td>\r\n </tr>\r\n <tr>\r\n <td class=\"tableData\" valign=\"top\">\r\n <tmpl_loop languages>\r\n <input type=\"radio\" name=\"languages\" value=\"<tmpl_var value>\" \r\n <tmpl_if __FIRST__>\r\n <tmpl_if query>\r\n <tmpl_if selected>\r\n checked=\"1\"\r\n </tmpl_if>\r\n <tmpl_else>\r\n checked=\"1\"\r\n </tmpl_if>\r\n <tmpl_else>\r\n <tmpl_if selected>checked=\"1\"</tmpl_if>\r\n </tmpl_if>\r\n ><tmpl_var name>\r\n <br>\r\n </tmpl_loop>\r\n </td>\r\n <td class=\"tableData\" valign=\"top\">\r\n <tmpl_loop contentTypesSimple>\r\n <tmpl_unless __FIRST__>\r\n <input type=\"checkbox\" name=\"contentTypes\" value=\"<tmpl_var value>\"\r\n <tmpl_if type_content>\r\n <tmpl_if query>\r\n <tmpl_if selected>\r\n checked=\"1\"\r\n </tmpl_if>\r\n <tmpl_else>\r\n checked=\"1\"\r\n </tmpl_if>\r\n <tmpl_else>\r\n <tmpl_if selected>checked=\"1\"</tmpl_if>\r\n </tmpl_if>\r\n ><tmpl_var name>\r\n <br>\r\n </tmpl_unless>\r\n </tmpl_loop>\r\n </td>\r\n <td></td>\r\n </tbody>\r\n </form>\r\n </table>\r\n </td> \r\n </tr>\r\n </tbody>\r\n</table>\r\n\r\n<p/>\r\n<tmpl_if numberOfResults>\r\n <p>Results <tmpl_var startNr> - <tmpl_var endNr> of about <tmpl_var numberOfResults> \r\n containing <b>\"<tmpl_var queryHighlighted>\"</b>. Search took <b><tmpl_var duration></b> seconds.</p>\r\n <ol style=\"Margin-Top: 0px; Margin-Bottom: 0px;\" start=\"<tmpl_var startNr>\">\r\n <tmpl_loop resultsLoop>\r\n <li>\r\n <a href=\"<tmpl_var location>\">\r\n <tmpl_if header><tmpl_var header><tmpl_else>No Title</tmpl_if></a>\r\n <div>\r\n <tmpl_if \"body\">\r\n <span class=\"preview\"><tmpl_var \"body\"></span><br/>\r\n </tmpl_if>\r\n <span style=\"color:#666666;\">Location: <tmpl_var crumbTrail></span>\r\n <br/>\r\n <br/>\r\n </div>\r\n </li>\r\n </tmpl_loop>\r\n </ol>\r\n</tmpl_if> \n\n\n<tmpl_if pagination.pageCount.isMultiple>\n <div class=\"pagination\">\n <tmpl_var pagination.previousPage> · <tmpl_var pagination.pageList.upTo20> · <tmpl_var pagination.nextPage>\n </div>\n</tmpl_if>\n','IndexedSearch');
|
||||
delete from international where internationalId=365 and namespace='WebGUI';
|
||||
delete from international where internationalId=366 and namespace='WebGUI';
|
||||
delete from international where internationalId=910 and namespace='WebGUI';
|
||||
delete from international where internationalId=912 and namespace='WebGUI';
|
||||
|
||||
|
||||
INSERT INTO template VALUES (14,'Job Listing','<tmpl_if displayTitle>\n <h1><tmpl_var title></h1>\n</tmpl_if>\n\n<tmpl_if description>\n <tmpl_var description><p />\n</tmpl_if>\n\n<tmpl_if session.scratch.search>\n <tmpl_var search.form>\n</tmpl_if>\n\n<table width=\"100%\" cellpadding=2 cellspacing=1 border=0><tr>\n<td align=\"right\" class=\"tableMenu\">\n\n<tmpl_if canPost>\n <a href=\"<tmpl_var post.url>\">Add a job.</a> ·\n</tmpl_if>\n\n<a href=\"<tmpl_var search.url>\"><tmpl_var search.label></a>\n\n</td></tr></table>\n\n<table width=\"100%\" cellspacing=1 cellpadding=2 border=0>\n<tr>\n<td class=\"tableHeader\">Job Title</td>\n<td class=\"tableHeader\">Location</td>\n<td class=\"tableHeader\">Compensation</td>\n<td class=\"tableHeader\">Date Posted</td>\n</tr>\n\n<tmpl_loop submissions_loop>\n\n<tr>\n<td class=\"tableData\">\n <a href=\"<tmpl_var submission.URL>\"> <tmpl_var submission.title>\n</td>\n<td class=\"tableData\"><tmpl_var submission.userDefined2></td>\n<td class=\"tableData\"><tmpl_var submission.userDefined1></td>\n<td class=\"tableData\"><tmpl_var submission.date></td>\n</tr>\n\n</tmpl_loop>\n\n</table>\n\n<tmpl_if multiplePages>\n <div class=\"pagination\">\n <tmpl_var previousPage> · <tmpl_var pageList> · <tmpl_var nextPage>\n </div>\n</tmpl_if>\n','USS');
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ sub _getComponentTypes {
|
|||
file=>WebGUI::International::get(915),
|
||||
image=>WebGUI::International::get(914),
|
||||
snippet=>WebGUI::International::get(916),
|
||||
style=>WebGUI::International::get(912),
|
||||
template=>WebGUI::International::get(913)
|
||||
);
|
||||
return \%components;
|
||||
|
|
@ -66,43 +65,36 @@ sub www_addThemeComponent {
|
|||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(9));
|
||||
my (@q, $output, $defaultList, $component, $f);
|
||||
my $types = _getComponentTypes();
|
||||
push(@q,{query=>"select collateralId,name from collateral where collateralType='file' order by name",type=>"file"});
|
||||
push(@q,{query=>"select collateralId,name from collateral where collateralType='image' order by name",type=>"image"});
|
||||
push(@q,{query=>"select collateralId,name from collateral where collateralType='snippet' order by name",type=>"snippet"});
|
||||
push(@q,{query=>"select styleId,name from style order by name",type=>"style"});
|
||||
push(@q,{query=>"select templateId,namespace,name from template order by name",type=>"template"});
|
||||
push(@q,{query=>"select collateralType,collateralId,name from collateral where collateralType='file' order by name",type=>"file"});
|
||||
push(@q,{query=>"select collateralType,collateralId,name from collateral where collateralType='image' order by name",type=>"image"});
|
||||
push(@q,{query=>"select collateralType,collateralId,name from collateral where collateralType='snippet' order by name",type=>"snippet"});
|
||||
$output .= '<h1>'.WebGUI::International::get(909).'</h1>';
|
||||
$output .= ' <script src="'.$session{config}{extrasURL}.'/doubleSelect.js"></script> <script>';
|
||||
my $selectList = '<select name="id" multiple="1" size="10">';
|
||||
foreach my $row (@q) {
|
||||
my $comp = WebGUI::SQL->buildHashRef($row->{query});
|
||||
$defaultList = $comp if ($row->{type} eq "style");
|
||||
my $first = 1;
|
||||
$selectList .= "\n".'<optgroup label="'.$types->{$row->{type}}.'">';
|
||||
foreach my $key (keys %{$comp}) {
|
||||
if ($first) {
|
||||
$output .= "newCat();\n";
|
||||
$first = 0;
|
||||
}
|
||||
$output .= 'O("'.$comp->{$key}.'","'.$key.'");'."\n";
|
||||
}
|
||||
if ($first) {
|
||||
delete $types->{$row->{type}};
|
||||
$selectList .= '<option value="'.$key.'">'.$comp->{$key}.'</option>';
|
||||
}
|
||||
$selectList .= '</optgroup>';
|
||||
}
|
||||
$output .= ' </script> ';
|
||||
my $sth = WebGUI::SQL->read("select templateId,namespace,name from template order by namespace,name");
|
||||
my $previous;
|
||||
while( my $comp = $sth->hashRef) {
|
||||
if ($previous ne $comp->{namespace}) {
|
||||
$selectList .= "\n".'<optgroup label="'.$types->{template}.'/'.$comp->{namespace}.'">';
|
||||
}
|
||||
$selectList .= '<option value="template_'.$comp->{templateId}.'_'.$comp->{namespace}.'">'.$comp->{name}.'</option>';
|
||||
$previous = $comp->{namespace};
|
||||
}
|
||||
$sth->finish;
|
||||
$selectList .= '</select>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","addThemeComponentSave");
|
||||
$f->hidden("themeId",$session{form}{themeId});
|
||||
$f->selectList(
|
||||
-name=>"type",
|
||||
-value=>["style"],
|
||||
-options=>$types,
|
||||
-label=>WebGUI::International::get(910),
|
||||
-extras=>'onChange="relate(this.form.type,this.form.id)"'
|
||||
);
|
||||
$f->selectList(
|
||||
-name=>"id",
|
||||
-label=>WebGUI::International::get(911),
|
||||
-options=>$defaultList
|
||||
$f->readOnly(
|
||||
-value=>$selectList,
|
||||
-label=>WebGUI::International::get(911)
|
||||
);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
|
|
@ -112,10 +104,15 @@ sub www_addThemeComponent {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_addThemeComponentSave {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(9));
|
||||
my $componentId = getNextId("themeComponentId");
|
||||
WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id)
|
||||
values ($session{form}{themeId}, $componentId, ".quote($session{form}{type}).",
|
||||
".quote($session{form}{id}).")");
|
||||
my @ids = WebGUI::FormProcessor::selectList("id");
|
||||
foreach my $id (@ids) {
|
||||
$id =~ /^(.*?)\_(.*)/;
|
||||
my $type = $1;
|
||||
$id = $2;
|
||||
my $componentId = getNextId("themeComponentId");
|
||||
WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id)
|
||||
values ($session{form}{themeId}, $componentId, ".quote($type).", ".quote($id).")");
|
||||
}
|
||||
return www_editTheme();
|
||||
}
|
||||
|
||||
|
|
@ -143,9 +140,7 @@ sub www_deleteThemeConfirm {
|
|||
WebGUI::SQL->write("delete from collateralFolder where name=".quote($theme->{name}));
|
||||
my $sth = WebGUI::SQL->read("select type,Id from themeComponent where themeId=".$session{form}{themeId});
|
||||
while (my $component = $sth->hashRef) {
|
||||
if ($component->{type} eq "style") {
|
||||
WebGUI::SQL->write("delete from style where styleId=".$component->{id});
|
||||
} elsif ($component->{type} eq "template") {
|
||||
if ($component->{type} eq "template") {
|
||||
my ($id,$namespace) = split("_",$component->{id});
|
||||
WebGUI::SQL->write("delete from template where templateId=".$id
|
||||
." and namespace=".quote($namespace));
|
||||
|
|
@ -219,25 +214,17 @@ sub www_editTheme {
|
|||
$output .= '<p><a href="'.WebGUI::URL::page('op=addThemeComponent&themeId='.$session{form}{themeId}).'">'
|
||||
.WebGUI::International::get(917).'</a><p>';
|
||||
my $componentTypes = _getComponentTypes();
|
||||
my @queries = (
|
||||
"select style.name as name, themeComponent.themeComponentId as componentId, 'style' as componentType
|
||||
from themeComponent, style
|
||||
where style.styleId=themeComponent.id and themeComponent.type='style'
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name",
|
||||
"select collateral.name as name, themeComponent.themeComponentId as componentId,
|
||||
my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId,
|
||||
collateral.collateralType as componentType from themeComponent, collateral
|
||||
where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name"
|
||||
);
|
||||
foreach my $query (@queries) {
|
||||
my $sth = WebGUI::SQL->read($query);
|
||||
while (my $component = $sth->hashRef) {
|
||||
$output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId}
|
||||
.'&themeComponentId='.$component->{componentId})
|
||||
.' '.$component->{name}.' ('.$componentTypes->{$component->{componentType}}.')<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name";
|
||||
my $sth = WebGUI::SQL->read($query);
|
||||
while (my $component = $sth->hashRef) {
|
||||
$output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId}
|
||||
.'&themeComponentId='.$component->{componentId})
|
||||
.' '.$component->{name}.' ('.$componentTypes->{$component->{componentType}}.')<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
my $sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent
|
||||
where type='template' and themeId=".$session{form}{themeId});
|
||||
while (my $data = $sth->hashRef) {
|
||||
|
|
@ -246,7 +233,7 @@ sub www_editTheme {
|
|||
templateId=".$templateId." and namespace=".quote($namespace));
|
||||
$output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId}
|
||||
.'&themeComponentId='.$data->{themeComponentId})
|
||||
.' '.$name.' ('.$componentTypes->{template}.')<br>';
|
||||
.' '.$name.' ('.$componentTypes->{template}.'/'.$namespace.')<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
|
@ -302,9 +289,6 @@ sub www_exportTheme {
|
|||
} elsif ($component->{type} eq "snippet") {
|
||||
my $c = WebGUI::Collateral->new($component->{id});
|
||||
$theme->{components}{$key}{properties} = $c->get;
|
||||
} elsif ($component->{type} eq "style") {
|
||||
$theme->{components}{$key}{properties} = WebGUI::SQL->quickHashRef("select * from style
|
||||
where styleId=".$component->{id});
|
||||
} elsif ($component->{type} eq "template") {
|
||||
my ($id, $namespace) = split("_",$component->{id});
|
||||
$theme->{components}{$key}{properties} = WebGUI::SQL->quickHashRef("select * from template
|
||||
|
|
@ -409,7 +393,7 @@ sub www_importThemeSave {
|
|||
".quote($theme->{name}).", 0)");
|
||||
foreach my $key (keys %{$theme->{components}}) {
|
||||
my $type = $theme->{components}{$key}{type};
|
||||
if (isIn($type, qw(style template))) {
|
||||
if ($type eq "template") {
|
||||
$theme->{components}{$key}{properties}{$type."Id"} = getNextId($type."Id");
|
||||
my (@fields, @values);
|
||||
foreach my $property (keys %{$theme->{components}{$key}{properties}}) {
|
||||
|
|
@ -496,24 +480,16 @@ sub www_viewTheme {
|
|||
);
|
||||
$output .= $f->print;
|
||||
my $componentTypes = _getComponentTypes();
|
||||
my @queries = (
|
||||
"select style.name as name, themeComponent.themeComponentId as componentId, 'style' as componentType
|
||||
from themeComponent, style
|
||||
where style.styleId=themeComponent.id and themeComponent.type='style'
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name",
|
||||
"select collateral.name as name, themeComponent.themeComponentId as componentId,
|
||||
my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId,
|
||||
collateral.collateralType as componentType from themeComponent, collateral
|
||||
where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name"
|
||||
);
|
||||
foreach my $query (@queries) {
|
||||
my $sth = WebGUI::SQL->read($query);
|
||||
while (my $component = $sth->hashRef) {
|
||||
$output .= $component->{name}.' ('.$componentTypes->{$component->{componentType}}.')<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent
|
||||
and themeComponent.themeId=$session{form}{themeId} order by name";
|
||||
my $sth = WebGUI::SQL->read($query);
|
||||
while (my $component = $sth->hashRef) {
|
||||
$output .= $component->{name}.' ('.$componentTypes->{$component->{componentType}}.')<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
my $sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent
|
||||
where type='template' and themeId=".$session{form}{themeId});
|
||||
while (my $data = $sth->hashRef) {
|
||||
my ($templateId,$namespace) = split("_",$data->{id});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue