%%generic-toggleSubscribed-member-html%%
2002-09-10 00:36:00

%%preprocess%%
$this->getBaseUrl();

// note p_subscriptionList looks like 34,456,34,354965,36
// test for sitemember->id in this->p_subscriptionList
$subscriptionArray= explode(",",$this->p_subscriptionList);
$found= 0;
foreach ($subscriptionArray AS $key=>$value) {
    if ($value==$sitemember->id) {
	$found= 1;
	berror("toggelSubscribed: found sitemember->id in subscriptionList array at $key. unsetting...",1);
	unset($subscriptionArray[$key]);
	}
    }

// if found, remove it and rebuild the list
if ($found) {
    $this->p_subscriptionList= implode(",",$subscriptionArray);
    if ($this->p_subscriptionList=="") $this->p_subscriptionList= " ";
    berror("toggelSubscribed: after implode, this->p_subscriptionList=$this->p_subscriptionList.",1);
    $this->subscribeTag= "Unsubscribed.";
    }

// if not found, add it to the end of the list
elseif ($this->p_subscriptionList) {
    $this->p_subscriptionList= trim($this->p_subscriptionList).",".$sitemember->id;
    $this->subscribeTag= "Subscribed.";
    }
else {
    $this->p_subscriptionList= $sitemember->id;
    $this->subscribeTag= "Subscribed (solo).";
    }

//deal with policy issue involved in member saving document
if ($sitemember->role=="member") {
	$session->updatestatus= "";
	$session->updatepublic= "";
	$session->updaterank= "";
	$session->canSave['document']= 1;
	$GLOBALS[session]= $session;
	}

// update the object
$this->updateObject();

%%header%%

%%css%%

%%template%%
Toggled subscription on $this->objtype:$this->id ($this->title). You are now $this->subscribeTag.<br>
<a href="$this->idUrl?method=view$session->cgi">Continue</a>...

%%listrow%%

%%nullobject%%

%%footer%%

%%postprocess%%
if (!$GLOBALS['debug']) {
	header("Location: $this->idUrl?method=view$session->cgi");
	print "Redirecting to $this->idUrl now.";
	}
 
%%end of context%%
