[opencms-dev] vfslink confusion

aaron butler abutler at trstone.com
Wed Feb 18 19:51:01 CET 2004


I am trying to track which pages use particular graphics.  I thought that 
would be done using the "Show Filesystem Links" option in the offline file 
dropdown list, but that doesn't seem to work.  If I understand the code 
correctly, there is no way for it to work in version 5.0.1 - the 
query.properties file in com.opencms.file.genericSql is

C_SELECT_VFS_LINKS=SELECT CMS_RESOURCES.RESOURCE_NAME \
	FROM CMS_RESOURCES \
	WHERE CMS_RESOURCES.RESOURCE_FLAGS = ? \
	AND CMS_RESOURCES.RESOURCE_TYPE = ? \
	AND CMS_RESOURCES.STATE != ? \
	ORDER BY CMS_RESOURCES.RESOURCE_NAME ASC

The stacktrace goes like
CmsNewExplorerFileList.getContent ->  CmsNewExplorerFileList.getRessources 
->  CMSObject.fetchVfsLinksForResource 
->  CMSResourceBroker.fetchVfsLinksForResource 
->  DBAccess.fetchVfsLinksForResourceID
  where DBAccess.fetchVfsLinksForResourceID has the following code:
---------
String query = "C_SELECT_VFS_LINKS";
         String pool = m_poolName;
         PreparedStatement stmnt = null;
         Connection con = null;
         ResultSet result = null;
         ArrayList vfsLinks = new ArrayList();

         // check if we need to use the same query working on the tables of 
the online project
         if (theProject.getId() == I_CmsConstants.C_PROJECT_ONLINE_ID) {
             pool = m_poolNameOnline;
             query += "_ONLINE";
         }

         try {
             // execute the query
             con = DriverManager.getConnection(pool);
             stmnt = con.prepareStatement(m_cq.get(query));
             stmnt.setInt(1, theResourceID);
             stmnt.setInt(2, theResourceTypeLinkID);
             stmnt.setInt(3, C_STATE_DELETED);
             result = stmnt.executeQuery()
----------
which means theResourceID is getting put into the slot marked for 
Resource_Flags.
Changing the reference in the query.properties file to ResourceID didn't 
solve the problem, though.

Should CMSResourceBroker be calling
CMSDbAccess.fetchAllVfsLinks(CmsProject theProject, ArrayList 
theResourceIDs, ArrayList theLinkContents, ArrayList theLinkResources, int 
theResourceTypeLinkID)
instead?

Am I completely misunderstanding the point of Show Filesystem Links?  I 
built 5.3.3 from CVS source (anon/anon, whatever branch/tag that will give 
me) and that doesn't seem to mesh with my understanding either.  I can 
forcefully change the LinkCount for a given resource and thereby get the 
Show Filesystem Links to be selectable in the dropdown list (or type in 
vfslink:/path/to/file) but I don't know what to do to make it show all the 
places I use a particular graphic.  I haven't dug in much on the 5.3.3 
source, though, and link management seems a bit buggy in other ways; maybe 
this is the right code base, but it needs the rest of the inclusion of <img 
src= "">, <link /> or <cms:link /> to be handled correctly for this feature 
to work...

Can someone point me in the right direction for this?  It would be great if 
I could work with 5.0.1, since I'm on a short timeframe, but that may not 
be possible.


-Aaron







More information about the opencms-dev mailing list