Download Official SAFE User Manual - SAFE Activation Framework for
Transcript
CHAPTER 2. SAFE SAFE (comp) <HTML> ... <table id='Root.A'> <tr id='Root.A.B_1'> ... </tr> <tr id='Root.A.B_2'> ... </tr> ... <tr id='Root.A.C'> ... </tr> </table> <div id='Root.D'> <div id='Root.D.B'> ... </div> </div> ... </HTML> Root D A table div B C B tr tr SFWC v1.123 div Figure 2.2: Activation tree and its corresponding web page. HTML code. A node in the activation tree (i.e., an f-unit) corresponds to one or more nodes in the HTML DOM tree. The insertion of an f-unit FooBar in the activation tree is referred to as activation of FooBar (Figure 2.1, step 2). More precisely, an f-unit is activated by its parent f-unit and thereby receives activation data through well-defined interfaces. The f-unit can use the activation data or data obtained directly from the database through queries to display parts of the web page. An f-unit can also activate other f-units, its child f-units (Figure 2.1, step 3). More details on the activation are provided in Section 3.4. Throughout this document, we will often use the name FooBar to refer to an arbitrary f-unit. For various reasons: FooBar has the nice initial letter F and contains two capital letters inside. We use this fact to demonstrate how filenames (in particular lowercase ones) corresponding to FooBar are derived, and when and how they are used. 2.1 F-units — the main building blocks of SAFE applications F-units constitute both functionality and data of a web application. Hierarchically organized in the activation tree, f-units bundle functionality of different tiers, e.g., client code (HTML, JavaScript, CSS), server code (PHP, SQL), and reactive code for asynchronous message transfers (JavaScript, AJAX). An f-unit is integrated using the SAFE Integrator from the SAFE tool suite. In the integration process, the various files an f-unit consists of are installed to the system. These files of an f-unit are introduced in this section. Please consider Section 2.2 for more details on the integration process. We assume an f-unit with given name FooBar. The first character of an f-unit name must be uppercase (please check Section 7.1 for more details about the syntax). All files of FooBar are organized in the bundle folder FUnitFooBar.bundle: The HTML/SFW skeleton of FooBar together with the activation of child f-units is specified in the file funitfoobar.sfw, the f-unit’s local data is stored in tables in the database whose definitions are specified in the file funitfoobar.db, style (CSS) and client side functionality (JavaScript) is specified in the files funitfoobar.css and funitfoobar. js . We will discuss each of these files in detail below. 14