Solution Sections
This solution will be rolled out in several articles to show the additional features that can be added on as needed. There are a few components that you will need to implement this solution and this article will go over the basics.
So, let's go over the major components to implement this solution.
Here are all the components for the solution. We will not go over all of them only the ones highlighted in BLUE.
· Interface: A way to for the end user to input the require variables to make it work in their environment.
· Solution Info: This will allow you to display info about your solution like Title, Details, Site Name, Site URL, Author, and Version. (This will be done in a future article.)
· jQuery Loading: Since jQuery is a part of the solution a way to ensure jQuery is present with this solution.
· Variables: A way to capture the data captured through the interface and apply it to your code.
· Error Checking: Now that we have a interface for end users to enter the variables it would be good to check for errors and communicate errors when found. (This will be done in a future article.)
· Solution Code: Last is your solution code and tying it into the solution.
· Solution Tracking: This is a way to track how many times your solution is being used by others. (This will be done in a future article.)
Now let's begin.
Interface
The interface is the forward facing view that will transfer this to a no code solution for the end user. The interface was designed to be simple and easy for an end user to provide the needed information to make the solution work in their environment.
Essentially these are variables that tell the script/solution how to function. To the end user these are just values that need to be entered into something like a form, which most end users will relate to.
The Interface is a table where we identify the “option”, provide a place to enter the “value” and outline any “help” or parameters to guide the end user. With the interface you can now provide the end user more details about was is needed in a more concise way then ever before. So CEWP Solution Interface variable collection is broken out into three sections and they are as follows:
· Option: This field identifies the name for the option.
· Value: This field is where the end user will enter the value/variable. This field will also be a different color then the other fields to clearly indicate where information should be entered.
· Help: This field will outline details as to what is needed in the option, how to provide the information and/or what impact this will have on the solution.
Here is a sample view of how the interface can look.
The CEWP Interface window is divided up into three main areas. The three areas provide an overview, a place to get the variables needed for your solution and the last to display the solution. The third part cannont be hidden and so we must set an area aside to display and communicate to the end user not to make changes. Just something we have to work with when using the RTE.
The three sections:
1. Overview: Provide a place to give a general overview of the solution and what is needed in the options view.
2. Options: Provide a place to gather the options and communicate any help.
3. Solution View: Have a separate area where the solution html code will show. Cannot hide this so we separate it and communicate for the end user not to change anything.
So let's walk through the code to set this all up.
Overview
The overview section is simply a table. The Overview row provides a place to help the end user understand what they can do in this configuration and if there are any items that must get completed.

Code:
<table class="table" >
<thead class="thead">
<tr><th class="thTop th" colspan="2">[Name] - Configuration</th></tr>
</thead>
<tbody class="tbody">
<tr><td class="tdOverview">Overview</td><td class="tdOverviewField">[Comments]</td></tr>
</tbody>
</table>
Options
The options area is the heart of this interface, as it is where the end user will input all the critical information to make the solution work in a no code environment. So there are three rows provided for each option to make it as easy for the end user. We provide the following rows:
· Option: This field identifies the name for the option. Best to provide as descriptive a name as possible.
· Value: This field is where the end user will enter the value/variable. This field will also be a different color then the other fields.
· Help: This field will outline details as to what is needed in the option, how to provide the information and/or what impact this will have on the solution. This is the place to provide any details that will help the end user put the right information in.
To make this solution work properly and have as little conflict with other solution introduced on the same page there is one thing that will have to happen. The option(n) id found in the code below will have to be appended. Why you ask, because if two solutions using this interface were to be put on the same page id="option1" would be present twice and the wrong variable will be used in one of the solutions and cause a problem. So each solutions developer will need to option(n) with something unique. I have provided a random key generator that can be used to make option(n) unique for your solution.
Here is an example: option1-tOcWUW. You would then apply -tOcWUW to all option(n) found in the code. They can be found in the interface table and where we define the variables.
Unique ID Generator: Click to get unique code to add to options.
Code Before:
<tr><td class="tdOption">Option</td><td class="tdOptionField ">[Name]</td></tr>
<tr><td class="tdValue">Value</td><td id="option1-" class="tdValueField"></td></tr>
<tr><td class="tdHelp">Help</td><td class="tdHelpField">[Comments]</td></tr>
<tr><td class="tdOption">Option</td><td class="tdOptionField ">[Name]</td></tr>
<tr><td class="tdValue">Value</td><td id="option2-" class="tdValueField"></td></tr>
<tr><td class="tdHelp">Help</td><td class="tdHelpField">[Comments]</td></tr>
Code After applying the unique identifier:
<tr><td class="tdOption">Option</td><td class="tdOptionField ">[Name]</td></tr>
<tr><td class="tdValue">Value</td><td id="option1-tOcWUW" class="tdValueField"></td></tr>
<tr><td class="tdHelp">Help</td><td class="tdHelpField">[Comments]</td></tr>
<tr><td class="tdOption">Option</td><td class="tdOptionField ">[Name]</td></tr>
<tr><td class="tdValue">Value</td><td id="option2-tOcWUW" class="tdValueField"></td></tr>
<tr><td class="tdHelp">Help</td><td class="tdHelpField">[Comments]</td></tr>
The CEWP Solution Interface can have as many options as you would like to add. The template I provide comes with 10 options, but can be expanded as needed.
jQuery Option
jQuery is used throughout this solution and so it is critical that the jQuery is loaded. Some end users must define where jQuery is inhouse and so we give the option for the end user to define that. To start off with, jQuery is being pulled from Google and you will see further below in the section called jQuery Load how we address an issue if the end user deletes the reference to jQuery. I have tried to make this as bullet proof as possible.
Code:
<tr><td class="tdOption">Option</td><td class="tdOptionField">jQuery File</td></tr>
<tr><td class="tdValue">Value</td><td id="jQueryJS" class="tdValueField">http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js</td></tr>
<tr><td class="tdHelp">Help</td><td class="tdHelpField">Only change this option if you want to use a local copy of the jQuery file.</td></tr>
Closing
When editing with RTE the end user will see all HTML in a WYSIWYG environment. So that means that if your solution has HTML output, it will be viewed in the RTE. Best practice is to show all of this at the end of the interface, this way we can communicate to the end user not to make any changes to the information below this line. We add this last row to the table to complete the interface part.

