Browse Source

Merge remote-tracking branch 'origin/master'

4.3
Jean-Roch Maitre 11 years ago
parent
commit
956b7b666c
2 changed files with 37 additions and 23 deletions
  1. +5
    -8
      submodules/callLogs/callLogs.js
  2. +32
    -15
      submodules/strategy/strategy.js

+ 5
- 8
submodules/callLogs/callLogs.js View File

@ -331,11 +331,8 @@ define(function(require){
result = [],
formatCdr = function(cdr) {
var date = monster.util.gregorianToDate(cdr.timestamp),
day = (date.getDate() < 10 ? "0" : "") + date.getDate(),
month = (date.getMonth() < 9 ? "0" : "") + (date.getMonth()+1),
year = date.getFullYear().toString().substr(2),
hours = (date.getHours() < 10 ? "0" : "") + date.getHours(),
minutes = (date.getMinutes() < 10 ? "0" : "") + date.getMinutes(),
shortDate = monster.util.toFriendlyDate(date, 'shortDate'),
time = monster.util.toFriendlyDate(date, 'shortTime'),
durationMin = parseInt(cdr.duration_seconds/60).toString(),
durationSec = (cdr.duration_seconds % 60 < 10 ? "0" : "") + (cdr.duration_seconds % 60),
hangupI18n = self.i18n.active().hangupCauses,
@ -356,8 +353,8 @@ define(function(require){
id: cdr.id,
callId: cdr.call_id,
timestamp: cdr.timestamp,
date: month+"/"+day+"/"+year,
time: hours+":"+minutes,
date: shortDate,
time: time,
fromName: cdr.caller_id_name,
fromNumber: cdr.caller_id_number || cdr.from.replace(/@.*/, ''),
toName: cdr.callee_id_name,
@ -375,7 +372,7 @@ define(function(require){
+ "%0D%0AFrom (Number): " + (cdr.caller_id_number || cdr.from.replace(/@.*/, ''))
+ "%0D%0ATo (Name): " + (cdr.callee_id_name || "")
+ "%0D%0ATo (Number): " + (cdr.callee_id_number || ("request" in cdr) ? cdr.request.replace(/@.*/, '') : cdr.to.replace(/@.*/, ''))
+ "%0D%0ADate: " + month+"/"+day+"/"+year
+ "%0D%0ADate: " + shortDate
+ "%0D%0ADuration: " + durationMin + ":" + durationSec
+ "%0D%0AHangup Cause: " + (cdr.hangup_cause || "")
+ "%0D%0ACall ID: " + cdr.call_id


+ 32
- 15
submodules/strategy/strategy.js View File

@ -209,12 +209,17 @@ define(function(require){
});
break;
case "hours":
var secondsToTime = function(seconds) {
var is12hMode = monster.apps.auth.currentUser.ui_flags && monster.apps.auth.currentUser.ui_flags.twelve_hours_mode ? true : false,
secondsToTime = function(seconds) {
var h = parseInt(seconds/3600) % 24,
m = (parseInt(seconds/60) % 60).toString(),
suffix = '';
if(is12hMode) {
suffix = h >= 12 ? 'PM' : 'AM';
h = (h > 12 ? h-12 : (h === 0 ? 12 : h)).toString();
return h + ":" + (m.length < 2 ? "0"+m : m) + suffix;
h = h > 12 ? h-12 : (h === 0 ? 12 : h)
}
return h.toString() + ":" + (m.length < 2 ? "0"+m : m) + suffix;
},
weekdaysRules = strategyData.temporalRules.weekdays,
templateData = {
@ -246,10 +251,10 @@ define(function(require){
// Setting Monday to Friday enabled by default for 9AM-5PM, when switching from 24hours Open to Custom Hours.
if(templateData.alwaysOpen) {
_.each(templateData.days, function(val) {
if(val.name !== "MainSaturday" && val.name !== "MainSunday") {
if(val.name !== 'MainSaturday' && val.name !== 'MainSunday') {
val.open = true;
val.from = "9:00AM";
val.to = "5:00PM";
val.from = is12hMode ? '9:00AM' : '9:00';
val.to = is12hMode ? '5:00PM' : '17:00';
}
});
}
@ -258,11 +263,8 @@ define(function(require){
var validationOptions = {
rules: {
"lunchbreak.from": {
"time12h": true
},
"lunchbreak.from": {},
"lunchbreak.to": {
"time12h": true,
"greaterDate": template.find('input[name="lunchbreak.from"]')
}
},
@ -273,21 +275,36 @@ define(function(require){
error.appendTo(element.parent());
}
};
if(is12hMode) {
validationOptions.rules["lunchbreak.from"].time12h = true;
validationOptions.rules["lunchbreak.to"].time12h = true;
} else {
validationOptions.rules["lunchbreak.from"].time24h = true;
validationOptions.rules["lunchbreak.to"].time24h = true;
}
_.each(self.weekdayLabels, function(wday) {
validationOptions.rules["weekdays."+wday+".from"] = {
"time12h": true
};
validationOptions.rules["weekdays."+wday+".from"] = {};
validationOptions.rules["weekdays."+wday+".to"] = {
"time12h": true,
"greaterDate": template.find('input[name="weekdays.'+wday+'.from"]')
};
if(is12hMode) {
validationOptions.rules["weekdays."+wday+".from"].time12h = true;
validationOptions.rules["weekdays."+wday+".to"].time12h = true;
} else {
validationOptions.rules["weekdays."+wday+".from"].time24h = true;
validationOptions.rules["weekdays."+wday+".to"].time24h = true;
}
validationOptions.groups[wday] = "weekdays."+wday+".from weekdays."+wday+".to";
});
monster.ui.validate(template.find('#strategy_custom_hours_form'), validationOptions);
container.find('.element-content').empty()
.append(template);
template.find('.timepicker').timepicker();
template.find('.timepicker').timepicker({
timeFormat: is12hMode ? 'g:ia' : 'G:i'
});
monster.ui.prettyCheck.create(template);
callback && callback();
break;


Loading…
Cancel
Save