| 1 |
var panel={ |
| 2 |
title:"Panel Shortcode", |
| 3 |
id :'oscitas-form-panel', |
| 4 |
pluginName: 'panel' |
| 5 |
}; |
| 6 |
(function() { |
| 7 |
_create_tinyMCE_options(panel); |
| 8 |
})(); |
| 9 |
|
| 10 |
function ebs_return_html_panel(pluginObj){ |
| 11 |
var form = jQuery('<div id="'+pluginObj.id+'" class="oscitas-container" title="'+pluginObj.title+'"><table id="oscitas-table" class="form-table">\ |
| 12 |
<tr>\ |
| 13 |
<th><label for="oscitas-type">Style</label></th>\ |
| 14 |
<td><select name="type" id="oscitas-panel-type">\ |
| 15 |
<option value="panel-default">Simple</option>\ |
| 16 |
<option value="panel-primary">Primary</option>\ |
| 17 |
<option value="panel-warning">Warning</option>\ |
| 18 |
<option value="panel-success">Success</option>\ |
| 19 |
<option value="panel-info">Information</option>\ |
| 20 |
<option value="panel-danger">Danger</option>\ |
| 21 |
</select><br />\ |
| 22 |
</td>\ |
| 23 |
</tr>\ |
| 24 |
<tr>\ |
| 25 |
<th><label for="oscitas-line">Show footer</label></th>\ |
| 26 |
<td><input type="checkbox" id="oscitas-panel-footer"/><br />\ |
| 27 |
</td>\ |
| 28 |
</tr>\ |
| 29 |
<tr>\ |
| 30 |
<th><label for="oscitas-panel-class">Custom Class:</label></th>\ |
| 31 |
<td><input type="text" name="line" id="oscitas-panel-class" value=""/><br />\ |
| 32 |
</td>\ |
| 33 |
</tr>\ |
| 34 |
</table>\ |
| 35 |
<p class="submit">\ |
| 36 |
<input type="button" id="oscitas-submit" class="button-primary" value="Insert Panel" name="submit" />\ |
| 37 |
</p>\ |
| 38 |
</div>'); |
| 39 |
return form; |
| 40 |
} |
| 41 |
function create_oscitas_panel(pluginObj){ |
| 42 |
var form=jQuery(pluginObj.hashId); |
| 43 |
|
| 44 |
var table = form.find('table'); |
| 45 |
|
| 46 |
|
| 47 |
// handles the click event of the submit button |
| 48 |
form.find('#oscitas-submit').click(function(){ |
| 49 |
// defines the options and their default values |
| 50 |
// again, this is not the most elegant way to do this |
| 51 |
// but well, this gets the job done nonetheless |
| 52 |
var cusclass=''; |
| 53 |
if(table.find('#oscitas-panel-class').val()!=''){ |
| 54 |
cusclass= ' class="'+table.find('#oscitas-panel-class').val()+'"'; |
| 55 |
} |
| 56 |
var shortcode = '['+$ebs_prefix+'panel style="'+table.find('#oscitas-panel-type').val()+ '"'+cusclass+']'; |
| 57 |
shortcode += '<br/>['+$ebs_prefix+'panel-header]<br/>Heading goes here<br/>[/'+$ebs_prefix+'panel-header]'; |
| 58 |
//shortcode += (table.find('#oscitas-panel-header').prop('checked')? '[panel-header]<br/>Heading goes here<br/>[/panel-header]': ''); |
| 59 |
shortcode += '<br/>['+$ebs_prefix+'panel-content]<br/>Content goes here<br/>[/'+$ebs_prefix+'panel-content]'; |
| 60 |
shortcode += (table.find('#oscitas-panel-footer').prop('checked')? '<br/>['+$ebs_prefix+'panel-footer]<br/>Footer goes here<br/>[/'+$ebs_prefix+'panel-footer]': ''); |
| 61 |
shortcode += '<br/>[/'+$ebs_prefix+'panel]'; |
| 62 |
|
| 63 |
// inserts the shortcode into the active editor |
| 64 |
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode); |
| 65 |
|
| 66 |
close_dialogue(pluginObj.hashId); |
| 67 |
}); |
| 68 |
} |
| 69 |
|
| 70 |
|