[opencms-dev] RE: vfslink confusion

aaron butler abutler at trstone.com
Thu Feb 19 18:34:02 CET 2004


Thomas,

Thanks for your response.  That is what I was trying to do.  I was basing 
it in part on the Archived Documentation in the user's guide, section 13.4:

OpenCms needs your help to adjust all links between resources. Therefore 
you have to mark all links in the templates (mastertemplates, 
frametemplates, contenttemplates and elements) with the tag 
\texttt{<link>}. In this link tag you define the link to another resource 
within the OpenCms system (No scheme, server name, port or webapplication 
name is allowed). You can add url parameters to the link, if you need:

\begin{quote}
\begin{verbatim}
href="]]><link>/index.html</link><![CDATA["
href="]]><link>/news.html?newsid=7</link><![CDATA["
src="]]><link>/pics/logo.gif</link><![CDATA["
\end{verbatim}
\end{quote}

An editor can use the HTML edit control. OpenCms will take care about links 
added with the control. Therefore it uses the JTidy library to find all "a 
href" and "img src" tags and inserts the needed OpenCms link tag.

\index{getLinkSubstitution}



I took that as meaning all references to images and anchors would go 
through all necessary prep work to handle them as link resources, so it is 
just a matter of finishing the job and it would do what I am looking for.

It looks like I could make a fairly small change to 
CMSDbAccess.writeFileContent to run it through something to strip out the 
link tags and create link resources.

I think I will give it a shot, but can you let me know if I am trying 
something ridiculous?  It seems like I am attempting a fairly minor 
functional feature addition, and I will be using existing code to do it.

Thanks.

-aaron






---------------

Hello Aaron,

if I understood you right, you wish to keep track which images are used
in which pages for example. Unfortunately, the OpenCms 5.0 VFS link
mechanism is not capable to do that. The link target saves in it's
resources flag attrib. the number of VFS links pointing to this file.
Each VFS link saves in it's resource flag attrib. the primary key of the
target resource. Thus, the Cms is able to identify all VFS links
pointing to a specified file. But this has nothing to do with image tags
or anchor tags in pages.

Regards,
Thomas Weckert
Alkacon Software - The OpenCms Experts
<http://www.alkacon.com=20>http://www.alkacon.com=20





>Date: Thu, 19 Feb 2004 10:00:10 -0500
>To: opencms-dev at opencms.org
>From: aaron butler <abutler at trstone.com>
>Subject: RE: vfslink confusion
>
>OK, I've looked at the other side of these links and I'm even more mixed up.
>
>  It looks like CMS_ResourceBroker.joinLinksToTargets (v5.0.1) 
> uses  CMSDbAccess.updateResourceFlags in 2 different ways: in the 
> commented section 5
>// 5) update the VFS link count per target resource
>it stores the count of unique pointers to a resource in the ResourceFlags 
>column:
>m_dbAccess.updateResourceFlags(theProject, targetIDs[i], linksPerTarget[i]);
>
>then in section 6
>// 6) update the target resource ID's in each VFS link
>it keeps the current targetID for a given link
>m_dbAccess.updateResourceFlags(theProject, linkID, targetID);
>
>For me to track this information, will I need to create a link resource 
>for each graphic in my galleries, and use those links instead of the 
>graphics in the sourcecode editor?  That seems very wrong, since the work 
>of generating the internal link references is done in 
>com.opencms.util.LinkSubstitution, and the core engine is clearly able to 
>find the resource from the publication direction.
>My inclination is to find out when the editor saves its changes, and make 
>sure it is automatically creating a new link resource for each new anchor, 
>graphic, or other resource included.
>
>Am I going about this the right way?  It still seems more likely that I am 
>completely missing the point of something.
>
>
>-Aaron
>
>
>
>>Date: Wed, 18 Feb 2004 13:50:33 -0500
>>To: opencms-dev at opencms.org
>>From: aaron butler <abutler at trstone.com>
>>Subject: vfslink confusion
>>
>>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