code:
<tr><td class="tdBBorder line" colspan="2">---- Change only the gray boxes on this page. ----</td></tr>
Branding and Style
To make this work well, it was important that we make this visually appealing and clear to the end user how this interface should be used. We used CSS to accomplish this which will allow you to easily customize the look and feel if you like.
<style>
/* This CSS section covers the Configuration table. */
#configBox { display:none; }.table { margin: 1em; border-collapse: collapse; width:95%; }.th { padding: .3em; border: 1px #000 solid; border-bottom: 3px #000 solid; vertical-align:top; }.tdOverview { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; vertical-align:top; width: 50px; }.tdOverviewField { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; vertical-align:top; }.tdOption { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; border-top: 3px #000 solid; vertical-align:top; width: 50px; }.tdOptionField { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; border-top: 3px #000 solid; vertical-align:top; font-weight: bold; }.tdValue { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; vertical-align:top; width: 50px; }.tdValueField { padding: .3em; border: 1px #000 solid; border-bottom: 1px #000 solid; vertical-align:top; background: #DCDCDC; vertical-align:top; }.tdHelp { padding: .3em; border: 1px #000 solid; border-bottom: 3px #000 solid; vertical-align:top; width: 50px; }.tdHelpField { padding: .3em; border: 1px #000 solid; border-bottom: 3px #000 solid; vertical-align:top; }.thTop { font-size: 1.5em; }.thead { background: #6699CC; }.tbody { background: #CAE5FF; }
/* This CSS section covers the Do Not change area. */
.line { text-align: center; font-weight: bold; }#errors { padding: .3em; background-color : #F5D0A9 ; display : none ; margin : 10px ; width:500px; }
/* This CSS section covers the Solution Info table. */
.tableInfo { margin: 1em; border-collapse: collapse; width:500px; }.thInfo { padding: .1em; border: 1px #E6E6E6 solid; border-bottom: 3px #E6E6E6 solid; border-top: 3px #E6E6E6 solid; vertical-align:top; }.tdInfo { padding: .1em; border: 1px #E6E6E6 solid; border-bottom: 1px #E6E6E6 solid; vertical-align:top; }.tdInfoOption { padding: .1em; border: 1px #E6E6E6 solid; border-bottom: 1px #E6E6E6 solid; background-color: #E6E6E6; vertical-align:top; text-align:center; }.tdInfoOptionHeader { padding: .1em; border: 1px #E6E6E6 solid; border-bottom: 1px #E6E6E6 solid; background-color: #BDBDBD; vertical-align:top; text-align:center; font-weight:bold;}.tdInfoLabel { text-align:right; font-weight:bold; width: 100px; padding : .3em; border: 1px #E6E6E6 solid; border-bottom: 1px #E6E6E6 solid; vertical-align:top; }
</style>