From 10285b71cf110f33bd84a9e30cd8ab2b0c441555 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 3 May 2005 19:14:58 +0000 Subject: [PATCH] added hide option to layout fixed typo in events calendar added context menu stuff that i forgot to check in added richEditId option to the HTMLArea method in HTMLForm --- docs/changelog/6.x.x.txt | 2 + docs/upgrades/upgrade_6.5.6-6.6.0.sql | 1 + lib/WebGUI/Asset/Wobject/EventsCalendar.pm | 2 +- lib/WebGUI/Asset/Wobject/Layout.pm | 30 ++++- lib/WebGUI/HTMLForm.pm | 11 +- www/extras/contextMenu/bg.jpg | Bin 0 -> 626 bytes www/extras/contextMenu/contextMenu.css | 31 +++++ www/extras/contextMenu/contextMenu.js | 133 +++++++++++++++++++++ 8 files changed, 202 insertions(+), 8 deletions(-) create mode 100644 www/extras/contextMenu/bg.jpg create mode 100644 www/extras/contextMenu/contextMenu.css create mode 100755 www/extras/contextMenu/contextMenu.js diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 5047faa33..55c8260b1 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -54,6 +54,8 @@ - Added "create shortcut" as a context menu option in the asset manager. - Fixed generateContent.pl to work with the new asset tree. - Updated TinyMCE to version 1.44. + - Added an option to the layout to hide child assets from being displayed. + This allows you to use non-layout child assets as stand alone pages. 6.5.6 diff --git a/docs/upgrades/upgrade_6.5.6-6.6.0.sql b/docs/upgrades/upgrade_6.5.6-6.6.0.sql index 8d42f412b..c1d9822b7 100644 --- a/docs/upgrades/upgrade_6.5.6-6.6.0.sql +++ b/docs/upgrades/upgrade_6.5.6-6.6.0.sql @@ -75,4 +75,5 @@ alter table Collaboration drop column allowRichEdit; alter table Collaboration add column richEditor varchar(22) not null default 'PBrichedit000000000002'; delete from userProfileField where fieldName like 'richEditor%'; delete from userProfileData where fieldName like 'richEditor%'; +alter table Layout add column assetsToHide text; diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm index 6387ff5c0..6758bda5b 100644 --- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm @@ -465,7 +465,7 @@ sub view { } $var{'pagination.previousPage'} = '
'. WebGUI::International::get(558,"Asset_EventsCalendar")." ".$monthRangeLength." ". $monthLabel.''; diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 40f255123..512d9e679 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -70,6 +70,10 @@ sub definition { noFormPost=>1, defaultValue=>undef, fieldType=>"hidden" + }, + assetsToHide => { + defaultValue=>undef, + fieldType=>"checkList" } } }); @@ -101,6 +105,21 @@ sub getEditForm { }, -value=>"view" ); + } else { + my @assetsToHide = split("\n",$self->getValue("assetsToHide")); + my $children = $self->getLineage(["children"],{"returnQuickReadObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]}); + my %childIds; + foreach my $child (@{$children}) { + $childIds{$child->getId} = $child->getTitle; + } + $tabform->getTab("display")->checkList( + -name=>"assetsToHide", + -value=>\@assetsToHide, + -options=>\%childIds, + -label=>"Assets To Hide", + -vertical=>1, + -uiLevel=>9 + ); } return $tabform; } @@ -147,6 +166,7 @@ sub view { my %vars; # I'm sure there's a more efficient way to do this. We'll figure it out someday. my @positions = split(/\./,$self->get("contentPositions")); + my @hidden = split("\n",$self->getValue("assetsToHide")); my $i = 1; my @found; foreach my $position (@positions) { @@ -154,10 +174,12 @@ sub view { foreach my $asset (@assets) { foreach my $child (@{$children}) { if ($asset eq $child->getId) { - push(@{$vars{"position".$i."_loop"}},{ - id=>$child->getId, - content=>$child->view - }) if $child->canView; + unless (isIn($asset,@hidden)) { + push(@{$vars{"position".$i."_loop"}},{ + id=>$child->getId, + content=>$child->view + }) if $child->canView; + } push(@found, $child->getId); } } diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index 665db28cb..73fa9e936 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -1454,13 +1454,17 @@ The UI level for this field. See the WebGUI developer's site for details. Defaul If no value is specified, this will be used. +=head3 richEditId + +An asset Id of a rich editor config. Defaults to the default rich editor in the settings. + =cut sub HTMLArea { my ($output); my ($self, @p) = @_; - my ($name, $label, $value, $subtext, $extras, $wrap, $rows, $columns, $uiLevel, $defaultValue) = - rearrange([qw(name label value subtext extras wrap rows columns uiLevel defaultValue)], @p); + my ($name, $label, $value, $subtext, $extras, $wrap, $rows, $columns, $uiLevel, $defaultValue, $richEditId) = + rearrange([qw(name label value subtext extras wrap rows columns uiLevel defaultValue richEditId)], @p); if (_uiLevelChecksOut($uiLevel)) { $output = WebGUI::Form::HTMLArea({ "name"=>$name, @@ -1469,7 +1473,8 @@ sub HTMLArea { "columns"=>$columns, "rows"=>$rows, "extras"=>$extras, - defaultValue=>$defaultValue + defaultValue=>$defaultValue, + richEditId=>$richEditId }); $output .= _subtext($subtext); $output = $self->_tableFormRow($label,$output); diff --git a/www/extras/contextMenu/bg.jpg b/www/extras/contextMenu/bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8da764bb24518046dae1047bee1a08ca434faf43 GIT binary patch literal 626 zcmb_YJxc>Y6r6W^x0g*WA1jCi(N;mLU}2|%1Qd~IV<)1QN>GakULzOrA1DZ7k)L2| zcZH3er5{bIRAOh5YJIm#;vsguazAu%^=amYwAR&b3dP+)FET}@U zTw;{Vw(0u{zN+lppfU+`&Y3|~kcOj4XfpTM1f}4Z12`m9R!N^KzxqgTjOff{+Gk!6 z2x0@Fv4D>_)!?t)h$%cIwIeP@du_|J7&vIu+LuA+78t*Zo89V(+;);b<*jSqGS5Ht zbZ63Xj<+xJIB#i+=~=+*$C2eDFu`_1i?JSA3hr;EVFFG?ckD^2InOfevY%O4YuOiy b=H)tF#9@~`Wxo?ya&*Sf-j@G!_~!W&$jN0< literal 0 HcmV?d00001 diff --git a/www/extras/contextMenu/contextMenu.css b/www/extras/contextMenu/contextMenu.css new file mode 100644 index 000000000..be63af71b --- /dev/null +++ b/www/extras/contextMenu/contextMenu.css @@ -0,0 +1,31 @@ +.contextMenu_skin { + position:absolute; + width:120px; + border:2px outset #eeeeee; + font-family: helvetica, arial, sans-serif; + line-height:18px; + cursor: default; + font-size:12px; + z-index:100; + visibility:hidden; + padding: 4px; + background-color: #eeeeee; + background-image: url(bg.jpg); + background-repeat: repeat-x; + font-weight: normal; +} +.contextMenu_skin A { + font-weight: normal; + width: 100%; + color: black; + text-decoration: none; + margin: 1px; +} +.contextMenu_skin A:hover { + font-weight: normal; + color: black; + margin: 0px; + background-color: #eeeeee; + border: 1px solid #dddddd; +} + diff --git a/www/extras/contextMenu/contextMenu.js b/www/extras/contextMenu/contextMenu.js new file mode 100755 index 000000000..827cf1432 --- /dev/null +++ b/www/extras/contextMenu/contextMenu.js @@ -0,0 +1,133 @@ +var ie5=document.all&&document.getElementById +var contextMenu_timer = null; +var contextMenu_items = new Array(); +function contextMenu_renderLeftClickHold(menuId,e) { + contextMenu_hideAll(e) + contextMenu_timer = setTimeout("contextMenu_show('" + menuId + "', " + contextMenu_getXOffset(e,document.getElementById("menuId")) + "," + contextMenu_getYOffset(e,document.getElementById("menuId")) + ")",1000); + return false; +} + +document.onmousedown=contextMenu_hideAll; + +function contextMenu_hideAll(e) { + e =ie5? event : e; + var firedobj = ie5?e.srcElement:e.target; + + while (firedobj != null && firedobj.tagName != "HTML" && firedobj.tagName != "IMG") { + if (firedobj.id.indexOf("contextMenu") != -1) { + return; + } + firedobj = firedobj.offsetParent; + } + contextMenu_hide(); +} + +function contextMenu_renderRightClick(menuId,e) { + contextMenu_hideAll(e) + contextMenu_show(menuId,contextMenu_getXOffset(e,document.getElementById("menuId")),contextMenu_getYOffset(e,document.getElementById("menuId"))); + e.cancelBubble=true; + e.returnValue=false; + return false; +} + + +function contextMenu_getXOffset(e,menu) { + var firedobj = ie5?e.srcElement:e.target; + var tempX = 0; + foundDiv = false; + while (firedobj!=null && firedobj.tagName!="HTML"){ + //this is a hack, need to revisit + if (firedobj.tagName == "DIV") foundDiv = true; + tempX+=firedobj.offsetLeft; + firedobj=firedobj.offsetParent; + } + if (foundDiv) { + return e.clientX - tempX; + }else { + return e.clientX; + } +} + +function contextMenu_getYOffset(e,menu) { + var firedobj = ie5?e.srcElement:e.target; + var tempY = 0; + foundDiv = false; + while (firedobj!=null && firedobj.tagName!="HTML"){ + //this is a hack, need to revisit + if (firedobj.tagName == "DIV") foundDiv = true; + tempY+=firedobj.offsetTop; + firedobj=firedobj.offsetParent; + } + if (foundDiv) { + return e.clientY - tempY; + }else { + return e.clientY; + } +} + +function contextMenu_show(menuId,x,y){ + var menuobj=document.getElementById(menuId) + //Find out how close the mouse is to the corner of the window + var rightedge=ie5? document.body.clientWidth-x : window.innerWidth-x + var bottomedge=ie5? document.body.clientHeight-y : window.innerHeight-y + + //if the horizontal distance isn't enough to accomodate the width of the context menu + if (rightedge'); + for (i=0;i" + this.linkLabels[i] + "
"); + } + document.write(''); + document.write('' + this.name + ''); + +} + +function contextMenu_addLink(linkUrl,linkLabel){ + this.linkUrls.push(linkUrl); + this.linkLabels.push(linkLabel); +} + +