merging 6.2.8 changes and initial draft of TinyMCE as rich editor

This commit is contained in:
JT Smith 2004-10-30 15:49:59 +00:00
parent a189f52942
commit 6ddb7c49e6
38 changed files with 328 additions and 145 deletions

View file

@ -35,6 +35,7 @@ use Tie::IxHash;
use WebGUI::URL;
use WebGUI::HTML;
#-------------------------------------------------------------------
sub _submenu {
my (%menu);
@ -50,7 +51,7 @@ sub _submenu {
$menu{WebGUI::URL::page('op=editCollateralFolder')} = WebGUI::International::get(759);
if (WebGUI::Grouping::isInGroup(3)) {
$menu{WebGUI::URL::page('op=emptyCollateralFolder')} = WebGUI::International::get(980);
$menu{WebGUI::URL::page('op=deleteCollateralFolder')} = WebGUI::International::get(760);
# $menu{WebGUI::URL::page('op=deleteCollateralFolder')} = WebGUI::International::get(760);
}
$menu{WebGUI::URL::page('op=listCollateral')} = WebGUI::International::get(766);
return menuWrapper($_[0],\%menu);
@ -59,7 +60,7 @@ sub _submenu {
#-------------------------------------------------------------------
sub www_deleteCollateral {
my $collateral = WebGUI::Collateral->new($session{form}{cid});
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") eq $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(774).'<p/><div align="center">';
$output .= '<a href="'.WebGUI::URL::page('op=deleteCollateralConfirm&cid='.$session{form}{cid}).'">'
@ -73,7 +74,7 @@ sub www_deleteCollateral {
#-------------------------------------------------------------------
sub www_deleteCollateralConfirm {
my $collateral = WebGUI::Collateral->new($session{form}{cid});
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") eq $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
$collateral->delete;
WebGUI::Session::deleteScratch("collateralPageNumber");
return www_listCollateral();
@ -82,7 +83,7 @@ sub www_deleteCollateralConfirm {
#-------------------------------------------------------------------
sub www_deleteCollateralFile {
my $collateral = WebGUI::Collateral->new($session{form}{cid});
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") eq $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
$collateral->deleteFile;
return www_editCollateral($collateral);
}
@ -90,7 +91,7 @@ sub www_deleteCollateralFile {
#-------------------------------------------------------------------
sub www_deleteCollateralFolder {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
return WebGUI::Privilege::vitalComponent() if ($session{scratch}{collateralFolderId} eq "0" || $session{scratch}{collateralFolderId} eq "");
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(775).'<p/><div align="center">';
$output .= '<a href="'.WebGUI::URL::page('op=deleteCollateralFolderConfirm').'">'
@ -104,7 +105,7 @@ sub www_deleteCollateralFolder {
#-------------------------------------------------------------------
sub www_deleteCollateralFolderConfirm {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
return WebGUI::Privilege::vitalComponent() if ($session{scratch}{collateralFolderId} eq "0" || $session{scratch}{collateralFolderId} eq "");
my $folders = WebGUI::CollateralFolder->getTree({-minimumFields => 1});
if (my $deadFolder = $folders->{$session{scratch}{collateralFolderId}}) {
my $parentId = $deadFolder->get("parentId");
@ -117,7 +118,6 @@ sub www_deleteCollateralFolderConfirm {
#-------------------------------------------------------------------
sub www_emptyCollateralFolder {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(979).'<p/><div align="center">';
$output .= '<a href="'.WebGUI::URL::page('op=emptyCollateralFolderConfirm').'">'
@ -131,7 +131,6 @@ sub www_emptyCollateralFolder {
#-------------------------------------------------------------------
sub www_emptyCollateralFolderConfirm {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
my @collateralIds = WebGUI::SQL->buildArray("select collateralId from collateral where collateralFolderId=".quote($session{scratch}{collateralFolderId}));
WebGUI::Collateral->multiDelete(@collateralIds);
return www_listCollateral();
@ -152,7 +151,7 @@ sub www_editCollateral {
my $c = $_[1] || WebGUI::Collateral->new($session{form}{cid});
$collateral = $c->get;
}
$canEdit = ($collateral->{userId} eq $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
$canEdit = ($collateral->{userId} == $session{user}{userId} || WebGUI::Grouping::isInGroup(3));
$folderId = $session{scratch}{collateralFolderId} || 0;
$f = WebGUI::HTMLForm->new;
$f->hidden("op","editCollateralSave");
@ -193,11 +192,10 @@ sub www_editCollateral {
if ($collateral->{collateralType} eq "snippet") {
$output .= '<h1>'.WebGUI::International::get(770).'</h1>';
if ($canEdit) {
$f->HTMLArea(
$f->textarea(
-name=>"parameters",
-value=>$collateral->{parameters},
-label=>WebGUI::International::get(771),
-popupToggle=>1
-label=>WebGUI::International::get(771)
);
} else {
$f->readOnly(
@ -570,7 +568,7 @@ sub www_htmlAreaviewCollateral {
$output .= '<tr><td align="center" valign="middle" width="100%" height="100%">';
$output .= '<p align="center"><br><img src="'.$session{config}{extrasURL}.'/htmlArea/images/icon.gif"
border="0"></p>';
$output .= '<P align=center><STRONG>WebGUI Image Manager<BR>for htmlArea</STRONG></P>';
$output .= '<P align=center><STRONG>WebGUI Image Manager<BR>for TinyMCE</STRONG></P>';
$output .= '</td></tr></table>';
} else {
my $c = WebGUI::Collateral->new($session{form}{cid});
@ -590,9 +588,9 @@ sub www_htmlAreaviewCollateral {
$output .= '<script language="javascript">';
$output .= "\nvar src = '".$file->getURL."';\n";
$output .= "if(src.length > 0) {
var manager = findAncestor(window.frameElement, 'manager', 'TABLE');
if(manager)
manager.all.txtFileName.value = src;
var manager=window.parent;
if(manager)
manager.document.getElementById('txtFileName').value = src;
}
</script>\n";
}

View file

@ -131,6 +131,7 @@ sub www_editNavigation {
my $f = WebGUI::TabForm->new(\%tabs);
$f->hidden({name=>'op', value=>'editNavigationSave'});
$f->hidden({name=>'navigationId', value=>$config->{navigationId}});
$f->getTab("properties")->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.'" />');
$f->getTab("properties")->readOnly(
-value=>$config->{navigationId},
-label=>'navigationId'
@ -274,7 +275,7 @@ sub www_editNavigationSave {
# Delete from cache
WebGUI::Page->recacheNavigation;
return www_listNavigation();
return "";
}
#-------------------------------------------------------------------
@ -287,7 +288,7 @@ sub www_listNavigation {
while (my %data = $sth->hash) {
$row[$i].= '<tr><td valign="top" class="tableData">'
.deleteIcon('op=deleteNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId})
.editIcon('op=editNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId})
.editIcon('op=editNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId}."&afterEdit=".WebGUI::URL::escape("op=listNavigation"))
.copyIcon('op=copyNavigation&identifier='.$data{identifier}.'&navigationId='.$data{navigationId})
.'</td>';
$row[$i].= '<td valign="top" class="tableData">'.$data{identifier}.'</td>';

View file

@ -107,8 +107,14 @@ sub _selectPositions {
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp},
-extras=>'onChange="changeTemplatePreview(this.form.templateId.value)"'
);
$output = '
<script language="JavaScript">
my $headtags = '
<script language="JavaScript">
var b_templates = new Array();
';
foreach $key (keys %{$templates}) {
$headtags .= " b_templates['".$key."'] = '".WebGUI::Page::drawTemplate($key)."';\n";
}
$headtags .= '
function checkBrowserVersion(){
this.ver=navigator.appVersion;
this.dom=document.getElementById?1:0;
@ -140,22 +146,20 @@ sub _selectPositions {
this.writeref.innerHTML=text;
}
}
function init(){
function inittemplatechanger(){
if(pbw.bw){
oMessage=new makeChangeTextObj("templatePreview");
oMessage.css.visibility="visible";
changeTemplatePreview(\''.$_[0].'\');
}
}
onload=init
function changeTemplatePreview(value) {
oMessage.writeIt(eval("b"+value));
oMessage.writeIt(b_templates[value]);
}
onload=inittemplatechanger
';
foreach $key (keys %{$templates}) {
$output .= " var b".$key." = '".WebGUI::Page::drawTemplate($key)."';\n";
}
$output .= '</script>';
$headtags .= '</script>';
WebGUI::Style::setRawHeadTags($headtags);
$output .= $f->printRowsOnly;
$output .= '<div id="templatePreview" style="padding: 5px;"></div>';
return $output;
@ -308,7 +312,7 @@ sub www_editPage {
$f = WebGUI::TabForm->new(\%tabs);
if ($session{form}{npp} ne "") {
my $buildFromPage = $session{form}{npp};
if ($buildFromPage == 0) {
if ($buildFromPage eq "0") {
$buildFromPage = $session{setting}{defaultPage};
}
%page = WebGUI::SQL->quickHash("select * from page where pageId=".quote($buildFromPage));
@ -873,6 +877,38 @@ sub www_pastePage {
}
}
#-------------------------------------------------------------------
sub www_richEditPageTree {
my (%var,@bad);
my $namelessroot = WebGUI::Page->new('0');
foreach my $page ($namelessroot->descendants) {
my $skipBadPage = 0;
foreach my $badPage (@bad) {
if ($page->{nestedSetLeft} > $badPage->{nestedSetLeft} && $page->{nestedSetRight} < $badPage->{nestedSetRight}) {
$skipBadPage = 1;
}
}
next if ($skipBadPage); # descendant of a page we threw out
if ($page->{isSystem}) {
push(@bad,$page);
next; # throw out system pages
}
unless (WebGUI::Page::canView($page)) {
push(@bad,$page);
next; # throw out pages we can't view
}
push(@{$var{page_loop}},{
id=>$page->{pageId},
url=>$page->{urlizedTitle},
indent=>"&nbsp;&nbsp;&nbsp;" x $page->{depth},
title=>$page->{title}
});
}
$session{page}{useEmptyStyle} = 1;
return WebGUI::Template::process(1,"richEditor/pagetree",\%var);
}
#-------------------------------------------------------------------
sub www_rearrangeWobjects {
return WebGUI::Privilege::insufficient() unless (WebGUI::Page::canEdit($session{page}{pageId}));
@ -904,6 +940,7 @@ Returns a HTML formatted indented pagetree complete with edit/delete/cut/move bu
=cut
sub www_viewPageTree {
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(4));
my ($output);
$session{page}{useAdminStyle} = 1;
$output = '<h1>'.WebGUI::International::get(448).'</h1>';

View file

@ -83,7 +83,7 @@ sub www_viewLoginHistory {
$output = '<h1>'.WebGUI::International::get(426).'</h1>';
$sth = WebGUI::SQL->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
while (%data = $sth->hash) {
$data{username} = 'unknown user' if ($data{userId} == 0);
$data{username} = 'unknown user' if ($data{userId} eq "0");
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
$row[$i] .= '<td>'.$data{status}.'</td>';
$row[$i] .= '<td>'.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").'</td>';

View file

@ -32,7 +32,7 @@ sub _submenu {
tie %menu, 'Tie::IxHash';
$menu{WebGUI::URL::page('op=editTemplate&tid=new&namespace='.$session{form}{namespace})} =
WebGUI::International::get(505);
if (($session{form}{op} eq "editTemplate" && $session{form}{tid} ne "new") || $session{form}{op} eq "deleteTemplateConfirm") {
if ($session{form}{op} eq "editTemplate" && ($session{form}{tid} ne "new" || $session{form}{op} ne "deleteTemplateConfirm")) {
$menu{WebGUI::URL::page('op=editTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace})} =
WebGUI::International::get(851);
$menu{WebGUI::URL::page('op=copyTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace})} =

View file

@ -91,7 +91,7 @@ sub www_theWg {
<br>ctId})}$con</font><font COLOR="#180204">t</font><font COLOR="#843619">e</font><font COLOR="#A72A04">n</font><font COLOR="#DC4A14">t</font><font COLOR="#E4460A">Ha</font><font COLOR="#D4521B">s</font><font COLOR="#FCE4C8">h</font><font COLOR="#FAECE6">{</font><font COLOR="#FCFDFA">"pag</font><font COLOR="#F4A68A">e</font><font COLOR="#FC9C6A">.</font><font COLOR="#E14A0C">p</font><font COLOR="#F44304">o</font><font COLOR="#EC4404">si</font><font COLOR="#F44304">ti</font><font COLOR="#EC4404">o</font><font COLOR="#FCB37A">n</font><font COLOR="#FCCCA8">"</font><font COLOR="#FCF5ED">.</font><font COLOR="#FCFDFA">${$wobjec</font><font COLOR="#DCCAC4">t</font><font COLOR="#ECC4B5">}</font><font COLOR="#AC5A3B">{</font><font COLOR="#DC4A14">t</font><font COLOR="#F44304">e</font><font COLOR="#EC4404">m</font><font COLOR="#F44304">p</font><font COLOR="#EC4404">l</font><font COLOR="#E4460A">a</font><font COLOR="#FC9C6A">t</font><font COLOR="#FCA484">e</font><font COLOR="#FCF5ED">P</font><font COLOR="#FCFDFA">osit</font><font COLOR="#FCF5ED">i</font><font COLOR="#CC7244">o</font><font COLOR="#D44C14">n</font><font COLOR="#EC4404">}}.</font><font COLOR="#CC4D14">=</font><font COLOR="#380304">"</font><font COLOR="#180204">&lt;</font><font COLOR="#0B0204">br>";
<br>}#--EasterEg</font><font COLOR="#843619">g</font><font COLOR="#9A2804">G</font><font COLOR="#E14A0C">o</font><font COLOR="#EC4404">es</font><font COLOR="#D44C14">H</font><font COLOR="#FCE4C8">e</font><font COLOR="#FCF5E2">r</font><font COLOR="#FCFDFA">Here!!C</font><font COLOR="#FCE5D9">h</font><font COLOR="#FCDED1">e</font><font COLOR="#CC5D30">c</font><font COLOR="#DC4A14">k</font><font COLOR="#EC4404">s</font><font COLOR="#F44304">i</font><font COLOR="#EC4404">fu</font><font COLOR="#EC3E04">s</font><font COLOR="#FC6323">e</font><font COLOR="#F46227">r</font><font COLOR="#FCD4A6">h</font><font COLOR="#FCEBCC">a</font><font COLOR="#FCF5E2">sp</font><font COLOR="#FCF5ED">r</font><font COLOR="#FCF5E2">i</font><font COLOR="#FCF5ED">v</font><font COLOR="#FCECD6">i</font><font COLOR="#FCEBCC">l</font><font COLOR="#FCB697">e</font><font COLOR="#C15B32">g</font><font COLOR="#D4521B">e</font><font COLOR="#E4460A">t</font><font COLOR="#E23D04">o</font><font COLOR="#F44304">v</font><font COLOR="#EC4404">ie</font><font COLOR="#E4460A">w</font><font COLOR="#F07D4F">t</font><font COLOR="#FCECD6">h</font><font COLOR="#FCFDFA">ewobj</font><font COLOR="#FCCEB8">e</font><font COLOR="#FCC4A5">c</font><font COLOR="#DC460A">t</font><font COLOR="#EC4404">i</font><font COLOR="#EC3E04">f</font><font COLOR="#E4460A">(</font><font COLOR="#A73709">!</font><font COLOR="#974221">W</font><font COLOR="#180204">e</font><font COLOR="#0B0204">bGUI::
<br>}#--EasterEg</font><font COLOR="#843619">g</font><font COLOR="#9A2804">G</font><font COLOR="#E14A0C">o</font><font COLOR="#EC4404">es</font><font COLOR="#D44C14">H</font><font COLOR="#FCE4C8">e</font><font COLOR="#FCF5E2">r</font><font COLOR="#FCFDFA">e!!C</font><font COLOR="#FCE5D9">h</font><font COLOR="#FCDED1">e</font><font COLOR="#CC5D30">c</font><font COLOR="#DC4A14">k</font><font COLOR="#EC4404">s</font><font COLOR="#F44304">i</font><font COLOR="#EC4404">fu</font><font COLOR="#EC3E04">s</font><font COLOR="#FC6323">e</font><font COLOR="#F46227">r</font><font COLOR="#FCD4A6">h</font><font COLOR="#FCEBCC">a</font><font COLOR="#FCF5E2">sp</font><font COLOR="#FCF5ED">r</font><font COLOR="#FCF5E2">i</font><font COLOR="#FCF5ED">v</font><font COLOR="#FCECD6">i</font><font COLOR="#FCEBCC">l</font><font COLOR="#FCB697">e</font><font COLOR="#C15B32">g</font><font COLOR="#D4521B">e</font><font COLOR="#E4460A">t</font><font COLOR="#E23D04">o</font><font COLOR="#F44304">v</font><font COLOR="#EC4404">ie</font><font COLOR="#E4460A">w</font><font COLOR="#F07D4F">t</font><font COLOR="#FCECD6">h</font><font COLOR="#FCFDFA">ewobj</font><font COLOR="#FCCEB8">e</font><font COLOR="#FCC4A5">c</font><font COLOR="#DC460A">t</font><font COLOR="#EC4404">i</font><font COLOR="#EC3E04">f</font><font COLOR="#E4460A">(</font><font COLOR="#A73709">!</font><font COLOR="#974221">W</font><font COLOR="#180204">e</font><font COLOR="#0B0204">bGUI::
<br>Privilege::c</font><font COLOR="#793117">a</font><font COLOR="#9A2804">n</font><font COLOR="#DC460A">V</font><font COLOR="#F44A06">i</font><font COLOR="#F44304">e</font><font COLOR="#D44C14">w</font><font COLOR="#FCD4A6">W</font><font COLOR="#FCDED1">o</font><font COLOR="#FCFDFA">bject(</font><font COLOR="#DCA591">$</font><font COLOR="#B45833">w</font><font COLOR="#CC4D14">o</font><font COLOR="#E14A0C">b</font><font COLOR="#EC4404">j</font><font COLOR="#F44304">e</font><font COLOR="#EC4404">c</font><font COLOR="#F44304">t</font><font COLOR="#EC4404">-</font><font COLOR="#F45413">></font><font COLOR="#FC8450">{w</font><font COLOR="#FC9C6A">o</font><font COLOR="#FCA477">b</font><font COLOR="#FC9C6A">j</font><font COLOR="#FC8E60">e</font><font COLOR="#EC632C">ct</font><font COLOR="#E14A0C">I</font><font COLOR="#E4460A">d</font><font COLOR="#EC4404">}</font><font COLOR="#F44304">)</font><font COLOR="#EC4404">){</font><font COLOR="#DC4A14">n</font><font COLOR="#FC7B43">e</font><font COLOR="#E48362">x</font><font COLOR="#FCECD6">t</font><font COLOR="#FCFDFA">;}#--</font><font COLOR="#FCF5E2">E</font><font COLOR="#E17348">n</font><font COLOR="#FC6B34">d</font><font COLOR="#EC4404">C</font><font COLOR="#F44304">h</font><font COLOR="#EC3E04">a</font><font COLOR="#DC4A14">n</font><font COLOR="#691C04">g</font><font COLOR="#442618">e</font><font COLOR="#0B0204">sif(${$