Jump to content

Recommended Posts

Posted (edited)

Here's a snippet I've just put together which you can drop into an HTML widget and get a list of all your installed FrogCode applications and widgets with their version number.  Might make keeping track of what you're got easier:

<style>
    .packageList {
        font-size: 11pt !important;
        width: calc(50% - 45px);
        float: left;
        margin: 5px;
        background: #FFFFFF;
        border: 1px solid #cccccc;
        padding: 10px;
        border-radius: 7px;
    }
    
    .packageIcon {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }
    .packageItem {
        width: 100%;
        margin-bottom: 5px;
    }
</style>

<div class="packageList">
    <table class="installedApps"></table>
</div>
<div class="packageList">
    <table class="installedWidgets"></table>
</div>


<script>
Frog.Model.api('packages.get', {
    enabled: true
}).done(function(response) {
    var apps = response.data.app;
    var widgets = response.data.widget;
    widgets.sort(sortFunction);
  
    for (var a = 0; a < apps.length; a++) {
        listPackage(apps[a].extended_data.appname,apps[a].extended_data.version,apps[a].extended_data.appicon,'installedApps');
    }
    for (var w = 0; w < widgets.length; w++) {
        listPackage(widgets[w].name,widgets[w].extended_data.version,widgets[w].extended_data.icon,'installedWidgets');
    }

}).fail(function(e) {
    console.log("FAILED");
});
  
function sortFunction(a, b) {
    if (a.name.toLowerCase() === b.name.toLowerCase()) {
        return 0;
    }
    else {
        return (a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 1;
    }
}
    
function listPackage(appName, version, icon, type) {   

    $('.'+type).append(
        '<tr class="packageItem">'+
            '<td><img class="packageIcon" src="'+icon+'"></td>'+
            '<td>'+appName+' </td>'+
            '<td>Version: <b>'+version+'</b>'+'</td>'+
        '</tr>'
    );

}
</script>

version numbers.PNG

Edited by Graham Quince
Tweaked the code to sort widgets alphabetically

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...