How to publish the vacancies on your company website (AWR)

Introduction:

The Adonis Web Recruitment module offers you to publish the available vacancies as follows;

Defining the layout

Using iFrame

In the administrator module, copy the URL to the calling layout, and use the iframe to display the vacancies as follows

<iframe src="https://localhost/AWR/1/Default.aspx" frameborder="0" style="width:100%; height:500px;"></iframe>

The src attribute specifies the page URL displaying the vacancies you want to display within the iframe. The frameborder attribute is set to 0 to remove the border around the iframe. The style attribute is used to set the width and height of the iframe.

Note that you need to have access to the website and its resources to display it within an iframe. If the website does not allow itself to be displayed in an iframe for security reasons, then you won't be able to display it using this method.

Using JavaScript and HTML

Instead of using an iFrame, you can add the vacancy list directly to your web page, using JavaScript and HTML.

Displaying the vacancy list as part of an existing company web page.

Download the file VacancyListExample.html how to use the VacancyListService.ashx.

Below you find an explanation of the main code, or scripts.

The main function $.ajax()

$.ajax({ url: "VacancyListService.ashx", data: { l: 1 //specify layout id }, success: function (result) { $("#vacList").html(generateVacList(result.vacancies)); } });

This JavaScript code uses jQuery's AJAX function to retrieve vacancies from the "VacancyListService.ashx" web service layout ID of "1". Upon successful retrieval, the function "generateVacList" is called to create HTML content for the list of vacancies, which is then inserted into the "vacList" div element.
If more layouts are defined change the layout ID to the proper number identifying the layout.

GenerateVacList()

function generateVacList(vacList) { var l = []; for (var i = 0; i < vacList.length; i++) l.push(generateVacancy(vacList[i])); return l.join(""); }

The function generateVacLis() takes an array of vacancy objects as input and returns an HTML string representing the list of vacancies. It uses a for loop to iterate through each vacancy object in the input array and calls the "generateVacancy" function to create HTML content for each vacancy. The resulting HTML content is stored in an array and joined into a single string.

generateVacancy()

This function takes a single vacancy object as input and returns an HTML string representing the vacancy's HTML content. It uses several helper functions, "htmlHeader", "htmlInfo", and "htmlButton", to create HTML content for different parts of the vacancy information, such as the vacancy description, location, vessel type, and application and details buttons.
You will find more vacancy information in the picture above. “Creating a layout”

Activate Popup Login window

The function isLoggedIn used in the apply button presents the login screen as a floating window (Popup windows), instead of opening a separate login page.

awrLogin()

The function awrLogin(destUrl) is responsible for showing the login page in a popup window. The function takes a destUrl parameter, which is the URL of the page the user was trying to access before being prompted to log in. The function creates a new URL with the destUrl parameter encoded and opens a new window with that URL. It also sets up an event listener to handle the close event of the popup window.

isLoggedIn()

The function isLoggedIn(destUrl), checks if the user is logged in by sending a POST request to the server with the URL obtained from the loggedInURL() function. If the server returns that the user is not logged in, the function calls the awrLogin(destUrl) function to show the login popup window. If the user is logged in, the function opens the destUrl parameter in a new window.

loggedInURL()

The function loggedInURL() returns the URL to check if the user is logged in. It does this by checking the current URL of the page and returning a basic URL with a different relative path depending on the current URL.

webAppBaseUrl()

webAppBaseUrl(urlStr) gets the base URL of the application by parsing the current URL. It extracts the application name from the URL path and returns the URL's origin concatenated with the application name.

Overall, this script allows for the authentication of users and opens the login page in a popup window while retaining the URL of the page the user was trying to access before logging in.