Wednesday, October 28, 2020

Drupal 8 Module Development--A You Tube Video Formatter

 The objective of this module was to programmatically create a formatter in Drupal 8 to play a You Tube video.

The image below shows the video in a Drupal 8 website.



Drupal 8 Module Development --An interactive code-based form

 The objective of this module was to programmatically create a table in a database with four columns and to create an interactive form into which data can be entered and saved in the table.

The image below shows the form with data on clothing materials carried by  Moxy Clothing Inc.




Drupal 8 Module Development -- A Welcome Message

 The objective of this module  was to present a welcome mesage in various formats to a logged in user to a Drupal 8 website.

In the first format, the message is presented on the main content page and in the left sidebar.  Two different messages are presented in this format.




In the next format, the welcome message is first written into a configuration form which is saved.  This message is them presented to the user when he/she logs in for the first time.






In  the third format, the message is changed.  The message in the left sidebar is not the same as that in the main content page.










Monday, September 7, 2020

Drupal 8 Module to programmatically create a database and tables

 The objective of this module was to programmatically create a database of Metsi employees, their respective departments and the location of the departments.  Metsi has sixteen employees in four departments located in two buildings in the Ottawa, Canada region.  The departments are software development, new software testing, IT Education, and software promotion.

There are two tables in the database that were created programmatically using hook schema: employee name and department, and department name and location.

The names of the employees were then outputted to a table with 8 employees per page with the option to go to the next page.

The following screenshot shows the table of Metsi employees with a table header and a pager.

New fields and data were added to the tables as updates using Drush.



Using Drupal 8 to expose database fields to Views

There are two tables in this database each with four fields.  The objective of this project was to extract the information in those fields using Views.  Because data in the table fields are different, the tables had to be joined in order to extract the information from both table fields.  The relationship feature of Views was used for this. 

To get going, a new view was created in the Admin->Structure->Views menu.  A table was created in Views and the database table fields were extracted and added to the Views table.  The table below shows the result using Views.  The information was organized as follows: player ID, player name, team ID, team name and team description.  A pager was added to the Views table set to allow 8 items per page.

Provisions were included for filters and sorters to be applied to the extracted data.

Views table showing data from two joined database tables


Tuesday, July 7, 2020

Creating an Interactive Webform with Visual Cobol 6.0 and Visual Studio 2019

This project was created using Visual COBOL 6.0 and Visual Studio 2019.  The objective was to interactively extract data from an indexed COBOL datafile and apply the result to a webform.

To begin, start up Visual Studio. Select File, New, Project.  Select ASP.NET Web Application for COBOL as the template.  Framework should be .NET Framework 4.6.

Give the project a name and a storage location. Click Create.  This should open up a form.

Go to Solution Explorer and add the projects LegacyBook and BookWrapper to the application as well as into the reference of the application.  LegacyBook is a procedural COBOL project that contains the business logic which the form can use.  LegacyBook uses COBOL types such as PIC X and PIC 99V99.  The BookWrapper project converts data from .NET types to COBOL types.

Note that LegacyBook requires a copybook (book-rec.cpy) and so does the BookWrapper project (book-rec-dotnet.cpy).

At this point, it is time to paint the Webform.  Painting the labels, buttons and textboxes on to the form was done by direct coding in the Default.aspx file and not by dragging and dropping them from the Toolbox.  The attachment below shows the Default.aspx file with the coding for this project.

 

The Default.aspx file showing the coding for the webform

Once the form has been drawn, it is time to add the following code to the Web.config file.

 

The Web.config file

Note that the indexed COBOL data file (bookfile.dat) is added to the Web.config file.

 

Next add the following code in the Default.aspx.cbl file.

 

The Default.aspx.cbl file that activates all the controls on the form

 This file activates the Search button, populates the form from the datafile and manages any error handling.

 At this point, there should be no errors in the project as shown on the bottom left of the Visual Studio screen.

 Run the application if no errors are identified.  Select Rebuild and then Debug, Start without Debugging.

 Visual Studio will  complete the above two processes and finally display the form.

 To display the results, enter four digits (from 1111 to 6666) in the book number field and click Search.

 

The completed webform with a search result for book number 2222

The form should be filled up with the results of the search.  The following shows a search for book number 2222.

 


Friday, February 21, 2020

Using PHP, HTML, CSS and javascript to create an example on-line Store

The objective of this project is to create a small on-line store with a few example products using PHP, HTML5 andCSS3.  The project begins with the setting up of a database and tables with queries on the PhpMyAdmin menu.  This includes adding descriptors such as size and color to the example products in the appropriate table and also JPG images of the products.

The information in the database tables can be retrieved through a database connection using localhost, username (root) and a password (optional).  The results include a visual presentation of the categories of products which when clicked displays the details of each product including an image, a short description, the price and available colors.

When javascript is applied to the project, the products in each category can be viewed by means of an arrow slider created by the javascript.

The truncated screencast below shows the example products, etc. in each category with an arrow slider at the top right (faintly seen) to view one product after the next.

Example Products in the On-Line Store