You are viewing limited content. For full access, please sign in.

Question

Question

Weblink pages

asked on May 8, 2014

We have a customer that has made some Weblink modifications and placed some buttons on the Weblink DocView page.  The problem is some documents don't open with docview.  I tested and browsed to a document and receive this url -  http://localhost/WebLink8/DocView.aspx?id=26522.  I then go to another document in Weblink and receive this url http://localhost/WebLink8/0/doc/26524/Page1.aspx.  Why do some documents open with a page1.aspx page instead of DocView? When the document is opened with this page then they don't see the buttons that were added.

0 0

Answer

SELECTED ANSWER
replied on May 8, 2014

There is a rewrite rule in the web.config file that transforms the second version to the first:

<rewrite url="^~/(.*)/doc/(.*)/Page(.*).aspx(\??)(.*)" to="~/DocView.aspx?dbid=$1&amp;id=$2&amp;page=$3&amp;$5" />

This means that internally, both requests end up executing the same aspx page.  The only reason for having the two kinds or URLs are aesthetics, some people think URLs like the second one are prettier, but for technical reasons we weren't able to always use the second kind of URL.

 

Are you sure that there's no logic in the page that could explain it showing up sometimes but not others?  Are there any resources that fail to load?  If your page is loaded by the second URL when you expect the first, relative paths to things like images and stylesheets won't work.

1 0
replied on January 11, 2019 Show version history

Is that valid for 10.3 ?

0 0
replied on January 14, 2019 Show version history

It is still true for the most recent version of WebLink, 10.1.

1 0

Replies

replied on May 9, 2014 Show version history

I don't believe this has anything to do with your custom coding nor the rewrite rules but Laserfiche WebLink coding and logic.

 

For example, if you go to http://webdemo.laserfiche.com/WebLink8/Browse.aspx?startid=7 and click on the document entitled "Cities Digital Junxure Integration" (at the botom) look at the URL that is displayed whenever DocView.aspx has finished loading. You should see "http://webdemo.laserfiche.com/WebLink8/0/doc/531643/Page1.aspx".

 

Click the back button and now click on the folder entitled "Agenda Manager" and then click on the document entitled "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/DocView.aspx?id=531522" in the URL bar whenever DocView.aspx has finished loading.

 

Viewing the HTML source of these two links reveals a difference:


"Cities Digital Junxure Integration"

<a href="0/doc/531643/Page1.aspx" class="DocumentBrowserNameLink">
<nobr>
<img src="images/DocPage1.gif" class="DocumentBrowserNameImage">
<span>Cities Digital Junxure Integration</span>
<span class="EntryRowIconText">[Icon]</span></nobr>
</a>

 

"Agenda Manager (3)"

<a href="0/doc/531522/Page1.aspx" class="DocumentBrowserNameLink" onclick="__doPostBack('TheDocumentBrowser:_ctl58:_ctl5',''); return false;">
<nobr>
<img src="images/DocPage1.gif" class="DocumentBrowserNameImage">
<span>Agenda Manager ‎(3)‎</span>
<span class="EntryRowIconText">[Icon]</span>
</nobr>
</a>

What stood out immediately was that the "Agenda Manager (3)" link contains an onclick event handler while the "Cities Digital Junxure Integration" link does no contain it. This is why you sometimes get the "DocView.aspx?id=" link. When the link is a pure HTML link then it's handled through the URL Rewriter but when it has a JavaScript callback it's not.


Basically, it appears to be a logic bug because anytime you access "Browse.aspx" without clicking through folders and click on a document within the root of that folder it will always show a rewritten URL. However if you access that same file via clicking through folders to get to it then it's going to show the non-rewritten URL.

 

Example:

  1. Click http://webdemo.laserfiche.com/WebLink8/Browse.aspx?startid=524401
  2. Now click on "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/0/doc/531522/Page1.aspx"
  3. Now click http://webdemo.laserfiche.com/WebLink8/Welcome.aspx
  4. Click "Product Brochures" link
  5. Click on "Agenda Manager" folder
  6. Click on "Agenda Manager (3)". You should see "http://webdemo.laserfiche.com/WebLink8/DocView.aspx?id=531522"

 

The following code has not been thoroughly tested but may help in this problem with the URL changing. Open up "Browse.aspx" and right before the "</body>" tag copy and paste the following:

 

<script type="text/javascript">
    document.body.onclick = function (e) {
        e = e || event;
        var from = findParent('a', e.target || e.srcElement);
        if (from) {
            /* it's a link, actions here */
            window.location = from.href;
        }
    }
    //find first parent with tagName [tagname]
    function findParent(tagname, el) {
        if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) {
            return el;
        }
        while (el = el.parentNode) {
            if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) {
                return el;
            }
        }
        return null;
    }
</script>

Save the file and reload it in your browser. Hope this helps!!

1 0
replied on May 9, 2014

Interesting observations, Wes.  One thing to be mindful of is that by explicitly setting the location, you can break things like control-click and middle button click (open in new tab).

0 0
replied on May 9, 2014

Thank you - I knew it was Laserfiche logic and not anything to do with the modifications the client made to the page.  I wanted to know if it is possible to force Laserfiche Weblink to always open a document with docview.aspx.  We will try the web.config file modification.  The documents are all scanned images without any logic.

0 0
replied on May 14, 2014

Hi Susan,

 

If any of the above responses answered your question, please click the "This answered my question" button on the appropriate post.

 

If you still need assistance with this matter, just update this thread. Thanks!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.