Formatting Web and Windows Providers

Hi,

I'd like to be able display some text in the toolbar in both my Web and Win provider. Can you add text onto the Toolbar, setting the text programatically, and could you give me an example of this?

 

Many thanks

Rich

RE: Formatting Web and Windows Providers

Hi Rich,
I am Win only....
No system to define a static or dynamic text field in the tooltbar.
Give me a better idea of your use case and I might just consider adding it!

Conrad

Af: Conrad Weyns 15. mar 2017

RE: Formatting Web and Windows Providers

Conrad,

I will try! 

I have created a provider (My Archive) which is licenced to our clients. We would like a clean way of notifying to the users that their licence is going to expire.

We do not want to use a popup message, as this would be rather annoying, nor do we want to put a row into the exisiting data.

When licenced our provider looks like this:

When the Licence has expired, it looks like this:

We would like to be able to do this:

 

Cheers

Rich

Af: Rich Hacker 16. mar 2017

RE: Formatting Web and Windows Providers

I see. This makes sense.
I am not sure what channel to introduce in order to dynamically feed data into such a text field.
Presumably, one would want to update this field upon a refresh.
It seems to me we will need to extend the API.
Another approach is to add a ToolbarMessage interface. I am thinking that, if you have configured the toolbar section with TextMessage="true", then the control will call you upon a refresh to get the text data if any...

If you some other idea, let me know.
I will give it some thought.

I am not sure if you are aware that you can throw and exception with a message in GetRows. This will invoke our "Yellow error box".
You could use this in the meantime to display a message once the lisence has expired.

Here is an example:

public IEnumerable<ArchiveRow> GetRows( String options )
....

if ( license_has_expired() )
    throw new SuperOffice.Exceptions.SoException("<message>                [SR_YOUR_RESLABEL]\n                License expired\n                Contact your administrator</message>");

....

/Conrad

 

Af: Conrad Weyns 16. mar 2017

RE: Formatting Web and Windows Providers

Many Thanks Conrad!

I will take a look at the Exception route, I hadn't though of that.

I am very new to this, but I was wondering if you might be able to add to ArchiveResultInformation?

public ArchiveResultInformation GetResultInformation()

{

    ArchiveResultInformation myResult = new ArchiveResultInformation();

    myResult.RowCount=_rowsReturned;

    myResult.TextResult = "Licence will Expire in 15 days";

    return myResult;

}

 

Cheers

Rich

Af: Rich Hacker 16. mar 2017

RE: Formatting Web and Windows Providers

Conrad,

I have tried the Exception route you suggested.

If you Throw from within GetRows(), you do not get the yellow box, but instead no rows returned to the prodiver - This is true for both Win and Web.

If you Throw from the Constructor of your Provider in Windows you get the Yellow Box displaying:

However, In Web you cannot get into SO at all, you just keep getting returned to the Login page.

As we want one Provider for both Win and Web, I think we may have to stay with our method of displaying a single row ('Licence Expired' for each column); It's a shame as I liked your suggestion!

Many Thanks again,

Rich

Af: Rich Hacker 16. mar 2017

RE: Formatting Web and Windows Providers

Hi Rick,

To set the formatting of a row or column item, the stylehints map to css styles in web. I haven't been able to confirm this yet, but I beleive that the styles are formatted as entityType_styleHint. Here one pre-defined style example:

.contact_nomail, .contact_nomail a,
.person_nomail .person_nomail a
{
    color:Blue;
}

You should be able to provide individual column colors as well, that would be just a simple css class with the style hint name. Again, I haven't test it, but that's what I see looking around the app, the css, and underlying archive control.

As for the toolbar text...well that would require adding an SoToolButton to the one of the three collections, LeftAlignedButtons, CenterAlignedButtons or RightAlignedButtons. I haven't found an easy way to do this yet... but will be trying to find out for you. 

Hope this helps!

Af: Tony Yates 16. mar 2017

RE: Formatting Web and Windows Providers

Tony,

Fantastic! I had actually removed that part of my message as I had found somthing on your Forums which suggested I did the following, which has worked.

    row.AddStyleHint("appointment_expired");

However, I appreciate the extra infomation as this will surley be of help in the future!

Many thanks for looking into the Toolbar Text, I look forward to your findings :)

Cheers

Rich

Af: Rich Hacker 16. mar 2017

RE: Formatting Web and Windows Providers

The yellow box should work in GetRows.. I will verify that.
And yes, this is Win only.

Sounds like Win&Web needs to join forces here. Will look into it but I can't promisse anything here and now!

Not sure what you expect us to do with the myResult.RowCount.
It needs the encoced text that will be Localized so it can contain resource labels or the multilanguage hack.
It could also contain a styleHint for text colour.


Conrad


Ehm..

Just has a look at the C# code.
I see that GetResultInformation() is part of the API. This is new to win!
So I guess your suggestion was to kidnapp this one and extend it?

....

Af: Conrad Weyns 16. mar 2017

RE: Formatting Web and Windows Providers

Conrad,

Yes, that was my initial though...as I say I am very new to this, so not sure if this is a good idea or not!?

Cheers

Rich

 

Af: Rich Hacker 16. mar 2017

RE: Formatting Web and Windows Providers

exception message in GetRows

 

My exception message test in GetRows still works for me in Win...

            if ( m_DesiredEntities == null )
                throw new SuperOffice.Exceptions.SoException("<message>          No entities selected!\n          Please select a Culture to display</message>");

 

About extending GetResultInformation:
I will ask some Web dudes what they think.

I will anyhow consider adding that phase to our control.

Conrad

Af: Conrad Weyns 16. mar 2017

RE: Formatting Web and Windows Providers

Great!

Many thanks again Conrad for you time on this!

Af: Rich Hacker 16. mar 2017