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 $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot; my @crumb; my $ancestors = $base->getLineage(["self","ancestors"],{returnQuickReadObjects=>1}); foreach my $ancestor (@{$ancestors}) { push(@crumb,''.$ancestor->get("menuTitle").''); } my $output = '

'.join(" > ", @crumb)."

\n"; my $children = $base->getLineage(["children"],{returnQuickReadObjects=>1}); foreach my $child (@{$children}) { next unless $child->canView; if ($child->get("className") =~ /^$session{form}{classLimiter}/) { $output .= '(•) '; } else { $output .= "(•) "; } $output .= ''.$child->get("menuTitle").''."
\n"; } $session{page}{useEmptyStyle} = 1; return $output; } #------------------------------------------------------------------- sub www_richEditPageTree { my $f = WebGUI::HTMLForm->new(-action=>"#",-extras=>'name"linkchooser"'); $f->text( -name=>"url", -label=>"URL", -extras=>'id="url"' ); $f->selectList( -name=>"target", -label=>"Target", -options=>{"_self"=>"Open link in same window.","_blank"=>"Open link in new window."}, -extras=>'id="target"' ); $f->button( -value=>"Done", -extras=>'onclick="createLink()"' ); WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/tiny_mce/tiny_mce_popup.js",{type=>"text/javascript"}); my $output = '
Insert A Link
Link Settings'.$f->print.'
Pages '; my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot; my @crumb; my $ancestors = $base->getLineage(["self","ancestors"],{returnQuickReadObjects=>1}); foreach my $ancestor (@{$ancestors}) { push(@crumb,''.$ancestor->get("menuTitle").''); } $output .= '

'.join(" > ", @crumb)."

\n"; my $children = $base->getLineage(["children"],{returnQuickReadObjects=>1}); foreach my $child (@{$children}) { next unless $child->canView; $output .= '(•) '.$child->get("menuTitle").''."
\n"; } $session{page}{useEmptyStyle} = 1; return $output.'
'; } #------------------------------------------------------------------- sub www_richEditImageTree { my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot; my @crumb; my $ancestors = $base->getLineage(["self","ancestors"],{returnQuickReadObjects=>1}); foreach my $ancestor (@{$ancestors}) { push(@crumb,''.$ancestor->get("menuTitle").''); } my $output = '

'.join(" > ", @crumb)."

\n"; my $children = $base->getLineage(["children"],{returnQuickReadObjects=>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{page}{useEmptyStyle} = 1; return $output; } #------------------------------------------------------------------- sub www_richEditViewThumbnail { my $image = WebGUI::Asset->newByUrl; $session{page}{useEmptyStyle} = 1; if ($image->get("className") =~ /WebGUI::Asset::File::Image/) { my $output = '
'; $output .= 'Preview'; $output .= '
'; $output .= $image->get("filename"); $output .= '
'; $output .= '\n"; return $output; } return '
Image Manager
'; } 1;