package WebGUI::Operation::FormHelpers;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::Asset;
use WebGUI::HTMLForm;
use WebGUI::Session;
use WebGUI::Style;
#-------------------------------------------------------------------
sub www_formAssetTree {
my $session = shift;
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
my @crumb;
my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1});
foreach my $ancestor (@{$ancestors}) {
push(@crumb,'form->process("classLimiter").";formId="
.$session->form->process("formId")).'">'.$ancestor->get("menuTitle").'');
}
my $output = '
'.join(" > ", @crumb)."
\n";
my $children = $base->getLineage(["children"],{returnObjects=>1});
foreach my $child (@{$children}) {
next unless $child->canView;
if ($child->get("className") =~ /^$session->form->process("classLimiter")/) {
$output .= 'getId.'\';window.opener.document.getElementById(\''.
$session->form->process("formId").'_display\').value=\''.$child->get("title").'\';window.close();">(•) ';
} else {
$output .= "(•) ";
}
$output .= 'form->process("classLimiter").";formId="
.$session->form->process("formId")).'">'.$child->get("menuTitle").''." \n";
}
$session->style->useEmptyStyle("1")
return $output;
}
#-------------------------------------------------------------------
sub www_richEditPageTree {
my $session = shift;
my $f = WebGUI::HTMLForm->new(-action=>"#",-extras=>'name"linkchooser"');
$f->text(
-name=>"url",
-label=>WebGUI::International::get(104),
-hoverHelp=>WebGUI::International::get('104 description'),
);
$f->selectBox(
-name=>"target",
-label=>WebGUI::International::get('target'),
-hoverHelp=>WebGUI::International::get('target description'),
-options=>{"_self"=>WebGUI::International::get('link in same window'),
"_blank"=>WebGUI::International::get('link in new window')},
);
$f->button(
-value=>WebGUI::International::get('done'),
-extras=>'onclick="createLink()"'
);
$session->style->setScript($session->config->get("extrasURL")."/tinymce/jscripts/tiny_mce/tiny_mce_popup.js",{type=>"text/javascript"});
my $output = '';
}
#-------------------------------------------------------------------
sub www_richEditImageTree {
my $session = shift;
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
my @crumb;
my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1});
foreach my $ancestor (@{$ancestors}) {
push(@crumb,''.$ancestor->get("menuTitle").'');
}
my $output = '
'.join(" > ", @crumb)."
\n";
my $children = $base->getLineage(["children"],{returnObjects=>1});
foreach my $child (@{$children}) {
next unless $child->canView;
if ($child->get("className") =~ /^WebGUI::Asset::File::Image/) {
$output .= '(•) ';
} else {
$output .= "(•) ";
}
$output .= ''.$child->get("menuTitle").''." \n";
}
$session->style->useEmptyStyle("1")
return $output;
}
#-------------------------------------------------------------------
sub www_richEditViewThumbnail {
my $session = shift;
my $image = WebGUI::Asset->newByUrl;
$session->style->useEmptyStyle("1")
if ($image->get("className") =~ /WebGUI::Asset::File::Image/) {
my $output = '