Multiple configurations for asp.net user control - asp.net

I'm working on a site that can be displayed to the user in several different ways, kind of like themes, but more functionality related. So basically, the page you are viewing is in a certain state (based on the user, country etc).
The rendering of the controls on a page will vary a bit depending on the current state, and I want this to be easily configurable. (For state A, hide this field in this control, for state B show this icon etc).
In a standard web site, a control would just access a section in web.config to get the its current configuration, but now I want the control to get different configurations depending on the state the page is in.
Any suggestions on how to implement this?

Why not just save the relevant UserControl Properties values in a database for each state. This way states can be added or modified on the fly later.

I choose to create an interface for getting configuration settings that directly mapped to ConfigurationManager.GetSection(string sectionPath).
I then injected (using Spring.Net) a class that used the built in configuration manager, but tried to resolve the section path at different levels depending on the current state.
So it started by trying to get the configuration from "[CurrentState]/Application/MyControlConfiguration", if not found tried the default "Application/MyControlConfiguration". Worked pretty well...
The controls didn't have to be aware that the application can override configuration settings depending on state.

Related

Different URL paths in different tabs depending on id

Let's say a user has a list of projects, and each project has it's own set of various collection items of charts, reports, tags, etc associated by project._id
When a user selects a project, all the associated collection items are viewable by route, for example /project/<projectId>/chart/<chartId>
Currently, a user can only view one project at a time. If he opens up a new tab or a new browser, he can still only view the one project. If he switches the project, all the other tabs/windows reactively change to the new project. This is because currently the project is tied to Meteor.user.profile.projectId (but I am looking for a better way).
I would like to change this behaviour so that tabs and windows are independent of each other. If a user pastes project\project1 into a new window it should load that and it's associated collections even if his current tab is in project\project2. I hope that makes sense.
I'm not sure how to accomplish this. I am looking for suggestions and solutions. Thanks.
I believe that this can easily be accomplished using session variables:
set a default somewhere in your client code, Session.setDefault('project', 1) (or make sure that project being undefined is handled gracefully)
when a user selects a project, set the variable:
Session.set('project', [selectedProjectId])
Wherever you need to decide which project to show: Session.get('project')

Identifying Pages in ASP.net

I am working on a website using DNN as my Content Management System of choice, and I'm running into an issue where the main content area and the side area will switch based on which page you are on.
In the .ascx file I know I can write a conditional based on the URL you're on:
<% If Request.RawUrl.Contains("piece-of-url") Then %>
but I was wondering if there is a more permanent or reliable way to mark a page, just in case the page name changes, or if there are pages underneath that page that may not have the same styling (although, I can include the extension as a way to get around this).
Thanks for your help.
In DNN if you want to change the way the page functions, base on the page you are on, you would typically either define a separate SKIN as Brent Mannering suggests, or apply a differnt module to different pages on the site.
That being said, you can also target the "TabId" of DNN pages, in the code for the ASCX file for the Skin you could define functionality based on the tabid.
When I've needed to do this, I've created a 'Bookmark' module and added it on the page.The bookmark module just stores a value pair in the settings, in my instance I was using values like <"HotelHomePage", "Hilton"> or <"DestinationHomePage", "Sydney">. This way, page name doesn't matter, you can change the page name, move the page to a different parent, but as long as the bookmark value on the page stays the same, you will always have it.
Just make sure that a bookmark exists for each page you need it on.

Tridion Structure Group Localization Permission Issue

I am using SDL Tridion 2011 and need to take the permissions off from the user to localize a structure group so that he does not make any changes in the name of the structure group by localizing it. However, even after removing the rights and permissions and making the structure group ‘read only’, the user is still able to localize the structure group by right clicking on it and going to properties. Please help if there's any resolution for it.
Also, is there any way we can restrict the user from unpublising or updating a page?
Permissions on a structure group control what you can do to the things it contains. Remove the localize permission in the parent structure group instead.
To prevent unpublishing you can do any of the following:
Remove the Read permission.
Go to the Security tab in the properties of the relevant publication, and remove the right to Publish to Content Distributor
Go to the Security tab of the relevant Target Type, and remove the Use Target Type permission
To prevent them updating a page, remove the Write permission, although be aware that editing the page allows them to modify the page composition, and that controlling this doesn't prevent changes to the content if the person has permission to modify the relevant components.
If none of these is sufficient, then you will need to implement a custom solution with either the events system, or workflow.
Inspect the properties for your Structure Group and go to the Security tab. Check which users/groups have the localize right and then see if your user is a member of any of those groups. Groups can be members of other groups, so you may need to check recursively to find where this ability is being allowed from.
Also make sure that the user is not an Administrator.
To prevent a user from unpublishing a page then you need to make sure they do not have "Publish to Content Distributor" rights at the Publication level. If they need to be able to publish pages, but not unpublish, you will need to take care of that by writing an Event System.
To prevent them from updating a page, you need to consider the Write permissions on the containing Structure Group.

