Index

Script Extensions

Script Extensions API Documentation

ScriptList

The script provides a class for creating generic list that can be used in a ListView.

  • Since:
    • Documents 5.0

Example

//#import "ScriptList"
var random = function(array) {
  return array[Math.floor(Math.random() * array.length)];
};
var startIndex = typeof start === "string" ? parseInt(start) : 0;
var itemCount = typeof limit === "string" ? parseInt(limit) : 50;
var list = new otris.scriptlist.List("My API List");
list.setStartIndex(startIndex);
// Static reference data for the list
var month = ["January", "Febuary", "March", "April", "May", "June", "July", "September", "October", "November", "December"];
var stati = ["_image:custom/bullet_ball_glass_red.gif", "_image:custom/bullet_ball_glass_yellow.gif", "_image:custom/bullet_ball_glass_green.gif"];
var check = ["0", "1"];
var zeros = "000000";
// Creating the list columns
list.addColumn("Status", "Status", "CUSTOM");
list.addColumn("Nummer", "Nummer");
list.addColumn("Month", "Month");
list.addColumn("Erledigt", "Erledigt", "CHECKBOX");
list.setGroupHeaderTemplate('<div style="padding-left:calc({{index}}*15px)"><span class="otrIcon"></span><b>{{value}}</b></div>');
list.setGrouping(["Month"]);
list.setCollapsed(false);
// Fill the list with data
for (var i = startIndex; i < startIndex + itemCount; i++) {
  var stringi = i + "";
  var row = list.addRow([random(stati), "#" + zeros.substr(0, zeros.length - stringi.length) + i, random(month), random(check)]);

  if(i%3==0) {
  	row.setTag('<div style="background: green;width: 3px;position: absolute;top: 1px;bottom: 1px;left: 2px;height: auto;"></div>');
  }
  else if(i%5==0) {
  	row.setTag(true);
  }
  else if(i%7==0) {
  	row.setTag('<div style="background: blue;width: 3px;position: absolute;top: 1px;bottom: 1px;left: 2px;height: auto;"></div>');
  }
  else if(i%11==0) {
  	row.setTag('<div style="background: red;width: 3px;position: absolute;top: 1px;bottom: 1px;left: 2px;height: auto;"></div>');
  }
  else if(i%2==0) {
 	row.setTag(true);
 	row.setTagColor("green");
  }
}
// No "infinite scrolling"
list.endList();
// Return the data as JSON string
context.returnType = "scriptList";
return list.transfer();

ScriptTour

This class is used to create a guided tour for the documents system.

  • Since:
    • Documents 5.0d

Example

//#import "ScriptTour"
var tour = new otris.tour.Tour();
tour.setTourConfiguration({
    defaults: {
	       cancelable: true,
        disableInteraction: true
    },
    steps: [{
        title: "Willkommen",
        text: "Möchten Sie eine kleine Einführung in documents erhalten?",
        cancelButton: true
    }, {
        type: "prep",
        text: "Die Tour wird vorbereitet...",
        openDashboard: true
    }, {
        text: "Persönliches Dashboard als Übersicht",
        selector: "dashboard.element:container center"
    }, {
        text: "Eingangskorb für Vorgänge",
        selector: "dashboard.element:tile_inbox right"
    }]
});
context.returnType="tour";
return tour.transfer();

ScriptTree

PortalScript to create the data for the ScriptTree. This script needs to be included in any
other PortalScript which builds a ScriptTree. The returnType of the script where this API
is used must be context.returnType = "scriptTree";

  • Since:
    • Documents 5.0

Example

// rootnode of the tree
var rootItem = new treeItem(4711, "RootNodeLabel");
// first entry
var subItem = new treeItem(0815, "SubNodeLabel");
//action will be fired if the node is clicked
subItem.action = "showFile:" + docFile.getAutoText("%id%");
subItem.isActive = true; // directly selected
//add node to the rootnode
rootItem.addItem(subItem);
//call the transfer function to get the scripttree XML
return rootItem.transfer();

TreeChart

Script library for generating the data for the Dynamic Tree Chart.

  • Since:
    • Documents 5.0

Example

// Remove the brackets around the hash sign in your real example
// #import "TreeChart"
var chart = new otris.treechart.TreeChart();
chart.title = "Example for the Dynamic Tree Chart";
chart.defaultNodeStyle = new otris.treechart.NodeStyle("#ffffff", "#000000", "Arial", "#000000", 11, 14, 6, 16);
var root = chart.createNode("1", "Root");
var leaf1 = chart.createLeaf("2", "1st leaf");
var leaf2 = chart.createLeaf("3", "2nd leaf");
root.addChild(leaf1);
root.addChild(leaf2);
root.setEdgeLabel(leaf1, "Edge to 1st leaf");
chart.setRoot(root);
return chart.transfer();