Skip to content

Commit

Permalink
improve the admin extensions experience
Browse files Browse the repository at this point in the history
- fix update notification (route thru web.cfm)
- fix some css linting issues
- darken TD text colour

Extensions List
- by default show all available extensions

Extension detail page
- show the extension release status in red on
- show category for installed extension
  • Loading branch information
zspitzer committed Apr 14, 2021
1 parent b80325b commit 647db5d
Show file tree
Hide file tree
Showing 12 changed files with 134 additions and 114 deletions.
50 changes: 34 additions & 16 deletions core/src/main/cfml/context/admin/ext.applications.detail.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@
// order
toOrderedArray(all,true);
versionStr = {};
versionStr.snapShot = [];
versionStr.pre_release = [];
versionStr.release = [];
versionStr = {
snapShot: [],
pre_release: [],
release: []
};
if(len(all)){
for(versions in all ){
if(FindNoCase("SNAPSHOT", versions)){
Expand All @@ -59,6 +60,15 @@
}
}
}
if (arrayLen(versionStr.release) gt 0)
ext_status="Released";
else if (arrayLen(versionStr.pre_release))
ext_status="Pre Release";
else if (arrayLen(versionStr.snapshot))
ext_status="Snapshot";
else
ext_status="Not Available";
</cfscript>


Expand Down Expand Up @@ -87,10 +97,11 @@
<cfset app=installed>
</cfif>
<cfset lasProvider=(app.provider?:"")=="local" || findNoCase("lucee.org",app.provider?:'') GT 0>
<cfoutput>
<cfoutput encodeFor="html">
<!--- title and description --->
<div class="modheader">
<h2>#app.name# (<cfif isInstalled>#stText.ext.installed#<cfelseif isServerInstalled>#stText.ext.installedServer#<cfelse>#stText.ext.notInstalled#</cfif>)</h2>

<cfif !lasProvider>
<div class="warning" style="color:##C93">This extension is not provided by the Lucee Association Switzerland and does not neccessarily follow our guidelines. This extension is not reviewed by the Lucee Association Switzerland.
For any sugestion to improve the Extension or any issue you encounter, please contact the author of the extension directly.</div>
Expand All @@ -102,8 +113,6 @@
<br /><br />
</div>



<table class="contentlayout">
<tbody>
<tr>
Expand All @@ -120,6 +129,10 @@
<td valign="top">
<table class="maintbl">
<tbody>
<tr class="extension">
<th scope="row">#stText.ext.releaseStatus#</th>
<td class="extension-status">#ext_status#</td>
</tr>
<!--- Extension Version --->
<cfif isInstalled>
<tr>
Expand All @@ -136,13 +149,19 @@
<th scope="row">Type</th>
<td>#installed.trial?"Trial":"Full"# Version</td>
</tr>

<cfif arrayLen(installed.categories)>
<tr>
<th scope="row">#stText.ext.category#</th>
<td>#arrayToList(installed.categories,', ')#</td>
</tr>
</cfif>
<cfelse>
<tr>
<th scope="row">#stText.ext.availableVersion#</th>
<td>#arrayToList(all,', ')#</td>
</tr>
</cfif>


<!--- price --->
<cfif !isNull(available.price) && len(trim(available.price))>
Expand All @@ -157,6 +176,11 @@
<th scope="row">#stText.ext.category#</th>
<td>#available.category#</td>
</tr>
<cfelseif arrayLen(installed.categories)>
<tr>
<th scope="row">#stText.ext.category#</th>
<td>#arrayToList(installed.categories,', ')#</td>
</tr>
</cfif>
<!--- author --->
<cfif !isNull(available.author) && len(trim(available.author))>
Expand Down Expand Up @@ -232,7 +256,7 @@ if(isInstalled) installedVersion=toVersionSortable(installed.version);
<input type="hidden" name="mainAction_" value="#isInstalled?stText.Buttons.upDown:stText.Buttons.install#">
<input type="hidden" name="provider" value="#isNull(available.provider)?"":available.provider#">

<table class="maintbl autowidth">
<table class="maintbl autowidth version-selector">
<tbody>
<cfset types="Release,Pre_Release,SnapShot">
<cfif arrayLen(all)>
Expand Down Expand Up @@ -335,13 +359,7 @@ if(isInstalled) installedVersion=toVersionSortable(installed.version);
else
$( "##versionForm" ).submit();
}
</script>
<style>
.btn {
color:white;
background-color:##CC0000;
}
</style>
</script>
</cfhtmlbody>


Expand Down
137 changes: 63 additions & 74 deletions core/src/main/cfml/context/admin/ext.applications.list.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,10 @@
}
}
dn=getDumpNail(img,130,50);
</cfscript><div class="extensionthumb">



