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
This commit is contained in:
JT Smith 2005-05-03 19:14:58 +00:00
parent c1303373f0
commit 10285b71cf
8 changed files with 202 additions and 8 deletions

View file

@ -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

View file

@ -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;

View file

@ -465,7 +465,7 @@ sub view {
}
$var{'pagination.previousPage'} = '<form method="GET" style="inline;" action="'.
$self->getUrl.'?calMonthStart='.$calMonthStart.
'&reload='.WebGUI::Id::Generate.'"><a href="'.$self->getUrl.
'&reload='.WebGUI::Id::generate().'"><a href="'.$self->getUrl.
'?calMonthStart='.$prevCalMonthStart.'&calMonthEnd='.$prevCalMonthEnd.'">'.
WebGUI::International::get(558,"Asset_EventsCalendar")." ".$monthRangeLength." ".
$monthLabel.'</a>';

View file

@ -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);
}
}

View file

@ -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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

View file

@ -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;
}

View file

@ -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<menuobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? document.body.scrollLeft+x-menuobj.offsetWidth : window.pageXOffset+x-menuobj.offsetWidth
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+x : window.pageXOffset+x
//same concept with the vertical position
if (bottomedge<menuobj.offsetHeight)
menuobj.style.top=ie5? document.body.scrollTop+y-menuobj.offsetHeight : window.pageYOffset+y-menuobj.offsetHeight
else
menuobj.style.top=ie5? document.body.scrollTop+y : window.pageYOffset+y
menuobj.style.visibility="visible"
return false
}
function contextMenu_hide(){
for (i=0;i<contextMenu_items.length;i++) {
document.getElementById("contextMenu_"+contextMenu_items[i]+"_menu").style.visibility="hidden"
}
return false;
}
function contextMenu_killTimer(){
try {
clearTimeout(contextMenu_timer);
}catch (e) {
}
return false;
}
function contextMenu_create(imagePath, id, name){
contextMenu_items.push(id);
this.id = id;
this.name = name;
this.imagePath=imagePath;
this.linkLabels = new Array();
this.linkUrls = new Array();
this.draw = contextMenu_draw;
this.addLink = contextMenu_addLink;
}
function contextMenu_draw(){
document.write('<div id="contextMenu_' + this.id + '_menu" class="contextMenu_skin">');
for (i=0;i<this.linkUrls.length;i++) {
document.write("<a href=\"" + this.linkUrls[i] + "\">" + this.linkLabels[i] + "</a><br />");
}
document.write('</div>');
document.write('<img src="' + this.imagePath + '" id="contextMenu_' + this.id + '" onmouseup="contextMenu_killTimer()" oncontextmenu="return contextMenu_renderRightClick(\'contextMenu_' + this.id + '_menu\',event)" onmousedown="contextMenu_renderLeftClickHold(\'contextMenu_' + this.id + '_menu\',event)" alt="' + this.name + '" title="' + this.name + '" align="absmiddle" />');
}
function contextMenu_addLink(linkUrl,linkLabel){
this.linkUrls.push(linkUrl);
this.linkLabels.push(linkLabel);
}