mirror of
https://github.com/Mibew/mibew.git
synced 2025-06-27 10:18:39 +03:00
Compare commits
No commits in common. "master" and "v2.0-alpha4" have entirely different histories.
master
...
v2.0-alpha
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,11 +1,6 @@
|
|||||||
# IDE folders
|
|
||||||
.idea
|
|
||||||
|
|
||||||
src/mibew/install/package
|
src/mibew/install/package
|
||||||
src/absent_*
|
src/absent_*
|
||||||
src/release*
|
src/release*
|
||||||
src/upload*
|
|
||||||
src/*.po
|
|
||||||
|
|
||||||
# Do not index actual configuration files
|
# Do not index actual configuration files
|
||||||
src/mibew/configs/config.yml
|
src/mibew/configs/config.yml
|
||||||
@ -18,7 +13,6 @@ src/mibew/files/avatar/*
|
|||||||
# Do not index cache files
|
# Do not index cache files
|
||||||
src/mibew/cache/*
|
src/mibew/cache/*
|
||||||
!src/mibew/cache/.keep
|
!src/mibew/cache/.keep
|
||||||
!src/mibew/cache/.htaccess
|
|
||||||
|
|
||||||
# Do not index plugins
|
# Do not index plugins
|
||||||
src/mibew/plugins/*
|
src/mibew/plugins/*
|
||||||
@ -34,22 +28,20 @@ src/composer.lock
|
|||||||
|
|
||||||
# Do not index third-party libraries
|
# Do not index third-party libraries
|
||||||
src/mibew/vendor
|
src/mibew/vendor
|
||||||
src/mibew/js/vendor
|
|
||||||
|
|
||||||
# Do not index node.js modules that are used for building
|
# Do not index node.js modules that are used for building
|
||||||
src/node_modules
|
src/node_modules
|
||||||
src/package-lock.json
|
|
||||||
|
|
||||||
# Do not index compiled js files of the core
|
# Do not index compiled js files of the core
|
||||||
src/mibew/js/compiled/*
|
src/mibew/js/compiled/*
|
||||||
!src/mibew/js/compiled/.keep
|
!src/mibew/js/compiled/.keep
|
||||||
|
|
||||||
# Do not index compiled files of chat styles
|
# Do not index compiled files of chat styles
|
||||||
src/mibew/styles/chats/*/templates_compiled/client_side/*
|
src/mibew/styles/chats/default/templates_compiled/client_side/*
|
||||||
!src/mibew/styles/chats/*/templates_compiled/client_side/.keep
|
!src/mibew/styles/chats/default/templates_compiled/client_side/.keep
|
||||||
src/mibew/styles/chats/*/js/compiled/*
|
src/mibew/styles/chats/default/js/compiled/*
|
||||||
!src/mibew/styles/chats/*/js/compiled/.keep
|
!src/mibew/styles/chats/default/js/compiled/.keep
|
||||||
|
|
||||||
# Do not index compiled files of page styles
|
# Do not index compiled files of page styles
|
||||||
src/mibew/styles/pages/*/templates_compiled/client_side/*
|
src/mibew/styles/pages/default/templates_compiled/client_side/*
|
||||||
!src/mibew/styles/pages/*/templates_compiled/client_side/.keep
|
!src/mibew/styles/pages/default/templates_compiled/client_side/.keep
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "src/i18n"]
|
|
||||||
path = src/i18n
|
|
||||||
url = git@github.com:Mibew/i18n.git
|
|
@ -1,12 +0,0 @@
|
|||||||
### Environment
|
|
||||||
* Mibew Messenger version:
|
|
||||||
* OS:
|
|
||||||
* Web server:
|
|
||||||
* PHP:
|
|
||||||
* PHP extensions:
|
|
||||||
* MySQL:
|
|
||||||
### Expected behavior
|
|
||||||
|
|
||||||
### Actual behavior
|
|
||||||
|
|
||||||
### Steps to reproduce the behavior
|
|
@ -1,8 +0,0 @@
|
|||||||
Fixes # .
|
|
||||||
|
|
||||||
Changes proposed in this pull request:
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
|
|
||||||
@Mibew/core-developers
|
|
38
README.md
38
README.md
@ -11,7 +11,7 @@ This repository contains the core of Mibew Messenger application.
|
|||||||
## Server requirements
|
## Server requirements
|
||||||
|
|
||||||
1. A webserver or web hosting account running on any major Operating System
|
1. A webserver or web hosting account running on any major Operating System
|
||||||
2. PHP (7.2.5 and above) with PDO, pdo_mysql, cURL, mbstring and gd extensions
|
2. PHP (5.3.3 and above) with MySQL support
|
||||||
3. MySQL 5.0 and above
|
3. MySQL 5.0 and above
|
||||||
|
|
||||||
## Build from sources
|
## Build from sources
|
||||||
@ -33,39 +33,7 @@ Mibew Messenger is licensed under the terms of [Apache License, Version 2.0](htt
|
|||||||
|
|
||||||
## Other repositories of the Mibew project
|
## Other repositories of the Mibew project
|
||||||
|
|
||||||
### Actual
|
|
||||||
1. [Mibew Messenger i18n repository](https://github.com/Mibew/i18n)
|
1. [Mibew Messenger i18n repository](https://github.com/Mibew/i18n)
|
||||||
2. [Mibew Messenger design repository](https://github.com/Mibew/design)
|
2. [Mibew Messenger design repository](https://github.com/Mibew/design)
|
||||||
3. [Mibew documentation repository](https://github.com/Mibew/docs.mibew.org)
|
3. [Mibew Java applications repository](https://github.com/Mibew/java)
|
||||||
|
4. [Mibew Tray repository](https://github.com/Mibew/tray)
|
||||||
### Obsolete
|
|
||||||
1. [Mibew Java applications repository](https://github.com/Mibew/java)
|
|
||||||
2. [Mibew Tray repository](https://github.com/Mibew/tray)
|
|
||||||
|
|
||||||
### Plugins
|
|
||||||
|
|
||||||
1. [Mibew Boilerplate plugin](https://github.com/Mibew/boilerplate-plugin) - a template for a real plugin
|
|
||||||
|
|
||||||
#### Ready for production use
|
|
||||||
|
|
||||||
1. [Mibew Advanced Button plugin](https://github.com/Mibew/advanced-button-plugin)
|
|
||||||
2. [Mibew Auto Invite plugin](https://github.com/Mibew/auto-invite-plugin)
|
|
||||||
3. [Mibew Auto Reply plugin](https://github.com/Mibew/auto-reply-plugin)
|
|
||||||
4. [Mibew Broadcast plugin](https://github.com/Mibew/broadcast-plugin)
|
|
||||||
5. [Mibew Bulk Logs Operations plugin](https://github.com/Mibew/bulk-logs-operations-plugin)
|
|
||||||
6. [Mibew Button Refresh plugin](https://github.com/Mibew/button-refresh-plugin)
|
|
||||||
7. [Mibew Emoji plugin](https://github.com/Mibew/emoji-plugin)
|
|
||||||
8. [Mibew Filter Visitors By Operator Code plugin](https://github.com/Mibew/filter-visitors-by-operator-code-plugin)
|
|
||||||
9. [Mibew First Message plugin](https://github.com/Mibew/first-message-plugin)
|
|
||||||
10. [Mibew Geo IP plugin](https://github.com/Mibew/geo-ip-plugin)
|
|
||||||
11. [Mibew Google Maps plugin](https://github.com/Mibew/google-maps-plugin)
|
|
||||||
12. [Mibew Open Street Map plugin](https://github.com/Mibew/open-street-map-plugin)
|
|
||||||
13. [Mibew Operator Status plugin](https://github.com/Mibew/mibew-operator-status-plugin)
|
|
||||||
14. [Mibew Purge History plugin](https://github.com/Mibew/purge-history-plugin)
|
|
||||||
15. [Mibew Real Ban plugin](https://github.com/Mibew/real-ban-plugin)
|
|
||||||
16. [Mibew Slack plugin](https://github.com/Mibew/mibew_slack)
|
|
||||||
17. [Mibew Title Notification plugin](https://github.com/Mibew/title-notification-plugin)
|
|
||||||
|
|
||||||
#### Not ready for production use (not stable, broken, obsolete, etc.)
|
|
||||||
|
|
||||||
1. [Mibew External API plugin](https://github.com/Mibew/external-api-plugin)
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"directory": "./mibew/js/vendor",
|
|
||||||
"analytics": false
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"rules": {
|
|
||||||
"indent": ["error", 4, {"SwitchCase": 1}],
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"semi": ["error", "always"],
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"no-unused-vars": ["error", {"caughtErrors": "none", "args": "none"}]
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"Mibew": true,
|
|
||||||
"MibewAPI": true,
|
|
||||||
"MibewAPIInteraction": true,
|
|
||||||
"MibewAPIChatInteraction": true,
|
|
||||||
"MibewAPIUsersInteraction": true,
|
|
||||||
"MibewAPIExecutionContext": true,
|
|
||||||
"Handlebars": true,
|
|
||||||
"_": true,
|
|
||||||
"Backbone": true,
|
|
||||||
"jQuery": true,
|
|
||||||
"vex": true,
|
|
||||||
"validator": true
|
|
||||||
},
|
|
||||||
"env":{
|
|
||||||
"browser": true
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "mibew",
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"underscore": "1.8.2",
|
|
||||||
"json": "https://github.com/douglascrockford/JSON-js.git#c98948ae1944a28e2e8ebc3717894e580aeaaa05",
|
|
||||||
"jquery": "1.11.3",
|
|
||||||
"backbone": "1.1.2",
|
|
||||||
"marionette": "2.4.1",
|
|
||||||
"handlebars": "4.3.0",
|
|
||||||
"vex": "2.3.2",
|
|
||||||
"validator-js": "3.40.0"
|
|
||||||
},
|
|
||||||
"resolutions": {
|
|
||||||
"underscore": "1.8.2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +1,33 @@
|
|||||||
{
|
{
|
||||||
"name": "mibew/mibew",
|
"name": "mibew/mibew",
|
||||||
"version": "3.6.0",
|
"version": "2.0-dev",
|
||||||
"description": "Mibew Messenger - open-source live support application",
|
"description": "Mibew Messenger - open-source live support application",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"homepage": "https://mibew.org",
|
"homepage": "http://mibew.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Mibew Messenger Project",
|
"name": "Mibew Messenger Project",
|
||||||
"homepage": "https://mibew.org/credits"
|
"homepage": "http://mibew.org/credits"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"email": "support@mibew.org",
|
"email": "support@mibew.org",
|
||||||
"issues": "https://github.com/mibew/mibew/issues",
|
"issues": "https://github.com/mibew/mibew/issues",
|
||||||
"forum": "https://mibew.org/forums",
|
"forum": "http://mibew.org/forums",
|
||||||
"source": "https://github.com/mibew/mibew"
|
"source": "https://github.com/mibew/mibew"
|
||||||
},
|
},
|
||||||
"repositories": [
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/mibew/handlebars.php"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/mibew/handlebars.php-helpers"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
"require": {
|
||||||
"mibew/handlebars.php": "~0.10.5",
|
"xamin/handlebars.php": "dev-master#e863d7af80fb485b7f6df45a191dda431f42b17c",
|
||||||
"mibew/handlebars.php-helpers": "1.*",
|
"symfony/http-foundation": "2.5.*",
|
||||||
"symfony/http-foundation": "4.4.*",
|
"symfony/routing": "2.5.*",
|
||||||
"symfony/routing": "4.4.*",
|
"symfony/config": "2.5.*",
|
||||||
"symfony/config": "4.4.*",
|
"symfony/yaml": "2.5.*",
|
||||||
"symfony/yaml": "^5.2",
|
"symfony/translation": "2.5.*",
|
||||||
"symfony/translation": "2.6.*",
|
"tedivm/stash": "0.12.*"
|
||||||
"tedivm/stash": "0.12.*",
|
|
||||||
"mibew/html5": "1.1.*",
|
|
||||||
"vierbergenlars/php-semver": "3.0.*",
|
|
||||||
"swiftmailer/swiftmailer": "~5.4.0",
|
|
||||||
"ua-parser/uap-php": "^3.9",
|
|
||||||
"true/punycode": "~1.1"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "3.*"
|
"squizlabs/php_codesniffer": "1.*"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"vendor-dir": "mibew/vendor"
|
"vendor-dir": "mibew/vendor"
|
||||||
|
621
src/gulpfile.js
621
src/gulpfile.js
@ -1,15 +1,12 @@
|
|||||||
// Initialize requirements
|
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
exec = require('child_process').exec,
|
exec = require('child_process').exec,
|
||||||
eventStream = require('event-stream'),
|
eventStream = require('event-stream'),
|
||||||
runSequence = require('gulp4-run-sequence'),
|
runSequence = require('run-sequence'),
|
||||||
through = require('through2'),
|
through = require('through2'),
|
||||||
lodash = require('lodash'),
|
lodash = require('lodash'),
|
||||||
PoFile = require('pofile'),
|
PoFile = require('pofile'),
|
||||||
strftime = require('strftime'),
|
strftime = require('strftime'),
|
||||||
del = require('del'),
|
|
||||||
bower = require('bower'),
|
|
||||||
gulp = require('gulp'),
|
gulp = require('gulp'),
|
||||||
uglify = require('gulp-uglify'),
|
uglify = require('gulp-uglify'),
|
||||||
concat = require('gulp-concat'),
|
concat = require('gulp-concat'),
|
||||||
@ -24,101 +21,59 @@ var fs = require('fs'),
|
|||||||
gzip = require('gulp-gzip'),
|
gzip = require('gulp-gzip'),
|
||||||
chmod = require('gulp-chmod'),
|
chmod = require('gulp-chmod'),
|
||||||
xgettext = require('gulp-xgettext'),
|
xgettext = require('gulp-xgettext'),
|
||||||
concatPo = require('gulp-concat-po'),
|
concatPo = require('gulp-concat-po');
|
||||||
rename = require('gulp-rename'),
|
|
||||||
eslint = require('gulp-eslint'),
|
|
||||||
removeDuplicateHeaders = require('mibew-gulp-greh'),
|
|
||||||
mkdirp = require('mkdirp');
|
|
||||||
|
|
||||||
// Set global configuration
|
// Set global configs.
|
||||||
var config = {
|
var config = {
|
||||||
mibewPath: 'mibew',
|
mibewPath: 'mibew',
|
||||||
configsPath: 'mibew/configs',
|
configsPath: 'mibew/configs',
|
||||||
phpVendorPath: 'mibew/vendor',
|
phpVendorPath: 'mibew/vendor',
|
||||||
jsVendorPath: 'mibew/js/vendor',
|
|
||||||
pluginsPath: 'mibew/plugins',
|
pluginsPath: 'mibew/plugins',
|
||||||
avatarsPath: 'mibew/files/avatar',
|
avatarsPath: 'mibew/files/avatar',
|
||||||
cachePath: 'mibew/cache',
|
cachePath: 'mibew/cache',
|
||||||
jsPath: 'mibew/js',
|
jsPath: 'mibew/js',
|
||||||
chatStylesPath: 'mibew/styles/chats',
|
chatStylesPath: 'mibew/styles/chats',
|
||||||
pageStylesPath: 'mibew/styles/pages',
|
pageStylesPath: 'mibew/styles/pages',
|
||||||
i18nPath: 'i18n',
|
|
||||||
i18nPrefix: 'mibew-i18n-',
|
|
||||||
releasePath: 'release',
|
|
||||||
uploadPath: 'upload',
|
|
||||||
compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt'),
|
compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt'),
|
||||||
getComposerUrl: 'https://getcomposer.org/installer',
|
getComposerUrl: 'https://getcomposer.org/installer',
|
||||||
phpBin: 'php -d "suhosin.executor.include.whitelist = phar" -d "memory_limit=512M"',
|
phpBin: 'php -d "suhosin.executor.include.whitelist = phar"',
|
||||||
package: require('./composer.json'),
|
package: require('./package.json')
|
||||||
msginit: 'msginit',
|
|
||||||
msgcat: 'msgcat'
|
|
||||||
}
|
}
|
||||||
config.i18nSuffix = '-' + config.package.version + '-' + strftime('%Y%m%d');
|
|
||||||
|
|
||||||
// Tasks for cleaning //////////////////
|
|
||||||
|
|
||||||
// Cleans all built files
|
// Checks all PHP files with PHP Code Sniffer.
|
||||||
gulp.task('clean', function(callback) {
|
gulp.task('phpcs', ['composer-install-dev'], function() {
|
||||||
return del([
|
return gulp.src([
|
||||||
config.releasePath,
|
config.mibewPath + '/**/*.php',
|
||||||
'composer.lock',
|
'!' + config.phpVendorPath + '/**/*.*',
|
||||||
config.phpVendorPath,
|
'!' + config.pluginsPath + '/**/*.*',
|
||||||
config.jsVendorPath,
|
'!' + config.cachePath + '/**/*.*'
|
||||||
config.jsPath + '/compiled/**/*',
|
], {
|
||||||
'!' + config.jsPath + '/compiled/.keep',
|
// Content of the cache directory is readable only for webserver. Thus
|
||||||
config.chatStylesPath + '/*/templates_compiled/client_side/*.js',
|
// we must to set "strict" option to false to prevent "EACCES" errors.
|
||||||
config.chatStylesPath + '/*/js/compiled/*.js',
|
// At the same we need to see all errors that take place.
|
||||||
config.pageStylesPath + '/*/templates_compiled/client_side/*.js'
|
strict: false,
|
||||||
], callback);
|
silent: false
|
||||||
|
})
|
||||||
|
.pipe(phpcs({
|
||||||
|
bin: config.phpVendorPath + '/bin/phpcs',
|
||||||
|
standard: 'PSR2',
|
||||||
|
warningSeverity: 0
|
||||||
|
}))
|
||||||
|
.pipe(phpcs.reporter('log'))
|
||||||
|
.pipe(phpcs.reporter('fail'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleans temporary English translation in the release dir
|
|
||||||
gulp.task('clean-tmp-po', function(callback) {
|
|
||||||
return del([config.releasePath + '/translation.po'], callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cleans temporary files of translations in the release dir
|
|
||||||
gulp.task('clean-tmp-i18n-files', function(callback) {
|
|
||||||
return del([
|
|
||||||
config.releasePath + '/**/*',
|
|
||||||
'!' + config.releasePath + '/*.zip',
|
|
||||||
'!' + config.releasePath + '/*.tar.gz',
|
|
||||||
'!' + config.releasePath + '/*.pot'
|
|
||||||
], callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cleans all files prepared for uploading to CDN
|
|
||||||
gulp.task('clean-upload', function(callback) {
|
|
||||||
return del([config.uploadPath], callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cleans everything
|
|
||||||
gulp.task('clean-all', function(callback) {
|
|
||||||
runSequence( ['clean', 'clean-upload'],
|
|
||||||
callback );
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Watcher tasks ///////////////////////
|
|
||||||
|
|
||||||
// Watch styles
|
|
||||||
gulp.task('watch', function() {
|
|
||||||
gulp.watch(config.pageStylesPath + '/**/*.handlebars', gulp.series('page-styles'));
|
|
||||||
gulp.watch(config.chatStylesPath + '/**/js/source/**/*.js', gulp.series('chat-styles-js'));
|
|
||||||
gulp.watch(config.chatStylesPath + '/**/*.handlebars', gulp.series('chat-styles-handlebars'));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Service tasks //////////////////
|
|
||||||
|
|
||||||
// Get and install PHP Composer
|
// Get and install PHP Composer
|
||||||
gulp.task('get-composer', function(callback) {
|
gulp.task('get-composer', function(callback) {
|
||||||
// Check whether Composer is already in place
|
// Check if Composer already in place
|
||||||
if (fs.existsSync('./composer.phar')) {
|
if (fs.existsSync('./composer.phar')) {
|
||||||
callback(null);
|
callback(null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get installer from the Internet
|
// Get installer from the internet
|
||||||
https.get(config.getComposerUrl, function(response) {
|
https.get(config.getComposerUrl, function(response) {
|
||||||
// Run PHP to install Composer
|
// Run PHP to install Composer
|
||||||
var php = exec(config.phpBin, function(error, stdout, stderr) {
|
var php = exec(config.phpBin, function(error, stdout, stderr) {
|
||||||
@ -130,107 +85,20 @@ gulp.task('get-composer', function(callback) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Install Composer dependencies excluding development ones
|
// Install Composer dependencies excluding development ones
|
||||||
gulp.task('composer-install', gulp.series('get-composer', function(callback) {
|
gulp.task('composer-install', ['get-composer'], function(callback) {
|
||||||
exec(config.phpBin + ' composer.phar install --no-dev',
|
exec(config.phpBin + ' composer.phar install --no-dev', function(error, stdout, stderr) {
|
||||||
function(error, stdout, stderr) {
|
callback(error ? stderr : null);
|
||||||
callback(error ? stderr : null);
|
});
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
// Install all Composer dependencies
|
// Install all Composer dependencies
|
||||||
gulp.task('composer-install-dev', gulp.series('get-composer', function(callback) {
|
gulp.task('composer-install-dev', ['get-composer'], function(callback) {
|
||||||
exec(config.phpBin + ' composer.phar install',
|
exec(config.phpBin + ' composer.phar install', function(error, stdout, stderr) {
|
||||||
function(error, stdout, stderr) {
|
callback(error ? stderr : null);
|
||||||
callback(error ? stderr : null);
|
});
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Installs bower dependencies
|
|
||||||
gulp.task('bower-install', function(callback) {
|
|
||||||
bower.commands.install([], {}, {})
|
|
||||||
.on('error', function(error) {
|
|
||||||
callback(error);
|
|
||||||
})
|
|
||||||
.on('end', function() {
|
|
||||||
// We should manually minify JavaScript files that was not minified
|
|
||||||
// by bower packages' authors
|
|
||||||
// TODO: This is a temproary workaround and should be removed once
|
|
||||||
// the packages will be fixed
|
|
||||||
var stream = eventStream.merge(
|
|
||||||
gulp.src(config.jsVendorPath + '/backbone/backbone.js',
|
|
||||||
{base: config.jsVendorPath})
|
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
|
||||||
// There are neither "@license" tag nor "!preserve" in the
|
|
||||||
// header. Add the header manually
|
|
||||||
.pipe(header(
|
|
||||||
"// Backbone.js 1.1.2\n"
|
|
||||||
+ "// (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n"
|
|
||||||
+ "// Backbone may be freely distributed under the MIT license.\n"
|
|
||||||
+ "// For all details and documentation:\n"
|
|
||||||
+ "// http://backbonejs.org\n"
|
|
||||||
))
|
|
||||||
.pipe(rename('backbone/backbone-min.js')),
|
|
||||||
gulp.src(config.jsVendorPath + '/json/json2.js',
|
|
||||||
{base: config.jsVendorPath})
|
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
|
||||||
// There are neither "@license" tag nor "!preserve" in the
|
|
||||||
// header, add the header manually
|
|
||||||
.pipe(header("// json2.js. Public Domain. See http://www.JSON.org/js.html\n"))
|
|
||||||
.pipe(rename('json/json2.min.js'))
|
|
||||||
)
|
|
||||||
.pipe(gulp.dest(config.jsVendorPath));
|
|
||||||
|
|
||||||
stream
|
|
||||||
.on('error', callback)
|
|
||||||
.on('end', callback);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tasks for checking //////////////////
|
// Compile all JavaScript files of the Mibew Core
|
||||||
|
|
||||||
// Checks all PHP files with PHP Code Sniffer
|
|
||||||
gulp.task('phpcs', gulp.series('composer-install-dev', function() {
|
|
||||||
return gulp.src([
|
|
||||||
config.mibewPath + '/**/*.php',
|
|
||||||
'!' + config.phpVendorPath + '/**/*.*',
|
|
||||||
'!' + config.pluginsPath + '/**/*.*',
|
|
||||||
'!' + config.cachePath + '/**/*.*'
|
|
||||||
], {
|
|
||||||
// Content of the cache directory is readable only for webserver.
|
|
||||||
// Thus we must to set "strict" option to false to prevent "EACCES"
|
|
||||||
// errors. At the same we need to see all errors that take place.
|
|
||||||
strict: false,
|
|
||||||
silent: false
|
|
||||||
})
|
|
||||||
.pipe(phpcs({
|
|
||||||
bin: config.phpVendorPath + '/bin/phpcs',
|
|
||||||
standard: 'PSR2',
|
|
||||||
warningSeverity: 0
|
|
||||||
}))
|
|
||||||
.pipe(phpcs.reporter('log'))
|
|
||||||
.pipe(phpcs.reporter('fail'));
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Checks all JavaScript Source files with ESLint
|
|
||||||
gulp.task('eslint', function() {
|
|
||||||
return gulp.src(config.jsPath + '/source/**/*.js')
|
|
||||||
.pipe(eslint())
|
|
||||||
.pipe(eslint.format())
|
|
||||||
.pipe(eslint.failAfterError());
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Restore empty English translation in the source code
|
|
||||||
gulp.task('post-pack-cleanup', function(callback) {
|
|
||||||
gulp.src('translation.po')
|
|
||||||
.pipe(gulp.dest(config.mibewPath + '/locales/en/'));
|
|
||||||
|
|
||||||
del(['translation.po', config.releasePath + '/translation.po'], callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Tasks of compiling //////////////////
|
|
||||||
|
|
||||||
// Compile all JavaScript files of the Mibew Messenger Core
|
|
||||||
gulp.task('js', function() {
|
gulp.task('js', function() {
|
||||||
return eventStream.merge(
|
return eventStream.merge(
|
||||||
getClientSideApp('default'),
|
getClientSideApp('default'),
|
||||||
@ -240,111 +108,75 @@ gulp.task('js', function() {
|
|||||||
gulp.src(config.jsPath + '/source/**/*.js')
|
gulp.src(config.jsPath + '/source/**/*.js')
|
||||||
)
|
)
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
.pipe(removeDuplicateHeaders())
|
|
||||||
.pipe(gulp.dest(config.jsPath + '/compiled'));
|
.pipe(gulp.dest(config.jsPath + '/compiled'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Compile and concatenate Handlebars templates for all chat styles
|
// Performs all job related with chat styles.
|
||||||
|
gulp.task('chat-styles', ['chat-styles-handlebars', 'chat-styles-js'], function() {
|
||||||
|
// This task is just a combination of other tasks. That is why there is no
|
||||||
|
// real code.
|
||||||
|
});
|
||||||
|
|
||||||
|
// Compile and concatenate handlebars files for all chat styles.
|
||||||
gulp.task('chat-styles-handlebars', function() {
|
gulp.task('chat-styles-handlebars', function() {
|
||||||
return getChildDirs(config.chatStylesPath)
|
// TODO: Process all available styles, not only the default one.
|
||||||
.then(function (dirs) {
|
var stylePath = config.chatStylesPath + '/default';
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
return gulp.src(stylePath + '/templates_src/client_side/**/*.handlebars')
|
||||||
gulp.src(config.chatStylesPath + '/' + dir
|
.pipe(handlebars({
|
||||||
+ '/templates_src/client_side/**/*.handlebars')
|
// Use specific version of Handlebars.js
|
||||||
.pipe(handlebars({
|
handlebars: handlebarsEngine
|
||||||
// Use specific version of Handlebars.js
|
}))
|
||||||
handlebars: handlebarsEngine
|
.pipe(wrapHandlebarsTemplate())
|
||||||
}))
|
.pipe(concat('templates.js'))
|
||||||
.pipe(wrapHandlebarsTemplate())
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
.pipe(concat('templates.js'))
|
.pipe(header(config.compiledTemplatesHeader))
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
.pipe(gulp.dest(stylePath + '/templates_compiled/client_side'));
|
||||||
.pipe(header(config.compiledTemplatesHeader))
|
|
||||||
.pipe(gulp.dest(config.chatStylesPath + '/' + dir
|
|
||||||
+ '/templates_compiled/client_side'))
|
|
||||||
.on('end', resolve)
|
|
||||||
.on('error', reject);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Compile and concatenate js files for all chat styles
|
// Compile and concatenate js files for all chat styles.
|
||||||
gulp.task('chat-styles-js', function() {
|
gulp.task('chat-styles-js', function() {
|
||||||
return getChildDirs(config.chatStylesPath)
|
// TODO: Process all available styles, not only the default one.
|
||||||
.then(function (dirs) {
|
var stylePath = config.chatStylesPath + '/default';
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
return gulp.src(stylePath + '/js/source/**/*.js')
|
||||||
gulp.src(config.chatStylesPath + '/' + dir
|
.pipe(concat('scripts.js'))
|
||||||
+ '/js/source/**/*.js')
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
.pipe(concat('scripts.js'))
|
.pipe(gulp.dest(stylePath + '/js/compiled'));
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
|
||||||
.pipe(gulp.dest(config.chatStylesPath + '/' + dir
|
|
||||||
+ '/js/compiled'))
|
|
||||||
.on('end', resolve)
|
|
||||||
.on('error', reject);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Performs all job related to pages styles
|
// Performs all job related with pages styles.
|
||||||
gulp.task('page-styles', function() {
|
gulp.task('page-styles', function() {
|
||||||
return getChildDirs(config.pageStylesPath)
|
// TODO: Process all available styles, not only the default one.
|
||||||
.then(function (dirs) {
|
var stylePath = config.pageStylesPath + '/default';
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject){
|
return gulp.src(stylePath + '/templates_src/client_side/**/*.handlebars')
|
||||||
gulp.src(config.pageStylesPath + '/' + dir
|
.pipe(handlebars({
|
||||||
+ '/templates_src/client_side/**/*.handlebars')
|
// Use specific version of Handlebars.js
|
||||||
.pipe(handlebars({
|
handlebars: handlebarsEngine
|
||||||
// Use specific version of Handlebars.js
|
}))
|
||||||
handlebars: handlebarsEngine
|
.pipe(wrapHandlebarsTemplate())
|
||||||
}))
|
.pipe(concat('templates.js'))
|
||||||
.pipe(wrapHandlebarsTemplate())
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
.pipe(concat('templates.js'))
|
.pipe(header(config.compiledTemplatesHeader))
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
.pipe(gulp.dest(stylePath + '/templates_compiled/client_side'));
|
||||||
.pipe(header(config.compiledTemplatesHeader))
|
|
||||||
.pipe(gulp.dest(config.pageStylesPath + '/' + dir
|
|
||||||
+ '/templates_compiled/client_side'))
|
|
||||||
.on('end', resolve)
|
|
||||||
.on('error', reject);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Performs all job related to chat styles
|
// Generate .pot files based on the sources
|
||||||
gulp.task('chat-styles', gulp.series('chat-styles-handlebars', 'chat-styles-js'));
|
|
||||||
|
|
||||||
// Prepares ready to use development version of Mibew Messenger without
|
|
||||||
// packing or validating it
|
|
||||||
gulp.task('rebuild', function(callback) {
|
|
||||||
runSequence(
|
|
||||||
'clean',
|
|
||||||
['js', 'chat-styles', 'page-styles', 'composer-install',
|
|
||||||
'bower-install'],
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Tasks for localization issues ///////
|
|
||||||
|
|
||||||
// Generate POT-file based upon the source code
|
|
||||||
gulp.task('generate-pot', function() {
|
gulp.task('generate-pot', function() {
|
||||||
return eventStream.merge(
|
return eventStream.merge(
|
||||||
gulp.src([
|
gulp.src([
|
||||||
config.mibewPath + '/**/*.php',
|
config.mibewPath + '/**/*.php',
|
||||||
'!' + config.phpVendorPath + '/**/*.*',
|
'!' + config.phpVendorPath + '/**/*.*',
|
||||||
'!' + config.pluginsPath + '/**/*.*',
|
'!' + config.pluginsPath + '/**/*.*',
|
||||||
'!' + config.cachePath + '/**/*.*'
|
'!' + config.cachePath + '/**/*.*'
|
||||||
], {
|
], {
|
||||||
// Content of the cache directory is readable only for
|
// Content of the cache directory is readable only for webserver.
|
||||||
// webserver. Thus we must to set "strict" option to false
|
// Thus we must to set "strict" option to false to prevent "EACCES"
|
||||||
// to prevent "EACCES" errors. At the same we need to see all
|
// errors. At the same we need to see all errors that take place.
|
||||||
// errors that take place.
|
strict: false,
|
||||||
strict: false,
|
silent: false
|
||||||
silent: false
|
})
|
||||||
})
|
|
||||||
.pipe(xgettext({
|
.pipe(xgettext({
|
||||||
language: 'PHP',
|
language: 'PHP',
|
||||||
keywords: [
|
keywords: [
|
||||||
@ -362,88 +194,27 @@ gulp.task('generate-pot', function() {
|
|||||||
]
|
]
|
||||||
})),
|
})),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
config.chatStylesPath + '/default/templates_src/**/*.handlebars',
|
config.chatStylesPath + '/default/templates_src/**/*.handlebars',
|
||||||
config.pageStylesPath + '/default/templates_src/**/*.handlebars'
|
config.pageStylesPath + '/default/templates_src/**/*.handlebars'
|
||||||
], {base: config.mibewPath})
|
], {base: config.mibewPath})
|
||||||
.pipe(xgettextHandlebars())
|
.pipe(xgettextHandlebars())
|
||||||
)
|
)
|
||||||
.pipe(concatPo(config.i18nPrefix + 'translation'
|
.pipe(concatPo('translation.pot', {
|
||||||
+ config.i18nSuffix + '.pot',
|
headers: {
|
||||||
{
|
'Project-Id-Version': 'Mibew Messenger ' + config.package.version,
|
||||||
headers: {
|
'Report-Msgid-Bugs-To': config.package.bugs.email,
|
||||||
'Project-Id-Version': 'Mibew Messenger '
|
'POT-Creation-Date': strftime('%Y-%m-%d %H:%M%z'),
|
||||||
+ config.package.version,
|
'PO-Revision-Date': '',
|
||||||
'Report-Msgid-Bugs-To': config.package.support.email,
|
'Last-Translator': '',
|
||||||
'POT-Creation-Date': strftime('%Y-%m-%d %H:%M%z'),
|
'Language-Team': '',
|
||||||
'PO-Revision-Date': '',
|
'Content-Type': 'text/plain; charset=UTF-8'
|
||||||
'Last-Translator': '',
|
}
|
||||||
'Language-Team': '',
|
}))
|
||||||
'Content-Type': 'text/plain; charset=UTF-8'
|
.pipe(gulp.dest('release'));
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.pipe(gulp.dest(config.releasePath));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate temporary English translation to be used in the release
|
// Pack sources to .zip and .tar.gz archives.
|
||||||
gulp.task('generate-tmp-po', gulp.series('generate-pot', function(callback) {
|
gulp.task('pack-sources', ['composer-install'], function() {
|
||||||
return exec(config.msginit + ' --no-translator --no-wrap -i '
|
|
||||||
+ config.releasePath + '/' + config.i18nPrefix + 'translation'
|
|
||||||
+ config.i18nSuffix + '.pot' + ' -l en -o '
|
|
||||||
+ config.releasePath + '/translation.po',
|
|
||||||
function(error, stdout, stderr) {
|
|
||||||
callback(error ? stderr : null);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Generate complete translations (that includes missed strings) to be used
|
|
||||||
// in the release
|
|
||||||
gulp.task('generate-pos', gulp.series('generate-tmp-po', function(callback) {
|
|
||||||
|
|
||||||
return getChildDirs(config.i18nPath + '/translations')
|
|
||||||
.then(function (dirs) {
|
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
mkdirp(config.releasePath + '/' + dir, function (error) {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
exec(config.msgcat + ' ' + config.i18nPath + '/translations/'
|
|
||||||
+ dir + '/translation.po ' + config.releasePath
|
|
||||||
+ '/translation.po --no-location --no-wrap --use-first'
|
|
||||||
+ ' -o ' + config.releasePath + '/' + dir
|
|
||||||
+ '/translation.po',
|
|
||||||
function(error, stdout, stderr) {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var sources = [
|
|
||||||
config.i18nPath + '/translations/' + dir + '/**/*',
|
|
||||||
'!' + config.i18nPath + '/translations/' + dir
|
|
||||||
+ '/translation.po'
|
|
||||||
];
|
|
||||||
|
|
||||||
gulp.src(sources)
|
|
||||||
.pipe(gulp.dest(config.releasePath + '/' + dir))
|
|
||||||
.on('error', reject)
|
|
||||||
.on('end', resolve);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Packaging tasks /////////////////////
|
|
||||||
|
|
||||||
// Pack sources for release as .zip and .tar.gz archives
|
|
||||||
gulp.task('pack-sources', gulp.series('composer-install', 'bower-install', function() {
|
|
||||||
gulp.src(config.mibewPath + '/locales/en/translation.po')
|
|
||||||
.pipe(gulp.dest('.'));
|
|
||||||
gulp.src(config.releasePath + '/translation.po')
|
|
||||||
.pipe(gulp.dest(config.mibewPath + '/locales/en/'));
|
|
||||||
|
|
||||||
var sources = [
|
var sources = [
|
||||||
config.mibewPath + '/**/*',
|
config.mibewPath + '/**/*',
|
||||||
// Exclude user's config
|
// Exclude user's config
|
||||||
@ -457,44 +228,16 @@ gulp.task('pack-sources', gulp.series('composer-install', 'bower-install', funct
|
|||||||
'!' + config.pluginsPath + '/*/**/*',
|
'!' + config.pluginsPath + '/*/**/*',
|
||||||
// Exclude Git repositories that can be shipped with third-party libs
|
// Exclude Git repositories that can be shipped with third-party libs
|
||||||
'!' + config.phpVendorPath + '/**/.git',
|
'!' + config.phpVendorPath + '/**/.git',
|
||||||
'!' + config.phpVendorPath + '/**/.git/**/*',
|
'!' + config.phpVendorPath + '/**/.git/**/*'
|
||||||
// Exclude vendors binaries
|
|
||||||
'!' + config.phpVendorPath + '/bin/**/*',
|
|
||||||
// Exclude JavaScript sources
|
|
||||||
'!' + config.jsPath + '/source/**/*',
|
|
||||||
// Actually we does not need backbone.babysitter and backbone.wreqr
|
|
||||||
// dependencies because they embed into marionette.js. So we exclude
|
|
||||||
// "backbone.babysitter" and "backbone.wreqr" directories and all their
|
|
||||||
// contents.
|
|
||||||
'!' + config.jsVendorPath + '/backbone.babysitter{,/**}',
|
|
||||||
'!' + config.jsVendorPath + '/backbone.wreqr{,/**}',
|
|
||||||
// Exclude dot files within third-party JS libraries.
|
|
||||||
'!' + config.jsVendorPath + '/**/.*',
|
|
||||||
// Exclude config files of various package systems
|
|
||||||
'!' + config.jsVendorPath + '/**/{bower,component,package,composer}.json',
|
|
||||||
// Exclude config files of various build systems
|
|
||||||
'!' + config.jsVendorPath + '/**/Gruntfile.*',
|
|
||||||
'!' + config.jsVendorPath + '/**/gulpfile.*',
|
|
||||||
'!' + config.jsVendorPath + '/**/Makefile',
|
|
||||||
// Exclude HTML files from third-party JS libraries. Such files can be
|
|
||||||
// used for docs or for tests, we need none of them.
|
|
||||||
'!' + config.jsVendorPath + '/**/*.html',
|
|
||||||
// There are too many useless files in Vex.js library. Exclude them.
|
|
||||||
'!' + config.jsVendorPath + '/vex/sass{,/**}',
|
|
||||||
'!' + config.jsVendorPath + '/vex/docs{,/**}',
|
|
||||||
'!' + config.jsVendorPath + '/vex/docs{,/**}',
|
|
||||||
'!' + config.jsVendorPath + '/vex/coffee{,/**}'
|
|
||||||
];
|
];
|
||||||
var srcOptions = {
|
var srcOptions = {
|
||||||
// Dot files (.htaccess, .keep, etc.) must be included in the package
|
// Dot files (.htaccess, .keep, etc.) must be included in the package.
|
||||||
dot: true,
|
dot: true,
|
||||||
// Content of the cache directory is readable only for webserver. Thus
|
// Content of the cache directory is readable only for webserver. Thus
|
||||||
// we must to set "strict" option to false to prevent "EACCES" errors.
|
// we must to set "strict" option to false to prevent "EACCES" errors.
|
||||||
// At the same we need to see all errors that take place.
|
// At the same we need to see all errors that take place.
|
||||||
strict: false,
|
strict: false,
|
||||||
silent: false,
|
silent: false
|
||||||
// Preserve root directory name (i.e. 'mibew/')
|
|
||||||
base: '.'
|
|
||||||
}
|
}
|
||||||
var version = config.package.version;
|
var version = config.package.version;
|
||||||
|
|
||||||
@ -505,111 +248,34 @@ gulp.task('pack-sources', gulp.series('composer-install', 'bower-install', funct
|
|||||||
.pipe(tar('mibew-' + version + '.tar'))
|
.pipe(tar('mibew-' + version + '.tar'))
|
||||||
.pipe(gzip())
|
.pipe(gzip())
|
||||||
)
|
)
|
||||||
.pipe(chmod(644))
|
.pipe(chmod(0644))
|
||||||
.pipe(gulp.dest(config.releasePath));
|
.pipe(gulp.dest('release'));
|
||||||
}));
|
|
||||||
|
|
||||||
// Pack translations for release as .zip and .tar.gz archives
|
|
||||||
gulp.task('pack-i18n', function(callback) {
|
|
||||||
return getChildDirs(config.i18nPath + '/translations')
|
|
||||||
.then(function (dirs) {
|
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
|
|
||||||
var srcOptions = {
|
|
||||||
base: config.releasePath
|
|
||||||
};
|
|
||||||
|
|
||||||
eventStream.merge(
|
|
||||||
gulp.src(config.releasePath + '/' + dir
|
|
||||||
+ '/**/*', srcOptions)
|
|
||||||
.pipe(zip(config.i18nPrefix + dir
|
|
||||||
+ config.i18nSuffix + '.zip')),
|
|
||||||
gulp.src(config.releasePath + '/' + dir
|
|
||||||
+ '/**/*', srcOptions)
|
|
||||||
.pipe(tar(config.i18nPrefix + dir
|
|
||||||
+ config.i18nSuffix + '.tar'))
|
|
||||||
.pipe(gzip())
|
|
||||||
)
|
|
||||||
.pipe(chmod(644))
|
|
||||||
.pipe(gulp.dest(config.releasePath))
|
|
||||||
.on('error', reject)
|
|
||||||
.on('end', resolve);
|
|
||||||
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tasks of releasing //////////////////
|
// Performs all tasks in the correct order.
|
||||||
|
|
||||||
// Prepare release of Mibew Messenger
|
|
||||||
gulp.task('prepare-release', function(callback) {
|
gulp.task('prepare-release', function(callback) {
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
['phpcs', 'js', 'chat-styles', 'page-styles', 'generate-pot'],
|
||||||
['phpcs', 'js', 'chat-styles', 'page-styles', 'generate-pot',
|
|
||||||
'generate-tmp-po'],
|
|
||||||
'pack-sources',
|
'pack-sources',
|
||||||
'post-pack-cleanup',
|
|
||||||
callback
|
callback
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Prepare releases of translations for Mibew Messenger
|
// Builds the sources
|
||||||
gulp.task('prepare-i18n-release', function(callback) {
|
|
||||||
runSequence( 'clean-tmp-po',
|
|
||||||
'generate-pos',
|
|
||||||
'pack-i18n',
|
|
||||||
'clean-tmp-i18n-files',
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mirror prepared releases of Mibew Messenger and its translations in a form
|
|
||||||
// intended for uploading into the CDN
|
|
||||||
gulp.task('prepare-for-upload', function(callback) {
|
|
||||||
gulp.src(config.releasePath + '/mibew-' + config.package.version + '.*')
|
|
||||||
.pipe(gulp.dest(config.uploadPath + '/core/' + config.package.version + '/'));
|
|
||||||
|
|
||||||
gulp.src(config.releasePath + '/mibew-i18n-translation-' + config.package.version + '-*.pot')
|
|
||||||
.pipe(gulp.dest(config.uploadPath + '/i18n/_pot/' + config.package.version + '/'));
|
|
||||||
|
|
||||||
return getChildDirs(config.i18nPath + '/translations')
|
|
||||||
.then(function (dirs) {
|
|
||||||
return Promise.all(dirs.map(function (dir) {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
gulp.src(config.releasePath + '/mibew-i18n-' + dir + '-' + config.package.version + '-*.*')
|
|
||||||
.pipe(gulp.dest(config.uploadPath + '/i18n/' + dir + '/' + config.package.version + '/'))
|
|
||||||
.on('error', reject)
|
|
||||||
.on('end', resolve);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Perform all preparations before uploading the release of Mibew Messenger and
|
|
||||||
// its translations into the CDN
|
|
||||||
gulp.task('prepare-all', function(callback) {
|
|
||||||
runSequence('clean-all', 'prepare-release', 'prepare-i18n-release',
|
|
||||||
'prepare-for-upload', callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Prepare release archives of the development version of Mibew Messenger
|
|
||||||
gulp.task('default', function(callback) {
|
gulp.task('default', function(callback) {
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
['js', 'chat-styles', 'page-styles'],
|
||||||
['js', 'chat-styles', 'page-styles', 'generate-tmp-po'],
|
|
||||||
'pack-sources',
|
'pack-sources',
|
||||||
['post-pack-cleanup', 'clean-tmp-po'],
|
|
||||||
callback
|
callback
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and prepare js file for a client side application with the specified
|
* Loads and prepare js file for a client side application with the specified
|
||||||
* name.
|
* name.
|
||||||
*
|
*
|
||||||
* @param {String} name Application name.
|
* @param {String} name Application name
|
||||||
* @returns A files stream that can be piped to any gulp plugin.
|
* @returns A files stream that can be piped to any gulp plugin.
|
||||||
*/
|
*/
|
||||||
var getClientSideApp = function(name) {
|
var getClientSideApp = function(name) {
|
||||||
@ -659,7 +325,7 @@ var wrapHandlebarsTemplate = function() {
|
|||||||
+ 'Handlebars.templates["<%= relative %>"] = <%= handlebars %>;\n'
|
+ 'Handlebars.templates["<%= relative %>"] = <%= handlebars %>;\n'
|
||||||
+ '})()',
|
+ '})()',
|
||||||
context: function(context) {
|
context: function(context) {
|
||||||
return {relative: context.file.relative.replace(/\.js$/, '').replace(/\\/g, '/')};
|
return {relative: context.file.relative.replace(/\.js$/, '')};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -679,7 +345,7 @@ var xgettextHandlebars = function() {
|
|||||||
contents = file.contents.toString();
|
contents = file.contents.toString();
|
||||||
|
|
||||||
while (match = helperRegExp.exec(contents)) {
|
while (match = helperRegExp.exec(contents)) {
|
||||||
// Try to find item in the .po file by its name
|
// Try to find item in the .po file by its name.
|
||||||
var item = lodash.find(po.items, function(item) {
|
var item = lodash.find(po.items, function(item) {
|
||||||
return match[2] === item.msgid;
|
return match[2] === item.msgid;
|
||||||
});
|
});
|
||||||
@ -687,7 +353,7 @@ var xgettextHandlebars = function() {
|
|||||||
var line = contents.substr(0, match.index).split(/\r?\n|\r/g).length;
|
var line = contents.substr(0, match.index).split(/\r?\n|\r/g).length;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
// There is no such item, create new one
|
// There is no such item. Create new one.
|
||||||
item = new PoFile.Item();
|
item = new PoFile.Item();
|
||||||
item.msgid = match[2].replace(/\\'/g, "'").replace(/\\"/g, '"');
|
item.msgid = match[2].replace(/\\'/g, "'").replace(/\\"/g, '"');
|
||||||
po.items.push(item);
|
po.items.push(item);
|
||||||
@ -698,46 +364,9 @@ var xgettextHandlebars = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update file contents
|
// Update file contents
|
||||||
file.contents = Buffer.from(po.toString());
|
file.contents = new Buffer(po.toString());
|
||||||
this.push(file);
|
this.push(file);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves list of all dirs which are placed in the specified one.
|
|
||||||
*
|
|
||||||
* @param {String} srcDir A dir to search.
|
|
||||||
* @returns Promise A promise which will be resolved with list of child dirs or
|
|
||||||
* rejected with the occured error.
|
|
||||||
*/
|
|
||||||
var getChildDirs = function(srcDir) {
|
|
||||||
return (new Promise(function(resolve, reject) {
|
|
||||||
fs.readdir(srcDir, function (err, files) {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(files);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})).then(function (files) {
|
|
||||||
// Replace all files that are not a directory with nulls.
|
|
||||||
return Promise.all(files.map(function (file) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
fs.lstat(srcDir + '/' + file, function (err, stat) {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(stat.isDirectory() ? file : null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}).then(function(dirs) {
|
|
||||||
// Remove all nulls from the array.
|
|
||||||
return dirs.filter(function (dir) {
|
|
||||||
return null !== dir;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
1
src/i18n
1
src/i18n
@ -1 +0,0 @@
|
|||||||
Subproject commit 55868d9973f531c3550575481bde4233cc625b91
|
|
@ -4,11 +4,6 @@ Options -Indexes
|
|||||||
# Follow symbolic links in the directory
|
# Follow symbolic links in the directory
|
||||||
Options +FollowSymLinks
|
Options +FollowSymLinks
|
||||||
|
|
||||||
<IfModule mod_negotiation.c>
|
|
||||||
# Forbid apache to guess file extensions
|
|
||||||
Options -MultiViews
|
|
||||||
</IfModule>
|
|
||||||
|
|
||||||
# Disable mod_security for Apache 1.x
|
# Disable mod_security for Apache 1.x
|
||||||
<IfModule mod_security.c>
|
<IfModule mod_security.c>
|
||||||
SecFilterEngine Off
|
SecFilterEngine Off
|
||||||
@ -36,7 +31,7 @@ Options +FollowSymLinks
|
|||||||
# Use separate front controller for the system installator
|
# Use separate front controller for the system installator
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^install(/(.*))?$ install.php [QSA,L]
|
RewriteRule ^install(|/(.*))$ install.php [QSA,L]
|
||||||
|
|
||||||
# Rewrite all other requests for files and directories that do not exist to
|
# Rewrite all other requests for files and directories that do not exist to
|
||||||
# the main front controller
|
# the main front controller
|
||||||
@ -46,10 +41,9 @@ Options +FollowSymLinks
|
|||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
<IfModule !mod_rewrite.c>
|
<IfModule !mod_rewrite.c>
|
||||||
# There is no mod_rewrite in the system. For the root Mibew Messenger
|
# There is no mod_rewrite in the system. For the root Mibew directory
|
||||||
# directory index_fallback.php should be loaded first to activate
|
# index_fallback.php should be loaded first to activate old-fashioned URLs.
|
||||||
# old-fashioned URLs. For all other directories index.php is just a
|
# For all other directories index.php is just a directory index file.
|
||||||
# directory index file.
|
|
||||||
DirectoryIndex index_fallback.php index.php
|
DirectoryIndex index_fallback.php index.php
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
@ -57,8 +51,3 @@ Options +FollowSymLinks
|
|||||||
<FilesMatch "\.(yml|po|ini|handlebars|keep)$">
|
<FilesMatch "\.(yml|po|ini|handlebars|keep)$">
|
||||||
Deny from all
|
Deny from all
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
||||||
# Deny access to CLI cron worker from the outside
|
|
||||||
<Files "cron.php">
|
|
||||||
Deny from all
|
|
||||||
</Files>
|
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
Mibew Messenger
|
Mibew Messenger
|
||||||
Copyright 2005-2023 the original author or authors.
|
Copyright 2005-2014 the original author or authors.
|
||||||
|
|
||||||
REQUIREMENTS
|
REQUIREMENTS
|
||||||
|
|
||||||
* Apache web server 1.3.34 or above with the ability to use local .htaccess
|
* Apache web server 1.3.34 or above
|
||||||
files (mod_rewrite module is optional, but recommended)
|
|
||||||
* MySQL database 5.0 or above
|
* MySQL database 5.0 or above
|
||||||
* PHP 7.2.5 or above with PDO, pdo_mysql, cURL, mbstring and gd extensions
|
* PHP 5.3.3 or above with MySQL support
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
1. Create folder with name 'mibew' in the root of your website.
|
1. Create folder with name 'mibew' in the root of your website.
|
||||||
2. Upload all the files contained in this archive (retaining the directory
|
2. Upload all the files contained in this archive (retaining the directory structure) into created folder.
|
||||||
structure) into created folder.
|
Be sure to chmod the mibew folder to 755.
|
||||||
Be sure to chmod the mibew folder to 0755.
|
|
||||||
3. Add a MySQL database with the name 'mibew'
|
3. Add a MySQL database with the name 'mibew'
|
||||||
4. Copy /mibew/configs/default_config.yml to /mibew/configs/config.yml
|
4. Copy /mibew/configs/default_config.yml to /mibew/configs/config.yml
|
||||||
5. Edit /mibew/configs/config.yml to the information needed to connect to the database
|
5. Edit /mibew/configs/config.yml to the information needed to connect to the database
|
||||||
@ -24,33 +22,11 @@ INSTALLATION
|
|||||||
user: admin
|
user: admin
|
||||||
password: <your password>
|
password: <your password>
|
||||||
9. Get button code and setup it on your site.
|
9. Get button code and setup it on your site.
|
||||||
10. Configure periodically running tasks by setting up an automated
|
10. Change your name.
|
||||||
process to visit the page http://<yourdomain>/cron?cron_key=<key>
|
11. Wait for your visitors on 'Pending users' page.
|
||||||
|
|
||||||
The full URL including the secret "cron key" used to protect against
|
|
||||||
unauthorized access can be seen on the 'General' tab at the 'Settings' page.
|
|
||||||
11. Change your name.
|
|
||||||
12. Wait for your visitors on 'Pending users' page.
|
|
||||||
|
|
||||||
On unix/linux platforms change the owner of /mibew/files/avatar and
|
On unix/linux platforms change the owner of /mibew/files/avatar and
|
||||||
/mibew/cache folders to the user, under which the web server is running
|
/mibew/cache folders to the user, under which the web server is running
|
||||||
(for instance, www). The owner should have all rights on the folders
|
(for instance, www). The owner should have all rights on the folders
|
||||||
/mibew/files/avatar and /mibew/cache
|
/mibew/files/avatar and /mibew/cache
|
||||||
(chmod 0700 /mibew/files/avatar && chmod 0700 /mibew/cache).
|
(chmod 700 /mibew/files/avatar && chmod 700 /mibew/cache).
|
||||||
|
|
||||||
UPDATE
|
|
||||||
|
|
||||||
1. Backup your actual installation (i.e. code and database).
|
|
||||||
2. Disable all plugins.
|
|
||||||
3. Delete all items in your Mibew Messenger directory on the server.
|
|
||||||
4. Unpack the archive with the official distrubition in that directory.
|
|
||||||
5. Remove install.php file.
|
|
||||||
6. Restore configuration (configs/ directory), plugins (plugins/ directory),
|
|
||||||
(maybe) custom styles (if you have any), (maybe) additional
|
|
||||||
locales (if you use any), and avatars (files/avatar/ directory) from the
|
|
||||||
backup you've made at the step 1.
|
|
||||||
7. Visit http://<yourdomain>/<path to your Mibew Messenger>/update and follow
|
|
||||||
the instructions to update the database tables (if needed).
|
|
||||||
8. Enable disabled plugins.
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Mibew/3.6.0
|
Mibew/2.0
|
1
src/mibew/cache/.htaccess
vendored
1
src/mibew/cache/.htaccess
vendored
@ -1 +0,0 @@
|
|||||||
Deny from all
|
|
@ -72,7 +72,7 @@ thread:
|
|||||||
useragent: "varchar(255)"
|
useragent: "varchar(255)"
|
||||||
# Total count of user's messages related with the thread.
|
# Total count of user's messages related with the thread.
|
||||||
messagecount: "varchar(16)"
|
messagecount: "varchar(16)"
|
||||||
# ID of the group at Mibew Messenger side related with the thread.
|
# ID of the group at Mibew side related with the thread.
|
||||||
groupid: "int references {opgroup}(groupid)"
|
groupid: "int references {opgroup}(groupid)"
|
||||||
|
|
||||||
# Contains "by thread" statistics
|
# Contains "by thread" statistics
|
||||||
@ -104,7 +104,7 @@ requestcallback:
|
|||||||
fields:
|
fields:
|
||||||
callbackid: "int NOT NULL auto_increment PRIMARY KEY"
|
callbackid: "int NOT NULL auto_increment PRIMARY KEY"
|
||||||
token: "varchar(64) NOT NULL DEFAULT ''"
|
token: "varchar(64) NOT NULL DEFAULT ''"
|
||||||
func: "varchar(64) NOT NULL"
|
function: "varchar(64) NOT NULL"
|
||||||
arguments: "varchar(1024)"
|
arguments: "varchar(1024)"
|
||||||
indexes:
|
indexes:
|
||||||
token: [token]
|
token: [token]
|
||||||
@ -129,23 +129,12 @@ translation:
|
|||||||
# Contains locales info
|
# Contains locales info
|
||||||
locale:
|
locale:
|
||||||
fields:
|
fields:
|
||||||
# Artificial primary key.
|
# Artificial primary key
|
||||||
localeid: "int NOT NULL auto_increment PRIMARY KEY"
|
localeid: "int NOT NULL auto_increment PRIMARY KEY"
|
||||||
# Locale code
|
# Locale code
|
||||||
code: "varchar(5) NOT NULL"
|
code: "varchar(5) NOT NULL"
|
||||||
# Human readable name of the locale.
|
# Indicates if a locale is enabled or not.
|
||||||
name: "varchar(128) NOT NULL DEFAULT ''"
|
|
||||||
# Indicates if the locale is enabled or not.
|
|
||||||
enabled: "tinyint NOT NULL DEFAULT 0"
|
enabled: "tinyint NOT NULL DEFAULT 0"
|
||||||
# Indicates if the locale uses RTL writing.
|
|
||||||
rtl: "tinyint NOT NULL DEFAULT 0"
|
|
||||||
# Name of the locale which is used with PHP's setlocale to format dates.
|
|
||||||
time_locale: "varchar(128) NOT NULL DEFAULT 'en_US'"
|
|
||||||
# Serialized array of various date formats.
|
|
||||||
date_format: "text"
|
|
||||||
unique_keys:
|
|
||||||
# Make sure locale code can be duplicated
|
|
||||||
code: [code]
|
|
||||||
|
|
||||||
# Contains localized mail templates
|
# Contains localized mail templates
|
||||||
mailtemplate:
|
mailtemplate:
|
||||||
@ -201,6 +190,7 @@ operator:
|
|||||||
istatus: "int DEFAULT 0"
|
istatus: "int DEFAULT 0"
|
||||||
idisabled: "int DEFAULT 0"
|
idisabled: "int DEFAULT 0"
|
||||||
vcavatar: "varchar(255)"
|
vcavatar: "varchar(255)"
|
||||||
|
vcjabbername: "varchar(255)"
|
||||||
# Operators privileges bitmask.
|
# Operators privileges bitmask.
|
||||||
iperm: "int DEFAULT 0"
|
iperm: "int DEFAULT 0"
|
||||||
dtmrestore: "int NOT NULL DEFAULT 0"
|
dtmrestore: "int NOT NULL DEFAULT 0"
|
||||||
@ -226,7 +216,7 @@ operatorstatistics:
|
|||||||
|
|
||||||
revision:
|
revision:
|
||||||
fields:
|
fields:
|
||||||
id: "INT NOT NULL PRIMARY KEY"
|
id: "INT NOT NULL"
|
||||||
|
|
||||||
# Contains relations between operators and groups
|
# Contains relations between operators and groups
|
||||||
operatortoopgroup:
|
operatortoopgroup:
|
||||||
@ -245,6 +235,7 @@ ban:
|
|||||||
dtmtill: "int NOT NULL DEFAULT 0"
|
dtmtill: "int NOT NULL DEFAULT 0"
|
||||||
address: "varchar(255)"
|
address: "varchar(255)"
|
||||||
comment: "varchar(255)"
|
comment: "varchar(255)"
|
||||||
|
blockedcount: "int DEFAULT 0"
|
||||||
|
|
||||||
# Contains dynamic configs
|
# Contains dynamic configs
|
||||||
config:
|
config:
|
||||||
@ -300,37 +291,3 @@ visitedpagestatistics:
|
|||||||
acceptedinvitations: "int NOT NULL DEFAULT 0"
|
acceptedinvitations: "int NOT NULL DEFAULT 0"
|
||||||
rejectedinvitations: "int NOT NULL DEFAULT 0"
|
rejectedinvitations: "int NOT NULL DEFAULT 0"
|
||||||
ignoredinvitations: "int NOT NULL DEFAULT 0"
|
ignoredinvitations: "int NOT NULL DEFAULT 0"
|
||||||
|
|
||||||
# Contains info about installed plugins
|
|
||||||
plugin:
|
|
||||||
fields:
|
|
||||||
# Artificial ID
|
|
||||||
id: "INT NOT NULL auto_increment PRIMARY KEY"
|
|
||||||
# Plugin name in "<Vendor>:<Name>" format.
|
|
||||||
name: "varchar(255) NOT NULL"
|
|
||||||
# Installed version of the plugin.
|
|
||||||
version: "varchar(255) NOT NULL"
|
|
||||||
# Indicates if the plugin is installed or not.
|
|
||||||
installed: "tinyint NOT NULL DEFAULT 0"
|
|
||||||
# Indicates if the plugin is enabled or not.
|
|
||||||
enabled: "tinyint NOT NULL DEFAULT 0"
|
|
||||||
# Indicates if the plugin is initialized or not.
|
|
||||||
initialized: "tinyint NOT NULL DEFAULT 0"
|
|
||||||
unique_keys:
|
|
||||||
name: [name]
|
|
||||||
|
|
||||||
# Contains info about all available updates
|
|
||||||
availableupdate:
|
|
||||||
fields:
|
|
||||||
# Artificial ID
|
|
||||||
id: "INT NOT NULL auto_increment PRIMARY KEY"
|
|
||||||
# Can be either "core" or fully qualified plugin's name
|
|
||||||
target: "varchar(255) NOT NULL"
|
|
||||||
# The latest available version of the plugin
|
|
||||||
version: "varchar(255) NOT NULL"
|
|
||||||
# A URL where the new version can be downloaded
|
|
||||||
url: "text"
|
|
||||||
# Description of the update
|
|
||||||
description: "text"
|
|
||||||
unique_keys:
|
|
||||||
target: [target]
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# IMPORTANT: Before install Mibew Messenger copy this file to config.yml and
|
# IMPORTANT: Before install mibew copy this file to config.yml and fill it with
|
||||||
# fill it with your own settings!
|
# your own settings!
|
||||||
|
|
||||||
|
|
||||||
# MySQL Database parameters
|
# MySQL Database parameters
|
||||||
@ -12,60 +12,9 @@ database:
|
|||||||
tables_prefix: ""
|
tables_prefix: ""
|
||||||
use_persistent_connection: false
|
use_persistent_connection: false
|
||||||
|
|
||||||
# Mail
|
# Mailbox
|
||||||
## This value will be used as sender address in all e-mails Mibew Messenger send.
|
|
||||||
mailbox: mibew@yourdomain.com
|
mailbox: mibew@yourdomain.com
|
||||||
|
|
||||||
## Mailer parameters
|
|
||||||
mailer:
|
|
||||||
# This value determines what kind of mailer will be used. Possible values
|
|
||||||
# are "mail" and "smtp".
|
|
||||||
#
|
|
||||||
# To use standard PHP mail function just set this option to "mail". No
|
|
||||||
# additional configs are required in this case.
|
|
||||||
#
|
|
||||||
# To use SMTP-based solution set this option "smtp". This approach require
|
|
||||||
# some extra configuration to be done (see below).
|
|
||||||
transport: mail
|
|
||||||
|
|
||||||
# The lines below represents default SMTP mailer configurations. They will
|
|
||||||
# be used only if the "transport" option is set to "smtp".
|
|
||||||
host: localhost
|
|
||||||
port: 25
|
|
||||||
user: user
|
|
||||||
pass: ""
|
|
||||||
# The following option determines what kind of encryption should be used.
|
|
||||||
# false means no encyption at all. Another values once can use are "ssl" and
|
|
||||||
# "tls".
|
|
||||||
encryption: false
|
|
||||||
|
|
||||||
# Cache subsystem
|
|
||||||
cache:
|
|
||||||
# This value determines where the cached data will be stored. Possible
|
|
||||||
# values are "none", "file_system" and "memcached".
|
|
||||||
#
|
|
||||||
# If "none" is used the caching will be disabled. This option should be used
|
|
||||||
# only if none of the other options works.
|
|
||||||
#
|
|
||||||
# If "file_system" is used the cached data will be stored in files within
|
|
||||||
# the "cache/" directory. Notice, that the file system storage does not work
|
|
||||||
# on NFS systems bucause exclusive file locks are not supported where.
|
|
||||||
#
|
|
||||||
# If "memcached" is used the cached data will be stored in Memcached
|
|
||||||
# storage. Before using this kind of storage make sure PHP's memcached
|
|
||||||
# extension is installed and enabled.
|
|
||||||
storage: file_system
|
|
||||||
|
|
||||||
# The lines below represents default Memcached server configurations. They
|
|
||||||
# will be used only if the "storage" option is set to "memcached".
|
|
||||||
memcached_servers:
|
|
||||||
- host: localhost
|
|
||||||
port: 11211
|
|
||||||
# The "weight" field is optional and can be omitted and it's only positive int number.
|
|
||||||
weight: 1
|
|
||||||
# Actually, one can use any number of memcached servers he wants. Just
|
|
||||||
# add servers description like the one above.
|
|
||||||
|
|
||||||
# Locales
|
# Locales
|
||||||
## Native name will be used in this locale
|
## Native name will be used in this locale
|
||||||
home_locale: en
|
home_locale: en
|
||||||
@ -77,22 +26,17 @@ default_locale: en
|
|||||||
# http://php.net/manual/en/timezones.php
|
# http://php.net/manual/en/timezones.php
|
||||||
timezone: ""
|
timezone: ""
|
||||||
|
|
||||||
# List of proxy's IP Mibew Messenger should trust. You should set this option
|
|
||||||
# if you use Mibew Messenger with a load balancer or behind a proxy.
|
|
||||||
trusted_proxies: []
|
|
||||||
# Here is an example of what values this option can take:
|
|
||||||
# trusted_proxies:
|
|
||||||
# - 127.0.0.1
|
|
||||||
# - ::1
|
|
||||||
# - 10.0.0.0/8
|
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
plugins: []
|
plugins: []
|
||||||
|
|
||||||
## Example of plugins configuration
|
## Exapmle of plugins configuration
|
||||||
# plugins:
|
# plugins:
|
||||||
# "VendorName:PluginName":
|
# -
|
||||||
# weight: 100
|
# name: "VendorName:PluginName"
|
||||||
# some_configurable_value: value
|
# config:
|
||||||
# "VendorName:AnotherPluginName":
|
# weight: 100
|
||||||
# very_important_value: "$3.50"
|
# some_configurable_value: value
|
||||||
|
# -
|
||||||
|
# name: "VendorName:AnotherPluginName"
|
||||||
|
# config:
|
||||||
|
# very_important_value: "$3.50"
|
||||||
|
@ -49,14 +49,6 @@ chat_user:
|
|||||||
thread_id: \d{1,10}
|
thread_id: \d{1,10}
|
||||||
token: \d{1,10}
|
token: \d{1,10}
|
||||||
|
|
||||||
chat_user_check:
|
|
||||||
path: /chat/{thread_id}/{token}/check
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Chat\UserChatController::checkAction
|
|
||||||
requirements:
|
|
||||||
thread_id: \d{1,10}
|
|
||||||
token: \d{1,10}
|
|
||||||
|
|
||||||
chat_user_invitation:
|
chat_user_invitation:
|
||||||
path: /chat/invitation
|
path: /chat/invitation
|
||||||
defaults:
|
defaults:
|
||||||
@ -80,33 +72,11 @@ chat_user_mail_send:
|
|||||||
token: \d{1,10}
|
token: \d{1,10}
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
chat_user_popup_style:
|
|
||||||
path: /chat/style/popup/{style}
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Chat\StyleController::loadPopupStyleAction
|
|
||||||
style: ""
|
|
||||||
requirements:
|
|
||||||
style: "[0-9A-Za-z_]*"
|
|
||||||
|
|
||||||
chat_user_popup_style_force_secure:
|
|
||||||
path: /chat/style/popup/{style}/force_secure
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Chat\StyleController::loadPopupStyleAction
|
|
||||||
style: ""
|
|
||||||
force_secure: on
|
|
||||||
requirements:
|
|
||||||
style: "[0-9A-Za-z_]*"
|
|
||||||
|
|
||||||
chat_user_start:
|
chat_user_start:
|
||||||
path: /chat
|
path: /chat
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\Chat\UserChatController::startAction
|
_controller: Mibew\Controller\Chat\UserChatController::startAction
|
||||||
|
|
||||||
chat_user_cookie_set_permission:
|
|
||||||
path: /chat/cookies-set-permission
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Chat\UserChatController::cookieSetPermissionAction
|
|
||||||
|
|
||||||
# Pages that are available for all users
|
# Pages that are available for all users
|
||||||
button:
|
button:
|
||||||
path: /b
|
path: /b
|
||||||
@ -127,19 +97,16 @@ js_translation:
|
|||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\Localization\JsTranslationController::indexAction
|
_controller: Mibew\Controller\Localization\JsTranslationController::indexAction
|
||||||
|
|
||||||
|
license:
|
||||||
|
path: /license
|
||||||
|
defaults: { _controller: Mibew\Controller\LicenseController::indexAction }
|
||||||
|
|
||||||
widget_gateway:
|
widget_gateway:
|
||||||
path: /widget
|
path: /widget
|
||||||
defaults: { _controller: Mibew\Controller\WidgetController::indexAction }
|
defaults: { _controller: Mibew\Controller\WidgetController::indexAction }
|
||||||
|
|
||||||
# Operators' pages
|
# Operators' pages
|
||||||
|
|
||||||
## About page
|
|
||||||
about:
|
|
||||||
path: /operator/about
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\AboutController::indexAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
|
||||||
|
|
||||||
## Banned visitors
|
## Banned visitors
|
||||||
ban_add:
|
ban_add:
|
||||||
path: /operator/ban/add
|
path: /operator/ban/add
|
||||||
@ -200,24 +167,21 @@ canned_message_add:
|
|||||||
path: /operator/canned-message/add
|
path: /operator/canned-message/add
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::showEditFormAction
|
_controller: Mibew\Controller\CannedMessageController::showEditFormAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
canned_message_add_save:
|
canned_message_add_save:
|
||||||
path: /operator/canned-message/add
|
path: /operator/canned-message/add
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::submitEditFormAction
|
_controller: Mibew\Controller\CannedMessageController::submitEditFormAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
canned_message_delete:
|
canned_message_delete:
|
||||||
path: /operator/canned-message/{message_id}/delete
|
path: /operator/canned-message/{message_id}/delete
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::deleteAction
|
_controller: Mibew\Controller\CannedMessageController::deleteAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
requirements:
|
requirements:
|
||||||
message_id: \d{1,10}
|
message_id: \d{1,10}
|
||||||
|
|
||||||
@ -225,8 +189,7 @@ canned_message_edit:
|
|||||||
path: /operator/canned-message/{message_id}/edit
|
path: /operator/canned-message/{message_id}/edit
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::showEditFormAction
|
_controller: Mibew\Controller\CannedMessageController::showEditFormAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
requirements:
|
requirements:
|
||||||
message_id: \d{1,10}
|
message_id: \d{1,10}
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
@ -235,8 +198,7 @@ canned_message_edit_save:
|
|||||||
path: /operator/canned-message/{message_id}/edit
|
path: /operator/canned-message/{message_id}/edit
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::submitEditFormAction
|
_controller: Mibew\Controller\CannedMessageController::submitEditFormAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
requirements:
|
requirements:
|
||||||
message_id: \d{1,10}
|
message_id: \d{1,10}
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
@ -245,8 +207,7 @@ canned_messages:
|
|||||||
path: /operator/canned-message
|
path: /operator/canned-message
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\CannedMessageController::indexAction
|
_controller: Mibew\Controller\CannedMessageController::indexAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
## Groups
|
## Groups
|
||||||
group_add:
|
group_add:
|
||||||
@ -377,27 +338,7 @@ locale_disable:
|
|||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
requirements:
|
requirements:
|
||||||
locale: "[a-z\\-]{2,5}"
|
locale: "[a-z\-]{2,5}"
|
||||||
|
|
||||||
locale_edit:
|
|
||||||
path: /operator/locale/{locale}/edit
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Localization\LocaleController::showEditFormAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
requirements:
|
|
||||||
locale: "[a-z\\-]{2,5}"
|
|
||||||
methods: [GET]
|
|
||||||
|
|
||||||
locale_edit_save:
|
|
||||||
path: /operator/locale/{locale}/edit
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\Localization\LocaleController::submitEditFormAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
requirements:
|
|
||||||
locale: "[a-z\\-]{2,5}"
|
|
||||||
methods: [POST]
|
|
||||||
|
|
||||||
locale_enable:
|
locale_enable:
|
||||||
path: /operator/locale/{locale}/enable
|
path: /operator/locale/{locale}/enable
|
||||||
@ -406,7 +347,7 @@ locale_enable:
|
|||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
requirements:
|
requirements:
|
||||||
locale: "[a-z\\-]{2,5}"
|
locale: "[a-z\-]{2,5}"
|
||||||
|
|
||||||
locales:
|
locales:
|
||||||
path: /operator/locale
|
path: /operator/locale
|
||||||
@ -607,42 +548,6 @@ password_recovery_reset:
|
|||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\PasswordRecoveryController::resetAction
|
_controller: Mibew\Controller\PasswordRecoveryController::resetAction
|
||||||
|
|
||||||
## Plugins
|
|
||||||
plugin_enable:
|
|
||||||
path: /operator/plugin/{plugin_name}/enable
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\PluginController::enableAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
plugin_disable:
|
|
||||||
path: /operator/plugin/{plugin_name}/disable
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\PluginController::disableAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
plugin_uninstall:
|
|
||||||
path: /operator/plugin/{plugin_name}/uninstall
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\PluginController::uninstallAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
plugin_update:
|
|
||||||
path: /operator/plugin/{plugin_name}/update
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\PluginController::updateAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
path: /operator/plugin
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\PluginController::indexAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
settings_common:
|
settings_common:
|
||||||
path: /operator/settings
|
path: /operator/settings
|
||||||
@ -698,8 +603,7 @@ statistics:
|
|||||||
defaults:
|
defaults:
|
||||||
type: "by-date"
|
type: "by-date"
|
||||||
_controller: Mibew\Controller\StatisticsController::indexAction
|
_controller: Mibew\Controller\StatisticsController::indexAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_VIEWSTATISTICS]
|
|
||||||
requirements:
|
requirements:
|
||||||
type: by-date|by-operator|by-page
|
type: by-date|by-operator|by-page
|
||||||
|
|
||||||
@ -721,7 +625,7 @@ translation_edit:
|
|||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
requirements:
|
requirements:
|
||||||
string_id: "\\d{1,10}"
|
string_id: "\d{1,10}"
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
translation_edit_save:
|
translation_edit_save:
|
||||||
@ -731,7 +635,7 @@ translation_edit_save:
|
|||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
requirements:
|
requirements:
|
||||||
string_id: "\\d{1,10}"
|
string_id: "\d{1,10}"
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
translation_export:
|
translation_export:
|
||||||
@ -774,26 +678,11 @@ translations:
|
|||||||
_access_permissions: [CAN_ADMINISTRATE]
|
_access_permissions: [CAN_ADMINISTRATE]
|
||||||
|
|
||||||
## Updates
|
## Updates
|
||||||
update:
|
updates:
|
||||||
path: /update
|
path: /operator/updates
|
||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\UpdateController::indexAction
|
_controller: Mibew\Controller\UpdatesController::indexAction
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
update_run:
|
|
||||||
path: /update/run
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\UpdateController::runUpdateAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
update_check:
|
|
||||||
path: /update/check
|
|
||||||
defaults:
|
|
||||||
_controller: Mibew\Controller\UpdateController::checkUpdatesAction
|
|
||||||
_access_check: Mibew\AccessControl\Check\PermissionsCheck
|
|
||||||
_access_permissions: [CAN_ADMINISTRATE]
|
|
||||||
|
|
||||||
## Users (visitors avaiting page)
|
## Users (visitors avaiting page)
|
||||||
users:
|
users:
|
||||||
@ -808,17 +697,7 @@ users_update:
|
|||||||
_controller: Mibew\Controller\UsersController::updateAction
|
_controller: Mibew\Controller\UsersController::updateAction
|
||||||
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
|
|
||||||
# System routes and includes
|
# Remove trailing slashe. This route is the last one because previous rotes can
|
||||||
|
|
||||||
# The following route is a fake and is used only to load plugins routes. It can
|
|
||||||
# have any unique name.
|
|
||||||
_include_pluign_routes:
|
|
||||||
# Resource name has no meaning and can be any value.
|
|
||||||
resource: .
|
|
||||||
# The type actually indicates that plugins routes should be included.
|
|
||||||
type: plugin
|
|
||||||
|
|
||||||
# Remove trailing slashes. This route is the last one because previous rotes can
|
|
||||||
# (but definitely should not) have trailing slashes.
|
# (but definitely should not) have trailing slashes.
|
||||||
remove_trailing_slash:
|
remove_trailing_slash:
|
||||||
path: /{url}
|
path: /{url}
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
# The following route is a fake and is used only to load routes of the core. It
|
|
||||||
# can have any unique name.
|
|
||||||
_include_core_routes:
|
|
||||||
resource: routing.yml
|
|
||||||
type: yaml
|
|
||||||
|
|
||||||
# Override the home route to allow users use <mibew root>/install.php path to
|
# Override the home route to allow users use <mibew root>/install.php path to
|
||||||
# the installer.
|
# the installer.
|
||||||
home:
|
home:
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Initialize libraries
|
|
||||||
require_once(dirname(__FILE__) . '/libs/init.php');
|
|
||||||
|
|
||||||
use Mibew\Cache\CacheFactory;
|
|
||||||
use Mibew\Maintenance\CronWorker;
|
|
||||||
use Mibew\Plugin\PluginManager;
|
|
||||||
|
|
||||||
$configs = load_system_configs();
|
|
||||||
|
|
||||||
// Prepare the cache. It is initialized in the same way as in index.php
|
|
||||||
$cache_factory = new CacheFactory($configs['cache']);
|
|
||||||
// For now directory for cache files cannot be changed via the configs file.
|
|
||||||
$cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
|
|
||||||
|
|
||||||
// Run plugins
|
|
||||||
if (get_maintenance_mode() === false) {
|
|
||||||
$plugin_manager = PluginManager::getInstance();
|
|
||||||
$plugin_manager->setCache($cache_factory->getCache());
|
|
||||||
$plugin_manager->loadPlugins($configs['plugins']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the job.
|
|
||||||
$worker = new CronWorker($cache_factory->getCache());
|
|
||||||
$success = $worker->run();
|
|
||||||
|
|
||||||
if ($success) {
|
|
||||||
echo("All cron jobs done\n");
|
|
||||||
} else {
|
|
||||||
echo("Cron job failed. Here are the errors:\n");
|
|
||||||
foreach ($worker->getErrors() as $error) {
|
|
||||||
echo(' ' . $error . "\n");
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -22,49 +22,19 @@ require_once(dirname(__FILE__) . '/libs/init.php');
|
|||||||
|
|
||||||
use Mibew\Application;
|
use Mibew\Application;
|
||||||
use Mibew\Authentication\AuthenticationManager;
|
use Mibew\Authentication\AuthenticationManager;
|
||||||
use Mibew\Cache\CacheFactory;
|
use Mibew\Routing\RouteCollectionLoader;
|
||||||
use Mibew\Mail\MailerFactory;
|
|
||||||
use Mibew\Plugin\PluginManager;
|
|
||||||
use Mibew\Routing\Router;
|
use Mibew\Routing\Router;
|
||||||
use Mibew\Routing\Loader\CacheLoader;
|
|
||||||
use Mibew\Routing\Loader\PluginLoader;
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Loader\YamlFileLoader;
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
|
||||||
$configs = load_system_configs();
|
$file_locator = new FileLocator(array(MIBEW_FS_ROOT));
|
||||||
|
$router = new Router(new RouteCollectionLoader($file_locator));
|
||||||
// Prepare the cache
|
$router->setOption(
|
||||||
$cache_factory = new CacheFactory($configs['cache']);
|
'route_collection',
|
||||||
// For now directory for cache files cannot be changed via the configs file.
|
RouteCollectionLoader::ROUTES_CORE | RouteCollectionLoader::ROUTES_PLUGINS
|
||||||
// TODO: Evaluate possibility of using custom cache directory.
|
);
|
||||||
$cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
|
|
||||||
|
|
||||||
// Run plugins
|
|
||||||
if (get_maintenance_mode() === false) {
|
|
||||||
$plugin_manager = PluginManager::getInstance();
|
|
||||||
$plugin_manager->setCache($cache_factory->getCache());
|
|
||||||
$plugin_manager->loadPlugins($configs['plugins']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main route loader which loads nothig but works as a cache proxy for other
|
|
||||||
// loaders.
|
|
||||||
$route_loader = new CacheLoader($cache_factory->getCache());
|
|
||||||
// Real loaders are attached via the resolver.
|
|
||||||
$loader_resolver = new LoaderResolver(array(
|
|
||||||
$route_loader,
|
|
||||||
new YamlFileLoader(new FileLocator(array(MIBEW_FS_ROOT))),
|
|
||||||
new PluginLoader(),
|
|
||||||
));
|
|
||||||
|
|
||||||
$router = new Router($route_loader, 'configs/routing.yml');
|
|
||||||
|
|
||||||
$application = new Application($router, new AuthenticationManager());
|
$application = new Application($router, new AuthenticationManager());
|
||||||
$application->setCache($cache_factory->getCache());
|
|
||||||
|
|
||||||
// Use custom config-dependent mailer factory
|
|
||||||
$application->setMailerFactory(new MailerFactory($configs['mailer']));
|
|
||||||
|
|
||||||
// Process request
|
// Process request
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -20,4 +20,4 @@
|
|||||||
// Force the user to specify the entry point. This should be done only when
|
// Force the user to specify the entry point. This should be done only when
|
||||||
// mod_rewrite is not used by apache.
|
// mod_rewrite is not used by apache.
|
||||||
header('HTTP/1.0 301 Moved Permanently');
|
header('HTTP/1.0 301 Moved Permanently');
|
||||||
header('Location: index.php');
|
header('Location: index.php/');
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -17,28 +17,24 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('MAINTENANCE_MODE', 'install');
|
define('INSTALLATION_IN_PROGRESS', true);
|
||||||
|
|
||||||
// Initialize libraries
|
// Initialize libraries
|
||||||
require_once(dirname(__FILE__) . '/libs/init.php');
|
require_once(dirname(__FILE__) . '/libs/init.php');
|
||||||
|
|
||||||
use Mibew\Application;
|
use Mibew\Application;
|
||||||
use Mibew\Authentication\DummyAuthenticationManager;
|
use Mibew\Authentication\DummyAuthenticationManager;
|
||||||
use Mibew\Routing\Loader\DummyPluginLoader;
|
use Mibew\Routing\RouteCollectionLoader;
|
||||||
use Mibew\Routing\Router;
|
use Mibew\Routing\Router;
|
||||||
use Symfony\Component\Config\FileLocator;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Loader\YamlFileLoader;
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
|
||||||
// Prepare router
|
|
||||||
$file_locator = new FileLocator(array(MIBEW_FS_ROOT));
|
$file_locator = new FileLocator(array(MIBEW_FS_ROOT));
|
||||||
$route_loader = new YamlFileLoader($file_locator);
|
$router = new Router(new RouteCollectionLoader($file_locator));
|
||||||
$loader_resolver = new LoaderResolver(array(
|
$router->setOption(
|
||||||
$route_loader,
|
'route_collection',
|
||||||
new DummyPluginLoader(),
|
RouteCollectionLoader::ROUTES_CORE | RouteCollectionLoader::ROUTES_INSTALLATION
|
||||||
));
|
);
|
||||||
$router = new Router($route_loader, 'configs/routing_install.yml');
|
|
||||||
|
|
||||||
$application = new Application($router, new DummyAuthenticationManager());
|
$application = new Application($router, new DummyAuthenticationManager());
|
||||||
|
|
||||||
|
2
src/mibew/js/libs/backbone-min.js
vendored
Normal file
2
src/mibew/js/libs/backbone-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
src/mibew/js/libs/backbone.marionette.min.js
vendored
Normal file
22
src/mibew/js/libs/backbone.marionette.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
28
src/mibew/js/libs/handlebars.min.js
vendored
Normal file
28
src/mibew/js/libs/handlebars.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
src/mibew/js/libs/jquery.min.js
vendored
Normal file
4
src/mibew/js/libs/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
src/mibew/js/libs/json2.js
Normal file
13
src/mibew/js/libs/json2.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
json2.js
|
||||||
|
2011-10-19
|
||||||
|
Public Domain.
|
||||||
|
See http://www.JSON.org/js.html
|
||||||
|
*/
|
||||||
|
var JSON;JSON||(JSON={});
|
||||||
|
(function(){function k(a){return 10>a?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function m(a,j){var c,d,h,n,g=e,f,b=j[a];b&&("object"===typeof b&&"function"===typeof b.toJSON)&&(b=b.toJSON(a));"function"===typeof i&&(b=i.call(j,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);case "object":if(!b)return"null";
|
||||||
|
e+=l;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){n=b.length;for(c=0;c<n;c+=1)f[c]=m(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(i&&"object"===typeof i){n=i.length;for(c=0;c<n;c+=1)"string"===typeof i[c]&&(d=i[c],(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+e)+"\n"+g+"}":"{"+f.join(",")+
|
||||||
|
"}";e=g;return h}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||||
|
p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,l,r={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,j,c){var d;l=e="";if(typeof c==="number")for(d=0;d<c;d=d+1)l=l+" ";else typeof c==="string"&&(l=c);if((i=j)&&typeof j!=="function"&&(typeof j!=="object"||typeof j.length!=="number"))throw Error("JSON.stringify");return m("",{"":a})});
|
||||||
|
"function"!==typeof JSON.parse&&(JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&typeof b==="object")for(g in b)if(Object.prototype.hasOwnProperty.call(b,g)){f=c(b,g);f!==void 0?b[g]=f:delete b[g]}return e.call(a,d,b)}var d,a=String(a);q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||||
|
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){d=eval("("+a+")");return typeof e==="function"?c({"":d},""):d}throw new SyntaxError("JSON.parse");})})();
|
6
src/mibew/js/libs/underscore-min.js
vendored
Normal file
6
src/mibew/js/libs/underscore-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,19 +19,10 @@
|
|||||||
(function(Mibew, $) {
|
(function(Mibew, $) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('a.remove-link').click(function() {
|
$('a.remove-link').click(function() {
|
||||||
var url = $(this).attr('href'),
|
return confirm(Mibew.Localization.trans(
|
||||||
message = Mibew.Localization.trans(
|
'Are you sure that you want to delete address {0} from the blocked list?',
|
||||||
'Are you sure that you want to delete address {0} from the blocked list?',
|
$(this).data('ban-address')
|
||||||
$(this).data('ban-address')
|
));
|
||||||
);
|
|
||||||
|
|
||||||
Mibew.Utils.confirm(message, function(value) {
|
|
||||||
if (value) {
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})(Mibew, jQuery);
|
})(Mibew, jQuery);
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*!
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function(Mibew, $) {
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('#copy-button-code').click(function(e){
|
|
||||||
$("#button-code").select();
|
|
||||||
document.execCommand('copy');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})(Mibew, jQuery);
|
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -51,7 +51,8 @@
|
|||||||
app.Invitation.start(options.invitationOptions);
|
app.Invitation.start(options.invitationOptions);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("Don't know how to start!");
|
throw new Error('Dont know how to start!');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -24,25 +24,17 @@
|
|||||||
Mibew.Views.MessagesCollection = Mibew.Views.CollectionBase.extend(
|
Mibew.Views.MessagesCollection = Mibew.Views.CollectionBase.extend(
|
||||||
/** @lends Mibew.Views.MessagesCollection.prototype */
|
/** @lends Mibew.Views.MessagesCollection.prototype */
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Default item view constructor.
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
itemView: Mibew.Views.Message,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class name for view's DOM element
|
* Class name for view's DOM element
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
className: 'messages-collection',
|
className: 'messages-collection'
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns default child view constructor.
|
|
||||||
*
|
|
||||||
* The function is used instead of "childView" property to provide
|
|
||||||
* an ability to override child view constructor without this class
|
|
||||||
* overriding.
|
|
||||||
*
|
|
||||||
* @param {Backbone.Model} model The model the view created for.
|
|
||||||
* @returns {Backbone.Marionette.ItemView}
|
|
||||||
*/
|
|
||||||
getChildView: function(model) {
|
|
||||||
return Mibew.Views.Message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -24,25 +24,17 @@
|
|||||||
Mibew.Views.StatusCollection = Mibew.Views.CollectionBase.extend(
|
Mibew.Views.StatusCollection = Mibew.Views.CollectionBase.extend(
|
||||||
/** @lends Mibew.Views.StatusCollection.prototype */
|
/** @lends Mibew.Views.StatusCollection.prototype */
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Default item view constructor.
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
itemView: Mibew.Views.Status,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class name for view's DOM element
|
* Class name for view's DOM element
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
className: 'status-collection',
|
className: 'status-collection'
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns default child view constructor.
|
|
||||||
*
|
|
||||||
* The function is used instead of "childView" property to provide
|
|
||||||
* an ability to override child view constructor without this class
|
|
||||||
* overriding.
|
|
||||||
*
|
|
||||||
* @param {Backbone.Model} model The model the view created for.
|
|
||||||
* @returns {Backbone.Marionette.ItemView}
|
|
||||||
*/
|
|
||||||
getChildView: function(model) {
|
|
||||||
return Mibew.Views.Status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -119,7 +119,7 @@
|
|||||||
eventArgs = {
|
eventArgs = {
|
||||||
'messageData': messageData,
|
'messageData': messageData,
|
||||||
'model': false
|
'model': false
|
||||||
};
|
}
|
||||||
|
|
||||||
// Trigger event. See description of eventName and eventArgs
|
// Trigger event. See description of eventName and eventArgs
|
||||||
// above.
|
// above.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* Represents chat layout
|
* Represents chat layout
|
||||||
*/
|
*/
|
||||||
Mibew.Layouts.Chat = Backbone.Marionette.LayoutView.extend(
|
Mibew.Layouts.Chat = Backbone.Marionette.Layout.extend(
|
||||||
/** @lends Mibew.Layouts.Chat.prototype */
|
/** @lends Mibew.Layouts.Chat.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -39,7 +39,7 @@
|
|||||||
avatarRegion: '#avatar-region',
|
avatarRegion: '#avatar-region',
|
||||||
messagesRegion: {
|
messagesRegion: {
|
||||||
selector: '#messages-region',
|
selector: '#messages-region',
|
||||||
regionClass: Mibew.Regions.Messages
|
regionType: Mibew.Regions.Messages
|
||||||
},
|
},
|
||||||
statusRegion: '#status-region',
|
statusRegion: '#status-region',
|
||||||
messageFormRegion: '#message-form-region'
|
messageFormRegion: '#message-form-region'
|
||||||
@ -59,7 +59,7 @@
|
|||||||
return {
|
return {
|
||||||
page: models.page.toJSON(),
|
page: models.page.toJSON(),
|
||||||
user: models.user.toJSON()
|
user: models.user.toJSON()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* Represents invitation layout
|
* Represents invitation layout
|
||||||
*/
|
*/
|
||||||
Mibew.Layouts.Invitation = Backbone.Marionette.LayoutView.extend(
|
Mibew.Layouts.Invitation = Backbone.Marionette.Layout.extend(
|
||||||
/** @lends Mibew.Layouts.Invitation.prototype */
|
/** @lends Mibew.Layouts.Invitation.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,7 @@
|
|||||||
regions: {
|
regions: {
|
||||||
messagesRegion: {
|
messagesRegion: {
|
||||||
selector: '#invitation-messages-region',
|
selector: '#invitation-messages-region',
|
||||||
regionClass: Mibew.Regions.Messages
|
regionType: Mibew.Regions.Messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* Represents leave message page layout
|
* Represents leave message page layout
|
||||||
*/
|
*/
|
||||||
Mibew.Layouts.LeaveMessage = Backbone.Marionette.LayoutView.extend(
|
Mibew.Layouts.LeaveMessage = Backbone.Marionette.Layout.extend(
|
||||||
/** @lends Mibew.Layouts.LeaveMessage.prototype */
|
/** @lends Mibew.Layouts.LeaveMessage.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -51,7 +51,7 @@
|
|||||||
serializeData: function() {
|
serializeData: function() {
|
||||||
return {
|
return {
|
||||||
page: Mibew.Objects.Models.page.toJSON()
|
page: Mibew.Objects.Models.page.toJSON()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* Represents survey layout
|
* Represents survey layout
|
||||||
*/
|
*/
|
||||||
Mibew.Layouts.Survey = Backbone.Marionette.LayoutView.extend(
|
Mibew.Layouts.Survey = Backbone.Marionette.Layout.extend(
|
||||||
/** @lends Mibew.Layouts.Survey.prototype */
|
/** @lends Mibew.Layouts.Survey.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -50,7 +50,7 @@
|
|||||||
serializeData: function() {
|
serializeData: function() {
|
||||||
return {
|
return {
|
||||||
page: Mibew.Objects.Models.page.toJSON()
|
page: Mibew.Objects.Models.page.toJSON()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -40,6 +40,6 @@ MibewAPIChatInteraction = function() {
|
|||||||
return [
|
return [
|
||||||
'result'
|
'result'
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
MibewAPIChatInteraction.prototype = new MibewAPIInteraction();
|
MibewAPIChatInteraction.prototype = new MibewAPIInteraction();
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -49,15 +49,13 @@
|
|||||||
*/
|
*/
|
||||||
closeThread: function() {
|
closeThread: function() {
|
||||||
// Show confirmation message if can
|
// Show confirmation message if can
|
||||||
var confirmMessage = Mibew.Localization.trans('Are you sure that you want to leave the chat?'),
|
var confirmMessage = Mibew.Localization.trans('Are you sure want to leave chat?');
|
||||||
context = this;
|
|
||||||
if (confirmMessage !== false) {
|
if (confirmMessage !== false) {
|
||||||
Mibew.Utils.confirm(confirmMessage, function(value) {
|
if (! confirm(confirmMessage)) {
|
||||||
if (value) {
|
return;
|
||||||
context.model.closeThread();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
this.model.closeThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -45,13 +45,13 @@
|
|||||||
),
|
),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display history window
|
* Dispalay history window
|
||||||
*/
|
*/
|
||||||
showHistory: function() {
|
showHistory: function() {
|
||||||
var user = Mibew.Objects.Models.user;
|
var user = Mibew.Objects.Models.user;
|
||||||
var link = this.model.get('link');
|
var link = this.model.get('link');
|
||||||
if (user.get('isAgent') && link) {
|
if (user.get('isAgent') && link) {
|
||||||
var winParams = Mibew.Utils.buildWindowParams(this.model.get('windowParams'));
|
var winParams = this.model.get('windowParams');
|
||||||
|
|
||||||
// TODO: Kill & at the server side
|
// TODO: Kill & at the server side
|
||||||
link = link.replace('&', '&', 'g');
|
link = link.replace('&', '&', 'g');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -48,15 +48,11 @@
|
|||||||
* Move to secure chat
|
* Move to secure chat
|
||||||
*/
|
*/
|
||||||
secure: function() {
|
secure: function() {
|
||||||
if (window.location.protocol == 'https:') {
|
var link = this.model.get('link')
|
||||||
return;
|
|
||||||
}
|
|
||||||
var link = this.model.get('link');
|
|
||||||
if (link) {
|
if (link) {
|
||||||
var style = Mibew.Objects.Models.page.get('style');
|
var style = Mibew.Objects.Models.page.get('style');
|
||||||
window.location.href = link.replace(/\&\;/g, '&')
|
window.location.href = link.replace(/\&\;/g, '&')
|
||||||
+ (style ? ((link.indexOf('?') > -1 ? '&' : '?')
|
+ (style ? ('&style=' + style) : '');
|
||||||
+ 'style=' + style) : '');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -44,17 +44,6 @@
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
/**
|
|
||||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
|
||||||
* extra fields to template.
|
|
||||||
* @returns {Object} Template data
|
|
||||||
*/
|
|
||||||
serializeData: function() {
|
|
||||||
var data = this.model.toJSON();
|
|
||||||
data.user = Mibew.Objects.Models.user.toJSON();
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load and display send mail window
|
* Load and display send mail window
|
||||||
*/
|
*/
|
||||||
@ -62,7 +51,7 @@
|
|||||||
var link = this.model.get('link');
|
var link = this.model.get('link');
|
||||||
var page = Mibew.Objects.Models.page;
|
var page = Mibew.Objects.Models.page;
|
||||||
if (link) {
|
if (link) {
|
||||||
var winParams = Mibew.Utils.buildWindowParams(this.model.get('windowParams'));
|
var winParams = this.model.get('windowParams');
|
||||||
|
|
||||||
var style = page.get('style');
|
var style = page.get('style');
|
||||||
var styleArg = '';
|
var styleArg = '';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
/*!
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function(Mibew, Handlebars, _) {
|
|
||||||
/**
|
|
||||||
* @class Represents Tracked path control view
|
|
||||||
*/
|
|
||||||
Mibew.Views.TrackedPathControl = Mibew.Views.Control.extend(
|
|
||||||
/** @lends Mibew.Views.TrackedPathControl.prototype */
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Template function
|
|
||||||
* @type Function
|
|
||||||
*/
|
|
||||||
template: Handlebars.templates['chat/controls/tracked_path'],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map ui events to view methods
|
|
||||||
* The view inherits events from
|
|
||||||
* {@link Mibew.Views.Control.prototype.events}.
|
|
||||||
* @type Object
|
|
||||||
*/
|
|
||||||
events: _.extend(
|
|
||||||
{},
|
|
||||||
Mibew.Views.Control.prototype.events,
|
|
||||||
{
|
|
||||||
'click': 'showTrackedPath'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display tracked path window
|
|
||||||
*/
|
|
||||||
showTrackedPath: function() {
|
|
||||||
var user = Mibew.Objects.Models.user;
|
|
||||||
var link = this.model.get('link');
|
|
||||||
if (user.get('isAgent') && link) {
|
|
||||||
var winParams = Mibew.Utils.buildWindowParams(this.model.get('windowParams'));
|
|
||||||
|
|
||||||
// TODO: Kill & at the server side
|
|
||||||
link = link.replace('&', '&', 'g');
|
|
||||||
|
|
||||||
var newWindow = window.open(link, 'UserTrackedPath', winParams);
|
|
||||||
if (newWindow !== null) {
|
|
||||||
newWindow.focus();
|
|
||||||
newWindow.opener=window;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
})(Mibew, Handlebars, _);
|
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -42,7 +42,7 @@
|
|||||||
serializeData: function() {
|
serializeData: function() {
|
||||||
return {
|
return {
|
||||||
page: Mibew.Objects.Models.page.toJSON()
|
page: Mibew.Objects.Models.page.toJSON()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
// Update group id
|
// Update group id
|
||||||
if (this.model.get('groups')) {
|
if (this.model.get('groups')) {
|
||||||
values.groupId = this.ui.groupSelect.val();
|
values.groupId = this.ui.groupSelect.val()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update name
|
// Update name
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -42,7 +42,7 @@
|
|||||||
serializeData: function() {
|
serializeData: function() {
|
||||||
return {
|
return {
|
||||||
page: Mibew.Objects.Models.page.toJSON()
|
page: Mibew.Objects.Models.page.toJSON()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -84,9 +84,6 @@
|
|||||||
* Get, check and post message
|
* Get, check and post message
|
||||||
*/
|
*/
|
||||||
postMessage: function() {
|
postMessage: function() {
|
||||||
if (this.isDisabledInput()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var msg = this.ui.message.val();
|
var msg = this.ui.message.val();
|
||||||
// TODO: Think about it
|
// TODO: Think about it
|
||||||
// Cut multiple line breaks
|
// Cut multiple line breaks
|
||||||
@ -94,12 +91,12 @@
|
|||||||
if (msg != '') {
|
if (msg != '') {
|
||||||
this.disableInput();
|
this.disableInput();
|
||||||
this.model.postMessage(msg);
|
this.model.postMessage(msg);
|
||||||
Mibew.Objects.Collections.messages.once(
|
|
||||||
'multiple:add',
|
|
||||||
this.postMessageComplete,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
Mibew.Objects.Collections.messages.on(
|
||||||
|
'multiple:add',
|
||||||
|
this.postMessageComplete,
|
||||||
|
this
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,13 +129,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check is disabled message input area
|
|
||||||
*/
|
|
||||||
isDisabledInput: function() {
|
|
||||||
return this.ui.message.attr('disabled') == 'disabled';
|
|
||||||
},
|
|
||||||
|
|
||||||
/**svn
|
|
||||||
* Clear message input area
|
* Clear message input area
|
||||||
*/
|
*/
|
||||||
clearInput: function() {
|
clearInput: function() {
|
||||||
@ -159,6 +149,11 @@
|
|||||||
this.enableInput();
|
this.enableInput();
|
||||||
// Always set focus on message input after message sent
|
// Always set focus on message input after message sent
|
||||||
this.ui.message.focus();
|
this.ui.message.focus();
|
||||||
|
Mibew.Objects.Collections.messages.off(
|
||||||
|
'multiple:add',
|
||||||
|
this.postMessageComplete,
|
||||||
|
this
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
ui: {
|
ui: {
|
||||||
groupSelect: 'select[name="group"]',
|
groupSelect: 'select[name="group"]',
|
||||||
groupDescription: '#group-description',
|
groupDescription: '#groupDescription',
|
||||||
name: 'input[name="name"]',
|
name: 'input[name="name"]',
|
||||||
email: 'input[name="email"]',
|
email: 'input[name="email"]',
|
||||||
message: 'textarea[name="message"]',
|
message: 'textarea[name="message"]',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
// Update group id
|
// Update group id
|
||||||
if (this.model.get('groups')) {
|
if (this.model.get('groups')) {
|
||||||
values.groupId = this.ui.groupSelect.val();
|
values.groupId = this.ui.groupSelect.val()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update name
|
// Update name
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -54,13 +54,6 @@
|
|||||||
_.bind(this.apiSetupAvatar, this)
|
_.bind(this.apiSetupAvatar, this)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update avatar if operator changed.
|
|
||||||
Mibew.Objects.Models.thread.on(
|
|
||||||
'change:agentId',
|
|
||||||
this.setFromThread,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Model finalizer
|
// Model finalizer
|
||||||
@ -79,37 +72,9 @@
|
|||||||
* @param args {Object} An object of passed arguments
|
* @param args {Object} An object of passed arguments
|
||||||
*/
|
*/
|
||||||
apiSetupAvatar: function(args) {
|
apiSetupAvatar: function(args) {
|
||||||
this.set({imageLink: (args.imageLink || false)});
|
if (args.imageLink) {
|
||||||
},
|
this.set({imageLink: args.imageLink});
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets avatar based on data from the thread.
|
|
||||||
* @param {Object} thread An instance of Mibew.Models.Thread
|
|
||||||
*/
|
|
||||||
setFromThread: function(thread) {
|
|
||||||
if (!thread.get('agentId')) {
|
|
||||||
// There is no operator. Hide the avatar.
|
|
||||||
this.set({imageLink: false});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request operator's avatar at the server side
|
|
||||||
Mibew.Objects.server.callFunctions(
|
|
||||||
[{
|
|
||||||
'function': 'getAvatar',
|
|
||||||
'arguments': {
|
|
||||||
'references': {},
|
|
||||||
'return': {
|
|
||||||
'imageLink': 'imageLink'
|
|
||||||
},
|
|
||||||
'threadId': thread.get('id'),
|
|
||||||
'token': thread.get('token')
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
_.bind(this.apiSetupAvatar, this),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -57,7 +57,7 @@
|
|||||||
* Not applicable for agents.
|
* Not applicable for agents.
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
defaultName: true
|
dafaultName: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -59,7 +59,7 @@
|
|||||||
}],
|
}],
|
||||||
function(args){
|
function(args){
|
||||||
if (args.closed) {
|
if (args.closed) {
|
||||||
Mibew.Utils.closeChatPopup();
|
window.close();
|
||||||
} else {
|
} else {
|
||||||
// Something went wrong. Display error message
|
// Something went wrong. Display error message
|
||||||
Mibew.Objects.Models.Status.message.setMessage(
|
Mibew.Objects.Models.Status.message.setMessage(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -60,7 +60,7 @@
|
|||||||
* @returns {String} Model type
|
* @returns {String} Model type
|
||||||
*/
|
*/
|
||||||
getModelType: function() {
|
getModelType: function() {
|
||||||
return 'SoundControl';
|
return 'SoundControl'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/*!
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function(Mibew, _){
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class Tracked path control model
|
|
||||||
*/
|
|
||||||
Mibew.Models.TrackedPathControl = Mibew.Models.Control.extend(
|
|
||||||
/** @lends Mibew.Models.TrackedPathControl.prototype */
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A list of default model values.
|
|
||||||
*
|
|
||||||
* The model inherits defaults from
|
|
||||||
* {@link Mibew.Models.Control.prototype.defaults}.
|
|
||||||
* @type Object
|
|
||||||
*/
|
|
||||||
defaults: _.extend(
|
|
||||||
{},
|
|
||||||
Mibew.Models.Control.prototype.defaults,
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* An URL of the tracked path page or false by default.
|
|
||||||
* @type String|Boolean
|
|
||||||
*/
|
|
||||||
link: false,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Params string for tracked path popup window
|
|
||||||
* @type String
|
|
||||||
*/
|
|
||||||
windowParams: ''
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns model type
|
|
||||||
* @returns {String} Model type
|
|
||||||
*/
|
|
||||||
getModelType: function() {
|
|
||||||
return 'TrackedPathControl';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
})(Mibew, _);
|
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -53,7 +53,7 @@
|
|||||||
* @returns {String} Model type
|
* @returns {String} Model type
|
||||||
*/
|
*/
|
||||||
getModelType: function() {
|
getModelType: function() {
|
||||||
return 'StatusMessage';
|
return 'StatusMessage'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -55,7 +55,7 @@
|
|||||||
* @returns {String} Model type
|
* @returns {String} Model type
|
||||||
*/
|
*/
|
||||||
getModelType: function() {
|
getModelType: function() {
|
||||||
return 'StatusTyping';
|
return 'StatusTyping'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -61,18 +61,6 @@
|
|||||||
* @param Object attributes Attributes hash for test
|
* @param Object attributes Attributes hash for test
|
||||||
*/
|
*/
|
||||||
validate: function(attributes) {
|
validate: function(attributes) {
|
||||||
// Check visitor's name
|
|
||||||
if (this.get('canChangeName') && typeof attributes.name != 'undefined') {
|
|
||||||
var trimmedName = attributes.name
|
|
||||||
// Remove leading spaces from the name
|
|
||||||
.replace(/^\s+/, '')
|
|
||||||
// Remove trailing spaces from the name
|
|
||||||
.replace(/\s+$/, '');
|
|
||||||
if (trimmedName.length === 0) {
|
|
||||||
return Mibew.Localization.trans('Name is required.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check email
|
// Check email
|
||||||
if (this.get('showEmail')) {
|
if (this.get('showEmail')) {
|
||||||
if (typeof attributes.email != 'undefined') {
|
if (typeof attributes.email != 'undefined') {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -101,15 +101,6 @@
|
|||||||
windowParams: options.windowsParams.history
|
windowParams: options.windowsParams.history
|
||||||
});
|
});
|
||||||
ctrlsCollection.add(controls.history);
|
ctrlsCollection.add(controls.history);
|
||||||
|
|
||||||
if (options.links.tracked) {
|
|
||||||
controls.tracked_path = new Mibew.Models.TrackedPathControl({
|
|
||||||
weight: 170,
|
|
||||||
link: options.links.tracked,
|
|
||||||
windowParams: options.windowsParams.trackedPath
|
|
||||||
});
|
|
||||||
ctrlsCollection.add(controls.tracked_path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create toggle sound button
|
// Create toggle sound button
|
||||||
@ -197,15 +188,6 @@
|
|||||||
|
|
||||||
models.soundManager = new Mibew.Models.ChatSoundManager();
|
models.soundManager = new Mibew.Models.ChatSoundManager();
|
||||||
|
|
||||||
// If the chat is ran inside an iframe we need to tell the parent page
|
|
||||||
// that the chat is started. This is needed to reopen chat when the user
|
|
||||||
// navigates to another page.
|
|
||||||
if (!models.user.get('isAgent') && options.links.chat) {
|
|
||||||
if (window.parent && window.parent.postMessage && (window.parent !== window)) {
|
|
||||||
window.parent.postMessage('mibew-chat-started:' + window.name + ':' + options.links.chat, '*');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: May be move it somewhere else
|
// TODO: May be move it somewhere else
|
||||||
// Periodically call update function at the server side
|
// Periodically call update function at the server side
|
||||||
periodicallyCalled.push(
|
periodicallyCalled.push(
|
||||||
@ -221,8 +203,6 @@
|
|||||||
"function": "update",
|
"function": "update",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"return": {
|
"return": {
|
||||||
'threadState': 'threadState',
|
|
||||||
'threadAgentId': 'threadAgentId',
|
|
||||||
'typing': 'typing',
|
'typing': 'typing',
|
||||||
'canPost': 'canPost'
|
'canPost': 'canPost'
|
||||||
},
|
},
|
||||||
@ -234,7 +214,7 @@
|
|||||||
"user": (! user.get('isAgent'))
|
"user": (! user.get('isAgent'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
},
|
},
|
||||||
function(args) {
|
function(args) {
|
||||||
// Check if there was an error
|
// Check if there was an error
|
||||||
@ -252,11 +232,6 @@
|
|||||||
Mibew.Objects.Models.user.set({
|
Mibew.Objects.Models.user.set({
|
||||||
canPost: args.canPost || false
|
canPost: args.canPost || false
|
||||||
});
|
});
|
||||||
// Update thread fields
|
|
||||||
Mibew.Objects.Models.thread.set({
|
|
||||||
'agentId': args.threadAgentId,
|
|
||||||
'state': args.threadState
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -267,12 +242,12 @@
|
|||||||
// Restart server updater because module just started and there are no
|
// Restart server updater because module just started and there are no
|
||||||
// reasons to wait refresh time to get results of previous request
|
// reasons to wait refresh time to get results of previous request
|
||||||
Mibew.Objects.server.restartUpdater();
|
Mibew.Objects.server.restartUpdater();
|
||||||
});
|
})
|
||||||
|
|
||||||
// Add module finalizer
|
// Add module finalizer
|
||||||
chat.addFinalizer(function() {
|
chat.addFinalizer(function() {
|
||||||
// Close layout
|
// Close layout
|
||||||
Mibew.Objects.chatLayout.destroy();
|
Mibew.Objects.chatLayout.close();
|
||||||
|
|
||||||
|
|
||||||
// Stop call functions periodically
|
// Stop call functions periodically
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -78,7 +78,7 @@
|
|||||||
"user": true
|
"user": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
},
|
},
|
||||||
function() {}
|
function() {}
|
||||||
)
|
)
|
||||||
@ -90,12 +90,12 @@
|
|||||||
// Restart server updater because module just started and there are no
|
// Restart server updater because module just started and there are no
|
||||||
// reasons to wait refresh time to get results of previous request
|
// reasons to wait refresh time to get results of previous request
|
||||||
Mibew.Objects.server.restartUpdater();
|
Mibew.Objects.server.restartUpdater();
|
||||||
});
|
})
|
||||||
|
|
||||||
// Add module finalizer
|
// Add module finalizer
|
||||||
invitation.addFinalizer(function() {
|
invitation.addFinalizer(function() {
|
||||||
// Close layout
|
// Close layout
|
||||||
Mibew.Objects.invitationLayout.destroy();
|
Mibew.Objects.invitationLayout.close();
|
||||||
|
|
||||||
|
|
||||||
// Stop call functions periodically
|
// Stop call functions periodically
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -58,8 +58,8 @@
|
|||||||
// When message sent form should be hide and description should be
|
// When message sent form should be hide and description should be
|
||||||
// changed
|
// changed
|
||||||
models.leaveMessageForm.on('submit:complete', function() {
|
models.leaveMessageForm.on('submit:complete', function() {
|
||||||
objs.leaveMessageLayout.leaveMessageFormRegion.empty();
|
objs.leaveMessageLayout.leaveMessageFormRegion.close();
|
||||||
objs.leaveMessageLayout.descriptionRegion.empty();
|
objs.leaveMessageLayout.descriptionRegion.close();
|
||||||
|
|
||||||
objs.leaveMessageLayout.descriptionRegion.show(
|
objs.leaveMessageLayout.descriptionRegion.show(
|
||||||
new Mibew.Views.LeaveMessageSentDescription()
|
new Mibew.Views.LeaveMessageSentDescription()
|
||||||
@ -71,7 +71,7 @@
|
|||||||
// Add module finalizer
|
// Add module finalizer
|
||||||
leaveMessage.addFinalizer(function() {
|
leaveMessage.addFinalizer(function() {
|
||||||
// Close layout
|
// Close layout
|
||||||
Mibew.Objects.leaveMessageLayout.destroy();
|
Mibew.Objects.leaveMessageLayout.close();
|
||||||
|
|
||||||
// Remove instance of leaveMessage form model
|
// Remove instance of leaveMessage form model
|
||||||
delete Mibew.Objects.Models.leaveMessageForm;
|
delete Mibew.Objects.Models.leaveMessageForm;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -50,7 +50,7 @@
|
|||||||
// Add module finalizer
|
// Add module finalizer
|
||||||
survey.addFinalizer(function() {
|
survey.addFinalizer(function() {
|
||||||
// Close layout
|
// Close layout
|
||||||
Mibew.Objects.surveyLayout.destroy();
|
Mibew.Objects.surveyLayout.close();
|
||||||
|
|
||||||
// Remove instance of survey form model
|
// Remove instance of survey form model
|
||||||
delete Mibew.Objects.Models.surveyForm;
|
delete Mibew.Objects.Models.surveyForm;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -26,11 +26,11 @@
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Show view event handler. Register handler to view's
|
* Show view event handler. Register handler to view's
|
||||||
* 'add:child' event.
|
* 'after:item:added' event.
|
||||||
* @param {Backbone.Marionette.ItemView} view View to show in region
|
* @param {Backbone.Marionette.ItemView} view View to show in region
|
||||||
*/
|
*/
|
||||||
onShow: function(view) {
|
onShow: function(view) {
|
||||||
view.on('add:child', this.scrollToBottom, this);
|
view.on('after:item:added', this.scrollToBottom, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
/*!
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function(Mibew){
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds utility functions
|
|
||||||
*/
|
|
||||||
Mibew.Utils = Mibew.Utils || {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes chat window.
|
|
||||||
*
|
|
||||||
* The method helps to close chat popup no mater how it's implemented
|
|
||||||
* (iframe or window).
|
|
||||||
*/
|
|
||||||
Mibew.Utils.closeChatPopup = function() {
|
|
||||||
if (window.parent && (window.parent !== window) && window.parent.postMessage) {
|
|
||||||
// It seems that the chat is working in an iframe. Tell the parent
|
|
||||||
// window that the chat is stoped so it could close the iframe.
|
|
||||||
window.parent.postMessage('mibew-chat-closed:' + window.name, '*');
|
|
||||||
} else {
|
|
||||||
// Just close the window.
|
|
||||||
window.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})(Mibew);
|
|
@ -1,629 +0,0 @@
|
|||||||
/*!
|
|
||||||
* This file is a part of Mibew Messenger.
|
|
||||||
*
|
|
||||||
* Copyright 2005-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds all Mibew Messenger functionality
|
|
||||||
*/
|
|
||||||
var Mibew = Mibew || {};
|
|
||||||
|
|
||||||
(function(Mibew) {
|
|
||||||
if (Mibew.ChatPopup) {
|
|
||||||
// It seems that this file was already loaded. We do not need to do the
|
|
||||||
// job twice.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds all functionality related with chat popups
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds objects instances
|
|
||||||
*/
|
|
||||||
Mibew.Objects = Mibew.Objects || {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds all popups instances.
|
|
||||||
*/
|
|
||||||
Mibew.Objects.ChatPopups = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Holds utility functions
|
|
||||||
*/
|
|
||||||
Mibew.Utils = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a cookie for the second level domain with path equals to '/'.
|
|
||||||
*
|
|
||||||
* @param {String} name Cookie name
|
|
||||||
* @param {String} value Cookie value
|
|
||||||
* @param {Date} expires Indicates when the cookie expires. If the value is
|
|
||||||
* omitted a session cookie will be created.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.createCookie = function(name, value, expires) {
|
|
||||||
if (navigator.cookieEnabled) {
|
|
||||||
var domain_parts = document.location.hostname.split('.').reverse();
|
|
||||||
var domain = domain_parts[0];
|
|
||||||
var position = 0;
|
|
||||||
do {
|
|
||||||
document.cookie = "" + name + "=" + value + "; "
|
|
||||||
+ "path=/; "
|
|
||||||
+ (document.location.protocol == 'https:' ? "SameSite=None; secure; " : '')
|
|
||||||
+ "domain=" + (Mibew.Utils.cookiesDomain || domain) + "; "
|
|
||||||
+ (expires ? ('expires=' + expires.toUTCString() + '; ') : '');
|
|
||||||
if (Mibew.Utils.readCookie(name) == value) {
|
|
||||||
if (!Mibew.Utils.cookiesDomain) {
|
|
||||||
Mibew.Utils.cookiesDomain = domain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
position++;
|
|
||||||
domain = domain_parts[position] + '.' + domain;
|
|
||||||
}
|
|
||||||
} while((position < domain_parts.length) && !Mibew.Utils.cookiesDomain);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to read cookie.
|
|
||||||
*
|
|
||||||
* @param {String} name Cookie name
|
|
||||||
* @returns {String|Boolean} Cookie value or boolean false if cookie with
|
|
||||||
* specified name does not exist
|
|
||||||
*/
|
|
||||||
Mibew.Utils.readCookie = function(name) {
|
|
||||||
var cookies = document.cookie.split('; ');
|
|
||||||
var nameForSearch = name + '=';
|
|
||||||
var value = false;
|
|
||||||
for (var i = 0; i < cookies.length; i++) {
|
|
||||||
if (cookies[i].indexOf(nameForSearch) != -1) {
|
|
||||||
value = cookies[i].substr(nameForSearch.length);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes cookie.
|
|
||||||
*
|
|
||||||
* @param {String} name Name of the cookie that should be deleted.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.deleteCookie = function(name) {
|
|
||||||
Mibew.Utils.createCookie(name, '', (new Date(0)));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets correct prototypes chain.
|
|
||||||
*
|
|
||||||
* This function is based on the logic used in Object.create method.
|
|
||||||
* Unfortunately not all target browsers support this function thus it
|
|
||||||
* should be implemented here.
|
|
||||||
*
|
|
||||||
* Warning: this methods completely rewrites prototype of "ctor" argument.
|
|
||||||
*
|
|
||||||
* @type {Function}
|
|
||||||
* @param {Function} ctor An object constructor which prototype should be
|
|
||||||
* updated.
|
|
||||||
* @param {Function} superCtor An object constructor which prototype should
|
|
||||||
* be used.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.inherits = (function() {
|
|
||||||
// Tmp function is defined in closure because in such case only one
|
|
||||||
// temporary function will be kept in memory regardless of inherits
|
|
||||||
// function calls number.
|
|
||||||
var Tmp = function() {};
|
|
||||||
|
|
||||||
return function(ctor, superCtor) {
|
|
||||||
Tmp.prototype = superCtor.prototype;
|
|
||||||
ctor.prototype = new Tmp();
|
|
||||||
Tmp.prototype = null;
|
|
||||||
ctor.prototype.constructor = ctor;
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attaches an event listener to the target object's event.
|
|
||||||
*
|
|
||||||
* This method uses native "addEventListener" in modern browsers and a
|
|
||||||
* workaround for IE < 9.
|
|
||||||
*
|
|
||||||
* @param {Object} target The object which fires the event.
|
|
||||||
* @param {String} eventName Name of the event.
|
|
||||||
* @param {Function} listener The function that should be triggered.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.addEventListener = function(target, eventName, listener) {
|
|
||||||
if (target.addEventListener) {
|
|
||||||
// A regular browser is used
|
|
||||||
target.addEventListener(eventName, listener, false);
|
|
||||||
} else {
|
|
||||||
if (target.attachEvent) {
|
|
||||||
// This is needed for IE < 9
|
|
||||||
target.attachEvent(
|
|
||||||
'on' + eventName,
|
|
||||||
// The closure is used to use valid this reference in the
|
|
||||||
// listener.
|
|
||||||
function (event) {
|
|
||||||
listener.call(target, event);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads CSS file and attach it to DOM.
|
|
||||||
*
|
|
||||||
* @param {String} url URL of the CSS that should be loaded.
|
|
||||||
* @param {String} [id] ID of the DOM element that will be created. Can be
|
|
||||||
* omitted.
|
|
||||||
* @returns {Element} Appended DOM item.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.loadStyleSheet = function(url, id) {
|
|
||||||
var styleSheet = document.createElement('link');
|
|
||||||
styleSheet.setAttribute('rel', 'stylesheet');
|
|
||||||
styleSheet.setAttribute('type', 'text/css');
|
|
||||||
styleSheet.setAttribute('href', url);
|
|
||||||
if (id) {
|
|
||||||
styleSheet.setAttribute('id', id);
|
|
||||||
}
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(styleSheet);
|
|
||||||
|
|
||||||
return styleSheet;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads JavaScript file and attach it to DOM.
|
|
||||||
*
|
|
||||||
* @param {String} url URL of the JavaScript file that should be loaded.
|
|
||||||
* @param {String} [id] ID of the DOM element that will be created. Can be
|
|
||||||
* omitted.
|
|
||||||
* @returns {Element} Appended DOM item.
|
|
||||||
*/
|
|
||||||
Mibew.Utils.loadScript = function(url, id) {
|
|
||||||
var script = document.createElement('script');
|
|
||||||
script.setAttribute('type', 'text/javascript');
|
|
||||||
script.setAttribute('src', url);
|
|
||||||
if (id) {
|
|
||||||
script.setAttribute('id', id);
|
|
||||||
}
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(script);
|
|
||||||
|
|
||||||
return script;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize a proper chat popup.
|
|
||||||
*
|
|
||||||
* This is a helper function which choose which popup (iframe or window)
|
|
||||||
* should be created, create it and store into Mibew.Objects.ChatPopups
|
|
||||||
* hash.
|
|
||||||
*
|
|
||||||
* @param {Object} options List of popup options.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.init = function(options) {
|
|
||||||
var canUseIFrame = (window.postMessage && options.preferIFrame),
|
|
||||||
Popup = canUseIFrame ? Mibew.ChatPopup.IFrame : Mibew.ChatPopup.Window;
|
|
||||||
Mibew.Objects.ChatPopups[options.id] = new Popup(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A constructor for base (abstract) popup object.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @param {Object} options A list of popup options.
|
|
||||||
*/
|
|
||||||
var BasePopup = function(options) {
|
|
||||||
/**
|
|
||||||
* Unique ID of the popup.
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.id = options.id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chat initialization URL.
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.url = options.url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Width of the popup in pixels.
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
this.width = options.width;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Height of the popup in pixels.
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
this.height = options.height;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicats if the popup should be resizable.
|
|
||||||
*
|
|
||||||
* It can be appliedonly for window popup.
|
|
||||||
*
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.resizable = options.resizable || false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains URL of JavaScript file that loads css file for IFrame popup.
|
|
||||||
*
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.styleLoader = options.styleLoader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if special actions should be done to fix problems with
|
|
||||||
* mod_security.
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.modSecurity = options.modSecurity || false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chat style
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.styleName = options.style;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds an URL that initializes a chat.
|
|
||||||
*
|
|
||||||
* @returns {String} Chat URL.
|
|
||||||
*/
|
|
||||||
BasePopup.prototype.buildChatUrl = function() {
|
|
||||||
var href = document.location.href,
|
|
||||||
referrer = document.referrer;
|
|
||||||
|
|
||||||
if (this.modSecurity) {
|
|
||||||
href = href.replace('http://','').replace('https://','');
|
|
||||||
referrer = referrer.replace('http://','').replace('https://','');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.url
|
|
||||||
+ ((this.url.indexOf('?') === -1) ? '?' : '&') + 'url=' + encodeURIComponent(href)
|
|
||||||
+ '&referrer=' + encodeURIComponent(referrer);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs IFrame popup.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @extends BasePopup
|
|
||||||
* @param {Object} options List of popup options.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame = function(options) {
|
|
||||||
// Call parent constructor.
|
|
||||||
BasePopup.call(this, options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store options in case we need some of them later.
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
this.options = options;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for popup iframe DOM Element.
|
|
||||||
* @type {Node}
|
|
||||||
*/
|
|
||||||
this.wrapperDiv = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Popup iframe DOM Element.
|
|
||||||
* @type {Node}
|
|
||||||
*/
|
|
||||||
this.iframe = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle iframe DOM Element.
|
|
||||||
* @type {Node}
|
|
||||||
*/
|
|
||||||
this.toggleDiv = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the popup is opened.
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.isOpened = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the popup is minified.
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.isMinified = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if cookies are blocked.
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
|
||||||
this.cookiesBlocked = false;
|
|
||||||
|
|
||||||
// Load default styles. These styles hide the popup while real styles
|
|
||||||
// are loading.
|
|
||||||
this.attachDefaultStyles();
|
|
||||||
// Load extra style sheets.
|
|
||||||
Mibew.Utils.loadScript(this.styleLoader);
|
|
||||||
|
|
||||||
// Check if the popup should be reopened.
|
|
||||||
var openedChatUrl = Mibew.Utils.readCookie('mibew-chat-frame-' + this.id);
|
|
||||||
if (openedChatUrl) {
|
|
||||||
// The chat was not closed so the popup should be reopened when a
|
|
||||||
// new page is visited.
|
|
||||||
this.safeOpen(openedChatUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it's possible to set cookies at all
|
|
||||||
var rnd = Math.random();
|
|
||||||
Mibew.Utils.createCookie('mibewCheckToken', rnd);
|
|
||||||
var checkCookiesBlock = Mibew.Utils.loadScript(options.url.split('?')[0] + '/cookies-set-permission' + '?rnd=' + rnd);
|
|
||||||
checkCookiesBlock.popup = this;
|
|
||||||
checkCookiesBlock.onload = function() {
|
|
||||||
this.popup.cookiesBlocked = false;
|
|
||||||
};
|
|
||||||
checkCookiesBlock.onerror = function() {
|
|
||||||
this.popup.cookiesBlocked = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set correct prototype chain for IFrame popup.
|
|
||||||
Mibew.Utils.inherits(Mibew.ChatPopup.IFrame, BasePopup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attaches default styles to the DOM.
|
|
||||||
*
|
|
||||||
* This function do its job only once no matter how many times it is called.
|
|
||||||
*
|
|
||||||
* @type {Function}
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame.prototype.attachDefaultStyles = (function() {
|
|
||||||
var executed = false;
|
|
||||||
|
|
||||||
return function() {
|
|
||||||
if (executed) {
|
|
||||||
// The function was already called. Just do nothing.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
executed = true;
|
|
||||||
|
|
||||||
var style = document.createElement('style'),
|
|
||||||
// These rules hides the popup while real styles are loading.
|
|
||||||
css = '.mibew-chat-frame {height: 0px; width: 0px;}';
|
|
||||||
|
|
||||||
style.setAttribute('type', 'text/css');
|
|
||||||
if (style.styleSheet){
|
|
||||||
style.styleSheet.cssText = css;
|
|
||||||
} else {
|
|
||||||
style.appendChild(document.createTextNode(css));
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(style);
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens the popup.
|
|
||||||
*
|
|
||||||
* @param {String} [url] The URL that should be opened in the popup. If the
|
|
||||||
* value is omitted, the chat initialization URL will be loaded.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame.prototype.open = function(url) {
|
|
||||||
if (this.isOpened) {
|
|
||||||
// Do not open the popup twice.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.cookiesBlocked) {
|
|
||||||
// Last resort. Replace this iframe-based popup with window-based popup
|
|
||||||
// and try to open a chat in a separate window.
|
|
||||||
Mibew.Objects.ChatPopups[this.id] = new Mibew.ChatPopup.Window(this.options);
|
|
||||||
Mibew.Objects.ChatPopups[this.id].open(url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.wrapperDiv) {
|
|
||||||
// Create new iframe and its wrapper.
|
|
||||||
// There is a bug in IE <= 7 that make "name" attribute unchangeble
|
|
||||||
// for elements that already exist. Thus a temporary div is used
|
|
||||||
// here as a workaround.
|
|
||||||
this.wrapperDiv = document.createElement('div');
|
|
||||||
this.wrapperDiv.className = 'mibew-chat-wrapper';
|
|
||||||
this.wrapperDiv.setAttribute('id', 'mibew-chat-wrapper-' + this.id);
|
|
||||||
this.wrapperDiv.style.display = 'none';
|
|
||||||
this.wrapperDiv.innerHTML = '<iframe name="mibewChat' + this.id + '"></iframe>';
|
|
||||||
|
|
||||||
this.iframe = this.wrapperDiv.getElementsByTagName('iframe')[0];
|
|
||||||
this.iframe.setAttribute('id', 'mibew-chat-frame-' + this.id);
|
|
||||||
this.iframe.className = 'mibew-chat-frame';
|
|
||||||
this.iframe.setAttribute('frameBorder', 0);
|
|
||||||
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(this.wrapperDiv);
|
|
||||||
|
|
||||||
// Setup toggle element. As it's not a part of the iframe, it should be
|
|
||||||
// treated separately.
|
|
||||||
this.toggleDiv = document.createElement('div');
|
|
||||||
this.toggleDiv.setAttribute('id', 'mibew-chat-frame-toggle-' + this.id);
|
|
||||||
this.toggleDiv.className = 'mibew-chat-frame-toggle mibew-chat-frame-toggle-on';
|
|
||||||
Mibew.Utils.addEventListener(this.toggleDiv, 'click', function(event) {
|
|
||||||
var popups = Mibew.Objects.ChatPopups,
|
|
||||||
matches = /^mibew-chat-frame-toggle-([0-9A-Za-z]+)$/.exec(this.id);
|
|
||||||
|
|
||||||
if (matches && popups[matches[1]]) {
|
|
||||||
popups[matches[1]].toggle();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(this.toggleDiv);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wrapperDiv.style.display = 'block';
|
|
||||||
this.toggleDiv.style.display = 'block';
|
|
||||||
this.iframe.src = url || this.buildChatUrl();
|
|
||||||
this.isOpened = true;
|
|
||||||
|
|
||||||
// Store style name in case we need it during iframe reopening
|
|
||||||
Mibew.Utils.createCookie('mibew-chat-frame-style-' + this.id, this.styleName);
|
|
||||||
|
|
||||||
// Check minification status of the popup and toggle it if needed.
|
|
||||||
var minifiedPopup = Mibew.Utils.readCookie('mibew-chat-frame-minified-' + this.id);
|
|
||||||
if (minifiedPopup === 'true') {
|
|
||||||
this.toggle();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check chat URL via special request, open the chat if check passes,
|
|
||||||
* close the popup if the check fails.
|
|
||||||
*
|
|
||||||
* @param {String} [url] The URL to open in the popup
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame.prototype.safeOpen = function(url) {
|
|
||||||
var check = Mibew.Utils.loadScript(url + '/check', 'mibew-check-iframe-' + this.id);
|
|
||||||
check.popup = this;
|
|
||||||
check.url = url;
|
|
||||||
var style = Mibew.Utils.readCookie('mibew-chat-frame-style-' + this.id);
|
|
||||||
check.onload = function() {
|
|
||||||
this.popup.open(this.url + (style ? '?style=' + style : ''));
|
|
||||||
};
|
|
||||||
check.onerror = function() {
|
|
||||||
this.popup.close();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the popup.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame.prototype.close = function() {
|
|
||||||
if (!this.isOpened) {
|
|
||||||
// A popup that was not opened thus it cannot be closed.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wrapperDiv.style.display = 'none';
|
|
||||||
this.iframe.src = '';
|
|
||||||
this.isOpened = false;
|
|
||||||
this.toggleDiv.style.display = 'none';
|
|
||||||
Mibew.Utils.deleteCookie('mibew-chat-frame-' + this.id);
|
|
||||||
Mibew.Utils.deleteCookie('mibew-chat-frame-minified-' + this.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles the popup.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.IFrame.prototype.toggle = function() {
|
|
||||||
this.wrapperDiv.style.display = this.isMinified ? "block" : "none";
|
|
||||||
this.isMinified = !this.isMinified;
|
|
||||||
this.toggleDiv.className = 'mibew-chat-frame-toggle mibew-chat-frame-toggle-'
|
|
||||||
+ (this.isMinified ? 'off' : 'on');
|
|
||||||
Mibew.Utils.createCookie('mibew-chat-frame-minified-' + this.id, this.isMinified);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs Window popup.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @extends BasePopup
|
|
||||||
* @param {Object} options List of popup options.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.Window = function(options) {
|
|
||||||
BasePopup.call(this, options);
|
|
||||||
|
|
||||||
this.window = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set correct prototype chain for Window popup.
|
|
||||||
Mibew.Utils.inherits(Mibew.ChatPopup.Window, BasePopup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens the popup.
|
|
||||||
*
|
|
||||||
* @param {String} [url] The URL that should be opened in the popup. If the
|
|
||||||
* value is omitted, the chat initialization URL will be loaded.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.Window.prototype.open = function(url) {
|
|
||||||
// Windows is already opened, nothing to do.
|
|
||||||
if (this.window != null && !this.window.closed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.window = window.open(
|
|
||||||
url || this.buildChatUrl(),
|
|
||||||
'mibewChat' + this.id,
|
|
||||||
this.getWindowParams()
|
|
||||||
);
|
|
||||||
this.window.focus();
|
|
||||||
this.window.opener = window;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the popup.
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.Window.prototype.close = function() {
|
|
||||||
if (!this.window) {
|
|
||||||
// There is nothing to close.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.window.close();
|
|
||||||
this.window = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds window params string.
|
|
||||||
*
|
|
||||||
* Generated params string can be used in window.open method as the third
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* @protected
|
|
||||||
* @returns {String}
|
|
||||||
*/
|
|
||||||
Mibew.ChatPopup.Window.prototype.getWindowParams = function() {
|
|
||||||
return [
|
|
||||||
'toolbar=0',
|
|
||||||
'scrollbars=0',
|
|
||||||
'location=0',
|
|
||||||
'status=1',
|
|
||||||
'menubar=0',
|
|
||||||
'width=' + this.width.toString(),
|
|
||||||
'height=' + this.height.toString(),
|
|
||||||
'resizable=' + (this.resizable ? '1' : '0')
|
|
||||||
].join(',');
|
|
||||||
};
|
|
||||||
|
|
||||||
// Attach a listener to window's "message" event to get the url of the chat
|
|
||||||
// which is opened in iframe popup.
|
|
||||||
Mibew.Utils.addEventListener(window, 'message', function(event) {
|
|
||||||
var matches = /^mibew-chat-started\:mibewChat([0-9A-Za-z]+)\:(.*)$/.exec(event.data);
|
|
||||||
if (matches) {
|
|
||||||
Mibew.Utils.createCookie('mibew-chat-frame-' + matches[1], matches[2]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Attach a listener to window's "message" event to close the iframe when
|
|
||||||
// the chat is closed.
|
|
||||||
Mibew.Utils.addEventListener(window, 'message', function(event) {
|
|
||||||
var popups = Mibew.Objects.ChatPopups,
|
|
||||||
matches = /^mibew-chat-closed\:mibewChat([0-9A-Za-z]+)$/.exec(event.data);
|
|
||||||
|
|
||||||
if (matches && popups[matches[1]]) {
|
|
||||||
popups[matches[1]].close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
})(Mibew);
|
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -24,24 +24,24 @@
|
|||||||
* Mibew.Views.CompositeBase
|
* Mibew.Views.CompositeBase
|
||||||
* @private
|
* @private
|
||||||
* @param {Backbone.Model} item Collection item
|
* @param {Backbone.Model} item Collection item
|
||||||
* @param {Function} ChildViewType Default item view constructor
|
* @param {Function} ItemViewType Default item view constructor
|
||||||
* @param {Object} childViewOptions Additional item view options
|
* @param {Object} itemViewOptions Additional item view options
|
||||||
* @returns Item view instance
|
* @returns Item view instance
|
||||||
*/
|
*/
|
||||||
var buildChildView = function(item, ChildViewType, childViewOptions) {
|
var buildItemView = function(item, ItemViewType, itemViewOptions) {
|
||||||
// Build options object
|
// Build options object
|
||||||
var options = _.extend({model: item}, childViewOptions);
|
var options = _.extend({model: item}, itemViewOptions);
|
||||||
// Try to find special view for this model
|
// Try to find special view for this model
|
||||||
if (typeof item.getModelType != 'function') {
|
if (typeof item.getModelType != 'function') {
|
||||||
return new ChildViewType(options);
|
return new ItemViewType(options);
|
||||||
}
|
}
|
||||||
var modelType = item.getModelType();
|
var modelType = item.getModelType();
|
||||||
if (modelType && Mibew.Views[modelType]) {
|
if (modelType && Mibew.Views[modelType]) {
|
||||||
return new Mibew.Views[modelType](options);
|
return new Mibew.Views[modelType](options);
|
||||||
} else {
|
} else {
|
||||||
return new ChildViewType(options);
|
return new ItemViewType(options);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Represents base collection view
|
* @class Represents base collection view
|
||||||
@ -53,13 +53,13 @@
|
|||||||
* Default item view constructor.
|
* Default item view constructor.
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
childView: Backbone.Marionette.ItemView,
|
itemView: Backbone.Marionette.ItemView,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return special contructor for an item view if it exists or the
|
* Return special contructor for an item view if it exists or the
|
||||||
* default constructor otherwise.
|
* default constructor otherwise.
|
||||||
*/
|
*/
|
||||||
buildChildView: buildChildView
|
buildItemView: buildItemView
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@
|
|||||||
* Return special contructor for an item view if it exists or the
|
* Return special contructor for an item view if it exists or the
|
||||||
* default constructor otherwise.
|
* default constructor otherwise.
|
||||||
*/
|
*/
|
||||||
buildChildView: buildChildView
|
buildItemView: buildItemView
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -24,25 +24,17 @@
|
|||||||
Mibew.Views.ControlsCollection = Mibew.Views.CollectionBase.extend(
|
Mibew.Views.ControlsCollection = Mibew.Views.CollectionBase.extend(
|
||||||
/** @lends Mibew.Views.ControlsCollection.prototype */
|
/** @lends Mibew.Views.ControlsCollection.prototype */
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Default item view constructor.
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
itemView: Mibew.Views.Control,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class name for view's DOM element
|
* Class name for view's DOM element
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
className: 'controls-collection',
|
className: 'controls-collection'
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns default child view constructor.
|
|
||||||
*
|
|
||||||
* The function is used instead of "childView" property to provide
|
|
||||||
* an ability to override child view constructor without this class
|
|
||||||
* overriding.
|
|
||||||
*
|
|
||||||
* @param {Backbone.Model} model The model the view created for.
|
|
||||||
* @returns {Backbone.Marionette.ItemView}
|
|
||||||
*/
|
|
||||||
getChildView: function(model) {
|
|
||||||
return Mibew.Views.Control;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -41,7 +41,7 @@
|
|||||||
/**
|
/**
|
||||||
* Register 'urlReplace' Handlebars helper.
|
* Register 'urlReplace' Handlebars helper.
|
||||||
*
|
*
|
||||||
* This helper seeks URLs and replaces them by 'a' tag
|
* This helper serch URLs and replace them by 'a' tag
|
||||||
*/
|
*/
|
||||||
Handlebars.registerHelper('urlReplace', function(text) {
|
Handlebars.registerHelper('urlReplace', function(text) {
|
||||||
return new Handlebars.SafeString(
|
return new Handlebars.SafeString(
|
||||||
@ -193,17 +193,14 @@
|
|||||||
* </code>
|
* </code>
|
||||||
*/
|
*/
|
||||||
Handlebars.registerHelper('replace', function(search, replacement, options) {
|
Handlebars.registerHelper('replace', function(search, replacement, options) {
|
||||||
var unescapedSearch = search
|
// Convert serch value to string and escape special regexp characters
|
||||||
// Allow using new line character
|
var searchPattern = search.toString().replace(
|
||||||
.replace(/\\n/g, '\n')
|
/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
|
||||||
// Allow using tab character
|
"\\$&"
|
||||||
.replace(/\\t/g, '\t')
|
),
|
||||||
// Allow using all UTF characters in \uXXX format.
|
re = new RegExp(searchPattern, 'g');
|
||||||
.replace(/\\u([A-Za-z0-9])/g, function(match, code) {
|
|
||||||
return String.fromCharCode(parseInt(code, 16));
|
|
||||||
});
|
|
||||||
|
|
||||||
return options.fn(this).split(unescapedSearch).join(replacement);
|
return options.fn(this).replace(re, replacement);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -290,7 +287,7 @@
|
|||||||
* </code>
|
* </code>
|
||||||
*/
|
*/
|
||||||
Handlebars.registerHelper('override', function(name, options) {
|
Handlebars.registerHelper('override', function(name, options) {
|
||||||
// We need to provide unlimited inheritance level. Rendering is started
|
// We need to provide unlimited inheritence level. Rendering is started
|
||||||
// from the deepest level template. If the content is in the block
|
// from the deepest level template. If the content is in the block
|
||||||
// storage it is related with the deepest level template. Thus we do not
|
// storage it is related with the deepest level template. Thus we do not
|
||||||
// need to override it.
|
// need to override it.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -26,7 +26,7 @@ var Mibew = {};
|
|||||||
// Use Backbone.Marionette with handlebars.js
|
// Use Backbone.Marionette with handlebars.js
|
||||||
Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
|
Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
|
||||||
return Handlebars.compile(rawTemplate);
|
return Handlebars.compile(rawTemplate);
|
||||||
};
|
}
|
||||||
|
|
||||||
// Use all handlebars template as partials too
|
// Use all handlebars template as partials too
|
||||||
// We does not use Handlebars.partials property because of it can be changed
|
// We does not use Handlebars.partials property because of it can be changed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -47,7 +47,7 @@
|
|||||||
return localized.replace(/\{([0-9]+)\}/g, function(match, index) {
|
return localized.replace(/\{([0-9]+)\}/g, function(match, index) {
|
||||||
return placeholders[parseInt(index)] || '';
|
return placeholders[parseInt(index)] || '';
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store localization object. Can be call multiple times, localization
|
* Store localization object. Can be call multiple times, localization
|
||||||
@ -56,6 +56,6 @@
|
|||||||
*/
|
*/
|
||||||
Mibew.Localization.set = function(strs) {
|
Mibew.Localization.set = function(strs) {
|
||||||
_.extend(localStrings, strs);
|
_.extend(localStrings, strs);
|
||||||
};
|
}
|
||||||
|
|
||||||
})(Mibew, _);
|
})(Mibew, _);
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'class': classes.join(' ')
|
'class': classes.join(' ')
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -75,10 +75,10 @@
|
|||||||
return "hidden";
|
return "hidden";
|
||||||
}
|
}
|
||||||
if (kind == this.model.KIND_INFO) {
|
if (kind == this.model.KIND_INFO) {
|
||||||
return "info";
|
return "inf";
|
||||||
}
|
}
|
||||||
if (kind == this.model.KIND_CONN) {
|
if (kind == this.model.KIND_CONN) {
|
||||||
return "connection";
|
return "conn";
|
||||||
}
|
}
|
||||||
if (kind == this.model.KIND_EVENTS) {
|
if (kind == this.model.KIND_EVENTS) {
|
||||||
return "event";
|
return "event";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* This file is a part of Mibew Messenger.
|
* This file is a part of Mibew Messenger.
|
||||||
*
|
*
|
||||||
* Copyright 2005-2023 the original author or authors.
|
* Copyright 2005-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user