Using new javascript library for the table list views.
wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+ wp_enqueue_style( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/css/tabulator.min.css' );
+ wp_enqueue_script( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/js/tabulator.min.js' );
+
if ( isset( $_REQUEST['option'] ) ) {
$option = $_REQUEST['option'];
}
wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/css/foundation-6.min.css' );
wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/js/foundation-6.min.js' );
- // wp_enqueue_style( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/css/tabulator.min.css' );
- // wp_enqueue_script( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/js/tabulator.min.js' );
+ wp_enqueue_style( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/css/tabulator.min.css' );
+ wp_enqueue_script( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/js/tabulator.min.js' );
if ( isset( $_REQUEST['option'] ) ) {
$option = $_REQUEST['option'];
wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+ wp_enqueue_style( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/css/tabulator.min.css' );
+ wp_enqueue_script( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/js/tabulator.min.js' );
+
if ( isset( $_REQUEST['option'] ) ) {
$option = $_REQUEST['option'];
}
wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+ wp_enqueue_style( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/css/tabulator.min.css' );
+ wp_enqueue_script( 'Tabulator', GLM_MEMBERS_PLUGINS_PLUGIN_URL . '/js/tabulator/dist/js/tabulator.min.js' );
+
if ( isset( $_REQUEST['option'] ) ) {
$option = $_REQUEST['option'];
}
jQuery(document).ready(function($){
var tabledata = [
{foreach $plugins as $plugin}
- { id:"{$plugin.id}", name:"{$plugin.name}", latestVersion: "{$plugin.latest_version}", numProdUpdates: "{count($plugin.oldProdVersions)}", numDevUpdates: "{count($plugin.oldDevVersions)}" },
+ { id:"{$plugin.id}", name:"{$plugin.name|escape:'quotes'}", latestVersion: "{$plugin.latest_version}", numProdUpdates: "{count($plugin.oldProdVersions)}", numDevUpdates: "{count($plugin.oldDevVersions)}" },
{/foreach}
];
{literal}
var table = new Tabulator("#dashboard-plugins",{
- height: 300,
+ height: "350px",
data: tabledata,
layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
columns:[
{title:"Plugin Name", field:"name", width:"350"},
{title:"Latest Version", field:"latestVersion", align:"left"},
],
rowClick:function(e, row){
console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$thisUrl}?page={$thisPage}&glm_action=plugins&option=view&plugin_id={literal}" + row.getData().id;
}
});
{/literal}
});
</script>
-<link href="https://unpkg.com/tabulator-tables@4.4.3/dist/css/tabulator.min.css" rel="stylesheet">
-<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.4.3/dist/js/tabulator.min.js"></script>
-
{include file='admin/footer.html'}
<a class="button primary" href="{$baseUrl}&option=pluginSite{if !empty($smarty.request.order)}&order={$smarty.request.order}{/if}">Add Site</a>
{if !empty($sites) && !$newEntry}
- <table class="stack hover">
+ <table class="stack hover hide">
<tr>
<th class="text-left"><a href="{$baseUrl}&order={if !empty($smarty.request.order) && $smarty.request.order != 'nameA'}nameA{else}nameD{/if}">Site Name</a></th>
<th class="text-left"><a href="{$baseUrl}&order={if !empty($smarty.request.order) && $smarty.request.order != 'prod_serverA'}prod_serverA{else}prod_serverD{/if}">Prod Server</a></th>
</tr>
{/foreach}
</table>
+
+ <div id="siteList"></div>
{/if}
{* Grid End *}
{include file='ui/f6/grid-end.html'}
<script>
-jQuery(document).ready(function($){
- $(document).foundation();
-
-});
+ jQuery(document).ready(function($){
+ $(document).foundation();
+ var tabledata = [
+ {foreach $sites as $site}
+ { id:"{$site.id}", name:"{$site.site_name|escape:'quotes'}",
+ prodServer: "{$site.prod_server}", prodVersion: "{$site.prod_version}",
+ prodUpToDate: {if !empty($site.prod_version) && version_compare( $plugin.fieldData.latest_version, $site.prod_version, '>' )}false{elseif !empty($site.prod_version)}true{else}null{/if},
+ devServer: "{$site.dev_server}", devVersion: "{$site.dev_version}",
+ devUpToDate: {if !empty($site.dev_version) && version_compare( $plugin.fieldData.latest_version, $site.dev_version, '>' )}false{elseif !empty($site.dev_version)}true{else}null{/if}
+ },
+ {/foreach}
+ ];
+
+ {literal}
+ var table = new Tabulator("#siteList",{
+ height: "350px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Site Name", field:"name", width:"250"},
+ {title:"Prod Server", field:"prodServer", align:"left"},
+ {title:"Prod Version", field:"prodVersion", align:"left", editor:true, cellEdited: function(cell){
+ console.log('Edit: ', cell );
+ }},
+ {title:"Status", field:"prodUpToDate", formatter:"tickCross"},
+ {title:"Dev Server", field:"devServer", align:"left"},
+ {title:"Dev Version", field:"devVersion", align:"left", editor: true},
+ {title:"Status", field:"devUpToDate", formatter:"tickCross"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$baseUrl}&option=pluginSite{if !empty($smarty.request.order)}&order={$smarty.request.order}{/if}&site_id={literal}" + row.getData().id;
+ }
+ });
+ {/literal}
+ });
</script>
{* Footer *}
{include file="admin/header.html"}
<h3>List Plugins</h3>
-<table class="stack hover">
+<table class="stack hover hide">
<thead>
<tr>
<th width="10">ID</th>
</table>
+<div id="pluginList"></div>
+
+<script>
+ jQuery(document).ready(function($){
+ var tabledata = [
+ {foreach $plugins as $plugin}
+ {
+ id:"{$plugin.id}",
+ name:"{$plugin.name|escape:'quotes'}",
+ latestVersion:"{$plugin.latest_version}", glmAssociate:{if $plugin.glm_associate.value}true{else}false{/if} },
+ {/foreach}
+ ];
+ {literal}
+ var table = new Tabulator("#pluginList",{
+ height: "350px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Plugin Name", field:"name", width:"350"},
+ {title:"Latest Version", field:"latestVersion", align:"left"},
+ {title:"GLM Assoc", field:"glmAssociate", align:"left", formatter:"tickCross"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$thisUrl}?page={$thisPage}&glm_action={$thisAction}&option=view&plugin_id={literal}" + row.getData().id;
+ }
+ });
+ {/literal}
+ });
+</script>
{* Footer *}
{include file="../../admin/footer.html"}
</style>
{if !empty($sites)}
- <table class="stack hover">
+ <table class="stack hover hide">
<tr>
<th class="text-left">Site Name</th>
<th class="text-left">URL</th>
</tr>
{/foreach}
</table>
+
+ <div id="siteList"></div>
{/if}
{* Grid End *}
{include file='ui/f6/grid-end.html'}
<script>
-jQuery(document).ready(function($){
- $(document).foundation();
-
-});
+ jQuery(document).ready(function($){
+ $(document).foundation();
+ var tabledata = [
+ {foreach $sites as $site}
+ { id:"{$site.id}", name:"{$site.site_name|escape:'quotes'}", url: "{$site.url}" },
+ {/foreach}
+ ];
+
+ {literal}
+ var table = new Tabulator("#siteList",{
+ height: "350px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Site Name", field:"name", width:"250"},
+ {title:"URL", field:"url", align:"left"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ }
+ });
+ {/literal}
+ });
</script>
{* Footer *}
{include file="admin/header.html"}
<h3>List Servers</h3>
-<table class="stack hover">
+<table class="stack hover hide">
<thead>
<tr>
<th width="10">ID</th>
</table>
+<div id="serverList"></div>
+
+<script>
+ jQuery(document).ready(function($){
+ var tabledata = [
+ {foreach $servers as $server}
+ { id:"{$server.id}", name:"{$server.name|escape:'quotes'}", location: "{$server.location}", phpVersion: "{$server.php_version}", mysqlVersion:"{$server.mysql_version}" },
+ {/foreach}
+ ];
+
+ {literal}
+ var table = new Tabulator("#serverList",{
+ height: "200px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Server Name", field:"name", width:"350"},
+ {title:"Location", field:"location", align:"left"},
+ {title:"PHP Version", field:"phpVersion", align:"left"},
+ {title:"MySQL Version", field:"mysqlVersion", align:"left"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$thisUrl}?page={$thisPage}&glm_action={$thisAction}&option=view&server_id={literal}" + row.getData().id;
+ }
+ });
+ {/literal}
+ });
+</script>
{* Footer *}
{include file="../../admin/footer.html"}
</style>
{if !empty($plugins)}
- <table class="stack hover">
+ <table class="stack hover hide">
<tr>
<th class="text-left">Plugin Name</th>
<th class="text-left">Prod Version</th>
</tr>
{/foreach}
</table>
+
+ <div id="pluginList"></div>
{/if}
+
{* Grid End *}
{include file='ui/f6/grid-end.html'}
<script>
jQuery(document).ready(function($){
$(document).foundation();
-
+ var tabledata = [
+ {foreach $plugins as $plugin}
+ { id:"{$plugin.id}", name:"{$plugin.name|escape:'quotes'}",
+ prodVersion: "{$plugin.prod_version}",
+ prodUpToDate: {if !empty($plugin.prod_version) && version_compare( $plugin.latest_version, $plugin.prod_version, '>' )}false{elseif !empty($plugin.prod_version)}true{else}null{/if},
+ devVersion: "{$plugin.dev_version}",
+ devUpToDate: {if !empty($plugin.dev_version) && version_compare( $plugin.latest_version, $plugin.dev_version, '>' )}false{elseif !empty($plugin.dev_version)}true{else}null{/if}
+ },
+ {/foreach}
+ ];
+
+ {literal}
+ var table = new Tabulator("#pluginList",{
+ height: "350px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Site Name", field:"name", width:"250"},
+ {title:"Prod Version", field:"prodVersion", align:"left"},
+ {title:"Status", field:"prodUpToDate", formatter:"tickCross"},
+ {title:"Dev Version", field:"devVersion", align:"left"},
+ {title:"Status", field:"devUpToDate", formatter:"tickCross"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$baseUrl}&option=pluginSite{if !empty($smarty.request.order)}&order={$smarty.request.order}{/if}&site_id={literal}" + row.getData().id;
+ }
+ });
+ {/literal}
});
</script>
{include file="admin/header.html"}
<h3>List Sites</h3>
-<table class="stack hover">
+<table class="stack hover hide">
<thead>
<tr>
<th width="10">ID</th>
</table>
+<div id="siteList"></div>
+
+<script>
+ jQuery(document).ready(function($){
+ var tabledata = [
+ {foreach $sites as $site}
+ { id:"{$site.id}", name:"{$site.name|escape:'quotes'}", prodUrl: "{$site.prod_url}", devUrl: "{$site.dev_url}" },
+ {/foreach}
+ ];
+
+ {literal}
+ var table = new Tabulator("#siteList",{
+ height: "350px",
+ data: tabledata,
+ layout: "fitColumns",
+ tooltips: true,
+ addRowPos: "top",
+ initialSort: [ {column: "name", dir: "asc"} ],
+ columns:[
+ {title:"Site Name", field:"name", width:"350", headerFilter: true},
+ {title:"Prod Url", field:"prodUrl", align:"left"},
+ {title:"Dev Url", field:"devUrl", align:"left"},
+ ],
+ rowClick:function(e, row){
+ console.log('Row ' + row.getData().id + ' Clicked!!!');
+ window.location.href="{/literal}{$thisUrl}?page={$thisPage}&glm_action={$thisAction}&option=view&site_id={literal}" + row.getData().id;
+ }
+ });
+ {/literal}
+ });
+</script>
{* Footer *}
{include file="../../admin/footer.html"}