Copy & Paste features in MasonSQL TABLE form

Preface

In the MasonSQl form of type TABLE at the left, for each row, there is a flag used to select colums to delete or to duplicate to new records ([DUP] button, if activated).
The columns to be duplicated, are indicated in the Mason method FIELDS_DUP.

The current record duplication function (with key [DUP]) and records deletion must not change!

New features

Now we want to add new functionality of Copy & Paste to allowing:
  • the following features are enabled only in edit mode.
  • it's possible to enable the fields (columns) to be copied
  • the user can select the columns authorized to be copied & pasted using the Mason method FIELDS_COPY_PASTE with the authorized fields list, comma separated (default empty list <%method FIELDS_COPY_PASTE></%method> )
  • to select (or deselect) a column the user must click the mouse over the column label
  • the selectable column will have the label cell with a different style (adding a class "ColSelectable" to <P> Html tag inside <TD>)
  • the selected column will have the label cell with a different style (replacing class "ColSelectable" with class "ColSelected" to <P> Html tag)
  • will be possible to copy the selected fields both existing rows and in new rows of the table
  • as like dup (duplication rows) are copied also the widget parameters and status (error); not only the value
  • be able to select multiple rows by using the [Shift] key from previous (last) selected row
  • the [sel.] label (at the left of labels) are marked with class `CopyPasteResetInvert` only if there is at least one selectable column and the row to copy is active
  • with a mouse Click over [sel.] label, the user can invert all fields (columns) selections
  • the first selected row (user action) will be the copied row, to be pasted in other rows
  • to highlight the selected line to copy, we must add the class "WidgetToCopy" in the widgets to be copied
  • if the first selected row (marked as source row) will be deselected (user action), you must remove "WidgetToCopy" class from widgets in the row and the next selected row (user action) will become the new row to be copied
  • subsequent rows selected (user action) will be the pasted rows to be overwritten immediately
  • if the user changes the active columns, rows previously selected to paste remain as they were (they are already modified, immediately after their selection) and the new columns entry will be applies only to new selected rows.
  • to highlight the selected pasted rows, we must add the class "WidgetPasted" to the pasted widgets
  • if the pasted row will be deselected (user action), the row will be restored to their values before the change (copying the data from the original recordset it is sufficient) and the class "WidgetPasted" will be removed from widgets in the deselected row
  • when user click the button [Salva] or [Annulla], the row flags used to mark the rows are reset (as is in old version with [Salva]) and all selected columns are reset to unselected
  • if the user change the page will be possible to also paste (user action) in the rows of the new selected page
  • when the page is changed, the rows flags are reset, but it maintains the selected columns
  • when the user change from readonly to editing state or from editing to readonly state, every selected columns and selected rows flags are reset (in the old code only [Salva] action resets the flags). This beavior will be active even if the new Copy&Paste feature is not used.

Implementation

  • The new code will be added in the file /opt/masonsql/htdocs/lib/displaybinding.js
  • The new styles will be added in dir /opt/masonsql/htdocs/css/ , files base.css and input.css
  • To check/add/remove classes, use dojo/dom-class

Paste rows in different pages

When you change the page in edit mode (our case) the changes that occurred within the page is saved to the server. So when there is a change of page, you can save the row to be copied in a dedicated array for use in the paste operations.
The right time to do this activity is in the handler DisplayBinding_onrequestHandler

When you display new page if the copy&paste is active, you must verify if the selected for copy row is displayed (you must use the key ad reference) and consequently you must add the style classes to the row widgets that are active in that moment.
The right time to do this activity is in the handler DisplayBinding_onchangeHandler

Environment of development

  • Ubuntu 12.04 server with latest MasonSQL
  • Test server masonsql-doc1.leader.it (probably it must be upgraded)

Topic revision: r12 - 20 Jan 2017, GuidoBrugnara
This site is powered by FoswikiCopyright (©) Leader.IT - Italy P.I. IT01434390223 Privacy policy & use of cookies