Click here to Skip to main content
15,886,836 members
Articles / Web Development / ASP.NET

Web-Application Framework - Catharsis - Part II

Rate me:
Please Sign up or sign in to vote.
4.57/5 (8 votes)
21 Apr 2010CPOL8 min read 38.8K   38   3
Catharsis web-app framework

Introduction

Catharsis (current version 2.5.3 - 13.4.2010) is a complete framework for developing .NET web applications. It is an Open Source distributed as the binaries (Guidance) or the source code, for free...  

Catharsis-title.png

The latest Guidance binaries, source code, some documents and stories can be found http://catarsa.com

The Catharsis (2.5) latest stories  

Example, step by step how to create complete solution, business model, DB Schema, CodeList identification, in detail described steps how to use the Guidance Recipe, and create the complete working web application.http://catarsa.com/Articles/Code/Example-Insurance-Company-01-New-Solution

Catharsis and its portal catarsa.com are using the Wiki .NET Parser. It provides smart way for your users how to create documentation. To your team it brings easy to use CMS tool with Easy to learn Wiki .NET Syntax, high performance, and simple extending or adjusting, 'cause code has only 200 rows. The engine comes from ANTLR ultimate parser.

How to use the Validator design pattern; the Business Rules declarative syntax: http://catarsa.com/Articles/Code/Validator-how-to-use-it

David O'Sullivan and Getting started on http://catarsa.com/Articles/Code/Catharsis-Guidance-Installation. How to install the Catharsis Guidance, how tor create initial Database, and finally how to create and run new Project/Solution

Current Catharsis release: 2.5 

You can download and install the Guidance immediately. The features of framework was radically extended - built in Excel export, Uploading and downloading of any type files, Paging on the Detail level...

Also the UI layout (including Home Page) was improved and provides more stuff and looks smarter. This article should quickly take you through the Catharsis base pages areas.

Catharsis.png 

Home Page Observation  

Catharsis - as framework - provides ‘kick-off’ page layout, which is (thanks to ASP.NET world) based on MasterPage. At this point it is very important to say:

