<?
	header("Content-Type: text/html; charset=utf-8");
	
	$g_path = '../../my/';
	
	include $g_path."u_globals.php";
	include $g_path."html/f.php";
	include $g_path."u_spoj_na_bazu.php";
	
	include $g_path."u_headers.php";
	
	ob_start();
		$x = get_data("select guid, library_guid, FolderName as Naziv, parent_guid from folder where guid = '".$_GET['value']."' ");
	
		/*
		$l_children = substr(get_children($x['guid'], "select guid, FolderName as Naziv, parent_guid from folder where parent_guid = '{_REPLACE_VALUE_}' "), 1);
		$y = get_data("select guid, FolderName as Naziv from folder where guid not in (".$l_children.") order by FolderName ", 1);
		*/
	
?>
		<div class="content">
			<?/*?>
			<p>Odabrali ste mapu: <b><?=$x['Naziv']?></b></p>
			<?*/?>
			
			<?/*?>
			<div class="buttons">
				<a href="#" onclick="folder_get_ch('<?=$_GET['value']?>'); return false;" class="button" title="Promijeni podatke mape '<?=$x['Naziv']?>'">Promijeni podatke</a>
				<a href="#" onclick="folder_get_add('<?=$_GET['value']?>'); return false;" class="button" title="Dodaj novu mapu unutar mape '<?=$x['Naziv']?>'">Dodaj novu (pod)mapu</a>
				<a href="#" onclick="folder_del('<?=$x['guid']?>'); return false;" class="button" title="Obriši mapu '<?=$x['Naziv']?>'">Obriši mapu</a>
			</div>
			<?*/?>
<?
			//$var_value_library_guid = $x['library_guid'];
			if($x['guid']){
				$l_guid = $x['guid'];
			}else{
				$l_guid = 'NULL';
			}
			$var_value_parent_guid = $l_guid;
			
			$l_forma_ch = gen_form('folder', 'tablica_foldera', $_GET['value']);
?>
			<div id="adddata"></div>
			<div id="chdata">
				<?/*?>
				<p>Promijeni podatke</p>
				<?*/?>
				<?=$l_forma_ch?>
			</div>
		</div>
		
<?
	$output = ob_get_contents();
	ob_end_clean();
	
	$la_data = array();
	$la_data[0] = $output;
	
	if($_GET['value']){
		$la_data[1] = ' &nbsp; || &nbsp; '.$g_term[$g_language_sign]['top_mapa'].': "'.$x['Naziv'].'"';
		$la_data[2] = $g_term[$g_language_sign]['top_akcija_promijeni_podatke'];
	}else{
		$la_data[1] = ' &nbsp; || &nbsp; '.$g_term[$g_language_sign]['top_nulta_mapa'].': "'.$x['Naziv'].'"';
		$la_data[2] = $g_term[$g_language_sign]['top_akcija_dodaj_nulta_mapa'];
	}
	
	ob_start();
		/*
		$lha_sifrarnik = array(
			array(1, 'Tip mape', 'folder_type', 'Koristi se za grupiranje mapa u određene cjeline, npr. Projektna dokumentacija, Proizvodna dokumentacija, Ugovori, Računi i sl.'),
			array(2, 'Status mape', 'folder_status', 'Određuje status pojedine mape, npr. Aktivna, Neaktivna.'),
			array(3, 'Tip dokumenta', 'document_type', 'Dodatna tipizacija dokumenata, kako bi se unutar pojedine mape dokumenti preciznije grupirali.'),
			array(4, 'Stanje dokumenta', 'document_state', 'Stanje pojedinog dokumenta, npr. U izradi, Završen, Arhiviran i sl.'),
		);
		
		$lh_sifrarnik_layer = 'uredjivanje-mapa-sifrarnici';
		*/
?>
		<div class="buttons">
<?
			if($_GET['value']){
?>
				<a href="#" onclick="folder_get_ch('<?=$_GET['value']
					?>'); return false;" title="<?=$g_term[$g_language_sign]['top_promijeni_podatke_mape']?> '<?=$x['Naziv']?>'"><img src="<?=$g_path_sl_res?>images/b-edit_map.gif" border="0"></a>
				<a href="#" onclick="folder_get_add('<?=$_GET['value']
					?>'); return false;" title="<?=$g_term[$g_language_sign]['top_dodaj_novu_mapu_unutar']?> '<?=$x['Naziv']?>'"><img src="<?=$g_path_sl_res?>images/b-add_map.gif" border="0"></a>
				<a href="#" onclick="folder_del('<?=$x['guid']
					?>'); return false;" title="<?=$g_term[$g_language_sign]['top_obrisi_mapu']?> '<?=$x['Naziv']?>'"><img src="<?=$g_path_sl_res?>images/b-del_map.gif" border="0"></a>
				<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
				<a href="#" onclick="submitThisForm(); return false;" title="<?=$g_term[$g_language_sign]['spremi']
					?>"><img src="<?=$g_path_sl_res?>images/b-spremi.gif" border="0"></a>
<?
			}else{
?>
				<a href="#" onclick="folder_get_add(''); display_layer(''); return false;" '.
					'title="<?=$g_term[$g_language_sign]['top_dodaj_nulta_mapa']?>"><img src="<?=$g_path_sl_res?>images/b-add_map_first.gif" border="0"></a>
				<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
				<a href="#" onclick="submitThisForm(); return false;" title="<?=$g_term[$g_language_sign]['spremi']
					?>"><img src="<?=$g_path_sl_res?>images/b-spremi.gif" border="0"></a>
<?
			}
?>
			<?/*?>
			<img src="res/images/b-separator.gif" border="0">
			<img src="res/images/b-sifrarnik.gif" border="0" title="Šifrarnici" onmouseover="document.getElementById('<?=$lh_sifrarnik_layer?>').style.display = 'block'">
			<div id="<?=$lh_sifrarnik_layer?>">
<?
				for($i = 0; $i < sizeof($lha_sifrarnik); $i++){
?>
						<a href="<?=make_link($lha_sifrarnik[$i][2], $_GET['a'].':'.$_GET['b'].':2:'.$lha_sifrarnik[$i][0])
							?>" title="<?=$lha_sifrarnik[$i][1]?>: <?=$lha_sifrarnik[$i][3]?>"><img src="res/images/b-sifrarnik-little.gif" border="0"></a>
<?
				}
?>
			</div>
			<?*/?>
		</div>
<?
	$output = ob_get_contents();
	ob_end_clean();
	$la_data[3] = $output;
	
		
	$l_json = json_encode($la_data);
	print $l_json;
?>