Organizations
Introduction
Organizations are sets of Diaries and Notebooks that are associated with one another. The diaries do not need to share the same Diary Directory and the Notebooks do not need to share the same Notebooks subdirectory of a single Diary Directory. This allows you to associate Diaries and Notebooks in a way that are looser than the more structured relationship that exists between Diaries in a given Diary Directory and their Notebooks in its Notebooks subdirectory.
In addition to this, the Diaries and Notebooks of an Organization can execute custom Mathematica code through Delayed Rules and their tags in a way similar to the way that WorkFlows do.
A given Diary or a given Notebook can belong to a one or more Organizations, and it can execute any combination of the tags associated with the Delayed Rules of the Organization.
As with WorkFlows, it is probably easiest to see how an Organization works by constructing a simple, but useful, example.
Organization Example: Contacts
For the buttons and executable commands that are described n this section to work it is assumed that you have installed the WorkLife FrameWork™ and have loaded it. This can be done either from the Load WorkLife Framework button on the supplied palette, by executing the command Needs["Diary`Diary`"], or by clicking on the following button:
Creating an Organization
A simple, but quite useful example of an Organization is a set of Diaries that cover a range of individuals that you have contact with even though those Diaries may exist in different Directories.
On a very basic level this might be a set of Diaries—all in the same Diary Directory—with one for each contact individual. You might also have other Diaries in this directory, but those will not be in the Organization. Or the set of diaries may be distributed amongst a number of directories because the differing contacts are associated with differeing projects, and you may have organized the diaries associated with those projects into distinct Diary Directories.
To create this Organization—call it "Contacts"—you open the Organizations Palette from the All Palettes Palette and click on the Create Organization Button.
In the dialog that opens, you enter the name of the new Organization that you want to create. The dialog looks like:
The Organization Creation Dialog
When you click on the Create an Organization button, the Organization is created and it appears in the Organizations Palette.
Here is an example of the Organizations Palette:
An Example of the Organizations Palette
In this case there are three Organizations defined: BetaTest, Contacts, and LLC. Associated with each of these are three buttons: nb→Org, Diaries, and Notebooks. The nb→Org button assigns whatever the current InputNotebook is to the indicated Organization. The Diaries and Notebooks buttons each open a dropdown palette to allow you to open one of the Diaries or Notebooks that are part of that Organization.
A Diary or a Notebook may each belong to multiple organizations.
Assigning to an Organization
So, for example, if the current InputNotebook is a Diary called "Stephen Wolfram," and you wish to assign this Diary to the Organization "Contacts," you would click on the nb→Org button under the Contacts sub-palette when the "Stephen Wolfram" notebook is the InputNotebook.
In this example, when the nb→Org button from the Contacts sub-palette of the Organizations Palette is clicked on, a dialog is opened asking for confirmation. This dialog looks like:
The Add to Organization Dialog
Accessing an Organization's Diaries and Notebooks
To quickly access an Organization's Diaries and Notebooks you can make use of the Diaries and Notebooks buttons on the Organizations Palette. Each of these opens a Popup Palette listing the Diaries and Notebooks contained in the indicated Organization.
For example, clicking on the Diaries button under the Contacts sub-palette for the case of the imaginary user that has the three Organizations, BetaTest, Contacts, and LLC, opens up the following Popup Palette over the Organizations palette:
An Example of the Popup Palette for a Diaries Button from the Organizations Palette
The buttons on this palette have the same function that they have on, for example, the Diary List Palette. In each case the button with the Diary's name, when clicked on, opens that Diary and makes it the current Diary. The button with the ★ makes that Diary the current one but does not open it up. The Open All button opens all of the Diaries listed in the palette (but the current Diary remains the same as it was prior to clicking on this button).
Information on an Organization
Although the title of this section sounds a bit like espionage work it is really about how to make use of the classification structure that an Organization provides.
Whether or not your current Diary Directory is that of a particular Organization you can access information on the Diaries and Notebooks of that Organization using the OrganizationDiaries and OrganizationNotebooks functions.
The function OrganizationDiaries gives a list of the file names and full paths to the diaries that are in the given Organization. For example, here are the items that are in the Organization "Contacts" at this time on my computer:
Antonine Dvorak.nb |
/Users/dreiss/Documents/Diaries/My Contacts/Antonine Dvorak.nb |
Donald Duck.nb |
/Users/dreiss/Documents/Diaries/My Contacts/Donald Duck.nb |
Pete Seeger.nb |
/Users/dreiss/Documents/Diaries/My Contacts/Pete Seeger.nb |
Stephen Wolfram.nb |
/Users/dreiss/Documents/Diaries/My Contacts/Stephen Wolfram.nb |
The function OrganizationNotebooks serves the same purpose for those Notebooks that are in the Organization. In the current case there are no Notebooks in the Organization "Contacts":
As one example of how to create a set of buttons that open the Diaries in an Organization here is a small bit of code to do this in the form of a function called MyOrganizationDiaryButtons. This code snippet will write the buttons below the code when executed in a Notebook. To make it work, for example, for the Organization "Contacts" you would execute MyOrganizationDiaryButtons["Contacts"] after first executing this definition of MyOrganizationDiaryButtons.
Visualization of an Organization
Another way to view information on an organization is to visualize the statistics of the Diaries and Notebooks in an Organization. There are several functions within the WorkLife FrameWork™ to do this, and their use is automated through the Analytics Palette.
By clicking on the on the Analytics button on the All Palettes Palette you will open the All Notebooks Palette. You can also open the All Notebooks Palette by executing
The Analytics Palette
The Openings: Organizations button provides a way to see how many times the Diaries and the Notebooks in an Organization have been opened.
The Openings: Organizations button opens a dialog that allows you to see graphical and numerical information on the statistics of the opening of all Diaries that are members of a particular Organization and of Notebooks that are members of a particular Organization.
The dialog looks like:
The Local Opening Report Dialog
In this dialog the meanings of the fields are similar to those in the Global Opening Report Dialog. The only difference is that the buttons generate a report for just the Diaries that are in an Organization (to be chosen in the next step) or just the Notebooks that are in an Organization. Thus it is a localized view of a different sort than provided by the Openings: Local button .
When one of the buttons Create OrganizationDiaryOpeningReport or Create OrganizationNotebookOpeningReport are clicked, a popup menu appears that allows you to select the Organization that you want the report on. This popup menu looks like the following, although the choices will be different depending on what Organizations you have created:
The Organizations Popup
When, for example, the Contacts button is clicked on, a report is generated that might look like the following:
In this case there were only four Diaries within the Organization "Contacts."
Organization Flows
For the buttons and executable commands that are described n this section to work it is assumed that you have installed the WorkLife FrameWork™ and have loaded it. This can be done either from the Load WorkLife Framework button on the supplied palette, by executing the command Needs["Diary`Diary`"], or by clicking on the following button:
Defining the Rules
The use of Organizations gives a way to create sets of Diaries and associated notebooks that are associated with each other in some way. How you choose to use this association is something that you define. One way to further define the association is to associate Rules with an Organization that may be used to execute Mathematica expressions automatically. These rules are very much like those that are used in WorkFlows. And, the entity that is used to define how the rules are used is an OrganizationFlow.
When an Organization is created the rule associated with it are not specified. In the case of "Contacts" this can be seen in the last element of the List that specifies the Organization's information
And another way to see this directly is to use the function OrganizationRules,
To specify the rules for an Organization one uses the function UpdateOrganizationRules. As in the case of WorkFlows, the rules must be Delayed Rules where the left hand side of each of the rules is a String, and these Strings must not be repeated.
So, or example, if you wanted the Organization "Contacts" to have rules to be avaliable for use you could define them as in the following:
Now the Organization has these rules associated with it:
The rule with the tag "nbopen" creates a Notebook with an orange background; the rule with the tag "allpalettes" opens the AllPalettesPalette; and the rule with the tag "todosstatistics" opens up a graphical visualization of the statistics of ToDos in the current Diary.
The list of tags for the rules associated with an Organization is given by the function OrganizationFlowTags. Here they are for the Organization "Contacts:"
Note that the tags in this list are given in the same order as in the list of rules themselves. This order is often relevant because it is the order that the expressions are executed in when the Flow is executed in a Default manner.
Executing an Organization's Rules
To execute the Mathematica expressions on the right hand sides of an Organization's rules, one uses the function ExecuteOrganizationFlow. There are three ways that the function ExecuteOrganizationFlow can be called.
ExecuteOrganizationFlow[nb,"organization",{"flowTagA","flowTagB",...}] executes the OrganizationFlow given by the list of tags for the specified Organization if the notebook belongs to it. ExecuteOrganizationFlow[nb,"organization",Default] executes the default OrganizationFlow given by the list of tags in OrganizationFlowTags["organization"] if the notebook nb belongs to "organization". ExecuteOrganizationFlow[nb,"organization"] executes the OrganizationFlow corresponding the list of tags in the notebook nb's OrganizationFlow.
Usage Message for ExecuteOrganizationFlow
First Form
When ExecuteOrganizationFlow is called in the first form it executes the Mathematica expressions corresponding to the Organization's rules in the order of the tags that appear in the list (read from left to right). Thus, for the Organization "Contacts"—where we assigned the three rules earlier:{"nbopen","allpalettes","todosstatistics"}— we can build a list from these and execute the associated Mathematica expressions as in the following example. Note though that the Diary or Notebook that appears in the first argument of ExecuteOrganizationFlow, must be one of those listed in either OrganizationDiaries["organization"] or OrganizationNotebooks["organization"]. (The case that we are looking at here has organization replaced by Contacts.) So, if the current Diary notebook is open and it is one of those listed in OrganizationDiaries["Contacts"], then executing the following makes sense:
In this case the AllPalettesPalette is first opened, then two orange Notebooks are created, and then finally the ToDosStatistics visualization is created for the current Diary Notebook.
Second Form
If, however, ExecuteOrganizationFlow is called in the second form, it executes the Mathematica expressions in the order that they appear in OrganizationFlowTags["Contacts"]: {"nbopen","allpalettes","todosstatistics"}. An orange notebook is opened, the AllPalettesPalette is opened, and then the ToDosStatistics visualization is created for the current Diary Notebook.
Third Form
When ExecuteOrganizationFlow is called in the third form it looks at the OrganizationFlow information that appears in the NotebookTaggingRules of the Diary or Notebook nb. (This is embedded information within the Diary or Notebook that you cannot see directly; however, the function NotebookTaggingRules[nb] allows you to see a list containing this information.)
When a notebook is assigned to an Organization it initially has no OrganizationFlow information embedded in it. To add such information you use the function UpdateNotebookOrganizationFlow.
UpdateNotebookOrganizationFlow[nb,{"flowtag1","flowtag2",...}] updates the OrganizationFlow of the notebook nb. It changes the notebook nb's OrganizationFlow to be the list of tags given.
Usage Message for UpdateNotebookOrganizationFlow
For example, to add the list of tags, {"nbopen","allpalettes","nbopen","nbopen","todosstatistics"} to the current Diary (if it is currently open) you would execute:
This confirms that the OrganizationFlowTags were added to the current Diary.
Now that the Current Diary has this OrganizationFlow embedded in it, this particular Flow can be executed by evaluating ExecuteOrganizationFlow[$CurrentDiaryNotebook,Contacts] as long as the current Diary is open.
Uses of Organization Flows
The possible uses of OrganizationFlows are quite varied, and really are only limited by creative inspiration.
One typical sophisticated use is to perform automatic extraction from or insertion of material into a Diary or Notebook when it is opened. For example, the Diary or Notebook might be updated from a database or other data source when it is opened. Or, a database might be updated based upon the current contents of the Diary or Notebook.
Copyright ©, 2005→2009, Scientific Arts, LLC
|