Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c931f4
commit d42e2b0
Showing
13 changed files
with
459 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
(function() { | ||
tinymce.create('tinymce.plugins.GrShortcodes', { | ||
tinymce.PluginManager.add('GrShortcodes', function(editor, url) { | ||
|
||
init : function(ed, url) { | ||
}, | ||
createControl : function(n, cm) { | ||
function getValues() { | ||
var wf = []; | ||
|
||
if (n=='webform'){ | ||
var mlb = cm.createListBox('GR Web Form Shortcode', { | ||
title : 'GR Web Form Shortcode', | ||
onselect : function(v) { | ||
if (tinyMCE.activeEditor.selection.getContent() == '' && v != null){ | ||
var shortcode = '[grwebform url="' + v + '" css="on"/]'; | ||
tinyMCE.activeEditor.selection.setContent( shortcode ) | ||
} | ||
} | ||
}); | ||
if (my_webforms != null) { | ||
for (var i in my_webforms) { | ||
|
||
if (my_webforms != null && my_campaigns != null) { | ||
for (var i in my_webforms) { | ||
mlb.add(my_webforms[i].name + ' (' + my_campaigns[my_webforms[i].campaign].name + ')', my_webforms[i].url); | ||
} | ||
} | ||
else { | ||
mlb.add('No webforms', null); | ||
} | ||
var webforms = {}; | ||
var webform_name = (my_campaigns != null) ? my_webforms[i].name + ' (' + my_campaigns[my_webforms[i].campaign].name + ')' : my_webforms[i].name; | ||
|
||
webforms.text = webform_name; | ||
webforms.url = my_webforms[i].url; | ||
|
||
return mlb; | ||
wf.push(webforms); | ||
} | ||
} | ||
else { | ||
return [{text:"No web forms", url:null}]; | ||
} | ||
return null; | ||
return wf; | ||
} | ||
|
||
editor.addButton('GrShortcodes', { | ||
type: 'listbox', | ||
title: 'GetResponse Web form integration', | ||
text: 'GR Web form', | ||
values: getValues(), | ||
onselect: function(v) { | ||
if (v.control.settings.url != null && v.control.settings.text != 'No web forms') { | ||
var shortcode = '[grwebform url="' + v.control.settings.url + '" css="on"/]'; | ||
editor.insertContent(shortcode); | ||
} | ||
} | ||
}); | ||
}); | ||
tinymce.PluginManager.add('gr', tinymce.plugins.GrShortcodes); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(function() { | ||
tinymce.create('tinymce.plugins.GrShortcodes', { | ||
|
||
init : function(ed, url) { | ||
}, | ||
createControl : function(n, cm) { | ||
if (n=='GrShortcodes'){ | ||
var mlb = cm.createListBox('GR Web Form Shortcode', { | ||
title : 'GR Web Form Shortcode', | ||
onselect : function(v) { | ||
if (tinyMCE.activeEditor.selection.getContent() == '' && v != null){ | ||
var shortcode = '[grwebform url="' + v + '" css="on"/]'; | ||
tinyMCE.activeEditor.selection.setContent( shortcode ) | ||
} | ||
} | ||
}); | ||
|
||
if (my_webforms != null && my_campaigns != null) { | ||
for (var i in my_webforms) { | ||
mlb.add(my_webforms[i].name + ' (' + my_campaigns[my_webforms[i].campaign].name + ')', my_webforms[i].url); | ||
} | ||
} | ||
else if (my_webforms != null) { | ||
for (var i in my_webforms) { | ||
mlb.add(my_webforms[i].name, my_webforms[i].url); | ||
} | ||
} | ||
else { | ||
mlb.add('No webforms', null); | ||
} | ||
|
||
return mlb; | ||
} | ||
return null; | ||
} | ||
}); | ||
tinymce.PluginManager.add('GrShortcodes', tinymce.plugins.GrShortcodes); | ||
})(); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.