cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/broadcast.js +6 -3
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/cloudcms-server.iml +1 -0
- package/d1/index.js +629 -0
- package/d1/index.js.works +203 -0
- package/d1/package.json +86 -0
- package/d1/package.json.works +14 -0
- package/duster/helpers/sample/nyt.js +2 -1
- package/framework/controllers.js +4 -4
- package/index.js +21 -14
- package/insight/insight.js +1 -1
- package/launchpad/index.js +203 -11
- package/launchpad/launchers/cluster.js +103 -110
- package/launchpad/launchers/redis.js +70 -0
- package/launchpad/launchers/single.js +36 -22
- package/locks/locks.js +63 -9
- package/locks/providers/cluster.js +3 -1
- package/locks/providers/memory.js +10 -7
- package/locks/providers/redis.js +62 -82
- package/middleware/admin/admin.js +3 -3
- package/middleware/authentication/adapters/session.js +11 -8
- package/middleware/authentication/authentication.js +28 -16
- package/middleware/authentication/authenticators/default.js +5 -2
- package/middleware/authentication/authenticators/session.js +5 -2
- package/middleware/authentication/providers/saml.js +2 -2
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +63 -38
- package/middleware/awareness/plugins/api_event.js +105 -0
- package/middleware/awareness/plugins/editorial.js +8 -7
- package/middleware/awareness/plugins/resources.js +13 -5
- package/middleware/awareness/providers/abstract-async.js +107 -84
- package/middleware/awareness/providers/abstract.js +1 -1
- package/middleware/awareness/providers/memory.js +0 -14
- package/middleware/awareness/providers/redis.js +186 -279
- package/middleware/cache/cache.js +4 -2
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cache/providers/shared-memory.js +3 -3
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/driver-config/driver-config.js +0 -6
- package/middleware/form/form.js +3 -3
- package/middleware/modules/modules.js +17 -8
- package/middleware/perf/perf.js +3 -2
- package/middleware/proxy/proxy.js +8 -21
- package/middleware/stores/store.js +0 -1
- package/middleware/stores/stores.js +4 -4
- package/middleware/virtual-config/virtual-config.js +11 -11
- package/middleware/virtual-files/virtual-files.js +0 -3
- package/middleware/wcm/wcm.js +4 -4
- package/middleware/welcome/welcome.js +0 -3
- package/notifications/notifications.js +74 -12
- package/notifications/providers/kafka.js +182 -0
- package/notifications/providers/stomp.js +4 -0
- package/package.json +33 -30
- package/server/index.js +508 -416
- package/server/standalone.js +9 -0
- package/temp/clusterlock/index.js +3 -3
- package/temp/clusterlock/package.json +1 -1
- package/temp/passport-saml/LICENSE +23 -0
- package/temp/passport-saml/README.md +406 -0
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/index.js +6 -0
- package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
- package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
- package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
- package/temp/passport-saml/lib/node-saml/types.js +8 -0
- package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/utility.js +19 -0
- package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
- package/temp/passport-saml/lib/node-saml/xml.js +140 -0
- package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
- package/temp/passport-saml/lib/passport-saml/index.js +11 -0
- package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
- package/temp/passport-saml/lib/passport-saml/types.js +11 -0
- package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
- package/temp/passport-saml/package.json +96 -0
- package/util/auth.js +16 -10
- package/util/cloudcms.js +108 -120
- package/util/proxy-factory.js +103 -237
- package/util/redis.js +113 -0
- package/util/renditions.js +12 -6
- package/util/request.js +12 -6
- package/util/util.js +16 -2
- package/.last_command +0 -7
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/temp/memored/.jshintrc +0 -4
- package/temp/memored/README.md +0 -240
- package/temp/memored/demo/demo1.js +0 -37
- package/temp/memored/demo/demo2.js +0 -32
- package/temp/memored/gulpfile.js +0 -8
- package/temp/memored/index.js +0 -343
- package/temp/memored/package.json +0 -54
- package/temp/memored/spec/memored.spec.js +0 -265
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "memored",
|
|
3
|
-
"version": "0.0.4",
|
|
4
|
-
"description": "Shared in-memory module for cluster applications",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "gulp"
|
|
8
|
-
},
|
|
9
|
-
"author": {
|
|
10
|
-
"name": "Paquitosoft"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"cache",
|
|
15
|
-
"memory",
|
|
16
|
-
"shared"
|
|
17
|
-
],
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "https://github.com/PaquitoSoft/memored.git"
|
|
21
|
-
},
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/PaquitoSoft/memored/issues"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"async": "^0.9.0",
|
|
27
|
-
"chai": "^1.9.1",
|
|
28
|
-
"faker": "^1.1.0",
|
|
29
|
-
"gulp": "^3.8.7",
|
|
30
|
-
"gulp-mocha": "^1.0.0"
|
|
31
|
-
},
|
|
32
|
-
"gitHead": "37d1ab5e06ab4fc5d3ff99d36bf4be7cbe019567",
|
|
33
|
-
"homepage": "https://github.com/PaquitoSoft/memored",
|
|
34
|
-
"_id": "memored@0.0.4",
|
|
35
|
-
"_shasum": "70b21f1707cb28f04ea2ef9629109b75f8cf7791",
|
|
36
|
-
"_from": "memored@*",
|
|
37
|
-
"_npmVersion": "1.4.21",
|
|
38
|
-
"_npmUser": {
|
|
39
|
-
"name": "paquitosoft",
|
|
40
|
-
"email": "paquitosoftware@gmail.com"
|
|
41
|
-
},
|
|
42
|
-
"maintainers": [
|
|
43
|
-
{
|
|
44
|
-
"name": "paquitosoft",
|
|
45
|
-
"email": "paquitosoftware@gmail.com"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"dist": {
|
|
49
|
-
"shasum": "70b21f1707cb28f04ea2ef9629109b75f8cf7791",
|
|
50
|
-
"tarball": "http://registry.npmjs.org/memored/-/memored-0.0.4.tgz"
|
|
51
|
-
},
|
|
52
|
-
"directories": {},
|
|
53
|
-
"_resolved": "https://registry.npmjs.org/memored/-/memored-0.0.4.tgz"
|
|
54
|
-
}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* global describe, after, it */
|
|
4
|
-
var cluster = require('cluster'),
|
|
5
|
-
expect = require('chai').expect,
|
|
6
|
-
faker = require('faker'),
|
|
7
|
-
async = require('async'),
|
|
8
|
-
memored = require('../index.js');
|
|
9
|
-
|
|
10
|
-
function _createUser() {
|
|
11
|
-
return {
|
|
12
|
-
firstName: faker.Name.findName(),
|
|
13
|
-
lastName: faker.Name.lastName(),
|
|
14
|
-
email: faker.Internet.email(),
|
|
15
|
-
address: {
|
|
16
|
-
streetAddress: faker.Address.streetName() + ' - ' + faker.Address.streetAddress(),
|
|
17
|
-
zipCode: faker.Address.zipCode(),
|
|
18
|
-
city: faker.Address.city()
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('Memored test suite', function() {
|
|
24
|
-
|
|
25
|
-
if (cluster.isMaster) {
|
|
26
|
-
cluster.fork();
|
|
27
|
-
|
|
28
|
-
describe('Memored - purge', function() {
|
|
29
|
-
|
|
30
|
-
var mockedData = [
|
|
31
|
-
{
|
|
32
|
-
key: 'mock1',
|
|
33
|
-
value: _createUser(),
|
|
34
|
-
ttl: 25
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'mock2',
|
|
38
|
-
value: _createUser(),
|
|
39
|
-
ttl: 75
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
key: 'mock3',
|
|
43
|
-
value: _createUser()
|
|
44
|
-
}
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
it.only('Should auto-remove old data if configured to purge', function(done) {
|
|
48
|
-
async.series({
|
|
49
|
-
setup: function(next) {
|
|
50
|
-
memored.setup({purgeInterval: 50, mockData: mockedData});
|
|
51
|
-
next();
|
|
52
|
-
},
|
|
53
|
-
getCacheSize: function(next) {
|
|
54
|
-
memored.size(function(data) {
|
|
55
|
-
expect(data.size).to.equal(3);
|
|
56
|
-
next();
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
wait: function(next) {
|
|
60
|
-
setTimeout(next, 60);
|
|
61
|
-
},
|
|
62
|
-
getCacheSize2: function(next) {
|
|
63
|
-
memored.size(function(data) {
|
|
64
|
-
expect(data.size).to.equal(2);
|
|
65
|
-
next();
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
waitAgain: function(next) {
|
|
69
|
-
setTimeout(next, 50);
|
|
70
|
-
},
|
|
71
|
-
getCacheSize3: function(next) {
|
|
72
|
-
memored.size(function(data) {
|
|
73
|
-
expect(data.size).to.equal(1);
|
|
74
|
-
next();
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
}, done);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
|
|
83
|
-
after(function() {
|
|
84
|
-
process.exit();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('Memored - store', function() {
|
|
88
|
-
|
|
89
|
-
it('Should store a value in the cache', function(done) {
|
|
90
|
-
var user1 = _createUser();
|
|
91
|
-
memored.store('user1', user1, function(err, expirationTime) {
|
|
92
|
-
expect(err).to.equal(null);
|
|
93
|
-
expect(expirationTime).to.equal(undefined);
|
|
94
|
-
done();
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('Should store a value and create an expiration time when ttl is used', function(done) {
|
|
99
|
-
var user2 = _createUser(),
|
|
100
|
-
t1 = Date.now();
|
|
101
|
-
memored.store('user2', user2, 100, function(err, expirationTime) {
|
|
102
|
-
expect(err).to.equals(null);
|
|
103
|
-
expect(expirationTime).to.be.a('number');
|
|
104
|
-
expect(expirationTime).to.be.least(t1 + 100);
|
|
105
|
-
done();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('Memored - read', function() {
|
|
112
|
-
|
|
113
|
-
it('Should read a cache entry', function(done) {
|
|
114
|
-
var user3 = _createUser();
|
|
115
|
-
async.series({
|
|
116
|
-
storeValue: function(next) {
|
|
117
|
-
memored.store('user3', user3, next);
|
|
118
|
-
},
|
|
119
|
-
readValue: function(next) {
|
|
120
|
-
memored.read('user3', function(err, value) {
|
|
121
|
-
expect(err).to.equals(null);
|
|
122
|
-
expect(value).to.eql(user3);
|
|
123
|
-
next();
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}, done);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('Should return an undefined entry when looking for a non-existing cache entry', function(done) {
|
|
130
|
-
memored.read('unknownKey', function(err, value) {
|
|
131
|
-
expect(err).to.equals(null);
|
|
132
|
-
expect(value).to.equal(undefined);
|
|
133
|
-
done();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('Should respect cache entry ttl', function(done) {
|
|
138
|
-
var user4 = _createUser(),
|
|
139
|
-
t1 = Date.now();
|
|
140
|
-
|
|
141
|
-
async.series({
|
|
142
|
-
storeValue: function(next) {
|
|
143
|
-
memored.store('user4', user4, 20, next);
|
|
144
|
-
},
|
|
145
|
-
readValue1: function(next) {
|
|
146
|
-
memored.read('user4', function(err, value, expirationTime) {
|
|
147
|
-
expect(err).to.equals(null);
|
|
148
|
-
expect(value).to.eql(user4);
|
|
149
|
-
expect(expirationTime).to.least(t1 + 20);
|
|
150
|
-
next();
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
readValue2: function(next) {
|
|
154
|
-
setTimeout(function() {
|
|
155
|
-
memored.read('user4', function(err, value) {
|
|
156
|
-
expect(err).to.equals(null);
|
|
157
|
-
expect(value).to.equal(undefined);
|
|
158
|
-
next();
|
|
159
|
-
});
|
|
160
|
-
}, 30);
|
|
161
|
-
}
|
|
162
|
-
}, done);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('Memored - remove', function() {
|
|
168
|
-
|
|
169
|
-
it('Should remove a cache entry', function(done) {
|
|
170
|
-
var user5 = _createUser();
|
|
171
|
-
async.series({
|
|
172
|
-
storeValue: function(next) {
|
|
173
|
-
memored.store('user5', user5, next);
|
|
174
|
-
},
|
|
175
|
-
readValue1: function(next) {
|
|
176
|
-
memored.read('user5', function(err, value) {
|
|
177
|
-
expect(err).to.equals(null);
|
|
178
|
-
expect(value).to.eql(user5);
|
|
179
|
-
next();
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
removeValue: function(next) {
|
|
183
|
-
memored.remove('user5', next);
|
|
184
|
-
},
|
|
185
|
-
readValue2: function(next) {
|
|
186
|
-
memored.read('user5', function(err, value) {
|
|
187
|
-
expect(err).to.equals(null);
|
|
188
|
-
expect(value).to.equal(undefined);
|
|
189
|
-
next();
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}, done);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
describe('Memored - clean', function() {
|
|
198
|
-
it('Should remove all values in cache', function(done) {
|
|
199
|
-
var user6 = _createUser(),
|
|
200
|
-
user7 = _createUser();
|
|
201
|
-
|
|
202
|
-
async.series({
|
|
203
|
-
soreValue1: function(next) {
|
|
204
|
-
memored.store('user6', user6, next);
|
|
205
|
-
},
|
|
206
|
-
storeValue2: function(next) {
|
|
207
|
-
memored.store('user7', user7, next);
|
|
208
|
-
},
|
|
209
|
-
readValue1: function(next) {
|
|
210
|
-
memored.read('user6', function(err, value) {
|
|
211
|
-
expect(err).to.equals(null);
|
|
212
|
-
expect(value).to.eql(user6);
|
|
213
|
-
next();
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
readValue2: function(next) {
|
|
217
|
-
memored.read('user7', function(err, value) {
|
|
218
|
-
expect(err).to.equals(null);
|
|
219
|
-
expect(value).to.eql(user7);
|
|
220
|
-
next();
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
cleanCache: function(next) {
|
|
224
|
-
memored.clean(next);
|
|
225
|
-
},
|
|
226
|
-
readValue4: function(next) {
|
|
227
|
-
memored.read('user6', function(err, value) {
|
|
228
|
-
expect(err).to.equals(null);
|
|
229
|
-
expect(value).to.equal(undefined);
|
|
230
|
-
next();
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
readValue5: function(next) {
|
|
234
|
-
memored.read('user7', function(err, value) {
|
|
235
|
-
expect(err).to.equals(null);
|
|
236
|
-
expect(value).to.equal(undefined);
|
|
237
|
-
next();
|
|
238
|
-
});
|
|
239
|
-
},
|
|
240
|
-
}, done);
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
describe('Memored - setup -- logger', function() {
|
|
245
|
-
var customLogger = {
|
|
246
|
-
messages: [],
|
|
247
|
-
log: function() {
|
|
248
|
-
this.messages.push(Array.prototype.slice.call(arguments).join(','));
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
it('Should use a custom logger when requested', function(done) {
|
|
252
|
-
memored.setup({
|
|
253
|
-
logger: customLogger
|
|
254
|
-
});
|
|
255
|
-
expect(customLogger.messages).to.be.have.length(0);
|
|
256
|
-
memored.store('user8', _createUser(), function() {
|
|
257
|
-
expect(customLogger.messages).to.have.length(1);
|
|
258
|
-
done();
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
});
|
package/web/cms/ice.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
$(document).ready(function() {
|
|
3
|
-
|
|
4
|
-
// bring up in-context menu with SHIFT, SHIFT, SHIFT combination
|
|
5
|
-
var SHIFT = 16;
|
|
6
|
-
var sequence = [ SHIFT, SHIFT, SHIFT ];
|
|
7
|
-
var sequenceIndex = 0;
|
|
8
|
-
$(document).keyup(function(event)
|
|
9
|
-
{
|
|
10
|
-
if (event.keyCode == sequence[sequenceIndex]) {
|
|
11
|
-
sequenceIndex++;
|
|
12
|
-
|
|
13
|
-
if (sequenceIndex == sequence.length) {
|
|
14
|
-
sequenceIndex = 0;
|
|
15
|
-
|
|
16
|
-
popupAuthorDialog();
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
} else {
|
|
21
|
-
sequenceIndex = 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return false;
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
var popupAuthorDialog = function()
|
|
28
|
-
{
|
|
29
|
-
var authorDialog = $("#authorDialog");
|
|
30
|
-
|
|
31
|
-
if ($(authorDialog).length == 0)
|
|
32
|
-
{
|
|
33
|
-
var html = '<div data-role="dialog" id="authorDialog" > \
|
|
34
|
-
<div data-role="header"><h3>What would you like to do?</h3></div> \
|
|
35
|
-
<div data-role="content"> \
|
|
36
|
-
<ul data-role="listview" data-inset="true" style="min-width:210px;" data-theme="a"> \
|
|
37
|
-
<li><a href="#" class="invalidate-cache" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Invalidate Cache</a></li> \
|
|
38
|
-
<li><a href="#" class="edit-mobile-project" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Edit Mobile Project</a></li> \
|
|
39
|
-
<li><a href="#" class="edit-page" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Edit this Page</a></li> \
|
|
40
|
-
<li><a href="#" class="switch-branch" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Switch Branches</a></li> \
|
|
41
|
-
</ul> \
|
|
42
|
-
</div> \
|
|
43
|
-
</div> \
|
|
44
|
-
';
|
|
45
|
-
|
|
46
|
-
authorDialog = $(html);
|
|
47
|
-
|
|
48
|
-
$(authorDialog).find(".invalidate-cache").click(function() {
|
|
49
|
-
$(authorDialog).dialog('close');
|
|
50
|
-
var location = window.location.href;
|
|
51
|
-
var x = location.indexOf("#");
|
|
52
|
-
if (x > -1 && location.indexOf("?invalidate") == -1)
|
|
53
|
-
{
|
|
54
|
-
location = location.substring(0, x) + "?invalidate=true" + location.substring(x);
|
|
55
|
-
}
|
|
56
|
-
var y = location.indexOf("&ui-state=dialog");
|
|
57
|
-
if (y > -1)
|
|
58
|
-
{
|
|
59
|
-
location = location.substring(0, y) + location.substring(y + 16);
|
|
60
|
-
}
|
|
61
|
-
window.location.href = location;
|
|
62
|
-
});
|
|
63
|
-
$(authorDialog).find(".edit-page").click(function() {
|
|
64
|
-
$(authorDialog).dialog('close');
|
|
65
|
-
});
|
|
66
|
-
$(authorDialog).find(".switch-branch").click(function() {
|
|
67
|
-
$(authorDialog).dialog('close');
|
|
68
|
-
popupBranchSelectionDialog();
|
|
69
|
-
});
|
|
70
|
-
$(authorDialog).find(".edit-mobile-project").click(function() {
|
|
71
|
-
$(authorDialog).dialog('close');
|
|
72
|
-
window.open("http://demo.cloudcms.net/console/#/repositories/d2039858cca205b23b7b/branches/b1dbc57b64c2426da244/folders/821c40ab613d9b5bcbbc656b62229301");
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
$(authorDialog).appendTo($.mobile.pageContainer);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
$.mobile.changePage(authorDialog,{'transition':'pop'});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
var popupBranchSelectionDialog = function()
|
|
82
|
-
{
|
|
83
|
-
var branchSelectionDialog = $("#branchSelectionDialog");
|
|
84
|
-
|
|
85
|
-
if ($(branchSelectionDialog).length == 0)
|
|
86
|
-
{
|
|
87
|
-
var html = ' \
|
|
88
|
-
<div data-role="dialog" id="branchSelectionDialog" > \
|
|
89
|
-
<div data-role="header"><h3>Select a Branch</h3></div> \
|
|
90
|
-
<div data-role="content"> \
|
|
91
|
-
<ul data-role="listview" data-inset="true" style="min-width:210px;" data-theme="a"> \
|
|
92
|
-
<li><a href="#" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Master</a></li> \
|
|
93
|
-
<li><a href="#" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Sandbox 1</a></li> \
|
|
94
|
-
<li><a href="#" data-inline="true" data-prefetch="true" data-iconpos="notext" data-transition="none">Test Branch</a></li> \
|
|
95
|
-
</ul> \
|
|
96
|
-
</div> \
|
|
97
|
-
</div> \
|
|
98
|
-
';
|
|
99
|
-
|
|
100
|
-
branchSelectionDialog = $(html);
|
|
101
|
-
|
|
102
|
-
$(branchSelectionDialog).appendTo($.mobile.pageContainer);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
$.mobile.changePage(branchSelectionDialog,{'transition':'pop'});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
*/
|
package/web/cms/preview.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
if (typeof($) !== "undefined")
|
|
2
|
-
{
|
|
3
|
-
// only do this code injection if we're running in a preview frame
|
|
4
|
-
if (parent.cmsPostMessage)
|
|
5
|
-
{
|
|
6
|
-
(function() {
|
|
7
|
-
|
|
8
|
-
var collectFields = function(el, array)
|
|
9
|
-
{
|
|
10
|
-
// look for any elements with special markup
|
|
11
|
-
$(el).find("[data-field-id]").each(function() {
|
|
12
|
-
|
|
13
|
-
var contentFieldId = $(this).attr("data-field-id");
|
|
14
|
-
|
|
15
|
-
// content type
|
|
16
|
-
var contentFieldType = $(this).attr("data-field-type");
|
|
17
|
-
if (!contentFieldType) {
|
|
18
|
-
contentFieldType = "string";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var contentField = {
|
|
22
|
-
"id": contentFieldId,
|
|
23
|
-
"type": contentFieldType
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// value
|
|
27
|
-
var contentFieldValue = $(this).attr("data-field-value");
|
|
28
|
-
if (!contentFieldValue) {
|
|
29
|
-
// pull html value for certain tags
|
|
30
|
-
if (["p", "div", "span", "textarea"].indexOf($(this)[0].nodeName.toLowerCase()) > -1) {
|
|
31
|
-
contentFieldValue = $(this).html();
|
|
32
|
-
}
|
|
33
|
-
// pull value for form tags
|
|
34
|
-
if (["input"].indexOf($(this)[0].nodeName.toLowerCase()) > -1) {
|
|
35
|
-
contentFieldValue = $(this).val();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (contentFieldValue) {
|
|
39
|
-
if (typeof(contentFieldValue) == "string") {
|
|
40
|
-
contentFieldValue = $.trim(contentFieldValue);
|
|
41
|
-
}
|
|
42
|
-
contentField.value = contentFieldValue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// title
|
|
46
|
-
var contentFieldTitle = $(this).attr("data-field-title");
|
|
47
|
-
if (contentFieldTitle) {
|
|
48
|
-
contentField.title = contentFieldTitle;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
array.push(contentField);
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var handle = function(allElement, currentElement)
|
|
56
|
-
{
|
|
57
|
-
var payload = {
|
|
58
|
-
"type": "fields",
|
|
59
|
-
"data": {
|
|
60
|
-
"pathname": window.location.pathname,
|
|
61
|
-
"hash": window.location.hash,
|
|
62
|
-
"search": window.location.search,
|
|
63
|
-
"href": window.location.href,
|
|
64
|
-
"allFields": [],
|
|
65
|
-
"currentFields": []
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// collect all + current fields
|
|
70
|
-
collectFields(allElement, payload.data.allFields);
|
|
71
|
-
collectFields(currentElement, payload.data.currentFields);
|
|
72
|
-
|
|
73
|
-
// send field information to preview server
|
|
74
|
-
parent.cmsPostMessage(payload);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// if we're running in jQuery mobile, we attach to the "pageshow" method
|
|
78
|
-
if ($.mobile)
|
|
79
|
-
{
|
|
80
|
-
// tell jquery mobile to update preview location whenever the page changes
|
|
81
|
-
$(document).bind('pageshow', function(event) {
|
|
82
|
-
|
|
83
|
-
// the whole body
|
|
84
|
-
var allElement = $(document.body);
|
|
85
|
-
|
|
86
|
-
// the current element
|
|
87
|
-
// the "page show" event yields the selected dom element (for single page 'multi-page' apps)
|
|
88
|
-
var currentElement = $(event.target);
|
|
89
|
-
handle(allElement, currentElement);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
else
|
|
93
|
-
{
|
|
94
|
-
// bind to document ready
|
|
95
|
-
$(document).ready(function() {
|
|
96
|
-
|
|
97
|
-
// we use the document body for both
|
|
98
|
-
var allElement = $(document.body);
|
|
99
|
-
handle(allElement, allElement);
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
})();
|
|
105
|
-
}
|
|
106
|
-
}
|