en | fr  | Contact  | Print  | Share

FrameBeurk documentation

5. Keys

The parameters of the http request that are sent by the browser to the server are used to determine the keys of the Maj and the Vue actions to execute.

The parameters of keys are not all free of choice : First of them are mandatory and systematic, the other -named extra parameters, are depending of the couple (Entity, Action). For Vues -but not for Majs, these extra parameters have to be declared in configuration. Their presence is checked by the Vue controller and they are instanciated as global variables to be used straight in the code of actions.


5.1. Maj key

The 3 mandatory parameters are :

  • ActMaj : Code of Maj action. Recommendation : Verb in the imperative mode, 2nd person singular, initial letter in low case.
  • EntMaj : Entity type. Recommendation : Name, singular, initial letter in up case.
  • IdMaj : Id of the modified entity. If present, must be numerical and positive. Optional in the case of a singleton entity.

5.2. Anti-double-submission token

In order to get rid of the problem of double-submission of forms, due to a browsing in the history of pages or a page refresh, FrameBeurk generates at each transaction a new token that is stored into the dialog data (in the PHP session) and send to the browser in all HTML forms and as a Javascript variable.

In the quite common case of Ajax browsings, forms that are present in the parts of the page that are not refreshed have an expired version of the token that would be refused if it is sent as is. The Javascript function that Ajax-sends a form therefore replaces the expired token by the last version.

5.3. Key token

For example in the case of the sending of a link by e-mail, it is preferred to send an URL having as parameter a unique random token rather than the usual parameters ActMaj+EntMaj+IdMaj.

The framework provides table Beurk_Clef to store the link between the key token and the parameters of the key that should be used to proceed. At the receiving of the key token, the Maj controller reads table Beurk_Clef to check the validity of the token and extracts the prepared action key.

5.4. Vue key

Same as the Maj key (same recommendations too), the 3 mandatory parameters are :

  • ActVue : Code of Vue action.
  • EntVue : Entity type.
  • IdVue : Id of the entity to display.

In the case of a Vue that displays the preliminary form of a Maj, the code of the Vue action is the same than the code of the Maj.

5.5. Vue div

When a div is displayed by index.php, its place on the page is set by the Layout.
When it is by ajax.php, the browser has previously sent to the server the name of the div where to display the Vue into the DivVue parameter of the request. The server sends back this div name along with the result of the request, except if the processing of the action decides otherwise. The browser displays the Vue in the div name received.

If the parameter DivVue is not sent in the browser request, the server sends a default div name made of the concatenation of ActVue, EntVue and IdVue.

5.6. Error-Vue key and error-Vue div

Also for Ajax browsing, the browser can specify to the server a Vue key and a Vue div to use in the case of an error during the proceeding of the Maj action (not shown on the diagram).


© 2010-2015 by ToolOscope SASU. © 2016-2018 by Arnaud De Rette. All rights reserved