Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Role Management modification
ankita
#1 Posted : Tuesday, 13 July 2010 8:03:16 PM(UTC)
Rank: Member

Joined: 13/07/2010(UTC)
Posts: 8
Location: India

Hi Roger,

First of all Thanks a lot for sharing such a nice web application. It is really very helpful!

I need a little help on modifying source code of manageusers.ascx page.
In GSP, Role Management is working like user based role, I would like to build the role based user concept.
For eg,
step 1: I have different Roles like, Teachers, Parents, Students, etc...(Role Master)
Step 2: There are certain entities which belongs to each Role. (UserRole Master)
Step 3: While assigning rights for particular Role, that role should be automatically assigned to entities belong to that role. (UserRoleRights Master - Roles would be automatically applied)
Step 4: Admin can modify rights for each user also. (UserRoleRights Master - Additional rights can be provided from Manage Users page)

So, in GSP, I need to implement step 4. For that, I need to change source code of manageuesrs.ascx page:
Step 1: I have to replace checkboxlist with dropdownlist with autopostback true. (fetch all roles). - Done
Step 2: On selection of particular role, All default rights will be displayed with checkbox disabled. - Done for fist Role only.
Step 3: After selection change event (event of dropdownlist_SelectedIndexChanged will be fired), rights for selected role should be populated. - Pending as code is working fine but window is automatically closed so data could not be displayed.

Please give me a solution to prevent window to be closed.

Let me know in case of any query.



Thanks & Regards,
Ankita Shah (MCPDEA)
Team Leader
Roger Martin
#2 Posted : Wednesday, 14 July 2010 12:15:48 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

It sounds like the window is closing because a postback is occurring during the dropdownlist_SelectedIndexChanged and the state of the window is not preserved.

I don't know if this will solve the problem, but there is some code that forces the window to open upon page load. When you add a user you can click a link like "Add another user", which causes a postback and re-displays the Add New User window. You can take a look at this code to see how it is done, then copy it into your postback event.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
ankita
#3 Posted : Thursday, 15 July 2010 8:15:09 PM(UTC)
Rank: Member

Joined: 13/07/2010(UTC)
Posts: 8
Location: India

Thanks for your quick reply!

I have tried as per your suggestion but it won't work. I am getting "Data could not be loaded" error.
If you have another solution then please share it with me. I will work on it later on.

One more help is appreciated!
Right now I have another query regarding the application flow which is on high priority rather than above query.
Can you please guide me for the right application flow in perspective of
- DAL (Data Access Layer),
- BAL (Business Access Layer),
- BO (Business Object/Entity),
- WS (Web Service) and
- Application layer coding or extra layers if any.

I have gone through the flow of application but I can't find a proper way.

If I am adding a new table in the application database, then what would be the right procedure for managing that table data like Add/Edit/Delete/Fetch transactions from the application.
Please guide me the right path for adding new functionality to GSP.



Thanks & Regards,
Ankita Shah (MCPDEA)
Team Leader
Roger Martin
#4 Posted : Friday, 16 July 2010 12:54:01 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

As for the "data could not be loaded" error, I don't know what the issue is without getting into the details of your particular situation. About the only thing I can suggest is to try to use client-side behavior (such as AJAX) rather than the server-side SelectedIndexChanged event. In the end I think you'll find it easier, although it is more work to set up the first time.

How you should implement new functionality depends on many things. In general, I assume you want to minimize the amount of work needed to upgrade your customized version of GSP to future versions. Therefore, your code should be as self-contained as possible, which means don't try to integrate it into all the different layers of GSP.

If you don't care about upgrading, then you might still want to make your code self-contained, since that will be easier to implement. But if you need to hook into the business rules of GSP, then you might need to perform a deeper integration.

To learn how to do the "deep" integration, use the debugger to step through the code from the stored procedure call all the way to the UI.

Hope this helps,
Roger Martin
Creator and Lead Developer of Gallery Server Pro
ankita
#5 Posted : Sunday, 18 July 2010 5:07:04 PM(UTC)
Rank: Member

Joined: 13/07/2010(UTC)
Posts: 8
Location: India

Thank you for the suggestion given.

I have solved window.close() issue of dropdownlist by taking input button and add client-side JavaScript on on-click attribute and also disable auto-post-back event of dropdownlist.

Regarding Coding pattern,
As you mentioned, I need to write self-contained code rather than hook up with all layers of GSP.
Initially, I have started deep-integration with GSP but it takes time to resolve the errors and issues occurred during development.
I have also tried to write self-contained code but I think for that I need to add all references of other projects into Application layer which will create problem later on. So, Please suggest me the main layers of application which I need to modify. Or suggest me the way to write self-contained code for new table and new page.

Your help on this topic is really appreciated!


Thanks & Regards,
Ankita Shah (MCPDEA)
Team Leader
ankita
#6 Posted : Tuesday, 20 July 2010 7:45:25 PM(UTC)
Rank: Member

Joined: 13/07/2010(UTC)
Posts: 8
Location: India

Hello Roger,

The issue of automatically window close on post-back of dropdownlist is resolved. As you mentioned, it is true that it was needed more time to set up first time but now I can say it is really easy.

I want to share the code may be it will helpful for others.
Below is my HTML code for dropdownlist:
<asp:DropDownList ID="cblAvailableRolesForExistingUser" runat="server" DataSourceID="odsAllGalleryServerRoles"
DataTextField="RoleName" DataValueField="RoleID" CssClass="gsp_j_edit_rolelist"
OnDataBound="cblAvailableRolesForExistingUser_DataBound" onchange="bindRoleEdit();">
</asp:DropDownList>

In code behind, I have added function into RegisterJavaScript() method:
function bindRoleEdit()
{{
var userName = dgEditUser.get_value();
cbEditUser.callback('bindRolePermissionEdit', userName);
}}

Add your code in cbEditUser_Callback event, I have written my code in swich case blog:

case "bindRolePermissionEdit":
{
//Write your code for on-change event
break;
}



Thanks & Regards,
Ankita Shah (MCPDEA)
Team Leader
ankita
#7 Posted : Tuesday, 20 July 2010 8:14:59 PM(UTC)
Rank: Member

Joined: 13/07/2010(UTC)
Posts: 8
Location: India

Hi Roger,

As we communicated in my first post, I have completed User Role Rights module which is based on Role wise User Management by modifying current code.

Thanks for the help given to complete this module. You really made this application awesome.

I have taken much time approx. 10 days to modify the source code for achieving user role rights functionality. May be this is my first time modification in the application. But I want to minimize the time to complete my further upcoming modules.

Can you please share the concept of self-contained pages as we communicated before.

I have added one table (XYZ) at database side. I want to add one page for Managing records of XYZ table which will contain basic functionality like Add, Edit, Delete and View.

I have gone through the application and I can say below are the main projects of this application which I need to change for implementing my code:
Business, Business Interface, Data.SqlServer, and WebSite. Suggest me if there is something wrong.

Thanks for the help!!


Thanks & Regards,
Ankita Shah (MCPDEA)
Team Leader
Roger Martin
#8 Posted : Wednesday, 21 July 2010 12:27:47 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

What I was suggesting is that you minimize the number of files in GSP that you modify.. For example, if you want to add something to the page that shows an album's contents, find the user control that renders these items and add your code there. But try to keep your code changes limited to that user control rather than modifying code in the various layers. This might mean your business rules and data access code are all in the UI layer, but that might be an acceptable tradeoff.

I don't know your requirements, so I don't know if you'll be able to do it like this. You might find that some level of editing in the various layers is required.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.