Difference between revisions of "Catglobe modules"

From Catglobe Wiki
Jump to: navigation, search
m
Line 17: Line 17:
 
   "Catglobe.Text"
 
   "Catglobe.Text"
 
});
 
});
 +
</source>
 +
 +
Let's go through the code above line by line. At line 1 we specify the resource id of the workflow which contains the Catglobe module loader. Line 2 calls the workflow with an array of strings indicating to the module loader which generic Catglobe modules we would like to load initially, in the example above we load Catglobe.DateTime and Catglobe.Text which allows us to manipulate date or time, and text respectively.
 +
 +
Not all modules have to be loaded initially. Depending on the flow through your workflow it's possible to delay inclusion of the generic modules until they are actually needed, the next example demonstrates how to load the Catglobe.Text module after the module loader was initialized:
 +
 +
<source lang="javascript">
 +
number moduleLoaderResId = 1234;
 +
Dictionary cgmod = Workflow_call(moduleLoaderResId, {
 +
  "Catglobe.DateTime"
 +
});
 +
 +
cgmod["Catglobe.ModuleLoader"]["load"].Call({
 +
  "Catglobe.Text"
 +
})
 
</source>
 
</source>

Revision as of 10:48, 12 September 2011

Catglobe modules

Using CG Script it's possible to build very complex solutions on top of the Catglobe platform. This page and sub pages offers some guidelines on how to use existing Catglobe modules and how to extend with additional generic modules, or create and register customized modules which are used by a specific solution.

Building a new solutioin, where Catglobe modules are used as the foundation, helps you abstract from tedious things like remembering the resource ids of a lot of generic workflows, it also makes it easier to move your solution to other Catglobe sites once it's done.

One workflow resource id must be known in order to initialize the Catglobe modules framework, namely the resource id of the Catglobe module loader.

Initializing the module loader

The Catglobe module loader is the workflow module responsible for loading all other generic Catglobe modules, the script below demonstrates how to initialize the module loader and add a few generic Catglobe modules:

number moduleLoaderResId = 1234;
Dictionary cgmod = Workflow_call(moduleLoaderResId, {
   "Catglobe.DateTime",
   "Catglobe.Text"
});

Let's go through the code above line by line. At line 1 we specify the resource id of the workflow which contains the Catglobe module loader. Line 2 calls the workflow with an array of strings indicating to the module loader which generic Catglobe modules we would like to load initially, in the example above we load Catglobe.DateTime and Catglobe.Text which allows us to manipulate date or time, and text respectively.

Not all modules have to be loaded initially. Depending on the flow through your workflow it's possible to delay inclusion of the generic modules until they are actually needed, the next example demonstrates how to load the Catglobe.Text module after the module loader was initialized:

number moduleLoaderResId = 1234;
Dictionary cgmod = Workflow_call(moduleLoaderResId, {
   "Catglobe.DateTime"
});

cgmod["Catglobe.ModuleLoader"]["load"].Call({
   "Catglobe.Text"
})