Alex LL
|
| Posted: 09/16/2002, 8:38 AM |
|
Hello everybody,
I'd like to display the "Delete" button in a record form if and only if a certain user is logged in.
I use php. I imagine to put some code in Before Show events, any hints?
thanks
|
|
|
 |
george l.
|
| Posted: 09/16/2002, 9:58 AM |
|
Alex. Maybe you can try the "Visible" Property. Example #2 does exactly what your looking for. Read the Help Section in C.C.S for more details.
Visible
Description
This property determines whether the component is to be shown (parsed into template) or not.
Syntax
$value = $object->Visible;
$object->Visible = $value;
Specification
result
Type: Boolean
Example 2
The following code hides Update and Delete buttons if current task is not assigned to the current user.
This code would usually be placed in Before Show event of a Record form. Additional code may be needed in Before Update or Before Delete event to protect the form from being modified and submitted externally.
global $tasks;
global $DBIntranetDB;
$current_task = CCGetParam("task_id", 0);
if($current_task!=0 && CCGetUserID() != CCDLookUp("user_id_assign_to", "tasks", "task_id=" . CCToSQL($current_task, "Integer"), $DBIntranetDB)
{
$tasks->Update->Visible = False;
$tasks->Delete->Visible = False;
}
Read the Help Guide->Programming Reference->Properties Section for more details.
|
|
|
 |
Alex LL
|
| Posted: 09/17/2002, 12:39 AM |
|
Sorry, I forgot to tell I use CC 2.0.5, not CCS.
|
|
|
 |
Nicole
|
| Posted: 09/18/2002, 12:02 AM |
|
Alex,
you cannot hide button in CC in so easy way as in CCS. In template pattern you can hide Delete & Edit buttons (not only one of them). I suppose the easiest way is to create two forms and show/hide one of the form depending on logged in user. Please refer to the following article about hiding the forms in CC: http://www.gotocode.com/art.asp?art_id=54&
|
|
|
 |
|