Delete object + binary file

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Delete object + binary file

Beitragvon Michael_S » Do 29. Mär 2012, 02:49

Hi,

I have a web user form which I'm using to create an object and upload a binary document (pdf). The objects are displayed using a listview and each item has a we:a link to edit or delete the object in the list. Currently the we:a delete link removes the object but not the associated binary file.

How do I remove both the object and the binary file at the same time?

Thanks,

Michael.
Production Area
London, UK
http://productionarea.com

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: Delete object + binary file

Beitragvon mokraemer » Do 29. Mär 2012, 13:52

maybe we can extend the delete option to delete all associtated files as well.
Currently, I think the only way is to call
deleteFile($id, $table, $path = "", $contentType = "")
which is defined in webEdition/we/include/we_delete_fn.inc.php
webEdition-Kern-Entwickler

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Delete object + binary file

Beitragvon Michael_S » Do 29. Mär 2012, 22:09

Hi mokraemer,

Yes, I think it would be logical to have the option to delete associated files. The we:tag would need to specify the associated file field names and a override if the associated file is being used by another object.
mokraemer hat geschrieben:maybe we can extend the delete option to delete all associtated files as well.
Currently, I think the only way is to call
deleteFile($id, $table, $path = "", $contentType = "")
which is defined in webEdition/we/include/we_delete_fn.inc.php
Michael.
Production Area
London, UK
http://productionarea.com

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: Delete object + binary file

Beitragvon mokraemer » Fr 30. Mär 2012, 00:31

would you mind to create a feature request in the bug base qa.webedition.org?
This helps us to keep track on features and bugs in WE.
webEdition-Kern-Entwickler

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Delete object + binary file

Beitragvon Michael_S » Fr 30. Mär 2012, 01:22

Sure will do.
mokraemer hat geschrieben:would you mind to create a feature request in the bug base qa.webedition.org?
This helps us to keep track on features and bugs in WE.
Production Area
London, UK
http://productionarea.com

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: Delete object + binary file

Beitragvon Michael_S » Fr 30. Mär 2012, 03:28

Hi mokraemer,

This is the solution I'm testing, it appears to work ...

Class field name: DOC
UserInput field name: DOC
File name: My-Document.pdf
Uploaded file name: DOC_[WE_ID]_My-Document.pdf

/my_docs/listview.php

Code: Alles auswählen

<we:listview type="object" name="DocListview" order="DocTitle" desc="false" classid="#" objectseourls="true" hidedirindex="false">
<we:repeat>

<we:comment>// ----- Get the associated binary document file name ----- //</we:comment>
<we:field type="binary" name="DOC" only="filename" to="global" nameto="FILE_ID_STR" />

<we:comment>// ----- Strip out the document id from the file name ----- //</we:comment>
<?php $FILE_ID = substr($FILE_ID_STR, 4, 3); ?>

<we:comment>// ----- Manually construct the delete link for both the Object and File (document) IDs ----- //</we:comment>
<a href="/my_docs/delete.php?we_delObject_ID=<we:field type="text" name="WE_ID" />&we_delDocument_ID=<?php echo $FILE_ID; ?>">Delete</a>

</we:repeat>
</we:listview>
/my_docs/delete.php

Code: Alles auswählen

<we:delete type="object" classid="#" forceedit="true" />
<we:delete type="document" pid="###" forceedit="true" />
As normal the listview's delete function view would be restricted by <we:ifRegisteredUser permission=" ... " and or userid=" ...">

Michael.
Production Area
London, UK
http://productionarea.com


Zurück zu „DB / Object Module“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste