Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Support Forum



Linking to middle of page.
KevinNicholls asked:
As I switch from grid view to default view, using the sytax described in Support #266, I link to the middle of the page (not to the top).

Now since the sytax seems to work everywhere else, I'm betting it's because of the special way I am attempting to call the view.

The page details subscriber (member) information.  I want admins, owners and staff to see a list (grid) of subscribers first, then be able to click to a certain member details.  But if the user is a member or guest, I want them to see only thier info (details filered by thier SubscriberID).  Functionally it works great- except for the mid page link as I go from grid to details.

Here is the source for the entire page:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ws="http://www.westside.com/_dtd/ws.dtd">
  <head>
    <ws:viewinfo version="1" masterpage="/Themes/template.view" modifiedby="KevinNicholls[knicholls@avistaadvantage.com]" />
    <title>Subscriber</title>
    <link rel="stylesheet" href="/Themes/default.css" type="text/css" />
  </head>
<!--#  
var dsFilter, drDefaultMode;
if (User.isInGroup("Owner")||User.isInGroup("Administrators")||User.isInGroup("Staff"))
{
    /*This user might have just come from the summary page */   
    if((Request.getQueryString().indexof("_mode"))>=0)
    {
        /* nothing- just follow the querystring */
        Script.log("Subscriber View", "QueryString had _mode");
        drDefaultMode="details";
        dsFilter="";
    }
    else
    {
    /* These users will be the only ones with summary list access */
    drDefaultMode="grid";
    dsFilter="";
    Script.log("Subscriber View", "QueryString did not have _mode, " + "drDefaultMode = " + drDefaultMode);
    }

}
else
{
/* the user is a Member or Guest, and needs to view only thier own data */
    drDefaultMode="details";
    var rsSubscriberID = new Resultset("AddressBook", "SubscriberID", "eMail='" + User.Email +"'");
    rsSubscriberId.next();
    Script.log("getSubscriberID", rsSubscriberID.SubscriberID);
     dsFilter = "<ws:datasource filter='=SubscriberID=" + rsSubscriberID.SubscriberID + "' />";
}
#-->
  <body>
    <ws:dataregion defaultmode="#drDefaultMode#" actionbarposition="bottom" jumpbarposition="top">#dsFilter#
      <ws:caption>Subscriber</ws:caption>
      <ws:jumpbar displaymodes="details,grid" />
      <ws:fieldbox>
        <ws:action type="showupdatepage" displaytype="image" displaymodes="grid,details" displayrole="author" />
      <a href="/Product/Subscriber/default.view?_mode=details&amp;SubscriberID=#record.SubscriberID#"><ws:field name="Company"><ws:caption>Company</ws:caption></ws:field></a><ws:field name="SubscriberID"><ws:caption>SubscriberID</ws:caption></ws:field>

<ws:field name="MemberEmail"><ws:caption>MemberEmail</ws:caption></ws:field>
<ws:field name="SubscriptionEnd"><ws:caption>SubscriptionEnd</ws:caption></ws:field>
<ws:field name="CostOfCapitol"><ws:caption>CostOfCapitol</ws:caption></ws:field>
</ws:fieldbox>
      <ws:actionbar displaymodes="grid" displayrole="editor">
        <ws:action displaymodes="grid,details" type="showinsertpage" displayrole="depositor" />
        <ws:action displaymodes="grid" type="delete" displayrole="author" />
        <ws:action displaymodes="details" type="showgridpage" href="?_lastfilter=1" />
        <ws:action type="submit" displaymodes="insert,update" />
      </ws:actionbar>
     <ws:dataregion actionbarposition="bottom" jumpbarposition="neither" displaymodes="details" defaultmode="grid" recordselectors="0"><ws:caption> Preferences</ws:caption><ws:datasource src="SubscriberImportance" joinfield="SubscriberID" joinfieldparent="SubscriberID" sort="+QuestionID" />
<ws:fieldbox>
<ws:action type="showupdatepage" displaytype="image" displaymodes="grid,details" displayrole="author" />
<ws:field name="QuestionID:QuestionProfileID:QuestionProfile" editmodes="none">
<ws:caption>Type</ws:caption>
</ws:field><ws:field name="QuestionID">
<ws:caption>QuestionID</ws:caption>
<ws:select displayfield="Question" /></ws:field><ws:field name="SubscriberImportance">
<ws:caption>Important?</ws:caption>
</ws:field></ws:fieldbox>

</ws:dataregion><ws:dataregion actionbarposition="top" jumpbarposition="neither" displaymodes="grid,details,update" defaultmode="grid"><ws:caption>Service Points</ws:caption><ws:datasource src="SubscriberMarket" joinfield="SubscriberID" joinfieldparent="SubscriberID" />
<ws:fieldbox>
<ws:action type="showupdatepage" displaytype="image" displaymodes="grid,details" displayrole="author" />
<ws:field name="MarketID:ServiceID:Srvc" editmodes="none">
<ws:caption>Srvc</ws:caption>
</ws:field><ws:field name="MarketID:LDCID:LDC" editmodes="none">
<ws:caption>LDC</ws:caption>
</ws:field><ws:field name="MarketID:StateID:St" editmodes="none">
<ws:caption>St</ws:caption>
</ws:field><ws:field name="ServicePoints" row_style="text-align:center;">
<ws:caption>ServicePoints</ws:caption>
</ws:field><ws:field name="MarketID:RegionID:RegionName" editmodes="none">
<ws:caption>RegionName</ws:caption>
</ws:field></ws:fieldbox>
<ws:actionbar class="ws-actionbar">
<ws:action displaymodes="grid,details" type="showinsertpage" displayrole="depositor" />
<ws:action displaymodes="grid" type="delete" displayrole="author" />
<ws:action displaymodes="details" type="showgridpage" href="?_lastfilter=1" />
<ws:action type="submit" displaymodes="insert,update" />
</ws:actionbar>
</ws:dataregion><ws:htmlblock><br />
<br />
</ws:htmlblock><ws:dataregion actionbarposition="bottom" jumpbarposition="neither" displaymodes="grid,details,update" defaultmode="details"><ws:caption>Region Profiles</ws:caption><ws:datasource src="SubscriberUseage" joinfield="SubscriberID" joinfieldparent="SubscriberID" />
<ws:fieldbox>

<ws:field name="RegionID" style="font-size:12pt;">
<ws:caption>Region</ws:caption>
<ws:select displayfield="RegionName" /></ws:field></ws:fieldbox>

<ws:dataregion actionbarposition="top" jumpbarposition="neither" displaymodes="grid,details,update" defaultmode="grid" pagesize="100"><ws:datasource src="SubscriberUseageDetail" joinfield="SubscriberUseageID" joinfieldparent="SubscriberUseageID" />
<ws:fieldbox>
<ws:action type="showupdatepage" displaytype="image" displaymodes="grid,details" displayrole="author" />
<ws:field name="MonthID">
<ws:caption>MonthID</ws:caption>
<ws:select displayfield="Mo" /></ws:field><ws:field name="ServiceParameterID">
<ws:caption>ServiceParameterID</ws:caption>
<ws:select displayfield="ServiceParameter" /></ws:field><ws:field name="UseageDetailValue">
<ws:caption>UseageDetailValue</ws:caption>
</ws:field></ws:fieldbox>
<ws:actionbar class="ws-actionbar">
<ws:action displaymodes="grid,details" type="showinsertpage" displayrole="depositor" />
<ws:action displaymodes="grid" type="delete" displayrole="author" />
<ws:action displaymodes="details" type="showgridpage" href="?_lastfilter=1" />
<ws:action type="submit" displaymodes="insert,update" />
</ws:actionbar>
</ws:dataregion></ws:dataregion></ws:dataregion>
  </body>
</html>
 
  tamram responded:
  Kevin --

The problem is that you are using substitution syntax to substitute in an entire XML element (the data source element). Because of the order in which the XML parser runs, the HTML for your view isn't being generated properly from the XML. Your browser is probably interpreting the resulting pound signs as bookmarks and jumping to that part of the page.

Rather than this line:

<ws:dataregion defaultmode="#drDefaultMode#" actionbarposition="bottom" jumpbarposition="top">#dsFilter#

you should use substitution to replace just the value of the filter attribute:

<ws:dataregion defaultmode="#drDefaultMode#" actionbarposition="bottom" jumpbarposition="top"><ws:datasource filter='#dsFilter#'"/>

You'll have to modify your code a little to make dsFilter equal to "*" in the first case and '=SubscriberID="<value>"' in the second case, but that should fix the problem.
 
  KevinNicholls responded:
  Simply amazing- works perfectly.
Thanks for the quick response.
 
  tamram responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Thanks,
DataWeb Support
 
  peterhus responded:
  This issue is open.  
  peterhus responded:
  Kevin,

Another thing you might consider:

When you test for

if (User.isInGroup("Owner")||User.isInGroup("Administrators")||User.isInGroup("Staff"))
{

you are implicitly hard-coding your view behavior to group membership, not permissions.  For example, say your Staff currently has Editor role and Members have Author role, set on the Security tab for the folder that contains this view and its default datatable.  It is these role settings that drive the behavior of the "Permissions Required to View/Edit" properties of views.  For example, you might want to have a column in the view only show up for people who are Editors.

if you ever decide to change the Members group to a role of Editor in the table, the view elements that have a "permissions Required to view" property of Editor will just start showing up like they are supposed to.  But... if you code your dsFilter calculation using isInGroup("Staff"), you will also have to go into the view and change the code to add || User.isInGroup("Members") to make that behavior consistent with your permissions change.

A more flexible test than the multiple isInGroup tests would be

if (User.hasPermission(User.perm_EditRecords, "Subscriber") {

then the filter calculation will track any changes you make to group permissions.

Notes: 
1)hasPermission is folder-specific, whereas isInGroup is web-wide.  This means that in a multi-table view like yours, you need to either keep your permissions all in sync, or be careful about which folder you are testing permissions on.

2) hasPermission uses permission terms like "EditRecords" and "CreateRecords". These terms correspond to the column headings on the security tabl.  the Permissions Required to View/Edit property uses Role names (Author, Editor, etc.).  There is a 1-1 correspondence between these in the product, but the more helpful way to think about them is using the permission terms.  For example, a field designated as Permissions Required to View=Editor shows up for all groups that have the "editRecords" permission checked on in the Security tab-- i.e. groups whose roles are set to Editor, Designer, Manager, or Administrator. 

let me know if this info is useful

thanks,
Peter Hussey
 
  KevinNicholls responded:
  Peter, this is aboslutely great advice.

Thanks for taking the extra time.

Kevin
 
  tamram responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

Thanks,
DataWeb Support
 
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us