chaskunz
|
| Posted: 07/17/2002, 8:22 AM |
|
I have created both an editable and a view-only form on a page, then added custom code to the Before Show event to control when each form is visible or not. However, the processing for BeforeShow in the main PHP page occurs way into the show() function, and now in 1.7.0 occurs even later. I had moved the processing of the BeforeShow event up to the top of the function, but after the upgrade to 1.7.0, all my changes were wiped out. How should I modify this, so I won't have to add it in each time. Shouldn't there be an AfterInitialize event for forms?
from phone_list.php:
function Show()
{
global $Tpl;
//Custom Code CAK - moved line from after $Tpl->block_path = $GridBlock;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
//End Custom Code
if(!$this->Visible) return;
$ShownRecords = 0;
$this->ds->Parameters["urlperson_id"] = CCGetFromGet("person_id", "");
$this->ds->Prepare();
$this->ds->Open();
$GridBlock = "Grid " . $this->ComponentName;
$Tpl->block_path = $GridBlock;
//CAK $this->CCSEventResult = CCGetEvent($this-CCSEvents, "BeforeShow");
$is_next_re
from phone_list_events.php:
function phone_BeforeShow() { //phone_BeforeShow @127-92FB57BA
//Custom Code @163-2A29BDB7
// -------------------------
global $phone;
global $DBConnection1;
$current_emp = CCGetParam("person_id","");
$current_user = CCGetUserID();
$cur_emp_user_id = CCDLookUp("user_id","user","person_id=".
$DBConnection1->ToSQL($current_emp,ccsInteger),$DBConnection1);
$cur_user_gp = CCDLookUp("group_id","user","user_id=".
$DBConnection1->ToSQL($current_user,ccsInteger),$DBConnection1);
if($current_emp != 0 && (!$current_user ||($current_user != $cur_emp_user_id
&& $cur_user_gp < 2))){
$phone->Visible = false;
} else {
$phone->Visible = true;
}
// -------------------------
//End Custom Code
} //Close phone_BeforeShow @127-FCB6E20C
|
|
|
 |
Nicole
|
| Posted: 07/18/2002, 4:54 AM |
|
Hello,
put hide form code into Page After Initialize event.
|
|
|
 |
|