%%folder-saveLink-member-html%%
2002-12-23 16:08

%%preprocess%%
// manually save a new folder with flavor=link, desciption is URL
$container= $GLOBALS['containers'];
$link= new Folder;
foreach ($_POST AS $key=>$value) {
	$link->{$key}= $value;
	berror("saveLink: setting link->$key==".$link->{$key},1);
	}

$link->applyPolicy();
if ($link->id=="") {
	if ($link->name=="") $link->name= uniqid("link");
	if ($folder->name!="/") $link->name= $folder->name."/".$link->name;
	else $link->name= "/".$link->name;
	berror("Inserting new link named $link->name.",1);
	$link->insertObject();
	$redirect=$folder->baseURL."?method=view".$session->cgi;
	}
else {
	// base this on folderid
	$parentFolder= new Folder;
	$parentFolder->selectObjectById($this->folderid);

	if ($link->name!="") {
		if ($parentFolder->name!="/") $link->name= $parentFolder->name."/".$link->name;
		else $link->name= "/".$link->name;
		}
	berror("Updating link #$link->id. (with name=$link->name)",1);
	$link->updateObject();
	$redirect=$parentFolder->baseURL."?method=view".$session->cgi;
	berror("redirect=$redirect and parentFolder=".$parentFolder->name,1);
	}

$header= "Location: ".$redirect;
if ($GLOBALS[debug]) {
 print "<a href='$redirect'>Click here to continue.</a>";
 }
else {
 header($header);
 exit;
 }

%%header%%


%%css%%


%%template%%
<table width='90%' border='0' cellspacing='20' cellpadding='5' align='center'>
<tr> <td> <p><b>$this->objtype object id#$this->id ($this->name):</b></p>
<p>$this->propertiesList</p>
<p><a href='$session->refreshURL'>refresh</a> | <a href='$this->baseURL?method=edit$session->cgi'>edit</a> | <a href='$this->baseURL?method=create$session->cgi'>create new</a> | <a href='$this->baseURL?method=addchild$session->cgi'>add child</a> | <a href='#top'>top</a></p>
</td><table width='90%' border='0' cellspacing='20' cellpadding='5' align='center'>
<tr> <td> <p><b>UPDATED! $this->objtype object id#$this->id ($this->name):</b></p>
<p>$this->propertiesList</p>
<p><a href='$session->refreshURL'>refresh</a> | <a href='$this->baseURL?method=edit$session->cgi'>edit</a> | <a href='$this->baseURL?method=create$session->cgi'>create new</a> | <a href='$this->baseURL?method=addchild$session->cgi'>add child</a> | <a href='#top'>top</a></p>
</td>
</tr>
</table>
</tr>
</table>


%%listrow%%


%%nullobject%%


%%footer%%


%%postprocess%%



%%end of context%%
