[DE] Add settings for date content control
This commit is contained in:
parent
475e9c0306
commit
c40c8d6a2d
|
@ -95,7 +95,22 @@
|
||||||
<table cols="1" style="width: 100%;">
|
<table cols="1" style="width: 100%;">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="header"><%= scope.textLang %></label>
|
<label><%= scope.textFormat %></label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-small">
|
||||||
|
<div id="control-settings-txt-format" style="width: 100%;"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-small">
|
||||||
|
<div id="control-settings-format" style="width: 100%; height: 165px;"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label><%= scope.textLang %></label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -103,16 +118,6 @@
|
||||||
<div id="control-settings-lang"></div>
|
<div id="control-settings-lang"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label class="header"><%= scope.textFormat %></label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div id="control-settings-format" style="width: 100%; height: 165px;"></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -226,7 +226,16 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
store: new Common.UI.DataViewStore(),
|
store: new Common.UI.DataViewStore(),
|
||||||
scrollAlwaysVisible: true
|
scrollAlwaysVisible: true
|
||||||
});
|
});
|
||||||
// this.listFormats.on('item:select', _.bind(this.onSelectFormat, this));
|
this.listFormats.on('item:select', _.bind(this.onSelectFormat, this));
|
||||||
|
|
||||||
|
this.txtDate = new Common.UI.InputField({
|
||||||
|
el : $('#control-settings-txt-format'),
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: false,
|
||||||
|
validateOnBlur: false,
|
||||||
|
style : 'width: 100%;',
|
||||||
|
value : ''
|
||||||
|
});
|
||||||
|
|
||||||
// Check Box
|
// Check Box
|
||||||
this.txtChecked = new Common.UI.InputField({
|
this.txtChecked = new Common.UI.InputField({
|
||||||
|
@ -355,6 +364,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
if (type == Asc.c_oAscContentControlSpecificType.DateTime) {
|
if (type == Asc.c_oAscContentControlSpecificType.DateTime) {
|
||||||
var specProps = props.get_DateTimePr();
|
var specProps = props.get_DateTimePr();
|
||||||
if (specProps) {
|
if (specProps) {
|
||||||
|
this.datetime = specProps;
|
||||||
var lang = specProps.get_LangId() || this.options.controlLang;
|
var lang = specProps.get_LangId() || this.options.controlLang;
|
||||||
if (lang) {
|
if (lang) {
|
||||||
var item = this.cmbLang.store.findWhere({value: lang});
|
var item = this.cmbLang.store.findWhere({value: lang});
|
||||||
|
@ -362,11 +372,11 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
this.cmbLang.setValue(item);
|
this.cmbLang.setValue(item);
|
||||||
}
|
}
|
||||||
this.updateFormats(this.cmbLang.getValue());
|
this.updateFormats(this.cmbLang.getValue());
|
||||||
// var rec = this.listFormats.store.find({format: specProps.get_DateFormat()});
|
var format = specProps.get_DateFormat();
|
||||||
// if (rec) {
|
var rec = this.listFormats.store.findWhere({format: format});
|
||||||
// this.listFormats.selectRecord(rec);
|
this.listFormats.selectRecord(rec);
|
||||||
// this.listFormats.scrollToRecord(rec);
|
this.listFormats.scrollToRecord(rec);
|
||||||
// }
|
this.txtDate.setValue(format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,10 +436,12 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
}
|
}
|
||||||
|
|
||||||
//for date picker
|
//for date picker
|
||||||
// var rec = this.listFormats.getSelectedRec();
|
if (this.type == Asc.c_oAscContentControlSpecificType.DateTime) {
|
||||||
// if (rec) {
|
var specProps = new AscCommon.CSdtDatePickerPr();
|
||||||
// props.set_DateFormat(rec.get('format'));
|
specProps.put_DateFormat(this.txtDate.getValue());
|
||||||
// }
|
specProps.put_LangId(this.cmbLang.getValue());
|
||||||
|
props.put_DateTimePr(specProps);
|
||||||
|
}
|
||||||
|
|
||||||
// for check box
|
// for check box
|
||||||
if (this.type == Asc.c_oAscContentControlSpecificType.CheckBox) {
|
if (this.type == Asc.c_oAscContentControlSpecificType.CheckBox) {
|
||||||
|
@ -558,25 +570,26 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
},
|
},
|
||||||
|
|
||||||
updateFormats: function(lang) {
|
updateFormats: function(lang) {
|
||||||
// this.props.put_Lang(lang);
|
if (this.datetime) {
|
||||||
// var data = this.props.get_DateTimeExamples(),
|
var props = this.datetime,
|
||||||
// arr = [];
|
formats = props.get_FormatsExamples(),
|
||||||
// var store = this.listFormats.store;
|
arr = [];
|
||||||
// for (var name in data) {
|
for (var i = 0, len = formats.length; i < len; i++)
|
||||||
// if (data[name]) {
|
{
|
||||||
// var rec = new Common.UI.DataViewModel();
|
props.get_String(formats[i], undefined, lang);
|
||||||
// rec.set({
|
var rec = new Common.UI.DataViewModel();
|
||||||
// format: name,
|
rec.set({
|
||||||
// value: data[name]
|
format: formats[i],
|
||||||
// });
|
value: props.get_String(formats[i], undefined, lang)
|
||||||
// arr.push(rec);
|
});
|
||||||
// }
|
arr.push(rec);
|
||||||
// }
|
}
|
||||||
// store.reset(arr);
|
this.listFormats.store.reset(arr);
|
||||||
// this.listFormats.selectByIndex(0);
|
this.listFormats.selectByIndex(0);
|
||||||
// var rec = this.listFormats.getSelectedRec();
|
var rec = this.listFormats.getSelectedRec();
|
||||||
// this.listFormats.scrollToRecord(rec);
|
this.listFormats.scrollToRecord(rec);
|
||||||
// this.onSelectFormat(this.listFormats, null, rec);
|
this.txtDate.setValue(rec.get('format'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditCheckbox: function(checked) {
|
onEditCheckbox: function(checked) {
|
||||||
|
@ -607,6 +620,11 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSelectFormat: function(lisvView, itemView, record) {
|
||||||
|
if (!record) return;
|
||||||
|
this.txtDate.setValue(record.get('format'));
|
||||||
|
},
|
||||||
|
|
||||||
textTitle: 'Content Control Settings',
|
textTitle: 'Content Control Settings',
|
||||||
textName: 'Title',
|
textName: 'Title',
|
||||||
textTag: 'Tag',
|
textTag: 'Tag',
|
||||||
|
@ -632,7 +650,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
textValue: 'Value',
|
textValue: 'Value',
|
||||||
textDate: 'Date Format',
|
textDate: 'Date Format',
|
||||||
textLang: 'Language',
|
textLang: 'Language',
|
||||||
textFormat: 'Formats',
|
textFormat: 'Display the date like this',
|
||||||
textCheckbox: 'Check box',
|
textCheckbox: 'Check box',
|
||||||
textChecked: 'Checked symbol',
|
textChecked: 'Checked symbol',
|
||||||
textUnchecked: 'Unchecked symbol'
|
textUnchecked: 'Unchecked symbol'
|
||||||
|
|
Loading…
Reference in a new issue