{=include-block:Y_Blocks.txt;head_no_charset=}
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<script type="text/javascript" src="/Y_Baselib.js"></script>
<script type="text/javascript">
//<![CDATA[
var gurl= "";
var gurl_last= "";
function hide_forms(){
	show_obj("add",false);
	show_obj("rename",false);
}
function do_reload(){
	if((document.location.pathname+document.location.search+document.location.hash) == gurl)
		document.location.reload();
	else
		document.location.href = gurl;
}

function do_set(bouquetnr, action){
	loadSyncURL("/control/setbouquet?selected="+bouquetnr+"&action="+action);
	gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm?selected=" + bouquetnr+ "#akt";
	window.setTimeout('do_reload()',50);
}
function do_save(){
	hide_forms();
	loadSyncURL("/control/savebouquet");
	alert("{=L:bou.bouqets_saved=}");
}
function do_update(){
	hide_forms();
	loadSyncURL("/control/updatebouquet");
}
function do_move(bouquetnr, action){
	var sel = parseInt(String(bouquetnr));
	loadSyncURL("/control/movebouquet?selected="+bouquetnr+"&action="+action);
	if(action=="up")	sel--;
	else			sel++;

	gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm?selected=" + sel+ "#akt";
	window.setTimeout('do_reload()',50);
}
function do_delete(bouquetnr, bouquet_name){
	if (confirm("{=L:bou.delete1=} \""+bouquet_name+"\" {=L:bou.delete2=}?")==true){
		loadSyncURL("/control/deletebouquet?selected="+bouquetnr);
		gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm?selected=" + bouquetnr+ "#akt";
		window.setTimeout('do_reload()',50);
	}
}
function do_add_start(){
	hide_forms();
	show_obj("add",true);
	document.add.bouquet_name.focus();
}
function do_add_abort(){
	show_obj("add",false);
}
function do_add(){
	if(document.add.bouquet_name.value != ""){
		res=loadSyncURL("/control/addbouquet?name="+document.add.bouquet_name.value);
		/*if(res != "Ok\r\n")
			alert("Bouquet-Name existiert schon!");
		else*/
			gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm#akt";
//		gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm?selected=" + bouquetnr+ "#akt";
		show_obj("add",false);
		window.setTimeout('do_reload()',200);
	}
	else
		alert("{=L:bou.no_bouquet_name=}!");
}
function do_rename_start(bouquetnr, bouquet_name){
	hide_forms();
	document.rename.bouquetnr.value = bouquetnr;
	document.rename.bouquet_name.value = bouquet_name;
	show_obj("rename",true);
	document.rename.bouquet_name.focus();
}
function do_rename_abort(){
	show_obj("rename",false);
}

function do_rename(){
	if(document.rename.bouquet_name.value != ""){
		res=loadSyncURL("/control/renamebouquet?selected="+document.rename.bouquetnr.value+"&nameto="+document.rename.bouquet_name.value);
/*		if(res != "Ok\r\n")
			alert("Bouquet-Name existiert schon!");
		else{
*/
			gurl = "/Y_Boxcontrol_Bouquet_Editor_Main.yhtm?selected=" + document.rename.bouquetnr.value+ "#akt";
			show_obj("rename",false);
			window.setTimeout('do_reload()',200);
//		}
	}
	else
		alert("{=L:bou.no_bouquet_name=}!");
}
//]]>
</script>
<style type="text/css">
.fly_form
{
	visibility: hidden;
	z-index: 4;
	position: absolute;
	left: 100px;
	top: 100px;
	border: 1px solid #2188e0;
	border-collapse: collapse;
	background-color: white;
	padding: 1em;
}
</style>
</head>
<body>
<div class="work_box">
	<div class="work_box_head"><div class="work_box_head_h2">
	{=var-set:help_url=Help-BoxControl-Bouquet-Editor=}{=var-set:menu={=L:set.menue.bouquet_editor=}=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
	<div class="work_box_body">
		<div id="add" class="fly_form">
			<form name="add" accept-charset="UTF-8" action="">
				<p><b>{=L:bou.bouquet_add=}</b><br/>
				{=L:bou.name_of_bouquet=}:
				<input type="text" size="30" name="bouquet_name" />
				<br/>
				<button type="button" ytype="save" onclick="do_add()">{=L:save=}</button>
				<button type="button" ytype="cancel" onclick="do_add_abort()">{=L:cancel=}</button>
				</p>
			</form>
		</div>
		<div id="rename" class="fly_form">
			<form name="rename" accept-charset="UTF-8" action="">
				<p><b>{=L:bou.rename_bouquet=}</b><br/>
				{=L:bou.name_of_bouquet=}:
				<input type="text" size="30" name="bouquet_name" />
				<input type="hidden" name="bouquetnr" value="" />
				<br/>
				<button type="button" ytype="save" onclick="do_rename()">{=L:save=}</button>
				<button type="button" ytype="cancel" onclick="do_rename_abort()">{=L:cancel=}</button>
				</p>
			</form>
		</div>
		<table width="100%" cellspacing="0" id="bouqueteditorlist">
<!-- line template -->
{=var-set:row=
<tr class="%c">
<td align="center" width="30px">
	%s
	<a href="javascript:do_set('%d','%s');">
	<img src="/images/%s.png" title="%s" style="border: 0px" /></a>
</td>
<td align="center" width="30px">
	<a href="javascript:do_set('%d','%s');">
	<img src="/images/%s.png" title="%s" style="border: 0px" />
	</a>
</td>
<td><a href="/Y_Boxcontrol_Bouquet_Editor_Edit.yhtm?selected=%d&amp;name=%s">%s</a></td>
<td width="100" style="white-space: nowrap; font-weight:normal;">
	<a href="javascript:do_rename_start('%d','%s');">
	<img src="/images/modify.png" title="{=L:bou.rename=}" style="border: 0px" /></a>&nbsp;
	<a href="javascript:do_delete('%d','%s');">
	<img src="/images/remove.png" title="{=L:bou.delete=}" style="border: 0px" /></a>&nbsp;
	<span  style="visibility:%s;"><a href="javascript:do_move('%d','down');">
	<img src="/images/arrowdown.png" title="{=L:bou.move_down=}" style="border: 0px" /></a>&nbsp;</span>
	<span  style="visibility:%s;"><a href="javascript:do_move('%d','up');">
	<img src="/images/arrowup.png" title="{=L:bou.move_up=}" style="border: 0px" /></a>&nbsp;</span>
</td>
</tr>
=}
{=func:bouquet_editor_main {=var-get:row=}=}
		</table>
		<p>
			<button type="button" ytype="add" onclick="javascript:do_add_start()">{=L:bou.bouquet_add=}</button>
			<button type="button" ytype="saveall" onclick="javascript:do_save()">{=L:save_all=}</button>
		</p>
	</div>
</div>
</body>
</html>

