added drag and drop content
This commit is contained in:
parent
9f94bbead8
commit
6d7d53bbff
16 changed files with 527 additions and 19 deletions
|
|
@ -22,7 +22,7 @@ use WebGUI::URL;
|
|||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon ©Icon &deleteIcon &editIcon
|
||||
&moveBottomIcon &moveDownIcon &moveLeftIcon &moveRightIcon &moveTopIcon &moveUpIcon
|
||||
&pageIcon &shortcutIcon &pasteIcon &wobjectIcon &viewIcon);
|
||||
&pageIcon &dragIcon &shortcutIcon &pasteIcon &wobjectIcon &viewIcon);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ A package for generating user interface buttons. The subroutines found herein do
|
|||
$html = copyIcon('op=something');
|
||||
$html = cutIcon('op=something');
|
||||
$html = deleteIcon('op=something');
|
||||
$html = dragIcon();
|
||||
$html = editIcon('op=something');
|
||||
$html = helpIcon(1,"MyNamespace");
|
||||
$html = moveBottomIcon('op=something');
|
||||
|
|
@ -118,7 +119,7 @@ sub cutIcon {
|
|||
|
||||
=head2 deleteIcon ( urlParameters [, pageURL ] )
|
||||
|
||||
Generates a button with an "X" printed on it.
|
||||
Generates a button that represents a delete operation.
|
||||
|
||||
=over
|
||||
|
||||
|
|
@ -144,6 +145,18 @@ sub deleteIcon {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 dragIcon ( )
|
||||
|
||||
Generates an icon that can be used to drag content.
|
||||
|
||||
=cut
|
||||
|
||||
sub dragIcon {
|
||||
return '<img id="dragTrigger" class="dragTrigger" src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/drag.gif" align="middle" border="0" alt="Drag" title="Drag" />';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 editIcon ( urlParameters [, pageURL ] )
|
||||
|
||||
Generates a button with the word "Edit" printed on it.
|
||||
|
|
@ -471,7 +484,7 @@ Generates an icon that looks like a wobject. It's purpose is to represent whethe
|
|||
=cut
|
||||
|
||||
sub wobjectIcon {
|
||||
return '<img class="dragTrigger" src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/wobject.gif" align="middle" border="0" alt="Wobject Settings" title="Wobject Settings" />';
|
||||
return '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/wobject.gif" align="middle" border="0" alt="Wobject Settings" title="Wobject Settings" />';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use WebGUI::Utility;
|
|||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_viewPageTree &www_movePageUp &www_movePageDown
|
||||
&www_cutPage &www_deletePage &www_deletePageConfirm &www_editPage
|
||||
&www_editPageSave &www_pastePage &www_moveTreePageUp
|
||||
&www_editPageSave &www_pastePage &www_moveTreePageUp &www_rearrangeWobjects
|
||||
&www_moveTreePageDown &www_moveTreePageLeft &www_moveTreePageRight);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -608,6 +608,30 @@ sub www_pastePage {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_rearrangeWobjects {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage($session{page}{pageId}));
|
||||
$session{page}{styleId} = 2;
|
||||
my @contentAreas = split(/\./,$session{form}{map});
|
||||
my $templatePosition = 1;
|
||||
foreach my $position (@contentAreas) {
|
||||
my @sequence = split(",",$position);
|
||||
my $sequenceNumber = 1;
|
||||
foreach my $wobjectId (@sequence) {
|
||||
$wobjectId =~ s/td(\d+)/$1/;
|
||||
WebGUI::SQL->setRow("wobject","wobjectId",{
|
||||
wobjectId=>$wobjectId,
|
||||
sequenceNumber=>$sequenceNumber,
|
||||
templatePosition=>$templatePosition
|
||||
});
|
||||
$sequenceNumber++;
|
||||
}
|
||||
$templatePosition++;
|
||||
}
|
||||
return $session{form}{map};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewPageTree {
|
||||
my ($output);
|
||||
|
|
|
|||
|
|
@ -278,7 +278,6 @@ sub generate {
|
|||
.moveUpIcon('op=movePageUp')
|
||||
.moveDownIcon('op=movePageDown')
|
||||
.cutIcon('op=cutPage');
|
||||
my @wobjectsinpage;
|
||||
my $sth = WebGUI::SQL->read("select * from wobject where pageId=".$session{page}{pageId}." order by sequenceNumber, wobjectId");
|
||||
while (my $wobject = $sth->hashRef) {
|
||||
my $wobjectToolbar = wobjectIcon()
|
||||
|
|
@ -325,16 +324,15 @@ sub generate {
|
|||
'wobject.canView'=>WebGUI::Privilege::canViewWobject($wobject->{wobjectId}),
|
||||
'wobject.canEdit'=>WebGUI::Privilege::canEditWobject($wobject->{wobjectId}),
|
||||
'wobject.controls'=>$wobjectToolbar,
|
||||
'wobject.controls.drag'=>dragIcon(),
|
||||
'wobject.namespace'=>$wobject->{namespace},
|
||||
'wobject.id'=>$wobject->{wobjectId},
|
||||
'wobject.isInDateRange'=>$w->inDateRange,
|
||||
'wobject.content'=>eval{$w->www_view}
|
||||
});
|
||||
WebGUI::ErrorHandler::fatalError("Wobject runtime error: ${$wobject}{namespace}. Root cause: ".$@) if($@);
|
||||
push(@wobjectsinpage,{'wobject.id'=>${$wobject}{wobjectId}});
|
||||
}
|
||||
$sth->finish;
|
||||
$var{"wobjectid_list"} = \@wobjectsinpage;
|
||||
return WebGUI::Template::process(getTemplate(),\%var);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -645,7 +645,9 @@ sub setRow {
|
|||
push(@pairs, $key.'='.quote($data->{$key}));
|
||||
}
|
||||
}
|
||||
WebGUI::SQL->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".quote($data->{$keyColumn}), $dbh);
|
||||
if ($pairs[0] ne "") {
|
||||
WebGUI::SQL->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".quote($data->{$keyColumn}), $dbh);
|
||||
}
|
||||
return $data->{$keyColumn};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue