use strict;return sub{my $this = shift;my $C = $this->{C};$this->out("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>Labels</title>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=7\"/>\n<style type=\"text/css\">\n	select, input, textarea, td, div\n	{\n			font: normal 10pt Tahoma, sans-serif;\n			margin: 2px;\n	}\n	\n	.header\n	{\n		font-size: 140\%;\n		font-weight: bold;\n		margin-bottom: 10px;\n	}\n	\n	.label\n	{\n		font-weight: bold;\n	}\n	\n	.addnew\n	{\n		font-weight: normal;\n		margin-top: 10px;\n	}\n	\n	a\n	{\n		color: brown;\n	}\n</style>\n<script>\n\nfunction htmlEncode(s)\n{\n	var str = new String(s);\n	str = str.replace(/&/g, \"&amp;\");\n	str = str.replace(/</g, \"&lt;\");\n	str = str.replace(/>/g, \"&gt;\");\n	str = str.replace(/\"/g, \"&quot;\");\n	return str;\n}\n\nfunction EditLabel(id, name)\n{\n	var div = document.getElementById(\'Label\' + id);\n	div.innerHTML =\n		\'<form method=\"post\" action=\"$C->{ENV}{SCRIPT_NAME}/zen/table/labelling_table.html\">\' + \n		\'<input type=\"hidden\" name=\"TableClass\" value=\"$C->{INPUT}{TableClass}\">\' + \n		\'<input type=\"hidden\" name=\"label_id\" value=\"\' + id + \'\">\' + \n		\'<input type=\"text\" size=\"20\" name=\"label_name\" value=\"\' + htmlEncode(name) + \'\">\' + \n		\'<input type=\"submit\" name=\"do_rename\" value=\"Rename\">\' + \n		\'<input type=\"submit\" name=\"do_delete\" value=\"Delete\" onClick=\"return confirm(&quot;Are you sure you want to delete this label?&quot;)\">\' + \n		\'</form>\';\n	\n}\n\nfunction AddLabel()\n{\n	var div = document.getElementById(\'AddLabel\');\n	div.innerHTML =\n		\'<form method=\"post\" action=\"$C->{ENV}{SCRIPT_NAME}/zen/table/labelling_table.html\">\' + \n		\'<input type=\"hidden\" name=\"TableClass\" value=\"$C->{INPUT}{TableClass}\">\' + \n		\'<input type=\"text\" size=\"20\" name=\"label_name\" value=\"\' + htmlEncode(name) + \'\">\' + \n		\'<input type=\"submit\" name=\"do_add\" value=\"Add\"></form>\';\n	\n}\n</script>\n</head>\n<body style=\"margin: 20px\">\n\n");$this->out(Zen::PerlHandler->get("IId95dc0bf217db9fba36ea754931fc840->mnt_table_labels")->do($this->{C}));$this->out("\n");if ( ! $C->{INPUT}{first_load} ) {$this->out("<script>self.opener.document.forms[\'Lister\'].submit();</script>\n");}$this->out("\n<div class=\"header\">Create / edit Labels</div>\n\n");my $in = $C->{Labels};my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{l} = -1;for my $f (@$loop) {$C->{ITERATION}{l}++;$C->{l} = $f;$this->out("<div class=\"label\" id=\"Label$C->{l}{id}\"><a href=\"#\" onClick=\"EditLabel($C->{l}{id},\'$C->{l}{name}\'); return false;\">$C->{l}{name}</a></div>\n");}$this->out("<div class=\"addnew\" id=\"AddLabel\"><a href=\"#\" onClick=\"AddLabel(); return false;\">[Add new label]</a></div>\n\n\n</body>\n</html>\n");}