Where I can find Button Override in Change Sets

I want to move standard button override (Clone) on custom object through Outbound change Sets, but I'm unable to find this position in possible changes.
In which category Button Overrides are stored?
Custom buttons and links are listed in change sets under 'Button or Link'. To deploy the Page Layouts to which they are assigned, be sure to add it to the change set under 'Page Layouts'.
If you want to deploy a button overridden with a Visualforce page, you will need to deploy the whole object, the Visualforce page, its Apex Classes, and any components that are in the Visualforce page. In addition, once you have deployed the pages and classes, you will need to go into the new environment and give the appropriate profiles access to them, otherwise navigating to the page will give them an 'Insufficient Privileges' error.
If you want more finely-grained control over what specific metadata components you are deploying (and you don't simply want to do it manually in the target org) then you should consider using the ANT-based metadata migration tool that Salesforce provides. It has some more power and flexibility in terms of migrating sub-components of metadata. Here is a link with a little getting started video for that, and here is the documentation.

No data showing on Google Analytics due to Profile/Filter Configuration

I'm using the Google Analytics Flex API to record data from a Flex application.
As I understand it, Google Analytics has a 3-tier hierarchy: An Account can contain one or more Properties, each of which can contain one or more Profiles. A UA code is associated with a Property, and Filters can be used to record specific traffic to a specific Profile.
The application lives on 5 different server environments (development, staging, live, etc) and we need to separate the data from the different environments.
Note that the server environments do not live within the same domain name. For example, staging is at staging.x.com, but the live version is at www.y.com. But I want them all to share the same UA code, so we are tracking them as 5 different Profiles.
So I have one Property with multiple Profiles. I set up a Filter for each Profile saying "Include only traffic form the domains that are equal to" and the particular hostname for that server environment.
The "Default URL" for the Property is set to the hostname of the default Profile, which is the live environment.
We set up that configuration yesterday, and today there is no data in any of our Profiles. We had data the day before (before doing the reconfiguration). I am confident that the tracking code in the client app is sending the hits to GA, since I can see them in Chrome debug mode, and the client app wasn't changed between the day before yesterday and yesterday. The only thing that changed was the configuration of the Property and the Profiles.
So obviously I'm missing something about Property and Profile configuration. Some specific questions:
Am I understanding Filters correctly? Is it somehow applying the Filter to the entire Property? It seemed like the Filters were at the Profile level.
Does the "Default URL" for the Property have an effect on which hits are recorded? What exactly is it used for?
Is there some restriction on how the Profiles within a Property can be affiliated? For example, do they have to belong to the same domain name? I thought not, but maybe I'm wrong?
Any other suggestions?
Obviously, I can experiment with the configuration and see what happens. But I have to wait until the next day to see the effects of each change. Thanks for helping.
Am I understanding Filters correctly? Is it somehow applying the
Filter to the entire Property? It seemed like the Filters were at the
Profile level.
Yes Filters are always applied at the profile level.
Does the "Default URL" for the Property have an effect on which hits
are recorded? What exactly is it used for?
The "Default URL" has no effect on data collection or filtering at all. It's only used to create links from the page reports back to your site. So when you see the top page being /index.html and you click the little link beside it it will take you to "Default URL"/index.html . So you might break that specific feature if the url doesn't exist on you domain. But for the sake of reporting it's completely fine to use a different url.
Is there some restriction on how the Profiles within a Property can be
affiliated? For example, do they have to belong to the same domain
name? I thought not, but maybe I'm wrong?
No, the Profiles inside a Web Property don't need to share the same domain name. It's perfectly fine to have multiple profiles filtered by hostname and it's completely fine and normal to have a global profile with data from multiple hostnames. In that last case the data may be a little off unless you implement Cross Domain Tracking.
Any other suggestions?
It seems that you have a very good understanding of how things work in GA. One thing that you might have missed and #jk commented about is that you should always have an unfiltered profile on you Web Property to avoid losing data due to bad filters.
Another thing to notice is that in the past I had problems with the predefined domain filters. It seems they were being aplied to the wrong field inside Google Analytics. I think they were being applied to the "Visitor ISP Organization". For that reason I never use predefined filters. So if you are using predefined filters you might consider changing them to Custom Include fields, select the "Hostname" metric and enter the domain you want to filter as a RegExp. I believe this bug should be fixed by now, but you never know, I just lost confidence in the predefined filters on that day.
If you acidentaly used 2 include filters in a profile that filter on the hostname but with different values chances are they are canceling each other. So you might want to go into each profile and check if they only contain one include filter each.
eg:
Include only trafic from x.com
Include only trafic from y.com
This will result in a profile with no data.
Another thing to notice is that filters don't apply to retroactive data. So if you apply a filter today to a profile it will only filter data from now on. Data that has already been processed will be elft untouched. There's no way to change data that has been added to a profile, nor to add retroactive data to a new profile.
Other than that you are probably good.

Resources