Thursday, October 22, 2015

WSO2ES-2.0.0 Enabling RTF for fields of an given asset type

For fields such as "Description" we will need to enable rich text format.
Default ES, only supports raw text for any field.

Below I have mentioned how to enable RTF for ES input fields with HTM and asset extensions.

01. goto <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/gadget/themes/default/partials and copy below content to a file with the name default_table.hbs into this location.


<h2 class="field-title">
    <a data-toggle="collapse" href="#collapse{{label}}" aria-expanded="false" class="collapsing-h2" >
        <i class="cu-btn-exp-col btn-collapsed">{{label}}</i>
    </a>
</h2>
<div class="collapse in" id="collapse{{label}}">
    {{#eachField this.fields}}
            <div class="row padding-bottom-lg">
                <div class="col-sm-2 text-right">{{label}}</div>
                <div class="col-sm-10">{{{value}}}</div>
            </div>
    {{/eachField}}
</div>

Here, you can see that I have used triple mustaches to unescape html in the field value.(compare with <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/themes/default/partials/default_table.hbs)

02. Now create a gadget and add below HTML content for the input field of its "Description".

<p><strong><span style="font-size: medium;">HTML ImprovedCode</span></strong></p>
<p>Improved HTML look with more features like:</p>
<ol>
<li><span style="background-color: #ffff00;">Code highlighting</span></li>
<li>Auto-indenting</li>
<li><span style="color: #ff0000;">Color Change</span></li>
<li><span style="text-decoration: underline;">Underline</span></li>
<li>Line Number</li>
</ol>
<p style="text-align: left;"> </p>

03. When you view this asset you can see the content of "Description" nicely in RTF as in bellow image.


















Note that with above extension RTF will be available for all the fields of an asset of this type.

Read more on ES extension model here[1]

[1] https://docs.wso2.com/display/ES200/Working+with+the+ES+Extension+Model

Read More

Thursday, May 28, 2015

Working with WSO2 ES with port offset and custom Hostname

In this tutorial, I am going to start an WSO2 Enterprise Store in a port offset with a custom hostname

port offset = 10
hostname  = www.wso2.org.es
     then https URLs will be served in 1953 and http URLs will be served in 1973
     URL contexts will be https://www.wso2.org.es:9453 and http://www.wso2.org.es:9773
  • Download  wso2es-2.0.0-SNAPSHOT.zip and unzip it to a preferred locations. Let’s say ES_HOME
  • Make below changes in  ES_HOME/repository/conf/carbon.xml file

<Offset>10</Offset>
<HostName>www.wso2.org.es</HostName>
<MgtHostName>www.wso2.org.es</MgtHostName>

  • In [ES_HOME]/repository/conf/security/sso-idp-config.xml file change AssertionConsumerService urls of SSOIdentityProviderConfig as following.

    <SSOIdentityProviderConfig>
    <TenantRegistrationPage>https://stratos-local.wso2.com/carbon/tenant-register/select_domain.jsp</TenantRegistrationPage>
    <ServiceProviders>
        <ServiceProvider>
            <Issuer>store</Issuer>  
    <AssertionConsumerService>https://www.wso2.org.es:9453/store/acs</AssertionConsumerService>
            <SignResponse>true</SignResponse>
            <CustomLoginPage>/store/login.jag</CustomLoginPage>
        </ServiceProvider>
        <ServiceProvider>
            <Issuer>social</Issuer>       
    <AssertionConsumerService>https://www.wso2.org.es:9453/social/acs</AssertionConsumerService>
            <SignResponse>true</SignResponse>
            <CustomLoginPage>/social/login</CustomLoginPage>
        </ServiceProvider>
        <ServiceProvider>
            <Issuer>publisher</Issuer>     
    <AssertionConsumerService>https://www.wso2.org.es:9453/publisher/acs</AssertionConsumerService>
            <SignResponse>true</SignResponse>        
    <CustomLoginPage>https://www.wso2.org.es:9453/publisher/controllers/login.jag</CustomLoginPage>
        </ServiceProvider>
    </ServiceProviders>
    </SSOIdentityProviderConfig>

  • In ES_HOME/repository/conf/identity.xml file change “IdentityProviderURL” under “SSOService” as below.

  • <IdentityProviderURL>https://www.wso2.org.es:9453/samlsso</IdentityProviderURL>

    • Do the following configurations under “ssoConfiguration” in files <ES_HOME>/repository/deployment/server/jaggeryapps/store/config/store.json and store-tenant.json.
    "identityProviderURL": "https://www.wso2.org.es:9453/samlsso"
    • Repeat above step with files <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/config/publisher.json and publisher-tenant.json.
    • In a command-line goto <ES_HOME>/bin and start the ES server by executing below commands based on the OS.
    Linux execute : wso2server.sh
    windows execute: wso2server.bat


    Read More
    Designed ByBlogger Templates