@import "custom/weather/weather";
@import "custom/nextgen/nextgen";
@import "custom/glma/glm-member-db";
-//@import "custom/glma/glm-member-db-events";
+@import "custom/glma/glm-member-db-events";
@import "custom/blocks/glm-blocks";
@import "custom/action-items/action-items";
@import "custom/svg-map/svg-map";
--- /dev/null
+$(function() {
+ console.log( "action items!" );
+});
\ No newline at end of file
+++ /dev/null
-$(function() {
- console.log( "action items!" );
-});
\ No newline at end of file
--- /dev/null
+<div id="events-sidebar" class="">
+ <h1 class="events-sidebar-title" >Events Calendar</h1>
+ <?php echo do_shortcode("[glm-members-event-list template='eventsFrontPage.html' limit=3]"); ?>
+ <?php ?>
+ <a class="button" id="calendar-link" href="<?php echo get_permalink();?>">View All Events</a>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="wp_login_error">
+ <p id="glm-member-login-notification">
+ <?php if( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) { ?>
+ The information you entered is incorrect. Please try again.
+ <?php }
+ else if( isset( $_GET['login'] ) && $_GET['login'] == 'empty' ) { ?>
+ Please enter both username and password.
+ <?php } else { ?>
+ <?php $glmAssociateConfig = apply_filters('glm_associate_config', null);
+ $supportEmail = $glmAssociateConfig['settings']['members_only_support_email'];
+ $supportPhone = $glmAssociateConfig['settings']['members_only_support_phone'];
+ $glmTerm = $glmAssociateConfig['terms']['term_member'];
+ ?>
+ Please log in with your <?php echo $glmTerm; ?> username and password.
+
+ <?php if ($supportEmail || $supportPhone) {
+ echo "<br>If you need assistance, ";
+ if ($supportEmail) {
+ echo "email (".$supportEmail.")";
+ if ($supportPhone) {
+ echo " or ";
+ }
+ }
+ if ($supportPhone) {
+ echo "call (".$supportPhone.")";
+ }
+ }
+ ?>
+ <?php } ?>
+ </p>
+ </div>
+ <div id='glm-member-login-form'>
+ <?php
+ update_option('glm_members_database_frontend_login_request', 'true');
+ $args = array(
+ 'echo' => false,
+ 'form_id' => 'glm_login_form'
+ );
+ $loginForm = wp_login_form($args);
+ $captcha = apply_filters('cptch_display', '', 'glm_login_form');
+ $form = str_replace( '<p class="login-remember">', $captcha . '<p class="login-remember">', $loginForm );
+ echo $form;
+ ?>
+</div>
+<?php get_template_part('parts/glm-members-only-lostpass-form'); ?>
--- /dev/null
+<a id="glm-member-password-lost-link" title="Lost Password">Lost Password?</a>
+ <div id="glm-member-password-lost-form">
+
+ <p>
+ <?php
+ _e(
+ "Enter your email address and we'll send you a link you can use to pick a new password.",
+ 'personalize_login'
+ );
+ ?>
+ </p>
+
+ <form id="lostpasswordform" action="<?php echo wp_lostpassword_url(); ?>" method="post">
+ <p class="form-row">
+ <label for="user_login"><?php _e( 'Email', 'personalize-login' ); ?>
+ <input type="text" name="user_login" id="user_login">
+ </p>
+
+ <p class="lostpassword-submit">
+ <input type="submit" name="submit" class="lostpassword-button"
+ value="<?php _e( 'Reset Password', 'personalize-login' ); ?>"/>
+ </p>
+ </form>
+ </div>
\ No newline at end of file
--- /dev/null
+<div id="glm-member-front-header" class="small-12 columns">
+ <?php if(function_exists('bcn_display') && !is_front_page()) {
+ echo "<div class='breadcrumbs small-12 medium-6 columns'>";
+ echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';
+ bcn_display();
+ echo "</div>";
+ } ?>
+ <div class="small-12 medium-6 columns members-only-buttons">
+ <a class='button glm-button' href="<?php echo wp_logout_url( home_url() ); ?>">Logout</a>
+ <?php if (current_user_can("glm_members_member")) { ?>
+ <?php $glmAssociateTerms = apply_filters('glm_associate_terms', "");?>
+ <?php apply_filters('glm_associate_terms', $glmAssociateTerms);?>
+ <a class='button glm-button' href='<?php echo get_admin_url(); ?>'>Enter <?php echo $glmAssociateTerms['term_member_cap']; ?> Admin Area</a>
+ <?php } ?>
+ </div>
+</div>
\ No newline at end of file
+++ /dev/null
-<div id="events-sidebar" class="">
- <h1 class="events-sidebar-title" >Events Calendar</h1>
- <?php echo do_shortcode("[glm-members-event-list template='eventsFrontPage.html' limit=3]"); ?>
- <?php ?>
- <a class="button" id="calendar-link" href="<?php echo get_permalink();?>">View All Events</a>
-</div>
\ No newline at end of file
+++ /dev/null
-<div class="wp_login_error">
- <p id="glm-member-login-notification">
- <?php if( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) { ?>
- The information you entered is incorrect. Please try again.
- <?php }
- else if( isset( $_GET['login'] ) && $_GET['login'] == 'empty' ) { ?>
- Please enter both username and password.
- <?php } else { ?>
- <?php $glmAssociateConfig = apply_filters('glm_associate_config', null);
- $supportEmail = $glmAssociateConfig['settings']['members_only_support_email'];
- $supportPhone = $glmAssociateConfig['settings']['members_only_support_phone'];
- $glmTerm = $glmAssociateConfig['terms']['term_member'];
- ?>
- Please log in with your <?php echo $glmTerm; ?> username and password.
-
- <?php if ($supportEmail || $supportPhone) {
- echo "<br>If you need assistance, ";
- if ($supportEmail) {
- echo "email (".$supportEmail.")";
- if ($supportPhone) {
- echo " or ";
- }
- }
- if ($supportPhone) {
- echo "call (".$supportPhone.")";
- }
- }
- ?>
- <?php } ?>
- </p>
- </div>
- <div id='glm-member-login-form'>
- <?php
- update_option('glm_members_database_frontend_login_request', 'true');
- $args = array(
- 'echo' => false,
- 'form_id' => 'glm_login_form'
- );
- $loginForm = wp_login_form($args);
- $captcha = apply_filters('cptch_display', '', 'glm_login_form');
- $form = str_replace( '<p class="login-remember">', $captcha . '<p class="login-remember">', $loginForm );
- echo $form;
- ?>
-</div>
-<?php get_template_part('parts/glm-members-only-lostpass-form'); ?>
+++ /dev/null
-<a id="glm-member-password-lost-link" title="Lost Password">Lost Password?</a>
- <div id="glm-member-password-lost-form">
-
- <p>
- <?php
- _e(
- "Enter your email address and we'll send you a link you can use to pick a new password.",
- 'personalize_login'
- );
- ?>
- </p>
-
- <form id="lostpasswordform" action="<?php echo wp_lostpassword_url(); ?>" method="post">
- <p class="form-row">
- <label for="user_login"><?php _e( 'Email', 'personalize-login' ); ?>
- <input type="text" name="user_login" id="user_login">
- </p>
-
- <p class="lostpassword-submit">
- <input type="submit" name="submit" class="lostpassword-button"
- value="<?php _e( 'Reset Password', 'personalize-login' ); ?>"/>
- </p>
- </form>
- </div>
\ No newline at end of file
+++ /dev/null
-<div id="glm-member-front-header" class="small-12 columns">
- <?php if(function_exists('bcn_display') && !is_front_page()) {
- echo "<div class='breadcrumbs small-12 medium-6 columns'>";
- echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';
- bcn_display();
- echo "</div>";
- } ?>
- <div class="small-12 medium-6 columns members-only-buttons">
- <a class='button glm-button' href="<?php echo wp_logout_url( home_url() ); ?>">Logout</a>
- <?php if (current_user_can("glm_members_member")) { ?>
- <?php $glmAssociateTerms = apply_filters('glm_associate_terms', "");?>
- <?php apply_filters('glm_associate_terms', $glmAssociateTerms);?>
- <a class='button glm-button' href='<?php echo get_admin_url(); ?>'>Enter <?php echo $glmAssociateTerms['term_member_cap']; ?> Admin Area</a>
- <?php } ?>
- </div>
-</div>
\ No newline at end of file
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
- "dev": true
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"base": {
"version": "0.11.2",
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
- "dev": true,
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
- "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
- "dev": true
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.2",
"integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==",
"dev": true
},
+ "node-dir": {
+ "version": "0.1.17",
+ "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz",
+ "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=",
+ "requires": {
+ "minimatch": "3.0.4"
+ },
+ "dependencies": {
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "requires": {
+ "brace-expansion": "1.1.11"
+ }
+ }
+ }
+ },
"node-gyp": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz",
"node-sass": "^3.8.0"
},
"dependencies": {
- "merge-stream": "^1.0.1"
+ "merge-stream": "^1.0.1",
+ "node-dir": "^0.1.17"
}
}
<body>
<h3>GLM Origin Theme Setup</h3>
<div id="module-list-container">
- <ul id="module-list"></ul>
</div>
<script src="renderer.js"></script>
</body>
const path = require('path');
const fs = require('fs');
const merge = require('merge-stream');
-
+const dir = require('node-dir');
+const appState = {};
+// PHP Functions File Libraries index file
var functionsFileReader = require('readline').createInterface({
input: require('fs').createReadStream('dev/modules.php')
});
-
+// Sass File Imports index file
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream('dev/app.scss')
});
-
+String.prototype.stringFromToken = function(position, token, lastToken = false){
+ if(lastToken && position === 'before'){
+ return this.substr(0, this.lastIndexOf(token))
+ }else if(lastToken && !postition === 'before'){
+ return this.substr(this.lastIndexOf(token) + 1);
+ }else {
+ if(position === 'before'){
+ return this.substr(0, this.indexOf(token))
+ }else{
+ return this.substr(this.indexOf(token)+1)
+ }
+ }
+}
String.prototype.stripSlashes = function(){
return this.replace(/\\(.)/mg, "$1");
}
-
-// Display Active and In-Active Modules
-let modName = '';
-function readLines(mode, state){
- if(mode === 'parse'){
- lineReader.on('line', function (line) {
- parseModules(this, line);
- });
- // activate or deactivate the JS files for each module
- functionsFileReader.on('line', function (line) {
- parsePhpLibs(this, line)
- });
-
- // functionsFileReader.on('line', function (line) {
- // parseModules(this, line);
- // });
- }else if( mode === "edit"){
- fs.readFile(state.path, 'utf8', function (err,data) {
- var result;
- if (err) {
- return console.log(err);
- }
- if(state.active){
- var newLine = state.line.substr(2);
- }else{
- var newLine = "//" + state.line;
- }
- result = data.replace(state.line, newLine);
- state.line = newLine;
- localStorage.setItem(state.name, JSON.stringify(state));
-
- fs.writeFile(state.path, result, 'utf8', function (err) {
- if (err) return console.log(err);
- });
- });
- }
+function setModules(modType,modName){
+ appState[modType] = modName;
+ return appState;
}
-let modList = $("#module-list");
-function parseModules(reader,line){
- let active = true;
- if(!line.match(/[^ ]/) || line.startsWith('/*') || line.startsWith('<?php') || line.startsWith('?>')){
- // nothing
- }else{
- if(line.startsWith('//')){
- modName = line.substr(line.lastIndexOf('/') + 1);
- modName = modName.replace(/[^\w\s\-]/gi, '')
- active = false;
- }else if(!line.startsWith('//')){
- if(line.indexOf("/") > -1){
- modName = line.substr(line.lastIndexOf('/') + 1);
- modName = modName.replace(/[^\w\s\-]/gi, '')
- }else if(line.indexOf(" ") > -1){
- modName = line.match( /"(.*?)"/ )[1];
- }
- active = true;
- }
-
- localStorage.setItem(modName, JSON.stringify({path: reader.input.path, line: line, modName: modName, active: active}))
- $('<li />', {
- class: `module-item module-active-${active}`,
- id: `${modName}`,
- text: `${modName}`
- }).appendTo(modList)
- }
+function storeModules(appState){
+ localStorage.setItem("app", JSON.stringify(appState));
}
-// true is used for init parsing of theme modules, edit is to activate or de-activate modules
-// true is called initially when scanning the app.scss file for commented modules
-// edit is called when selectively activating and de-activating modules from the GUI
-// last param is the path to the file to be editted since we can't use the readLine Stream again (idk how yet)
-function scanModules(parse, edit, state){
- if(parse) {
- readLines("parse");
- }else if(edit){
- readLines("edit", state)
- }
+function getModuleTypes(modules){
+ return Object.keys(modules)
}
-
-scanModules(true, false, false);
-
-
-// On Click Set Mod State
-$(document).on("click", ".module-item", function(){
- let _ = $(this);
- let modName = _.attr("id");
- let thisMod = JSON.parse(localStorage.getItem(modName))
-
- let moduleLocation = `dev/${thisMod.line.split("import ").pop().replace(/[;'"]+/g, '')}`;
- let state = {path: thisMod.path, line: thisMod.line, name: modName}
-
- if( _.hasClass("module-active-true") ){
- state.active = false;
- _.removeClass("module-active-true");
- _.addClass("module-active-false");
- }else if( _.hasClass("module-active-false") ){
- state.active = true;
- _.removeClass("module-active-false");
- _.addClass("module-active-true");
+function getModules(){
+ return JSON.parse(localStorage.getItem("app"));
+}
+function getModuleByName(modName){
+ let mods = JSON.parse(localStorage.getItem("app")), newMods = [];
+ for(modType in mods){
+ newMods.push(getModulesByType(modType).filter(function(mod){
+ return mod.name == modName;
+ }))
}
+ return newMods[0].concat(newMods[1])[0];
+}
- scanModules(false, true , state)
-
- // Activate or De-Activate JS Files
- let jsFile = path.join(__dirname, `../${moduleLocation}.js`);
- let newJsFile = jsFile+'.off';
- fs.exists(jsFile, function(exists) {
- if(exists){
- fs.rename(jsFile, newJsFile, function(err){
- if (err) throw err;
- });
- }
+// Returns an array of Modules
+function getModulesByType(moduleType){
+ let appState = JSON.parse(localStorage.getItem("app"));
+ return appState[moduleType];
+}
+function getDevDirs(){
+ let fullPath = path.join(__dirname, `../dev`);
+ fs.readdir(fullPath, function(err, item) {
+ console.log(item)
});
- fs.exists(newJsFile, function(exists) {
- if(exists){
- fs.rename(newJsFile, jsFile, function(err){
- if (err) throw err;
+}
+function buildList(){
+ getModuleTypes(getModules()).forEach(function(modType){
+ $(`<h2 id="${modType}-title">${modType} </h2>`).appendTo( $("#module-list-container"));
+ $(`<ul class="module-list" id="${modType}-modules" />`).insertAfter( $(`#${modType}-title`));
+ getModulesByType(modType).forEach(function(mod){
+ $('<li>', {
+ text : mod.name,
+ class : `module-item module-active`,
+ id : `${mod.name}-module`,
+ "data-type" : modType
+ }).appendTo( $(`#${modType}-modules`) );
+ })
+ })
+}
+function scanDev(){
+ ['dev/core', 'dev/custom'].forEach(function(dirPath) {
+ let modType = dirPath.stringFromToken('after', "/");
+ let fullPath = path.join(__dirname, `../${dirPath}`);
+ let mods = [];
+ fs.readdir(fullPath, function(err, item) {
+ item.forEach(function(modName){
+ mods.push({name: modName, active: true, path: `${fullPath}/${modName}`});
});
- }
- });
-})
\ No newline at end of file
+ storeModules(setModules(modType,mods));
+ });
+ })
+}
+$(document).on("click", '.module-item', function(){
+ let modName = $(this).attr('id').stringFromToken('before', '-', true);
+ let dataType = $(this).data('type');
+ let thisModule = getModuleByName(modName);
+ console.log(getModuleByName(modName))
+});
+scanDev();
+buildList();
\ No newline at end of file
#module-list-container{
}
-#module-list-container ul#module-list{
+#module-list-container ul.module-list{
list-style-type: none;
padding: 0;
}
-#module-list-container ul#module-list li.module-item{
+#module-list-container ul.module-list li.module-item{
padding: 5px 8px;
margin: 5px;
display: inline-block;
}
-#module-list-container ul#module-list li.module-item:hover{
+#module-list-container ul.module-list li.module-item:hover{
cursor: pointer;
}
-#module-list-container ul#module-list li.module-item.module-active-true{
+#module-list-container ul.module-list li.module-item.module-active{
background: lightgreen;
}
-#module-list-container ul#module-list li.module-item.module-active-false{
+#module-list-container ul.module-list li.module-item.module-inactive{
background: tomato;
}
\ No newline at end of file