</cfscript>
<div class="extensionthumb">
<a <cfif _type=="web">href="#link#"<cfelse>style="border-color: ##E0E0E0;"</cfif> title="#_extensions.name#
Categories: #arrayToList(cat)#
#arrayToList(cat)#
Installed version: #_extensions.version#<cfif hasUpdates>
Latest version: #latest.v#</cfif>"><cfif hasUpdates>
<div class="ribbon-wrapper" <cfif _type=="server">style="border-color:##bf4f36"</cfif>><div class="ribbon" <cfif _type=="server">style="background-color:##bf4f36"</cfif>>UPDATE ME!</div></div>
Expand Down Expand Up @@ -234,19 +232,18 @@ Latest version: #latest.v#</cfif>"><cfif hasUpdates>
<cfif isQuery(external)>
<cfset hiddenFormContents = "" >
<cfset count = 1>

<cfloop list="Release,Pre_Release,SnapShot" index="key">
<span><input
<cfif count EQ 1>class="bl button" <cfelseif count EQ 3> class="br button" <cfelse> class="bm button" </cfif>
style="width:180px"
name="changeConnection"
id="btn_#UcFirst(Lcase(key))#"
value="#stText.services.update.short[key]# (#versionStr[key].RecordCount#)"
onclick="enableVersion('#UcFirst(Lcase(key))#');"
type="button"></span>
<cfsavecontent variable="tmpContent">
<div id="div_#UcFirst(Lcase(key))#" >

<div class="version-selector">
<cfloop list="Release,Pre_Release,SnapShot" index="key">
<span><input
<cfif count EQ 1>class="bl btn button" <cfelseif count EQ 3> class="br btn button" <cfelse> class="bm btn button" </cfif>
style="width:180px"
name="changeConnection"
id="btn_#UcFirst(Lcase(key))#"
value="#stText.services.update.short[key]# (#versionStr[key].RecordCount#)"
onclick="enableVersion('#UcFirst(Lcase(key))#');"
type="button"></span>
<cfsavecontent variable="tmpContent">

<cfloop query="#versionStr[key]#" group="id">
<cfif (
session.extFilter.filter2 eq ""
Expand All @@ -255,32 +252,38 @@ Latest version: #latest.v#</cfif>"><cfif hasUpdates>
or doFilter(session.extFilter.filter2,info.title?:'',false)
)
>
<cfset link="#request.self#?action=#url.action#&action2=detail&id=#versionStr[key].id#">
<cfset dn=getDumpNail(versionStr[key].image,130,50)>
<div class="extensionthumb">
<cfscript>
link="?action=#url.action#&action2=detail&id=#versionStr[key].id#";
latest=getLatestVersion(versionStr[key].id);
dn=getDumpNail(versionStr[key].image,130,50);
</cfscript>
<div class="extensionthumb" data-release-type="#UcFirst(Lcase(key))#">
<cfset lasProvider=(versionStr[key].provider?:"")=="local" || findNoCase("lucee.org",versionStr[key].provider) GT 0>
<cfif not lasProvider><cfset noneLasCounter++></cfif>
<a <cfif not lasProvider> style="border-color: ###(lasProvider?'9C9':'FC6')#;"</cfif> href="#link#" title="#stText.ext.viewdetails#">
<a <cfif not lasProvider> style="border-color: ###(lasProvider?'9C9':'FC6')#;"</cfif> href="#link#"
title="#versionStr[key].name#
#arrayToList(cat)#
Latest version: #latest.v#
">
<div class="extimg">
<cfif len(dn)>

<img src="#dn#" style="max-width:130px;max-height:50px" alt="#stText.ext.extThumbnail#" />
<img src="#dn#" style="max-width:130px;max-height:50px" alt="#stText.ext.extThumbnail#" />
</cfif>
</div>
<cfset listnotinstalled = listnotinstalled+1>
<b title="#versionStr[key].name#">#cut(versionStr[key].name,30)#</b><br />
<!------>
<cfif structKeyExists(versionStr[key],"price") and versionStr[key].price GT 0>#versionStr[key].price# <cfif structKeyExists(versionStr[key],"currency")>#versionStr[key].currency#<cfelse>USD</cfif><cfelse>#stText.ext.free#</cfif>
<cfif structKeyExists(versionStr[key],"price") and versionStr[key].price GT 0>#versionStr[key].price#
<cfif structKeyExists(versionStr[key],"currency")>#versionStr[key].currency#<cfelse>USD</cfif><cfelse>#stText.ext.free#</cfif>
</a>
</div>
</cfif>
</cfloop>
</div>
</cfsavecontent>
<cfset hiddenFormContents &= tmpContent>
<cfset count = count+1>
</cfloop>

</cfsavecontent>
<cfset hiddenFormContents &= tmpContent>
<cfset count = count+1>
</cfloop>
</div>
<div id="extList" class="extensionlist topBottomSpace">
#hiddenFormContents#
<div class="clear"></div>
Expand Down Expand Up @@ -333,51 +336,37 @@ Latest version: #latest.v#</cfif>"><cfif hasUpdates>

