Forums / Install & configuration / Webdav: how to define a class should be seen as a folder ?

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.

eZ debug

Timing: Jan 19 2025 06:03:45
Script start
Timing: Jan 19 2025 06:03:45
Module start 'content'
Timing: Jan 19 2025 06:03:46
Module end 'content'
Timing: Jan 19 2025 06:03:46
Script end

Main resources:

Total runtime1.0447 sec
Peak memory usage4,096.0000 KB
Database Queries210

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0098 589.2188180.8047
Module start 'content' 0.00980.8974 770.0234677.0234
Module end 'content' 0.90730.1373 1,447.0469345.0469
Script end 1.0445  1,792.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00500.4743210.0002
Check MTime0.00170.1632210.0001
Mysql Total
Database connection0.00130.122110.0013
Mysqli_queries0.922488.29772100.0044
Looping result0.00260.24772080.0000
Template Total0.994695.220.4973
Template load0.00320.305420.0016
Template processing0.991494.901220.4957
Template load and register function0.00010.011010.0001
states
state_id_array0.00280.268910.0028
state_identifier_array0.00210.196520.0010
Override
Cache load0.00290.2761470.0001
Sytem overhead
Fetch class attribute can translate value0.00140.131350.0003
Fetch class attribute name0.00190.1817100.0002
XML
Image XML parsing0.00190.179750.0004
class_abstraction
Instantiating content class attribute0.00010.0054130.0000
General
dbfile0.01701.6232410.0004
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 31
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs