head	1.1;
access;
symbols;
locks; strict;
comment	@# @;
expand	@b@;


1.1
date	2003.12.18.00.41.00;	author spike;	state Exp;
branches;
next	;


desc
@@


1.1
log
@first commit for KLDP.net
@
text
@<?

include_once "./setting.php";

include_once $global["root"] . "/include/handle.php";
include_once $global["root"] . "/include/print_array.php";

include_once $global["root"] . "/lib/Site.php";
include_once $global["root"] . "/lib/Basic_Doc_Group.php";

// escape error.
if ($_POST["action"] == "rename" and
		trim($_POST[sprintf("group_name_%s", $_POST["group_no"])])
		== "") {
	goprev();
}

if ($_POST["action"] == "remove" and trim($_POST["group_no"]) == "") {
	goprev();
}

if ($_POST["action"] == "add" and trim($_POST["group_name"]) == "") {
	goprev();
}

$Site = new Site;
$Site->init();
$Site->set_permission("user");

// trim value
switch ($_POST["action"]) {
	case ("add") :
		$Site->DB->transaction_start(true);
		$Group = new Basic_Doc_Group;
		$retval = $Group->add($_POST["group_name"]);
	break;
	case ("rename") :
		$Site->DB->transaction_start(true);
		$Group = new Basic_Doc_Group;

		$name = $_POST[sprintf("group_name_%s", $_POST["group_no"])];

		$retval = $Group->rename($_POST["group_no"], $name);
	break;
	case ("remove") :
		$Site->DB->transaction_start(true);
		$Group = new Basic_Doc_Group;
		$retval = $Group->remove($_POST["group_no"]);
	break;
	default :
		$Site->end1();
		goprev();
}

$Site->DB->retval = $retval;

$retval = $Site->DB->retval;

$Site->DB->close();

if ($retval) {
	$url = sprintf("Location: %s/mail.php?mode=doc_group_management",
		$_SESSION["user_global_url"]);

	$Site->end1();
	Header($url);
	exit;
} else {
	$Site->end1();
	goprev();
}

/*
Description
-----------

Author
------
 Spike^ekipS <spike@@spikeekips.net>

Changelog
---------

Usage
-----

*/

?>
@
