Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
feature(Tinebase): ars explainer
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed May 26, 2021
1 parent bfb0efb commit 1da22f6
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
55 changes: 55 additions & 0 deletions tine20/Tinebase/css/communityIdentExplainer.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@borderColor: lightgray;

table.x-ars-xplain, .x-ars-xplain table {
border-spacing: 0px;
}

.x-ars-xplain-col {
padding: 2px;
vertical-align: bottom;
hyphens: auto;
width: 34px;
max-width: 46px;
}

.x-ars-xplain-group {
width: 100%;
text-align: center;
}
.x-ars-xplain-group tr {
height: 18px;
}

.x-ars-xplain-label-land {
border-left: 1px solid @borderColor;
}

.x-ars-xplain-label-gem {
border-right: 1px solid @borderColor;
}

.x-ars-xplain-leftcorner {
border-left: 1px solid @borderColor;
border-top: 1px solid @borderColor;
min-width: 10px;
}

.x-ars-xplain-rightcorner {
border-right: 1px solid @borderColor;
border-top: 1px solid @borderColor;
min-width: 10px;
}


.x-ars-xplain-data {
max-width: 46px;
}

.x-ars-xplain-data input {
width: 30px;
text-align: center;
}

.x-ars-xplain-value-stand {
font-size: 8px;
}
7 changes: 7 additions & 0 deletions tine20/Tinebase/js/CommunityIdentNr/Picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Tine 2.0
*
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Cornelius Weiss <c.weiss@metaways.de>
* @copyright Copyright (c) 2021 Metaways Infosystems GmbH (http://www.metaways.de)
*/
72 changes: 72 additions & 0 deletions tine20/Tinebase/js/CommunityIdentNr/explainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Tine 2.0
*
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Cornelius Weiss <c.weiss@metaways.de>
* @copyright Copyright (c) 2021 Metaways Infosystems GmbH (http://www.metaways.de)
*/
require('../../css/communityIdentExplainer.less');

const template = new Ext.XTemplate(
'<table class="x-ars-xplain">' +
' <tr>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-satzart" rowSpan="2">Satzart</td>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-textkennzeichen" rowSpan="2">Textkennzeichen</td>' +
' <td class="x-ars-xplain-regionalschluessel" colspan="5">' +
' <table class="x-ars-xplain-group">' +
' <tr>' +
' <td>&nbsp;</td>' +
' <td rowspan="2">Amtlicher Regionalschlüssel</td>' +
' <td>&nbsp;</td>' +
' </tr>' +
' <tr>' +
' <td class="x-ars-xplain-leftcorner">&nbsp;</td>' +
' <td class="x-ars-xplain-rightcorner">&nbsp;</td>' +
' </tr>' +
' </table>' +
' </td>' +
' <td class="x-ars-xplain-leer" rowspan="2"></td>' +
' </tr>' +
' <tr>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-land">Land</td>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-rb">RB</td>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-kreis">Kreis</td>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-vb">VB</td>' +
' <td class="x-ars-xplain-col x-ars-xplain-label-gem">Gem</td>' +
' </tr>' +
' <tr>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-satzart"><input type="text" class="x-form-text x-form-field" value="{satzArt}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-textkennzeichen"><input type="text" class="x-form-text x-form-field" value="{textkenzeichen}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-land"><input type="text" class="x-form-text x-form-field" value="{arsLand}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-rb"><input type="text" class="x-form-text x-form-field" value="{arsRB}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-kreis"><input type="text" class="x-form-text x-form-field" value="{arsKreis}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-vb"><input type="text" class="x-form-text x-form-field" value="{arsVB}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-value-gem"><input type="text" class="x-form-text x-form-field" value="{arsGem}"></td>' +
' <td class="x-ars-xplain-data x-ars-xplain-col x-ars-xplain-value-stand">stand: {stand}</td>' +
' </tr>' +
'</table>'
).compile();

const ExplainForm = Ext.extend(Ext.form.Field, {
// fieldLabel: 'Amtlicher Regionalschlüssel',
hideLabel: true,
defaultAutoCreate: { tag: 'div' },

onRender() {
this.supr().onRender.apply(this, arguments);
template.overwrite(this.el, {});
},

setValue(value, record) {
const stand = record.data.last_modified_time || record.data.creation_time;
template.overwrite(this.el, _.assign(_.mapValues(record.data, Ext.util.Format.htmlEncode), {
stand: stand.format('d.m.Y')
}));
}
});
Ext.reg('ars-explain-field', ExplainForm)

Tine.widgets.form.FieldManager.register('Tinebase', 'CommunityIdentNr', 'arsCombined', {
xtype: 'ars-explain-field',
height: 60
}, Tine.widgets.form.FieldManager.CATEGORY_EDITDIALOG);
1 change: 1 addition & 0 deletions tine20/Tinebase/js/Tinebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ require('../../library/ExtJS/ext-custom');

// include traditional stuff as defined in jsb2
require('./../../Tinebase/Tinebase.jsb2');
require('./CommunityIdentNr/explainer');

// UI style >= 2019
require('node-waves');
Expand Down
1 change: 1 addition & 0 deletions tine20/Tinebase/js/widgets/form/FieldManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ Tine.widgets.form.FieldManager = function() {
categoryKey = this.getKey([appName, modelName, fieldName, category]),
genericKey = this.getKey([appName, modelName, fieldName]);

field.name = fieldName;
fields[category ? categoryKey : genericKey] = field;
},

Expand Down

0 comments on commit 1da22f6

Please sign in to comment.