use strict;return sub{my $this = shift;my $C = $this->{C};$this->out("<script>\n\nvar LockExtSections = 0;\nvar LockExtProducts = new Array();\n\nfunction AddNewLockExtSection()\n{\n	LockExtSections++;\n\n	var d = document.getElementById(\'LockExtDiv\');\n	var b = document.getElementById(\'LockExtButton\');\n	var t = document.getElementById(\'LockExtTail\');\n\n	var selVals = new Array();\n	\n	if (LockExtSections == 1)\n	{\n		d.innerHTML = \'<hr><div class=\"form-group\"><label>Customers will have to buy</label>\';\n		b.value = \"Add one more section\";\n		t.innerHTML = \"\";\n	}\n	else\n	{\n		for (var i = 1; i < LockExtSections; i++)\n		{\n			selVals[i] = document.getElementById(\'LockedExtNum\' + i).selectedIndex;\n		}\n	}\n\n	d.innerHTML += \'<select class=\"custom-select\" name=\"locked_ext_num\' + LockExtSections + \'\" id=\"LockedExtNum\' + LockExtSections + \'\">\'\n	+ \'<option value=\"\"></option>\'\n	+ \'<option value=\"0\"> ALL</option>\'\n	+ \'<option value=\"1\"> At least one</option>\'\n	+ \'<option value=\"2\"> At least two</option>\'\n	+ \'<option value=\"3\"> At least three</option>\'\n	+ \'<option value=\"4\"> At least four</option>\'\n	+ \'<option value=\"5\"> At least five</option>\'\n	+ \'<option value=\"6\"> At least six</option>\'\n	+ \'<option value=\"7\"> At least seven</option>\'\n	+ \'<option value=\"8\"> At least eight</option>\'\n	+ \'<option value=\"9\"> At least nine</option>\'\n	+ \'</select>\'\n	+ \'</div><div class=\"form-group\"><label>products of:</label>\'\n	+ \'<div id=\"LockedExtTd\' + LockExtSections + \'\"></div></div><hr>\';\n\n	var lnk = new atkMLinker(\'locked_ext_prods\' + LockExtSections, \"$C->{SYS}{URL}/master/store/packages/products_lockext_m.html?TabCustom2=$C->{View}{ID}\");\n	lnk.makeHTML(document.getElementById(\'LockedExtTd\' + LockExtSections));\n\n	d.innerHTML += \'\';\n\n	if (LockExtSections > 1)\n	{\n		for (var i = 1; i < LockExtSections; i++)\n		{\n			document.getElementById(\'LockedExtNum\' + i).selectedIndex = selVals[i];\n		}\n	}\n\n	return lnk;\n}\n\nfunction InitLockExtSections(data)\n{\n	var chunks = data.split(\'-\');\n	var pair;\n	var prods;\n	var sel;\n	for (var i = 0; i < chunks.length; i++)\n	{\n		pair = chunks[i].split(\':\');\n		prods = pair[1].split(\',\');\n\n		var lnk = AddNewLockExtSection();\n\n		var sel = document.getElementById(\'LockedExtNum\' + LockExtSections);\n		for (var s = 0; s < sel.options.length; s++)\n		{\n			if (sel.options[s].value == pair[0])\n			{\n				sel.selectedIndex = s;\n				break;\n			}\n		}\n		\n		for (var j = 0; j < prods.length; j++)\n		{\n			lnk.receive(prods[j], LockExtProducts[prods[j]]);\n		}\n	}\n}\n\n</script>\n\n<div id=\"LockExtDiv\"></div>\n\n<a href=\"javascript:AddNewLockExtSection();\" id=\"LockExtButton\">Enable extended package locking management</a>\n\n<div id=\"LockExtTail\"></div>\n\n");if ( $C->{Object}{locked_ext} ) {$this->out("\n<script src=\"$C->{SYS}{URI}/suppl/atk/linkers.js\"></script>\n");$C->{AtkListersJsIncidence}++;$this->out("\n");$C->{ViewLockedExt} = $C->{View}{lockedExt};$this->out("");my $in = [keys %{$C->{ViewLockedExt}{prodTitles}}];my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{pid} = -1;for my $f (@$loop) {$C->{ITERATION}{pid}++;$C->{pid} = $f;$this->out("");$C->{title} = Zen::PerlHandler->get("jsline" =~ /::/ ? "jsline" : II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIIllIIllIlIIll($II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$II720d6e18aa34327713eb014408fc9144::lIIlIIIIlllIlIII},1009,$II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$IIb39071a48a82a07eeb9256f406abebc5::IlIIllllllIIIlll}).'::filters::'."jsline".'::'."jsline")->do($C->{ViewLockedExt}{prodTitles}{$C->{pid}});$this->out("<script>LockExtProducts[\'$C->{pid}\'] = \'$C->{title}\';</script>\n");}$this->out("\n<script>InitLockExtSections(\'$C->{Object}{locked_ext}\')</script>\n\n");}$this->out("");}