Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #118 from jmohler1970/ColdFusion-2016
Browse files Browse the repository at this point in the history
ColdFusion 2016
  • Loading branch information
jmohler1970 committed Apr 17, 2016
2 parents 4504efa + 7b07f6e commit 7cda9cc
Show file tree
Hide file tree
Showing 105 changed files with 3,200 additions and 2,676 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BootsFaces for JSF shows the way to a cleaner approach. So what I have done is c
### With Bootstrap for ColdFusion

```
<b:button processed="#showme#" binding="savelabel" icon="floppy-disk" size="lg" />
<b:button processed="#showme#" value="#rc.savelabel#" icon="floppy-disk" size="lg" />
```


3 changes: 3 additions & 0 deletions ajax/for_modal.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<cfsetting showDebugOutput="No">

<cfoutput>The time is now #LSDateFormat(now())# @ #LSTimeFormat(Now(), 'h:mm:ss')#</cfoutput>
122 changes: 5 additions & 117 deletions application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
component extends="framework.one" accessors="true" {


this.name="bs-4-cf-282";
this.name="bs-4-cf-349";
this.applicationManagement = true;
this.sessionManagement = true;

Expand Down Expand Up @@ -69,84 +69,10 @@ fileclose(objAppFile);


// Support for complicated variables. This used to have to be in FW/1
application.objFormUtilities = new framework.formUtilities();


application.Bootstrap = {

// Antisamy options
isSafeHTML = [ "cf_buttongroup", "cf_buttontoolbar", "cf_column", "cf_container", "cf_dropmenu",
"cf_fieldset", "cf_formgroup", "cf_head",
"cf_jumbotron", "cf_modal", "cf_navbar", "cf_navbarlinks", "cf_navlink",
"cf_panel", "cf_row", "cf_table", "cf_tabview", "cf_tr","cf_well"], // these tags to not run through getSafeHTML
profile = "", // blank means use system default
throwOnError = false, // Default behavior for getSafeHTML()

// Cacheing
cache = {content = "Bootstrap", language = "i18n" }, // Only Bootstrap should use this

// i18n options
langRoot = expandPath("vendor/lang") & "/",
arLang = [],

actionRoot = "http://" & cgi.server_name & (cgi.server_port == 80 ? "" : ":" & cgi.server_port) & cgi.script_name & "/",
validLook = ["", "link", "default", "primary", "success", "info", "warning", "danger"], // There does not guarantee they are valid

iconLibrary = {"default" = "glyphicon glyphicon-", "awesome" = "fa fa-", "jquery-ui" = "ui-icon ui-icon-"}, // be sure to include ending dashes
imageLibrary = {"default" = replace(cgi.script_name, "/index.cfm", "") & "/assets/"}, // used by b:graphicImage

// used by b:outputStyleSheet
styleSheetLibrary = {"default" = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css",
local = replace(cgi.script_name, "/index.cfm", "") & "/assets/",
innovation = replace(cgi.script_name, "/index.cfm", "") & "/layouts/innovation/",
vendor = replace(cgi.script_name, "/index.cfm", "") & "/vendor/"
},

// used by b:outputScript
scriptLibrary = {"default" = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",
local = replace(cgi.script_name, "/index.cfm", "") & "/assets/",
vendor = replace(cgi.script_name, "/index.cfm", "") & "/vendor/"
}
};


application.GSConfig = new model.services.settings().getWebsite();
application.objFormUtilities = new framework.formUtilities();
application.GSConfig = new model.services.settings().getWebsite();



application.geti18n = function(required string key, any placeholder = []) output="false" {

if (!isArray(arguments.placeholder)) arguments.placeholder = [arguments.placeholder];


if (CacheIdExists(application.lang, application.Bootstrap.cache.language)) {

local.stLang = cacheGet(application.lang, application.Bootstrap.cache.language);



if (local.stLang.keyExists(arguments.key)) {

local.myString = local.stLang[arguments.key];

for (var i in arguments.placeholder) {

local.myString = local.myString.replace('%s', i); // only does first match
}

return getSafeHTML(local.myString);
} // end keyExists
} // end cacheIdExists


return "{#arguments.key#}";
}; // end function


// Language control
application.lang = "en_US"; // needs to be smarter


invoke("views._bootstrap.bootstrap", "setupApplication");
} // end setupApplication