<cfhtmlbody>
<script type="text/javascript">
$(document).ready(function(){
if('#server.lucee.state#' == 'SNAPSHOT')
var version = 'Snapshot';
else if('#server.lucee.state#' == 'RC')
var version = 'Pre_release';
else
var version = 'Release';
enableVersion(version, "intial");
$("##btn_"+version).addClass("btn");
});
function enableVersion(v){
var $pre = $("##btn_Pre_release");
var $snap = $("##btn_Snapshot");
var $rel = $("##btn_Release");
function enableVersion(v, i){
$("##extList").find('div').each(function(index) {
var xx = $(this).attr('id');
if(i== 'intial'){
$('##div_'+v).show();
if("div_"+v != xx){
$('##'+xx).hide();
}
$(".btn").removeClass('btn');
$("##btn_"+v).addClass("btn");
} else {
if("div_"+v == 'div_Release'){
$("##btn_Pre_release").removeClass('btn');
$("##btn_Snapshot").removeClass('btn');
$("##btn_"+v).addClass("btn");
$('##'+xx).hide();
$('##div_Release').show();
}
if("div_"+v == 'div_Pre_release') {
$("##btn_Release").removeClass('btn');
$("##btn_Snapshot").removeClass('btn');
$("##btn_"+v).addClass("btn");
$('##'+xx).hide();
$('##div_Pre_release').show();
}
if("div_"+v == 'div_Snapshot') {
$("##btn_Release").removeClass('btn');
$("##btn_Pre_release").removeClass('btn');
$("##btn_"+v).addClass("btn");
$('##'+xx).hide();
$('##div_Snapshot').show();
}
switch (v){
case "Release":
$pre.removeClass('btn');
$snap.removeClass('btn');
$rel.addClass('btn');
break;
case "Pre_release":
$rel.removeClass('btn');
$snap.removeClass('btn');
$pre.addClass('btn');
break;
case "Snapshot":
$rel.removeClass('btn');
$pre.removeClass('btn');
$snap.addClass('btn');
break;
default:
throw new Error("unknown: " + v);
}
$("##extList .extensionthumb").each(
function () {
$(this).toggle( $(this).data('release-type') == v);
}
});
);
}
</script>
</cfhtmlbody>
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/cfml/context/admin/ext.functions.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
<cfloop query="providers">
<cfif hash(providers.url) EQ arguments.hashProvider>
<cfset detail.provider=loadCFC(providers.url)>
<Cfdump var=#detail.provider#>
<cfabort>
<cfset var apps=detail.provider.listApplications()>
<cfset detail.info=detail.provider.getInfo()>
<cfset detail.url=providers.url>
Expand Down Expand Up @@ -148,7 +150,7 @@
<cfreturn detail>
</cffunction>

<cffunction name="getDumpNail" localmode=true>
<cffunction name="getDumpNail" localmode=true output="false">
<cfargument name="src" required="yes" type="string">
<cfargument name="width" required="yes" type="number" default="80">
<cfargument name="height" required="yes" type="number" default="40">
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/cfml/context/admin/overview.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ Error Output --->
<cfhtmlbody>
<script type="text/javascript">
$( function() {
$('##updateInfoDesc').load('update.cfm?#session.urltoken#&adminType=#request.admintype#');
$('##updateInfoDesc').load('?action=update&adminType=#request.admintype#');
} );
</script>
</cfhtmlbody>
Expand Down
1 change: 1 addition & 0 deletions core/src/main/cfml/context/admin/resources/language/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<data key="ext.version">Version</data>
<data key="ext.appupdate">Update</data>
<data key="ext.created">Release Date</data>
<data key="ext.releaseStatus">Release Status</data>
<data key="ext.notinstalled">Available to Install</data>
<data key="ext.codename">Code Name</data>
<data key="ext.stepof">Step {current} of {total}</data>
Expand Down
10 changes: 6 additions & 4 deletions core/src/main/cfml/context/admin/update.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
--->
--->
<cfsetting showdebugoutput="false">
<cftry>
<cfparam name="session.alwaysNew" default="true" type="boolean">
Expand Down Expand Up @@ -109,9 +109,9 @@
<cfset uid=extensions.id>
<cfset link="">
<cfset dn="">
<cfset link="#self#?action=ext.applications&action2=detail&id=#uid#">
<cfset link="?action=ext.applications&action2=detail&id=#uid#">
<cfoutput>
<a href="#link#" style="color:red;text-decoration:none;">- #extensions.name#</a><br>
<a href="#link#" style="color:red;text-decoration:none;">- #extensions.name#</a> #extensions.version#<br>
</cfoutput>
</cfloop>
</cfsavecontent>
Expand Down Expand Up @@ -206,4 +206,6 @@
</div> --->
</cfoutput>
</cfcatch>
</cftry>
</cftry>
<!-- no updates available -->
<cfabort>
2 changes: 1 addition & 1 deletion core/src/main/cfml/context/admin/web.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
</cfmodule>
</cfif>
</cfif>
<cfif (current.action != "overview" || current.action != "chartAjax") && current.action != "services.restart">
<cfif (current.action != "overview" || current.action != "chartAjax" || current.action != "update") && current.action != "services.restart">
<cfcookie name="lucee_admin_lastpage" value="overview" expires="NEVER">
<cfelseif current.action == "services.restart">
<cfcookie name="lucee_admin_lastpage" value="services.restart" expires="NEVER">
Expand Down
Loading

0 comments on commit 647db5d

Please sign in to comment.