{"id":2554,"date":"2021-12-18T10:39:52","date_gmt":"2021-12-18T15:39:52","guid":{"rendered":"https:\/\/xlinesoft.com\/blog\/?p=2554"},"modified":"2022-03-24T10:05:22","modified_gmt":"2022-03-24T15:05:22","slug":"version-10-7","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2021\/12\/18\/version-10-7\/","title":{"rendered":"Version 10.7"},"content":{"rendered":"<p>Version 10.7 of PHPRunner and ASPRunner.NET is here! <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/download\">Trial version download links<\/a><\/p>\n<p>If you purchased PHPRunner or ASPRunner.NET less than 12 months ago, proceed to the <a href=\"https:\/\/xlinesoft.com\/dss\/support.asp\">control panel<\/a> and download the registered version 10.7 there under &#8216;My purchases&#8217;. Use &#8216;Reg info&#8217; link next to your latest purchase.<\/p>\n<p>This new version features the following improvements:<br \/>\n1. Files upload to cloud providers: Google Drive, OneDrive, Amazon S3, Dropbox<br \/>\n2. Notification API<\/p>\n<p>Let&#8217;s dig into new functionality. <\/p>\n<h2>Files upload to cloud providers<\/h2>\n<p>When you set &#8216;Edit as&#8217; type of the field to File\/Image you now have an option to choose one of the cloud storage options. <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/google_drive.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/google_drive-600x246.png\" alt=\"\" width=\"600\" height=\"246\" class=\"alignnone size-medium wp-image-2577\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/google_drive-600x246.png 600w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/google_drive-768x315.png 768w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/google_drive.png 769w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><br \/>\n<!--more--><\/p>\n<h3>Google Drive<\/h3>\n<p>Refer to <a href=\"https:\/\/xlinesoft.com\/blog\/2021\/11\/02\/working-with-google-drive-rest-api\/\">this article<\/a> that explains how to create an app in Google Cloud Console and get <strong>OAuth Client ID<\/strong> and <strong>OAuth Client Secret<\/strong>. <strong>Folder ID<\/strong> is optional. If you do not specify it, files will be uploaded to the root folder. <\/p>\n<p>To find the folder id proceed to that folder in Google Drive in your web browser. The URL may look like this:<\/p>\n<pre>https:\/\/drive.google.com\/drive\/u\/3\/folders\/0B-9X707clcqJMmI4OTI4MWEtMDBmNS00OGIwLThiZmYtOWJhMDdiNTc3ZmU3?resourcekey=0-z0sQH4Jjn_-nLn64zuPDvg<\/pre>\n<p>Here <strong>0B-9X707clcqJMmI4OTI4MWEtMDBmNS00OGIwLThiZmYtOWJhMDdiNTc3ZmU3<\/strong> is your folder id.<\/p>\n<p>Make sure to read the <strong>Important<\/strong> note below.<\/p>\n<h3>Microsoft OneDrive<\/h3>\n<h4>Create a new app registration<\/h4>\n<p>Proceed to <a href=\"https:\/\/portal.azure.com\/#blade\/Microsoft_AAD_RegisteredApps\/ApplicationsListBlade\">Azure -> App registrations -> New registrations<\/a><\/p>\n<p><strong>Name:<\/strong> <any name><br \/>\n<strong>Supported account types:<\/strong> This parameter can not be changed later.<br \/>\nIf you plan to use your personal OneDrive account, choose Personal Accounts only<\/p>\n<p><strong>Redirect URI:<\/strong> &#8211; you can change this parameter later<br \/>\n<strong>Platform:<\/strong> Web<\/p>\n<p><strong>PHPRunner:<\/strong><br \/>\n<application url>\/oauthcallback.php<br \/>\nFor example<br \/>\nhttps:\/\/my.site\/app\/oauthcallback.php<br \/>\nor<br \/>\nhttp:\/\/localhost:8086\/oauthcallback.php<\/p>\n<p><strong>ASPRunner.NET:<\/strong><br \/>\n<application url>\/oauthcallback<br \/>\nFor example<br \/>\nhttps:\/\/my.site\/app\/oauthcallback<br \/>\nor<br \/>\nhttp:\/\/localhost:8086\/oauthcallback<\/p>\n<p>Press <strong>Register<\/strong> to create the application. <\/p>\n<h4>Configure app registration<\/h4>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/azure_portal-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/azure_portal-1-600x335.png\" alt=\"\" width=\"600\" height=\"335\" class=\"alignnone size-medium wp-image-2574\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/azure_portal-1-600x335.png 600w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/azure_portal-1-768x428.png 768w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/azure_portal-1.png 925w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>App registrations -> Your app, Proceed to <strong>Overview<\/strong><br \/>\n<strong>Application (client) ID<\/strong> &#8211; copy to PHPRunner\/ASPRunner.NET as Client ID<\/p>\n<p>Proceed to Certificates &#038; secrets, click &#8216;New client secret&#8217;<br \/>\nAfter the secret is created copy its Value (not the Secret ID!) to the Client Secret field in PHPRunner\/ASPRunner.NET<\/p>\n<p>Proceed to <strong>API Permissions<\/strong><br \/>\nClick Microsoft Graph and add permissions.<br \/>\nUse the search tool.<br \/>\nThe following permissions need to be added:<br \/>\n<strong>offline_access<br \/>\nFiles.ReadWrite<\/strong><\/p>\n<p>Proceed to <strong>Authentication<\/strong><br \/>\nAdd the Redirect URL if you didn&#8217;t do that before or need to add a new one.<br \/>\nPress Add platform, choose Web.<br \/>\nSee above which Redirect URL to enter.<\/p>\n<p>Proceed to <a href=\"https:\/\/onedrive.com\">OneDrive<\/a>.<br \/>\nNote the URL in browser&#8217;s address box. It should be something like this<br \/>\nhttps:\/\/onedrive.live.com\/?id=root&#038;cid=7FD32AC638D2A7<br \/>\nCopy the cid parameter value to Drive field in PHPRunner<br \/>\nFor example:<br \/>\n<strong>7FD32AC638D2A7<\/strong><\/p>\n<p>You are all set. Now you can run your application. <\/p>\n<h3>Important<\/h3>\n<p>This applies to both Google Drive and Microsoft OneDrive. After the project is built and published, open it in the web browser and proceed to any page of a table where cloud storage is used. You will be redirected to Google or Microsoft site to log in.<br \/>\nLog in under the account that should be used to store the files. Then the application will save the credentials, and no further login will be needed.<\/p>\n<p>The credentials are saved in <app directory>\\templates_c\\googledrive.php or onedrive.php file respectively. For ASPRunner.NET file names will be googledrive.json and obedrive.json. If you need to change the OneDrive or GoogleDrive configuration and start storing files under a different account, delete that file, then close all browser windows to clear the session. Open any page where cloud storage is used in the browser again and log in to Google or Microsoft using your new account.<\/p>\n<h3>Amazon S3<\/h3>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/amazon_s3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/amazon_s3-600x268.png\" alt=\"\" width=\"600\" height=\"268\" class=\"alignnone size-medium wp-image-2578\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/amazon_s3-600x268.png 600w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/amazon_s3.png 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>You need to specify Access Key ID, Secret Access Key, S3 Bucket name, Region and optional path. <\/p>\n<p>1. Logon to <a href=\"https:\/\/console.aws.amazon.com\/\">AWS Console<\/a> as a root user. <\/p>\n<p>2. In the navigation bar on the upper right, choose your account name or number and then choose My Security Credentials.<\/p>\n<p>3. Expand the <strong>Access keys (access key ID and secret access key)<\/strong> section.<\/p>\n<p>4. To create an access key, choose <strong>Create New Access Key<\/strong>. If you already have two access keys, this button is disabled and you must delete an access key before you can create a new one. When prompted, choose either <strong>Show Access Key<\/strong> or <strong>Download Key File<\/strong>. This is your only opportunity to save your secret access key. After you&#8217;ve saved your secret access key in a secure location, choose <strong>Close<\/strong>.<\/p>\n<p>5. Go back to the account home page, select S3 from the list of Services. Create a new bucket or select an existing one. This is where you can see the <strong>Bucket Name<\/strong> and <strong>Region<\/strong>. <\/p>\n<p>6. <strong>Important:<\/strong> in bucket properties, under <strong>Permissions<\/strong>, scroll down to <strong>Cross-origin resource sharing (CORS)<\/strong> and paste the following JSON there. It is required for Amazon S3 Javascript library to work. <\/p>\n<pre name=\"code\" class=\"json:nocontrols\">\r\n[\r\n    {\r\n        \"AllowedHeaders\": [\r\n            \"*\"\r\n        ],\r\n        \"AllowedMethods\": [\r\n            \"HEAD\",\r\n            \"GET\",\r\n            \"PUT\",\r\n            \"POST\",\r\n            \"DELETE\"\r\n        ],\r\n        \"AllowedOrigins\": [\r\n            \"*\"\r\n        ],\r\n        \"ExposeHeaders\": [\r\n            \"ETag\"\r\n        ]\r\n    }\r\n]\r\n<\/pre>\n<h2>Notification API<\/h2>\n<p>To enable Notification API, proceed to Miscellaneous screen, click &#8216;Notification API&#8217; button, enable this feature and create a new table to store notifications. Now, since this is an API, we need to write some code to make it work. Let&#8217;s start with something simple. When someone adds a new record to the Categories table we also want to create a notification. <\/p>\n<p>For this purpose, we will add the following code to the Categories table AfterAdd event:<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre name=\"code\" class=\"php:nocontrols\">\r\naddNotification( \"New category added: \".$values[\"CategoryName\"] , \"New category\", \"fa-envelope\", makePageLink( \"categories\", \"view\", $keys) );\r\n<\/pre>\n<p><strong>C#<\/strong><\/p>\n<pre name=\"code\" class=\"csharp:nocontrols\">\r\nCommonFunctions.addNotification( \"New category added: \" + values[\"CategoryName\"].ToString() , \"New category\", \"fa-envelope\", makePageLink( \"categories\", \"view\", keys) );\r\n<\/pre>\n<p>If everything worked as expected, we will see a new notification added after each new record in the <strong>Categories<\/strong> table. And if we click on any notification, it will take us to that new Category view page. <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/scr_notifications.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2021\/12\/scr_notifications.png\" alt=\"\" width=\"467\" height=\"365\" class=\"alignnone size-full wp-image-2565\" \/><\/a><\/p>\n<p>Let&#8217;s take a closer look at this function&#8217;s parameters. <\/p>\n<p><strong>PHP<\/strong><br \/>\nfunction <strong>addNotification<\/strong>( $message, $title = null, $icon = null, $url = null, $expire = null, $user = null, $provider = null )<\/p>\n<p><strong>C#<\/strong><br \/>\nfunction <strong>CommonFunctions.addNotification<\/strong>(dynamic _param_message, dynamic _param_title = null, dynamic _param_icon = null, dynamic _param_url = null, dynamic _param_expire = null, dynamic _param_user = null, dynamic _param_provider = null)<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p><strong>$message<\/strong> &#8211; notification text<\/p>\n<p><strong>$title<\/strong> &#8211; optional notification title<\/p>\n<p><strong>$icon<\/strong> &#8211; optional icon, can be in one of three formats:<\/p>\n<p>URL &#8211; &#8220;https:\/\/website.com\/path\/image.png&#8221; or &#8220;images\/file.gif&#8221;<\/p>\n<p>Bootstrap icon: &#8220;glyphicon-film&#8221;, &#8220;glyphicon-hand-right&#8221;<br \/>\n<a href=\"https:\/\/getbootstrap.com\/docs\/3.4\/components\/\">The full list of available Bootstrap icons<\/a>.<\/p>\n<p>Font Awesome icon: &#8220;fa-envelope&#8221;, &#8220;fa-user&#8221;<br \/>\n<a href=\"https:\/\/fontawesome.com\/v5.15\/icons?d=gallery&#038;p=2&#038;m=free\">The full list of available Font Awesome icons<\/a>.<\/p>\n<p><strong>$url<\/strong> &#8211; optional URL. When specified, a click on notification sends the user to the specified address. See makePageLink function<\/p>\n<p><strong>$expire<\/strong> &#8211; optional expiration date and time for the message. Can be either datetime in &#8220;YYYY-MM-DD hh:mm:ss&#8221; format, or a number of minutes the notification should be visible. After the expiration date\/time the notification will be deleted from the notifications table.<\/p>\n<p>Examples:<br \/>\n&#8220;2022-01-10 00:00:00&#8221; or 1440 for 24-hour period<\/p>\n<p><strong>$user<\/strong> &#8211; username the message should be visible to. If not specified, all users and guests will see the notification.<\/p>\n<p><strong>$provider<\/strong> &#8211; when $user is a database user, whose username and password are stored in a database table, this parameter must be empty. When the user is from Active Directory, OpenID, Google etc, then put the two-letter security provider code here. You can find it on the &#8216;Security screen&#8217; under the provider settings dialog.<\/p>\n<h4>Alternative syntax<\/h4>\n<p><strong>PHP<\/strong><br \/>\nfunction <strong>createNotification<\/strong>( $params )<\/p>\n<p><strong>C#<\/strong><br \/>\nfunction <strong>CommonFunctions.createNotification<\/strong>( dynamic params )<\/p>\n<p>$params &#8211; array of notification parameters<br \/>\n$params[&#8220;message&#8221;] &#8211; corresponds to $message parameter in addMessage()<br \/>\n$params[&#8220;title&#8221;] &#8211; notification title<br \/>\n$params[&#8220;icon&#8221;] &#8211; icon<br \/>\n$params[&#8220;url&#8221;] &#8211; URL<br \/>\n$params[&#8220;expire&#8221;] &#8211; expiration datetime or time in minutes<br \/>\n$params[&#8220;user&#8221;] &#8211; user<br \/>\n$params[&#8220;provider&#8221;] &#8211; security provider<\/p>\n<h4>Creating a link to an application page<\/h4>\n<p>You can use a helper function <strong>makePageLink<\/strong> to quickly create links to any application page.<\/p>\n<p><strong>PHP<\/strong><br \/>\nfunction <strong>makePageLink<\/strong>( $table, $pageType, $keys = null, $additionalParams = array() )<\/p>\n<p><strong>C#<\/strong><br \/>\nfunction <strong>makePageLink<\/strong>(dynamic table, dynamic pageType, dynamic keys = null, dynamic additionalParams = null)<\/p>\n<p><strong>Parameters:<\/strong><br \/>\n<strong>$table<\/strong> &#8211; name of the table the page belongs to. Specify empty string for pages like login, menu etc.<\/p>\n<p><strong>$page<\/strong> &#8211; page type like &#8220;list&#8221;, &#8220;add&#8221;, &#8220;edit&#8221;<\/p>\n<p><strong>$keys<\/strong> &#8211; when creating a link to edit or view page, specify record keys here. This can be either simple array of values, like<br \/>\narray( 10, &#8220;JOHN&#8221;)<br \/>\nor associative array with field names as keys:<br \/>\narray( &#8220;department&#8221; => 10, &#8220;last_name&#8221; => &#8220;JOHN&#8221;)<br \/>\nWhen used in &#8216;After record updated&#8217; or &#8216;After record added&#8217; event, pass the <strong>$keys<\/strong> parameter of the event as is. <\/p>\n<p><strong>$additionalParams<\/strong> &#8211; any additional params you want to add to the URL.<br \/>\narray( &#8220;page&#8221; => &#8220;list1&#8221; ) will create a URL to the additional list page named &#8220;list1&#8221;<\/p>\n<p><strong>Examples:<\/strong><\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre name=\"code\" class=\"php:nocontrols\">makePageLink( \"cars\", \"list\", null, array( \"page\" => \"list1\" ))<\/pre>\n<p><strong>C#<\/strong><\/p>\n<pre name=\"code\" class=\"csharp:nocontrols\">CommonFunctions.makePageLink( \"cars\", \"list\", null, new XVar(\"page\", \"list1\"))<\/pre>\n<p>The code above will produce a link &#8220;cars_list.php?page=list1&#8221;, which points to the additional List page called <strong>list1<\/strong>.<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre name=\"code\" class=\"php:nocontrols\">makePageLink( \"cars\", \"view\", $keys )\r\n<\/pre>\n<p><strong>C#<\/strong><\/p>\n<pre name=\"code\" class=\"csharp:nocontrols\">CommonFunctions.makePageLink( \"cars\", \"view\", keys )\r\n<\/pre>\n<p>When called from the &#8216;After Record Added&#8217; event returns a link to the View page of the newly added record.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Version 10.7 of PHPRunner and ASPRunner.NET is here! Trial version download links If you purchased PHPRunner or ASPRunner.NET less than 12 months ago, proceed to the control panel and download the registered version 10.7 there under &#8216;My purchases&#8217;. Use &#8216;Reg info&#8217; link next to your latest purchase. This new version features the following improvements: 1. Files upload to cloud providers: Google Drive, OneDrive, Amazon S3, Dropbox 2. Notification API Let&#8217;s dig into new functionality. Files upload to cloud providers When you set &#8216;Edit as&#8217; type&#8230;<span class=\"clearfix clearfix-post\"><\/span><a href=\"https:\/\/xlinesoft.com\/blog\/2021\/12\/18\/version-10-7\/\" class=\"more-link\">Continue Reading <span class=\"screen-reader-text\">&#8220;Version 10.7&#8221;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,10,1],"tags":[],"class_list":["post-2554","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-news","category-php-category"],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=2554"}],"version-history":[{"count":31,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2554\/revisions"}],"predecessor-version":[{"id":2662,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2554\/revisions\/2662"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=2554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=2554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=2554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}