CGI-Application-Util-Diff

 view release on metacpan or  search on metacpan

htdocs/assets/templates/cgi/application/util/diff/form.js  view on Meta::CPAN


	var row = this.getRecord(arg.target).getData();

	// Wipe out any previous menu.

	var e       = document.getElementById("menu.button");
	e.innerHTML = "";

	// Declare the event handler for when menu items are clicked.

	var onMenuItemClick = function(p_sType, p_aArgs, p_oItem)
	{
		// Set form field action's value for the submit.

		var e    = document.getElementById("action");
		e.value  = p_oItem.value;
		e        = document.getElementById("target");
		e.value  = row.name;
		var sure = false;

		if ( (<tmpl_var name=confirm_action> == 0) || confirm("Action: " + p_oItem.value) )

htdocs/assets/templates/cgi/application/util/diff/form.js  view on Meta::CPAN

	}
	else
	{
		item_list =
		[
<tmpl_loop name=file_loop>		<tmpl_var name=item>
</tmpl_loop>		];
	}

	// Instantiate the menu.
	// When the uses selects an item, the above function, onMenuItemClick, will be executed.

	var oMenuButton = new YAHOO.widget.Button
		({
			type: "menu",
			label: row.name,
			menu: item_list,
			container: "menu.button"
		});
}

var util_diff_callback =
{

lib/CGI/Application/Util/Diff.pm  view on Meta::CPAN

use Path::Class; # For dir() and cleanup().

our $VERSION = '1.03';

# -----------------------------------------------

sub build_form
{
	my($self)        = @_;
	my($dir_action)  = $self -> param('actions') -> get_dir_menu();
	my(@dir_action)  = map{qq|{text: "$$dir_action{$_}", value: "$_", onclick: {fn: onMenuItemClick} }|} sort keys %$dir_action;
	my($file_action) = $self -> param('actions') -> get_file_menu();
	my(@file_action) = map{qq|{text: "$$file_action{$_}", value: "$_", onclick: {fn: onMenuItemClick} }|} sort keys %$file_action;

	# Since this is Javascript, we must add a ',' to all elements but the last.
	# We cannot add a ',' to all elements, and then use this:
	# substr($dir_action[$#dir_action], -1, 1) = '';
	# to chop a comma off the last element, because substr() won't work with an array element as an lvalue.

	for my $i (0 .. ($#dir_action - 1) )
	{
		$dir_action[$i] .= ',';
	}



( run in 1.262 second using v1.01-cache-2.11-cpan-49f99fa48dc )