I do know – I am not good designer! (but I'd like to be...) ! And therefore I do provide all source-code, and expect from you to adjust it. To make these improvements as simple as possible, every logical area is placed in separate WebControl, and depends on CSS settings. Just play with …

Home page quick summary 

Home page layout could be separated into few independent areas. For our purposes they could be named: 

  1. Current action information
  2. Actions
  3. User information
  4. Localization switch
  5. Navigation
  6. Main Content
  7. Paging on list level (pages) & on detail level (entity)

HomePage.png

As said above, all these areas are based on web-controls, which are placed on a MasterPage. They are smart ones, they are Presenters. They are provided with information stored in Model (MVC pattern) and will always display what you have decided to show (What you have just stored for user in the Model)

Do not hesitate and move controls, rebuild master page, change CSS, but for tutorial purposes I will expect the built-in design. Be sure that whenever you'll place these Presenters, they will display information stored in the Model, and that is what we want.

Current Action Information 

When navigating application, users are calling controllers and their actions (by clicking buttons, anchors) Current controller and action are always displayed at this area. Both terms are localized, which allows you to be more user-friendly. Controller name is send to GetLocalized() method, which is available on every control, and if the translation is found, it is also displayed. Home is at this example converted to Home page.

GetLocalized() is one of the essences of Catharsis. Any string, which should be localized, should be called through that method. Translations then can be done on the run, on the Translations controller.

GetLoclized() is now also available on ever string! It means that you can type "yourString".GetLoclized() and the framework does the rest

Actions

MVC provides separation of concern on two levels. Firstly there are controllers, which could be seen as the ‘area-responsible’ handlers. There could be controller for languages, translations, suppliers, contracts, persons …

The second level is represented by actions, which are request-response based (adding, changing, deleting, finding, listing …).

HomePage2.png 

Actions 

Some actions should be displayed to user as the list of possible ‘navigation links’. On entity controllers there are common actions of that type: Search, List and New.

But which actions will be available for user are dependent only on you – developer. The ‘action web-control’ just takes the list of ActionLinks nested in the Model and displays them.

Buttons  

(They are placed bellow Main content area.) 

On a home page are missing the buttons actions. They are usually visible when editing and their typical background is Save, Update, Cancel … Some are provided by Catharsis as default (you'll see). Any other you can add (To Buttons list in the Model).

User Information 

User information contains User name (as saved in the storage), currently selected role and selected display language.

User names are maintained in the runtime by Catharsis UI. You can add and remove them, and also append roles, which user can use.

Current Role 

In comparison with ASP.NET Roles there is a big difference in Catharsis. User can have many roles (at least one). But access is evaluated only against CurrentRole. User can select, which role is CurrentRole from his role-set, for example by clicking on a link in ‘User information area’. Catharsis than checks the access rights comparing list of allowed roles (or disabled) for current action and Users.CurrentRole.

This reduces mishmash (user can see only what ‘The role’ should see). If you design your application to have let say two roles ‘Translator’ and ‘RegisteredUser’ you can give them different access. User, who is in both roles, then can see only translation if in Translator role, and is not disturbed with other possible navigation and actions. You (and your users) will like it ...

Localization 

No more .resx files, which are horrible to edit and distribute to translator. Catharsis provides localization based on objects (translations) stored in Database. The great advantage is that you can localize in a runtime. What it exactly means?
Adding new languages

 Yes, you can add new languages in runtime for your localization purposes. Just add the language using Catharsis UI and provide its LocalName (Ceština for Czech …). From that moment, user can switch into that new language and translations gains new input box for it.

You probably expect that user can also switch language by setting keyboard in a browser; that more specific language ‘en-GB’ can use ‘en’ phrase when ‘en-GB’ is not provided; that if phrase is not found the default translation is used; that if nothing is find at all, that at least the searched keyword is returned.

Well, that’s exactly how Catharsis behaves.

Try to add language, try to add or change a phrase, you will see … GetLocalized() can be used for everything, including the error messages translation

Localization is more then translation - adjusting

In Europe (where I am from) we much often meet requirements for translation (multilingual UI). Catharsis localization is not only about translation. Even if you are using let's say. English, it can help you a lot with adjusting texts and messages on UI. 

For example 'Business rules', which are not met, must be explained to user. Messages like 'Cannot delete' are not clear enough. Catharsis allows you to call for a 'localized' or 'adjusted' error string in the way: “CannotDelete {0} {1} {2}”. You (or smart users) then can provide a message like ”Item '{0}' cannot be deleted. It still used ({1} times) in the {2} entity”

Navigation  

Work-Flow can be seen from two sights. There is inner movement on a controller (list, search, detail, update …) and outer one represented by navigating among controllers. User can add subject, than basic contract, then detail contract … or user can be filling some questionnaire step by step in a ‘wizard-mode’. All of that could be done by Navigation links.

Catharsis has Presenter which takes NavigationLinks from the Model and display them. It’s upon you to fill in correct links to the Model…

Main Content  

Nothing special. The main area of your just growing application...

Detail View

Detail was extended with paging buttons (and Access keys) which allows you to directly move to next entity. Do you like shortcuts?

Shift + Alt + F => goes to Search (the focus is on the first input button, you can type)

Shift + Alt + S => Search the results -> on the List you select any entity

Shift + Alt + E => on List will start the export to Excel! Direct for all filtered entities!

On Entity detail View:

Shift + Alt + E => Start to edit

Shift + Alt + S == save

Shift + Alt + W (Go to next)

Shift + Alt + E => start to edit

...

Shift + Alt + 1 => Select Tab with Navigation TreeView

Shift + Alt + 2 => Second tab with actions
 

Entity2.png

List View

You can sort any Entity using the shared control ListWC. You can even sort by Subject.Address.City.NativeName if you want. using Shift + Alt + E you will ran the Export to Excel action (if you have MS office installed, Excel will be opened)Sorting.png

 And many many more

Enjoy Catharsis!  

Radim Köhler

Source code

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Czech Republic Czech Republic
Web developer since 2002, .NET since 2005

Competition is as important as Cooperation.

___

Comments and Discussions

 
GeneralBest Localization Plug-in for Visual Studio. Pin
Alexander Nesterenko17-Dec-08 21:46
Alexander Nesterenko17-Dec-08 21:46 
Generallinks to other articles in the series Pin
BillW331-Oct-08 11:07
professionalBillW331-Oct-08 11:07 
GeneralRe: links to other articles in the series Pin
Radim Köhler2-Oct-08 6:24
Radim Köhler2-Oct-08 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.