Expand All @@ -161,45 +87,7 @@ function setupSession() {

function setupRequest() {


if(application.Bootstrap.arLang.isEmpty()) {
for(local.langFile in DirectoryList(application.Bootstrap.langRoot, false, "path", "*.php")) {
application.Bootstrap.arLang.append(local.langFile.listLast("/").listFirst("."));
}
}



if(!cacheRegionExists(application.Bootstrap.cache.content)) CacheRegionNew(application.Bootstrap.cache.content);
if(!cacheRegionExists(application.Bootstrap.cache.language)) CacheRegionNew(application.Bootstrap.cache.language);


if(cacheGetAllIds(application.Bootstrap.cache.language).isEmpty()) {



// load i18n
local.languageService = new model.services.language();




local.i18n = {};
local.i18n.append( local.languageService.readPHP(application.Bootstrap.langroot) ); // traditional language file
// simple append won't work
local.stTitle = local.languageService.readProperties( expandPath(".") & "/title.properties" );

for (local.languageKey in local.stTitle) {

local.i18n[local.languageKey].append( local.stTitle[local.languageKey] ); // titles are here
}

for (local.languageKey in local.i18n) {
CachePut(local.languageKey, local.i18n[local.languageKey], 1, 1, application.Bootstrap.cache.language);
}

}

invoke("views._bootstrap.bootstrap", "setupRequest");
} // end setupRequest


Expand Down
11 changes: 9 additions & 2 deletions controllers/supportController.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ component accessors="true" {
property beanFactory;
property framework;

property healthService;
property uploadService;
property gsService;


void function health(required struct rc) output="false" {

rc.sessioncount = healthService.getSessionCount();
rc.runningApps = healthService.getRunningApplications();
rc.stSiteInfo = healthService.getSiteInfo();

rc.version = gsService.get_site_version();
}


void function after(require struct rc) {
void function after(require struct rc) output="false" {

variables.framework.setLayout("pages");
}
Expand Down
16 changes: 12 additions & 4 deletions layouts/default.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/css/bootstrap.min.css" rel="stylesheet">
</cfcase>
<cfdefaultcase>
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/<cfoutput>#lcase(session.bootswatch)#</cfoutput>/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/<cfoutput>#lcase(session.bootswatch)#</cfoutput>/bootstrap.min.css" rel="stylesheet">
</cfdefaultcase>
</cfswitch>

<!--- Support for all icon libraries. It is recommended that you choose one --->
<!--- Glypicons are built into Bootstrap --->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" rel="stylesheet">


<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">


<link href="https://cdnjs.cloudflare.com/ajax/libs/awesome-bootstrap-checkbox/0.3.4/awesome-bootstrap-checkbox.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.10.8/css/dataTables.bootstrap.min.css" rel="stylesheet">

Expand All @@ -41,7 +49,7 @@
<b:outputStyleSheet library="vendor" name="bootstrap-wysiwyg.css" />
<b:outputStyleSheet library="vendor" name="material.css" />

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>


<cfswitch expression="#session.bootswatch#">
Expand Down Expand Up @@ -143,7 +151,7 @@ padding-top: 50px;


</b:container>
</body>




Expand Down
65 changes: 32 additions & 33 deletions layouts/docs.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@




<b:navBar brand="Bootstrap for ColdFusion" fixed="top" inverse="true" style="background-image : linear-gradient(45deg, ##0A1855 0px, ##DA0024 100%)">
<b:navbarLinks>

<b:dropMenu value="Getting Started">
<b:navLink key="Introduction" href="~/docs/getting_started" active="#IIF(getItem() EQ 'getting_started', 1, 0)#" />
<b:navLink value="Setup" href="~/docs/setup" />
<b:navLink value="I18n" href="~/docs/i18n" />
<b:navLink value="Directory Structure" href="~/docs/structure" />
<b:navLink value="Smart tags & common features" href="~/common" />
<b:navLink value="Antisamy" href="~/docs/antisamy" />
<b:navLink value="Cacheing" href="~/docs/cache" />
<b:navLink key="Installation" active="#getItem().find('getting_started')#" href="~/docs/getting_started" />
<b:navLink value="Setup" active="#getItem().find('setup')#" href="~/docs/setup" />
<b:navLink value="I18n" active="#getItem().find('i18n')#" href="~/docs/i18n" />
<b:navLink value="Directory Structure" active="#getItem().find('structure')#" href="~/docs/structure" />
<b:navLink value="Smart tags & common features" active="#getItem().find('common')#" href="~/common" />
<b:navLink value="Antisamy" active="#getItem().find('antisamy')#" href="~/docs/antisamy" />
<b:navLink value="Cacheing" active="#getItem().find('cache')#" href="~/docs/cache" />

<!---
<b:navLink />
Expand All @@ -23,37 +24,35 @@


<b:dropMenu value="CSS" active="#ArrayContains(['grid','typography','tables','forms','select','awesomecheckbox','buttons','helper'], getItem())#">
<b:navLink value="Grid system" href="~/docs/grid" icon="th-large" />
<b:navLink value="Typography" href="~/docs/typography" />
<b:navLink value="Tables" href="~/docs/tables" icon="th" />
<b:navLink value="Forms" href="~/docs/forms" />
<b:navLink value="Select, Checkbox, Radio" href="~/docs/select" />
<b:navLink value="Awesome Bootstrap Checkboxes" href="~/docs/awesomecheckbox" />
<b:navLink value="Buttons & Links" href="~/docs/buttons" />
<b:navLink value="Helper classes" href="~/docs/helper" />
<b:navLink value="Grid system" active="#getItem().find('grid')#" href="~/docs/grid" icon="th-large" />
<b:navLink value="Typography" active="#getItem().find('typography')#" href="~/docs/typography" />
<b:navLink value="Tables" active="#getItem().find('tables')#" href="~/docs/tables" icon="th" />
<b:navLink value="Forms" active="#getItem().find('forms')#" href="~/docs/forms" />
<b:navLink value="Select, Checkbox, Radio" active="#getItem().find('select')#" href="~/docs/select" />
<b:navLink value="Awesome Bootstrap Checkboxes" active="#getItem().find('awesomecheckbox')#" href="~/docs/awesomecheckbox" />
<b:navLink value="Buttons & Links" active="#getItem().find('buttons')#" href="~/docs/buttons" />
<b:navLink value="Material Colors & Helper classes" active="#getItem().find('helper')#" href="~/docs/helper" />
</b:dropMenu>

<b:dropMenu value="Components" active="#ArrayContains(['icons','dropdowns','buttonGroups','nav','label','jumbotron','thumbnail','alert','progress','panel','include'], getItem())#">
<b:navLink value="Icons" href="~/docs/icons" icon="picture" />
<b:navLink value="Dropdowns" href="~/docs/dropdowns" />
<b:navLink value="Button groups" href="~/docs/buttonGroups" />
<b:navLink value="Navs" href="~/docs/nav" />
<b:navLink value="Labels & Badges" href="~/docs/label" />
<b:navLink value="Jumbotron" href="~/docs/jumbotron" />
<b:navLink value="Images" href="~/docs/image" icon="picture" />
<b:navLink value="Alerts" href="~/docs/alert" icon="list-alt" />
<b:navLink value="Progress Bars" href="~/docs/progress" icon= "tasks" />
<b:navLink value="Panels & Wells" href="~/docs/panel" />
<b:navLink value="Include" href="~/docs/include" />
<b:navLink value="Icons" active="#getItem().find('icons')#" href="~/docs/icons" icon="picture" />
<b:navLink value="Dropdowns" active="#getItem().find('dropdowns')#" href="~/docs/dropdowns" />
<b:navLink value="Button groups" active="#getItem().find('buttonGroups')#" href="~/docs/buttonGroups" />
<b:navLink value="Navs" active="#getItem().find('nav')#" href="~/docs/nav" />
<b:navLink value="Labels & Badges" active="#getItem().find('label')#" href="~/docs/label" />
<b:navLink value="Jumbotron" active="#getItem().find('jumbotron')#" href="~/docs/jumbotron" />
<b:navLink value="Images" active="#getItem().find('image')#" href="~/docs/image" icon="picture" />
<b:navLink value="Alerts" active="#getItem().find('alert')#" href="~/docs/alert" icon="list-alt" />
<b:navLink value="Progress Bars" active="#getItem().find('progress')#" href="~/docs/progress" icon= "tasks" />
<b:navLink value="Panels & Wells" active="#getItem().find('panel')#" href="~/docs/panel" />
<b:navLink value="Include" active="#getItem().find('include')#" href="~/docs/include" />
</b:dropMenu>

<b:dropMenu value="JavaScript" active="#ArrayContains(['wysiwyg','modal','tab','poll'], getItem())#">
<b:navLink value="WYSIWIG Editor" href="~/docs/wysiwyg" icon="pencil" />
<b:navLink value="Modal" href="~/docs/modal" icon="modal-window" />
<b:navLink value="Tab" href="~/docs/tab" icon="folder-close" />
<b:navLink value="Poll" href="~/docs/poll" icon="refresh" />
<b:navLink />
<b:navLink value="Head, JS, & CSS tags" href="~/docs/setup" />
<b:navLink value="WYSIWIG Editor" active="#getItem().find('wysiwyg')#" href="~/docs/wysiwyg" icon="pencil" />
<b:navLink value="Modal" active="#getItem().find('model')#" href="~/docs/modal" icon="modal-window" />
<b:navLink value="Tab" active="#getItem().find('tab')#" href="~/docs/tab" icon="folder-close" />
<b:navLink value="Poll" active="#getItem().find('poll')#" href="~/docs/poll" icon="refresh" />
</b:dropMenu>


Expand All @@ -63,7 +62,7 @@
<b:navLink />
<b:navLink header="By Bootswatch"/>
<cfloop index="rc.i" list="Cerulean,Cosmo,Cyborg,Darkly,Flatly,Journal,Lumen,Paper,Readable,Sandstone,Simplex,Slate,Spacelab,Superhero,United,Yeti">
<b:navLink href="~/bootswatch/#rc.i#" binding="i" disabled="#IIF(session.bootswatch EQ rc.i , 1, 0)#" />
<b:navLink href="~/bootswatch/#rc.i#" value="#rc.i#" active="#session.bootswatch.find(rc.i)#" />
</cfloop>
</b:dropMenu>

Expand Down
2 changes: 1 addition & 1 deletion layouts/pages.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<b:navbarLinks>
<b:dropMenu key="tab_Pages" active="#IIF(getSection() EQ 'pages', 1, 0)#">
<b:navLink value="View All Pages" href="~/pages" active="#IIF(getSection() EQ 'pages' AND getItem() EQ 'home', 1, 0)#" />
<b:navLink value="Create New Page" href="~/pages/edit" active="#IIF(getSection() EQ 'pages' AND getItem() EQ 'edit' AND rc.slug EQ '', 1, 0)#" />
<b:navLink value="Create New Page" href="~/edit" active="#IIF(getSection() EQ 'pages' AND getItem() EQ 'edit' AND rc.slug EQ '', 1, 0)#" />
<b:navLink value="Edit Page" processed="#IIF(getSection() EQ 'pages' AND getItem() EQ 'edit' AND rc.slug NEQ '', 1, 0)#" active="1" />
<b:navLink value="Menu Manager" href="~/pages/menu" active="#IIF(getSection() EQ 'pages' AND getItem() EQ 'menu', 1, 0)#" />
</b:dropMenu>
Expand Down
55 changes: 55 additions & 0 deletions model/services/health.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
component {



numeric function getSessionCount() output="false" {
local.oSession = createObject("java","coldfusion.runtime.SessionTracker");
return local.oSession.getSessionCount();
}


numeric function getApplicationSessionCount(required string appName) output="false" {
local.oSession = createObject("java","coldfusion.runtime.SessionTracker");
local.mySessions= local.oSession.getSessionCollection(arguments.appName);
return StructCount(mySessions);
}


array function getRunningApplications() output="false" {

var oApp = createObject("java","coldfusion.runtime.ApplicationScopeTracker");
var applications = oApp.getApplicationKeys();
var availApps = ArrayNew(1);

while (applications.hasNext()) {
availApps.append(applications.next());
}

return availApps;
}



/* System functions. Use sparingly */
struct function getSiteInfo() output="false" {

var oSystem = createObject('java','java.lang.System');
var jremodel = oSystem.getProperty("sun.arch.data.model");
var allProp = oSystem.getProperties();



var stResult = {CFVERSION = server.ColdFusion.ProductVersion,
CFLEVEL = server.ColdFusion.ProductLevel,
JREBIT = allProp["sun.arch.data.model"],
JREVENDOR = allProp["java.vendor"],
JRENAME = allProp["java.runtime.name"],
JREVERSION = allProp["java.runtime.version"] };

return stResult;
}



}

Loading

0 comments on commit 7cda9cc

Please sign in to comment.