This topic is locked

Help - Suppress Edit on xxxList.php

8/24/2006 4:30:26 PM
PHPRunner General questions
F
frocco author

Hello,
I want to remove the Edit link when a record is closed.

The user shoul donly be allowed to view it.
A closed record has a value of 1 in the ticketClosed field.

I see not event in the List that would allow me to do this.
Thanks
Frank

J
Jane 8/25/2006

Frank,
you can create a view for all not closed tickets.

For that edit SQL query on the Edit SQL query tab:

select `field1`,

`field1`,

`ticketClosed`

from `TableName`

where `ticketClosed`!=1
F
frocco author 8/25/2006

This is not what I want.

I still want to show the records in the list, but disable the Edit link.
Thanks
Frank

Frank,

you can create a view for all not closed tickets.

For that edit SQL query on the Edit SQL query tab:

select `field1`,

`field1`,

`ticketClosed`

from `TableName`

where `ticketClosed`!=1
J
Jane 8/25/2006

Frank,
open ...list.php file, find loopRs($rsData,$nPageSize) function, locate following code snippet in it:

<?php if(CheckSecurity(@$_SESSION["OwnerID"],"Edit")) { ?>

<td align=center>

<?php

$strOwnerID = $ownerid;

if($strOwnerID) $strOwnerID = $data[$ownerid];

if(CheckSecurity($strOwnerID, "Edit"))

{

?>

<a href="products_edit.php"

onClick="java script:

document.forms.editform.editid.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField]));?>';

<?php if($strKeyField2) {?>

document.forms.editform.editid2.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField2]));?>';

<?php } ?>

<?php if($strKeyField3) {?>

document.forms.editform.editid3.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField3]));?>';

<?php } ?>

document.forms.editform.submit();

return false;" ><?php echo mlang_message("EDIT");?></a>

<?php } ?>

&nbsp;</td>

<?php } ?>



and replace it with this one:



<?php if ($data["ticketClosed"]!=1) {?>
<?php if(CheckSecurity(@$_SESSION["OwnerID"],"Edit")) { ?>

<td align=center>

<?php

$strOwnerID = $ownerid;

if($strOwnerID) $strOwnerID = $data[$ownerid];

if(CheckSecurity($strOwnerID, "Edit"))

{

?>

<a href="products_edit.php"

onClick="java script:

document.forms.editform.editid.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField]));?>';

<?php if($strKeyField2) {?>

document.forms.editform.editid2.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField2]));?>';

<?php } ?>

<?php if($strKeyField3) {?>

document.forms.editform.editid3.value = '<?php echo htmlspecialchars(db_addslashes($data[$strKeyField3]));?>';

<?php } ?>

document.forms.editform.submit();

return false;" ><?php echo mlang_message("EDIT");?></a>

<?php } ?>

&nbsp;</td>

<?php } ?>
<?php } else {?><td align=center></td><?php } ?>

F
frocco author 8/25/2006

Thank you Jane,
I will use your suggestion.
I was hoping that there was an event on the List that I could use.

otherwise, my changes will be lost on next gen.
Frank

Frank,

open ...list.php file, find loopRs($rsData,$nPageSize) function, locate following code snippet in it:
and replace it with this one:

J
Jane 8/25/2006

Frank,
there is no way to do it using events.

F
frocco author 8/25/2006

That would be a nice feature for a future version of PHPRunner.
I also thought about modifying the template.
Frank

F
frocco author 8/25/2006

I just tried your change in a customized template.

This will work out quite well.

I will just create templates for each application that requires furthur customizing.
Thanks for your help.
Frank

That would be a nice feature for a future version of PHPRunner.

I also thought about modifying the template.
Frank