FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jsFiddle/ModuleConfig.cfc at master · contentbox-modules/jsFiddle · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
contentbox-modules
/
jsFiddle
Public
forked from
existdissolve/jsFiddle
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
jsFiddle
/
ModuleConfig.cfc
Copy path
More file actions
More file actions
Latest commit
History
History
History
119 lines (106 loc) · 4.05 KB
Breadcrumbs
jsFiddle
/
ModuleConfig.cfc
Copy path
File metadata and controls
119 lines (106 loc) · 4.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
Author : Joel Watson
Description :
This module allows you to add fiddles from jsFiddle.net
*
*/
component
{
//
Module Properties
this
.
title
=
"
jsFiddle
"
;
this
.
author
=
"
Joel Watson
"
;
this
.
webURL
=
"
http://existdissolve.com
"
;
this
.
description
=
"
Helps you embedd fiddles from jsFiddle
"
;
this
.
version
=
"
1.0
"
;
//
If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
this
.
viewParentLookup
=
true
;
//
If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this
.
layoutParentLookup
=
true
;
//
Module Entry Point
this
.
entryPoint
=
"
jsfiddle
"
;
this
.
alias
=
"
jsFiddle
"
;
function
configure
(){
//
module Settings
settings
=
{
//
Developer Key
"
width
"
=
"
100%
"
,
"
height
"
=
"
300px
"
,
"
cachetime
"
=
30
,
"
users
"
=
'
'
,
"
tabs
"
=
'
'
};
//
SES Routes
routes
=
[
//
Module Entry Point
{
pattern
=
"
/
"
,
handler
=
"
home
"
,
action
=
"
index
"
},
//
Convention Route
{
pattern
=
"
/:handler/:action?
"
}
];
//
Custom Declared Interceptors
interceptors
=
[
{
class
=
"
#
moduleMapping
#.interceptors.jsFiddle
"
,
name
=
"
jsFiddle
"
}
];
//
objects
binder
.
map
(
"
jsFiddle@jsFiddle
"
).
to
(
"
#
moduleMapping
#.model.jsFiddle
"
);
}
/**
* Fired when the module is registered and activated.
*/
function
onLoad
(){
//
Let's add ourselves to the main menu in the Modules section
var
menuService
=
controller
.
getWireBox
().
getInstance
(
"
AdminMenuService@cb
"
);
//
Add Menu Contribution
menuService
.
addSubMenu
(
topMenu
=
menuService
.
MODULES
,
name
=
"
jsFiddle
"
,
label
=
"
jsFiddle
"
,
href
=
"
#
menuService
.
buildModuleLink
(
'
jsFiddle
'
,
'
home.settings
'
)
#
"
);
//
Override settings?
var
settingService
=
controller
.
getWireBox
().
getInstance
(
"
SettingService@cb
"
);
var
args
=
{
name
=
"
cbox-jsfiddle
"
};
var
setting
=
settingService
.
findWhere
(
criteria
=
args
);
if
(
!
isNull
(
setting
) ){
//
override settings from contentbox custom setting
controller
.
getSetting
(
"
modules
"
).
jsFiddle
.
settings
=
deserializeJSON
(
setting
.
getvalue
() );
//
run process for updating user fiddles, if expired
var
jsFiddleService
=
controller
.
getWireBox
().
getInstance
(
"
jsFiddle@jsFiddle
"
);
jsFiddleService
.
updateUserFiddles
(
listToArray
(
controller
.
getSetting
(
"
modules
"
).
jsFiddle
.
settings
.
users
) );
}
}
/**
* Fired when the module is activated
*/
function
onActivate
(){
var
settingService
=
controller
.
getWireBox
().
getInstance
(
"
SettingService@cb
"
);
//
store default settings
var
findArgs
=
{
name
=
"
cbox-jsfiddle
"
};
var
setting
=
settingService
.
findWhere
(
criteria
=
findArgs
);
if
(
isNull
(
setting
) ){
var
args
=
{
name
=
"
cbox-jsfiddle
"
,
value
=
serializeJSON
(
settings
)};
var
jsFiddleSettings
=
settingService
.
new
(
properties
=
args
);
settingService
.
save
(
jsFiddleSettings
);
}
//
Install the ckeditor plugin
var
ckeditorPluginsPath
=
controller
.
getSetting
(
"
modules
"
)[
"
contentbox-admin
"
].
path
&
"
/modules/contentbox-ckeditor/includes/ckeditor/plugins/cbjsFiddle
"
;
var
pluginPath
=
moduleMapping
&
"
/includes/cbjsFiddle
"
;
directoryCopy
(
source
=
pluginPath
,
destination
=
ckeditorPluginsPath
,
recurse
=
true
);
}
/**
* Fired when the module is unregistered and unloaded
*/
function
onUnload
(){
//
Let's remove ourselves to the main menu in the Modules section
var
menuService
=
controller
.
getWireBox
().
getInstance
(
"
AdminMenuService@cb
"
);
//
Remove Menu Contribution
menuService
.
removeSubMenu
(
topMenu
=
menuService
.
MODULES
,
name
=
"
jsFiddle
"
);
}
/**
* Fired when the module is deactivated by ContentBox Only
*/
function
onDeactivate
(){
var
settingService
=
controller
.
getWireBox
().
getInstance
(
"
SettingService@cb
"
);
var
args
=
{
name
=
"
cbox-jsfiddle
"
};
var
setting
=
settingService
.
findWhere
(
criteria
=
args
);
if
(
!
isNull
(
setting
) ){
settingService
.
delete
(
setting
);
}
//
Uninstall the ckeditor plugin
var
ckeditorPluginsPath
=
controller
.
getSetting
(
"
modules
"
)[
"
contentbox-admin
"
].
path
&
"
/modules/contentbox-ckeditor/includes/ckeditor/plugins/cbjsFiddle
"
;
var
pluginPath
=
controller
.
getSetting
(
"
modules
"
)[
"
jsFiddle
"
].
path
&
"
/includes/cbjsFiddle
"
;
directoryDelete
(
path
=
ckeditorPluginsPath
,
recurse
=
true
);
}
}
Back
|
FazBrowse Home
|
New Git URL