Skip to content

Commit

Permalink
Add license link in order screen
Browse files Browse the repository at this point in the history
  • Loading branch information
gdarko committed Sep 6, 2024
1 parent b1d9068 commit 6d4d5b0
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 24 deletions.
6 changes: 5 additions & 1 deletion assets/js/admin/licenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
for (var i = 0; i < elements.length; i++) {
var licenseKey = elements[i].querySelector('.dlm-placeholder');
if (licenseKey) {
licenseKey.innerHTML = '';
licenseKey.innerHTML = '&nbsp;';
licenseKey.classList.add('empty');
}
}
Expand Down Expand Up @@ -321,6 +321,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
if (!el) {
return;
}

if(el.classList.contains('empty')) {
return;
}
var str = el.innerHTML;

if (str.length === 0) {
Expand Down
12 changes: 12 additions & 0 deletions assets/lib/iconfont/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@
"css": "minus",
"code": 59397,
"src": "entypo"
},
{
"uid": "e15f0d620a7897e2035c18c80142f6d9",
"css": "link-ext",
"code": 61582,
"src": "fontawesome"
},
{
"uid": "815503841e980c848f55e0271deacead",
"css": "link",
"code": 59398,
"src": "entypo"
}
]
}
2 changes: 2 additions & 0 deletions assets/lib/iconfont/css/digital-license-manager-codes.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.dlm-icon-eye:before { content: '\e803'; } /* '' */
.dlm-icon-plus:before { content: '\e804'; } /* '' */
.dlm-icon-minus:before { content: '\e805'; } /* '' */
.dlm-icon-link:before { content: '\e806'; } /* '' */
.dlm-icon-link-ext:before { content: '\f08e'; } /* '' */
.dlm-icon-certificate:before { content: '\f0a3'; } /* '' */
.dlm-icon-file-pdf:before { content: '\f1c1'; } /* '' */
.dlm-icon-id-card:before { content: '\f2c2'; } /* '' */
Expand Down
14 changes: 8 additions & 6 deletions assets/lib/iconfont/css/digital-license-manager-embedded.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/lib/iconfont/css/digital-license-manager-ie7-codes.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.dlm-icon-eye { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe803;&nbsp;'); }
.dlm-icon-plus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe804;&nbsp;'); }
.dlm-icon-minus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe805;&nbsp;'); }
.dlm-icon-link { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe806;&nbsp;'); }
.dlm-icon-link-ext { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf08e;&nbsp;'); }
.dlm-icon-certificate { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0a3;&nbsp;'); }
.dlm-icon-file-pdf { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf1c1;&nbsp;'); }
.dlm-icon-id-card { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf2c2;&nbsp;'); }
Expand Down
2 changes: 2 additions & 0 deletions assets/lib/iconfont/css/digital-license-manager-ie7.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
.dlm-icon-eye { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe803;&nbsp;'); }
.dlm-icon-plus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe804;&nbsp;'); }
.dlm-icon-minus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe805;&nbsp;'); }
.dlm-icon-link { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe806;&nbsp;'); }
.dlm-icon-link-ext { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf08e;&nbsp;'); }
.dlm-icon-certificate { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0a3;&nbsp;'); }
.dlm-icon-file-pdf { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf1c1;&nbsp;'); }
.dlm-icon-id-card { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf2c2;&nbsp;'); }
Expand Down
16 changes: 9 additions & 7 deletions assets/lib/iconfont/css/digital-license-manager.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@font-face {
font-family: 'digital-license-manager';
src: url('../font/digital-license-manager.eot?5288027');
src: url('../font/digital-license-manager.eot?5288027#iefix') format('embedded-opentype'),
url('../font/digital-license-manager.woff2?5288027') format('woff2'),
url('../font/digital-license-manager.woff?5288027') format('woff'),
url('../font/digital-license-manager.ttf?5288027') format('truetype'),
url('../font/digital-license-manager.svg?5288027#digital-license-manager') format('svg');
src: url('../font/digital-license-manager.eot?53239116');
src: url('../font/digital-license-manager.eot?53239116#iefix') format('embedded-opentype'),
url('../font/digital-license-manager.woff2?53239116') format('woff2'),
url('../font/digital-license-manager.woff?53239116') format('woff'),
url('../font/digital-license-manager.ttf?53239116') format('truetype'),
url('../font/digital-license-manager.svg?53239116#digital-license-manager') format('svg');
font-weight: normal;
font-style: normal;
}
Expand All @@ -15,7 +15,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'digital-license-manager';
src: url('../font/digital-license-manager.svg?5288027#digital-license-manager') format('svg');
src: url('../font/digital-license-manager.svg?53239116#digital-license-manager') format('svg');
}
}
*/
Expand Down Expand Up @@ -60,6 +60,8 @@
.dlm-icon-eye:before { content: '\e803'; } /* '' */
.dlm-icon-plus:before { content: '\e804'; } /* '' */
.dlm-icon-minus:before { content: '\e805'; } /* '' */
.dlm-icon-link:before { content: '\e806'; } /* '' */
.dlm-icon-link-ext:before { content: '\f08e'; } /* '' */
.dlm-icon-certificate:before { content: '\f0a3'; } /* '' */
.dlm-icon-file-pdf:before { content: '\f1c1'; } /* '' */
.dlm-icon-id-card:before { content: '\f2c2'; } /* '' */
Expand Down
20 changes: 13 additions & 7 deletions assets/lib/iconfont/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@
}
@font-face {
font-family: 'digital-license-manager';
src: url('./font/digital-license-manager.eot?5991676');
src: url('./font/digital-license-manager.eot?5991676#iefix') format('embedded-opentype'),
url('./font/digital-license-manager.woff?5991676') format('woff'),
url('./font/digital-license-manager.ttf?5991676') format('truetype'),
url('./font/digital-license-manager.svg?5991676#digital-license-manager') format('svg');
src: url('./font/digital-license-manager.eot?20025957');
src: url('./font/digital-license-manager.eot?20025957#iefix') format('embedded-opentype'),
url('./font/digital-license-manager.woff?20025957') format('woff'),
url('./font/digital-license-manager.ttf?20025957') format('truetype'),
url('./font/digital-license-manager.svg?20025957#digital-license-manager') format('svg');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -231,14 +231,20 @@ <h1>digital-license-manager <small>font demo</small></h1>
<div class="span3" title="Code: 0xe805">
<i class="demo-icon dlm-icon-minus">&#xe805;</i> <span class="i-name">dlm-icon-minus</span><span class="i-code">0xe805</span>
</div>
<div class="span3" title="Code: 0xe806">
<i class="demo-icon dlm-icon-link">&#xe806;</i> <span class="i-name">dlm-icon-link</span><span class="i-code">0xe806</span>
</div>
<div class="span3" title="Code: 0xf08e">
<i class="demo-icon dlm-icon-link-ext">&#xf08e;</i> <span class="i-name">dlm-icon-link-ext</span><span class="i-code">0xf08e</span>
</div>
</div>
<div class="row">
<div class="span3" title="Code: 0xf0a3">
<i class="demo-icon dlm-icon-certificate">&#xf0a3;</i> <span class="i-name">dlm-icon-certificate</span><span class="i-code">0xf0a3</span>
</div>
<div class="span3" title="Code: 0xf1c1">
<i class="demo-icon dlm-icon-file-pdf">&#xf1c1;</i> <span class="i-name">dlm-icon-file-pdf</span><span class="i-code">0xf1c1</span>
</div>
</div>
<div class="row">
<div class="span3" title="Code: 0xf2c2">
<i class="demo-icon dlm-icon-id-card">&#xf2c2;</i> <span class="i-name">dlm-icon-id-card</span><span class="i-code">0xf2c2</span>
</div>
Expand Down
Binary file modified assets/lib/iconfont/font/digital-license-manager.eot
Binary file not shown.
6 changes: 5 additions & 1 deletion assets/lib/iconfont/font/digital-license-manager.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/lib/iconfont/font/digital-license-manager.ttf
Binary file not shown.
Binary file modified assets/lib/iconfont/font/digital-license-manager.woff
Binary file not shown.
Binary file modified assets/lib/iconfont/font/digital-license-manager.woff2
Binary file not shown.
6 changes: 4 additions & 2 deletions includes/Integrations/WooCommerce/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use IdeoLogix\DigitalLicenseManager\Database\Repositories\Licenses;
use IdeoLogix\DigitalLicenseManager\Enums\LicenseSource;
use IdeoLogix\DigitalLicenseManager\Enums\LicenseStatus;
use IdeoLogix\DigitalLicenseManager\Enums\PageSlug;
use IdeoLogix\DigitalLicenseManager\ListTables\Licenses as LicensesListTable;
use IdeoLogix\DigitalLicenseManager\Settings;
use IdeoLogix\DigitalLicenseManager\Core\Services\LicensesService;
Expand Down Expand Up @@ -704,12 +705,13 @@ public static function getOrderedLicensesHtml( $licenses, $order_item ) {
$html = sprintf( '<p>%s:</p>', __( 'The following licenses have been generated for this order item', 'digital-license-manager' ) );
$html .= '<ul class="dlm-license-list">';
foreach ( $licenses as $license ) {
$url = admin_url(sprintf( 'admin.php?page=%s&action=edit&id=%d', PageSlug::LICENSES, $license->getId() ));
if ( ! $hide_keys ) {
$decrypted = $license->getDecryptedLicenseKey();
$decrypted = is_wp_error( $decrypted ) ? 'ERROR' : $decrypted;
$html .= sprintf( '<li> <code class="dlm-placeholder">%s</code></li>', $decrypted );
$html .= sprintf( '<li> <code class="dlm-placeholder">%s</code>&nbsp;<a class="dlm-placeholder-link" href="%s"><span class="dlm-icon-link-ext"></span></a></li>', $decrypted, $url );
} else {
$html .= sprintf( '<li><code class="dlm-placeholder empty" data-id="%d"></code></li>', $license->getId() );
$html .= sprintf( '<li><code class="dlm-placeholder empty" data-id="%d">&nbsp;</code>&nbsp;<a target="_blank" href="%s"><span class="dlm-icon-link-ext"></span></a></li></li>', $license->getId(), $url );
}
}
$html .= '</ul>';
Expand Down

0 comments on commit 6d4d5b0

Please sign in to comment.