Webdav: how to define a class should be seen as a folder ?

Author Message

Xavier Dutoit

Sunday 13 March 2005 6:49:14 am

Hello,

Where is the setup to be able to "see" a class as a folder ?
I couldn't find any information on that and I have strange behavior (?related):

a new class "report" is seen as an image (with a .jpg added at the end) and if a folder contains an object of the class article, my web browser (IE6) displays an error message.

Any idea where is the setting ?

Thanks in advance,

Xavier

http://www.sydesy.com

Bård Farstad

Monday 14 March 2005 5:15:40 am

Xavier,

the current WebDAV implementation does this automatically. If there is an image attribute then this is used and the object is represented as such.

Don't think there is much that needs to be changed for this. Just a webdav.ini setting and disable the automatic checking for this. This would be a great issue to get solved during the hackfest.

--bård

Documentation: http://ez.no/doc

Xavier Dutoit

Monday 14 March 2005 5:48:34 am

Bård,

Tricky feature indeed, well spoted ;)

IMHO, it would make more sense to check first if the class is a container, then if it has an image attribute.

The logic:
1) if you can contain children object, then display it as folder,
2) if it has an image attribute, then display it as image (with the extension)
3) else use the standard icon.

I'm not sure I can make it on friday, could you give me a hint of where to find the code that manage the folder+image trick so I can try to modify it and send you the patch ?

Xavier

http://www.sydesy.com

Bård Farstad

Monday 14 March 2005 6:29:49 am

Xavier, I agree. That would be a better implementation.

Do you have time to look at the sources and make a small patch, then we can get this into 3.6?

--bård

Documentation: http://ez.no/doc

Norman Leutner

Wednesday 23 March 2005 2:07:25 am

Would be nice, if you could send me that patch too.
I´m currently having the same problem with my topics, which contain a image attribute.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Xavier Dutoit

Tuesday 29 March 2005 3:04:38 am

Ok, have a look at the new param in webdav.ini (diff output) :

+# List of classes that should be seen as a folder.
+# by default, if a class contains an image attribute it is seen as an image
+# if a container class doesn't contains an image attribute it is also seen as an image
+FolderClasses[]=folder
+FolderClasses[]=article
+#FolderClasses[]=your_custom_class

and modify kernel/classes/webdav/ezwebdavcontentserver.php

     /*!
+      Check if the object has to be seen as a folder
+    */
+    function objectAsFolder ( &$object, &$class )
+    {
+        $webdavINI =& eZINI::instance( WEBDAV_INI_FILE );
+        $classIdentifier = $class->attribute( 'identifier' );
+        if ( $webdavINI->hasGroup( 'GeneralSettings' ) &&  $webdavINI->hasVariable( 'GeneralSettings', 'FolderClasses' ) )
+        {
+            $folderClasses = $webdavINI->variable( 'GeneralSettings', 'FolderClasses' );
+            foreach ( $folderClasses as $folderClass)
+            {
+                if ($folderClass == $classIdentifier)
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /*!
       Gathers information about a given node (specified as parameter).
     */
     function fetchNodeInfo( &$node )
@@ -1429,7 +1451,9 @@
         include_once( 'kernel/classes/ezcontentupload.php' );
         $upload = new eZContentUpload();
         $info = $upload->objectFileInfo( $object );
-        if ( $info )
+        $class =& $object->contentClass();
+        
+        if (!$this->objectAsFolder ( $object,$class ) && $info )
         {
             $filePath = $info['filepath'];
             $entry["mimetype"] = false;
@@ -1470,7 +1494,6 @@
         {
             // Here we only show items as folders if they have
             // is_container set to true, otherwise it's an unknown binary file
-            $class =& $object->contentClass();
             if ( !$class->attribute( 'is_container' ) )
             {
                 $entry['mimetype'] = 'application/octet-stream';

http://www.sydesy.com

Oree Eyo

Monday 18 July 2005 3:49:39 am

Is it the only way to make ezwebdav to show a class as a folder????
Sounds strange.
In the content folder I see nothing. but when I upload the file is getting into the system. as a File object.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:13:13
Script start
Timing: Jan 19 2025 00:13:13
Module start 'layout'
Timing: Jan 19 2025 00:13:13
Module start 'content'
Timing: Jan 19 2025 00:13:14
Module end 'content'
Timing: Jan 19 2025 00:13:14
Script end

Main resources:

Total runtime1.1989 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0153 588.1953152.6563
Module start 'layout' 0.01530.0038 740.851639.4922
Module start 'content' 0.01921.1783 780.3438675.9141
Module end 'content' 1.19750.0013 1,456.257820.0938
Script end 1.1988  1,476.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3481160.0003
Check MTime0.00200.1670160.0001
Mysql Total
Database connection0.00170.138310.0017
Mysqli_queries1.115393.0268730.0153
Looping result0.00080.0641710.0000
Template Total1.148095.820.5740
Template load0.00270.224220.0013
Template processing1.145395.527120.5726
Template load and register function0.00010.008310.0001
states
state_id_array0.00140.115910.0014
state_identifier_array0.00110.092820.0006
Override
Cache load0.00240.2034470.0001
Sytem overhead
Fetch class attribute can translate value0.00090.071740.0002
Fetch class attribute name0.00110.0929100.0001
XML
Image XML parsing0.00160.135640.0004
class_abstraction
Instantiating content class attribute0.00000.0023130.0000
General
dbfile0.00190.1551300.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 31
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs