WebGUI 2.4.0 release
This commit is contained in:
parent
2a61818564
commit
6286f9bfaf
74 changed files with 2332 additions and 548 deletions
|
|
@ -24,18 +24,29 @@ use WebGUI::Widget;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _traversePageTree {
|
||||
my ($sth, @data, $output, $depth, $i);
|
||||
for ($i=0;$i<=$_[1];$i++) {
|
||||
$depth .= " ";
|
||||
my ($lineSpacing, $sth, @data, $output, $depth, $i, $toLevel);
|
||||
if ($_[2] > 0) {
|
||||
$toLevel = $_[2];
|
||||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.'· <a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a><br>';
|
||||
$output .= _traversePageTree($data[2],$_[1]+1);
|
||||
}
|
||||
for ($i=1;$i<=$_[1]*$_[3];$i++) {
|
||||
$depth .= " ";
|
||||
}
|
||||
for ($i=1;$i<=$_[5];$i++) {
|
||||
$lineSpacing .= "<br>";
|
||||
}
|
||||
if ($_[1] < $toLevel) {
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.$_[4].' <a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a>';
|
||||
$output .= $lineSpacing;
|
||||
$output .= _traversePageTree($data[2],$_[1]+1,$_[2],$_[3],$_[4],$_[5]);
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
$sth->finish;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -47,24 +58,29 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Site Map";
|
||||
return WebGUI::International::get(2,$namespace);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace='.$namespace.'"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Site Map</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace='.$namespace.'"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(1,$namespace).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget",$namespace);
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,128,'Site Map').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process Macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Starting from this level?</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,128,'Site Map').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(3,$namespace).'</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(4,$namespace).'</td><td>'.WebGUI::Form::text("depth",20,2,0).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(6,$namespace).'</td><td>'.WebGUI::Form::text("indent",20,2,5).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(7,$namespace).'</td><td>'.WebGUI::Form::text("bullet",20,30,'·').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(8,$namespace).'</td><td>'.WebGUI::Form::text("bullet",20,1,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -78,7 +94,7 @@ sub www_addSave {
|
|||
my ($widgetId, $displayTitle, $image, $attachment);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create();
|
||||
WebGUI::SQL->write("insert into SiteMap values ($widgetId, '$session{form}{startAtThisLevel}', '$session{form}{showOnlyThisLevel}')",$session{dbh});
|
||||
WebGUI::SQL->write("insert into SiteMap values ($widgetId, '$session{form}{startAtThisLevel}', '$session{form}{depth}', '$session{form}{indent}', ".quote($session{form}{bullet}).", '$session{form}{lineSpacing}')",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -91,17 +107,22 @@ sub www_edit {
|
|||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace='.$namespace.'"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Site Map</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace='.$namespace.'"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(5,$namespace).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,128,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process Macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Starting from this level?</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,128,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(3,$namespace).'</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(4,$namespace).'</td><td>'.WebGUI::Form::text("depth",20,2,$data{depth}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(6,$namespace).'</td><td>'.WebGUI::Form::text("indent",20,2,$data{indent}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(7,$namespace).'</td><td>'.WebGUI::Form::text("bullet",20,30,$data{bullet}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(8,$namespace).'</td><td>'.WebGUI::Form::text("lineSpacing",20,1,$data{lineSpacing}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -113,7 +134,7 @@ sub www_edit {
|
|||
sub www_editSave {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
WebGUI::SQL->write("update SiteMap set startAtThisLevel='$session{form}{startAtThisLevel}', showOnlyThisLevel='$session{form}{showOnlyThisLevel}' where widgetId=$session{form}{wid}",$session{dbh});
|
||||
WebGUI::SQL->write("update SiteMap set startAtThisLevel='$session{form}{startAtThisLevel}', depth='$session{form}{depth}', indent='$session{form}{indent}', bullet=".quote($session{form}{bullet}).", lineSpacing='$session{form}{lineSpacing}' where widgetId=$session{form}{wid}",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -122,7 +143,7 @@ sub www_editSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, $output, $sth, @root, $parent);
|
||||
my (%data, $output, $parent);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId='$_[0]'",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
@ -135,16 +156,7 @@ sub www_view {
|
|||
} else {
|
||||
$parent = 1;
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$parent' order by sequenceNumber",$session{dbh});
|
||||
while (@root = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($root[2])) {
|
||||
$output .= '· <a href="'.$session{env}{SCRIPT_NAME}.'/'.$root[0].'">'.$root[1].'</a><br>';
|
||||
unless ($data{showOnlyThisLevel} eq 1) {
|
||||
$output .= _traversePageTree($root[2],1);
|
||||
}
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= _traversePageTree($parent,0,$data{depth},$data{indent},$data{bullet},$data{lineSpacing});
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue