OWS code modularity: invoking one configuration from another one

March 18, 2010

The following method allows you to use one of the main features of “object-oriented programming” - modularity - applied in not object-oriented OWS. With this approach, you may place frequently used functions into the separate configurations and call them from other configuration instead of copy-pasting and creating redundant code.

If you want to integrate one configuration to another you can use the following expression:

{OPENCONTROL,[ModuleID,System],configurationid,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,span}

Where XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX – configuration guid.

This is the easiest way to call another configuration code. However, this approach does not support the possibility to transfer parameters into the invoked configuration.

 


 

If you want to have this option, you'd need to use the following method:

  1.  Place the clear div-block and set id for it with prefix “lxT”. Result of configuration that is calling will show in this block.
    <div id="lxT*****"></div>
  2. Place next javascript code (necessarily inside script tags):

<script type="text/javascript">

/* <![CDATA[ */

ows.Create('*****',-1,0,'s:1x,m:*****,p:[TabID,System],id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,lxSrc:***** ','/DesktopModules/OWS/','/DesktopModules/OWS/',false,-1,'','',false,'parameters');

/* ]]> */

</script>

Where ***** - name of the div-block without prefix;

XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX – configuration guid;

parameters – list of QueryString parameters which you want to transfer, separated by “&” symbol.

Example:

I need to insert “Quick-Builder” table into the News Edit form which should give me possibility to manage News Categories.

I create “Quick-Builder” configuration and set it up in a way that it receives "ContentId" querystring parameter.

In the News Edit form configuration I insert the following code:

<tr>

                <td valign="top">

                    Category</td>

                <td valign="top">

<div id="lxTdivCategory"></div>

<script>

/* <![CDATA[ */

ows.Create('divCategory',-1,0,'s:1x,m:divCategory,p:[TabID,System],id:12634627-7515-091F-3904-8B8BABBEACA5,lxSrc:divCategory','/DesktopModules/OWS/','/DesktopModules/OWS/',false,-1,'','',false,'ContentID=-1');

/* ]]> */

</script>

                               </td>

</tr>

 

This is it. Happy programming.


 

Average ( Ratings):
 
Want to help out?
 
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share