<?php

/*************************************************************************/
/* DOCEBO CMS - Content Management System                                */
/* ============================================                          */
/*                                                                       */
/* Copyright (c) 2005 by Giovanni Derks <virtualdarkness[AT]gmail-com>   */
/* http://www.docebocms.org                                              */
/*                                                                       */
/* This program is free software. You can redistribute it and/or modify  */
/* it under the terms of the GNU General Public License as published by  */
/* the Free Software Foundation; either version 2 of the License.        */
/*************************************************************************/

if (!defined("IN_DOCEBO")) die ("You can't access this file directly...");

function loginBlockEdit(& $out, & $lang, & $form, $block_id, $sub_id) {

	$opt=loadBlockOption($block_id);

 	// selettore gruppi


 	$out->add(block_css_list($form, $lang, $opt["css"]));
	$out->add(getBlindNavDescField($form, $lang, $opt));	
 	$out->add(getGMonitoringField($form, $lang, $opt));


}



function loginBlockSave($block_id, $sub_id) {

	saveParam($block_id, "css", (int)$_POST["css"]);
	saveBlindNavDesc($block_id);	
	saveGMonitoring($block_id);

}


function loginBlockAdd($block_id, $sub_id) {

	saveParam($block_id, "css", 1);

}






// OLD / TEMP:

require_once($GLOBALS["where_cms"]."/admin/modules/manpage/manBlocks.php");

function login_options( $block ) {

	$out=& $GLOBALS['page'];
	$lang=& DoceboLanguage::createInstance('admin_manpage', 'cms');

	$backurl = $block->getBackurl();
	$out->add('<form method="POST" action="'.page_url(array()).'">' //&amp;insert=1
		.'<div class="stdBlock">');
	$block->loadParamAsInput();

	$idBlock=$block->getIdBlock();
	$q=mysql_query("SELECT title FROM ".$GLOBALS["prefix_cms"]."_area_block WHERE idBlock='$idBlock';");
	list($title)=mysql_fetch_row($q);

	$opt=loadBlockOption($idBlock); //--debug-//print_r($opt);
	$out->add("<br />");

	$out->add("<br />\n");
	$db_group=db_block_groups($idBlock);
	sel_block_groups($idBlock, $db_group);

	$out->add("<br /><b>".$lang->def("_BLOCK_STYLE").":</b>\n");
	$out->add(block_css_list($lang, $opt["css"]));



	$out->add('<br /><input class="button" type="submit" id="save" name="save" value="'._LOGIN_INSERT.'" />'
		.'</div>'
		.'</form>');

	// back option
	$out->add('<form method="post" action="'.$backurl['backurl'].'">'
		.'<div class="stdBlock">');
	$block->loadParamAsInput();
	$out->add('<input class="button" type="submit" value="'._LOGIN_BACK.'" />'
		.'</div>'
		.'</form>');

}



function save_options( $block ) {
	global $prefixCms;

	//--debug--// print_r($_POST);

	$backurl = $block->getBackurl();
	$idBlock=$block->getIdBlock();

	if ((int)$_POST["folder_id"] == 0)
		$path="/";
	else {
		$q=mysql_query("SELECT * FROM ".$prefixCms."_login_dir WHERE id='".$_POST["folder_id"]."';");
		$row=mysql_fetch_array($q);

		$path=$row["path"];
	}

	$q=mysql_query("UPDATE ".$prefixCms."_area_block SET title='".$_POST["title"]."' WHERE idBlock='$idBlock';");

	$err="";
	saveParam($idBlock, "css", (int)$_POST["css"]);
	save_block_groups($idBlock, $_POST["idGroups"]);

	// back option
	echo '<form method="post" action="'.$backurl['backurl'].'">'
		.'<div class="stdBlock">';
	$block->loadParamAsInput();

	if ($err == "") {
		echo("<b>"._LOGIN_ALLOK."</b><br />");
		echo '<input class="button" type="submit" value="'._LOGIN_BACK.'" />';
	}
	else {
		echo("<b><font color=\"#FF0000\">"._WARN."</font>:</b> $err<br />"._SAVEDREMAIN."<br /><br />\n");
		echo '<input class="button" type="submit" value="'._LOGIN_BACK.'" />';
	}


	echo '</div></form>';
}

?>