//
//dropdown for categories
echo '<select id="category-scDropdown">';
- echo '<option value=""> Select Category </option>';
+ echo '<option> Select Category </option>';
foreach($list as $key=>$value){
echo '<option value='. $key . '>' . $value['name'] . '</option>';
}
// // dropdown for blank start
echo '<select id="blank-start-scDropdown">';
- echo '<option value=""> Blank Start </option>
- <option selected="selected" value="False"> False </option>
- <option value = "True"> True </option>';
+ echo '<option> Blank Start </option>
+ <option value="False"> False </option>
+ <option value="True"> True </option>';
echo '</select>';
// show list options 'scb' = shortcode builder acronym
echo '<div id="showList" title="List Options">';
- echo '<label><input class="listBox" type="checkbox" name="list-scb" value="all">All</label>';
- echo '<label><input class="listBox" type="checkbox" name="list-scb" value="none">None</label>';
+ echo '<label><input class="showLists" type="checkbox" name="list-scb" value="all">All</label>';
+ echo '<label><input class="showLists" type="checkbox" name="list-scb" value="none">None</label>';
foreach($listAttr as $key=>$value){
if($value != ''){
echo '<label class="checkList"><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
// show detail options
echo '<div id="showDetail" title="Detail Options">';
- echo '<label><input class="detailBox" type="checkbox" name="detailBox" value="all">All</label>';
- echo '<label><input class="detailBox" type="checkbox" name="detailBox" value="none">None</label>';
+ echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="all">All</label>';
+ echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="none">None</label>';
foreach($detailAttr as $key=>$value){
if($value != ''){
echo '<label class="checkDetails"><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
*/
jQuery(document).ready(function ($) {
- var shortcodeDropdown, shortcodeCategory, blankStart, listBox, detailBox, target, shortcodeString;
+ var shortcodeDropdown, shortcodeCategory, blankStart, listBox, detailBox, target, boxTarget, shortcodeString;
var shortcodeValues = {};
$("#showDetail").hide();
$("#showList").hide();
// reset the dropdowns and checkbox if when switching shortcodes
document.getElementById('category-scDropdown').options[0].selected = 'selected';
document.getElementById('blank-start-scDropdown').options[0].selected = 'selected';
- document.getElementById('id-scDropdown').options[0].selected = 'selected';
+ if(document.getElementById('id-scDropdown').length > 0)
+ document.getElementById('id-scDropdown').options[0].selected = 'selected';
UncheckAll();
// delete the object properties to reset the object
var targetVal = $("#" + target + "-scDropdown option:selected").val();
shortcodeValues[target] = targetVal;
});
-
// use jquery dialog to separate the checkbox lists
$("#listBtn").on("click", function () {
$("#showList").dialog();
$("#detailBtn").on("click", function () {
$("#showDetail").dialog();
});
-
+
// generate the shortcode into a string and insert into the content upon clicking
$("#generate").on("click", function () {
// enforce the selection of a shortcode
// set up properties for shortcode lists
if(shortcodeDropdown === "glm-members-list"){
var listValues = $('input[name="listBox"]:checkbox:checked').map(function() {
- target = $(this).attr("class").slice(0, -5);
+ boxTarget = $(this).attr("class").slice(0, -5);
return this.value;
}).get();
-
+
var listString = "";
listValues.forEach(function(value){
listString += value + ",";
});
+
if(listValues !== ""){
listString = listString.replace(/,\s*$/, "");
- shortcodeValues[target] = listString;
+ console.log(target + "string:" + listString);
+ shortcodeValues[boxTarget] = listString;
}
+
// set up properties for detail shortcode
} else if( shortcodeDropdown === "glm-member-detail"){
var detailValues = $('input[name="detailBox"]:checkbox:checked').map(function() {
- target = $(this).attr("class").slice(0, -7);
+ boxTarget = $(this).attr("class").slice(0, -7);
return this.value;
}).get();
});
if(detailValues !== ""){
detailString = detailString.replace(/,\s*$/, "");
- shortcodeValues[target] = detailString;
+ shortcodeValues[boxTarget] = detailString;
}
}
-
// start the shortcode string that will be added to the tinymce editor
shortcodeString = "[" + shortcodeDropdown;
}
return false;
}
- }
insert_tag(shortcodeString);
+ }
} else {
alert("Please Select a Shortcode");
}
var catscd = document.getElementById('category-scDropdown');
var blank = document.getElementById('blank-start-scDropdown');
var list = document.getElementById('type-scList');
+ var members = document.getElementById('member-scDropdown');
if(scd){
window.onload = document.getElementById('shortcodeDropdown').options[0].selected = 'selected';
if(list){
window.onload = document.getElementById('type-scList').options[0].selected = 'selected';
}
+ if(members){
+ window.onload = document.getElementById('member-scDropdown').options[0].selected = 'selected';
+ }
window.onload = UncheckAll();
function UncheckAll(){