From b8f2320c0a17b3e9f4f62d4c17c54354d2ef0589 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Tue, 29 Nov 2022 17:35:41 +0100 Subject: [PATCH] =?UTF-8?q?Il=20link=20di=20un=20gruppo=20non=20pu=C3=B2?= =?UTF-8?q?=20contenere=20la=20barra...=20o=20altri=20caratteri=20speciali?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CGridTableRec/CGridTableRec.ts | 13 ++++++++++--- src/components/CMyPopupEdit/CMyPopupEdit.ts | 17 ++++++++++++----- src/components/CMyPopupEdit/CMyPopupEdit.vue | 1 + src/model/GlobalStore.ts | 1 + src/statics/lang/it.js | 2 +- src/store/Modules/fieldsTable.ts | 11 +++++++---- src/store/Modules/tools.ts | 17 ++++++++++++++--- 7 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 5cbc55e8..3e42d24c 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -1120,7 +1120,7 @@ export default defineComponent({ function showandsel(row: any, col: any, newval: any, valinitial: any) { - console.log('showandsel CGridTable', row, col, newval) + // console.log('showandsel CGridTable', row, col, newval) rowsel = row colsel.value = col idsel = row._id @@ -1130,7 +1130,7 @@ export default defineComponent({ } function annulla(val: any) { - console.log('GridTable annulla') + // console.log('GridTable annulla') /* if (newRecord.value) { globalStore.DeleteRec({ table: mytable.value, id: newRecord.value._id }) @@ -1260,7 +1260,7 @@ export default defineComponent({ createNewRecordDialog() - console.log('newRecord.value', newRecord.value) + // console.log('newRecord.value', newRecord.value) // serverData.value.push(newRecord.value) pagination.value.rowsNumber++ @@ -1732,6 +1732,13 @@ export default defineComponent({ if (col.notsave) { delete myobj[col.name] } + // Add the column + if (col.field_toduplicate_nospace) { + // + let trovato = tools.removespecial_chars(myobj[col.name]) + myobj[col.field_toduplicate_nospace] = trovato + // console.log('trovato', trovato, 'name', myobj[col.name], 'duplicate:', myobj[col.field_toduplicate_nospace], 'orig', myobj[col.name]) + } }) mydata.data = myobj diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts index 713ef8f7..02887fdf 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.ts +++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts @@ -301,12 +301,12 @@ export default defineComponent({ // console.log('OBJ:', obj) if (true) { - console.log(' CAMPO', props.field + '.' + props.subfield) + // console.log(' CAMPO', props.field + '.' + props.subfield) let myval = tools.getLabelFooterByRow(myrow.value, props.field + '.' + props.subfield, props.table) if (myval) myvalue.value = myval - console.log(' RECORD INPUT', myrow.value) - console.log(' VALORE OUTPUT: ', myvalue.value) + // console.log(' RECORD INPUT', myrow.value) + // console.log(' VALORE OUTPUT: ', myvalue.value) } } @@ -770,11 +770,17 @@ export default defineComponent({ } + function nameKeydown(e: any, col: any) { + if (col.allowchar === costanti.ALLOWCHAR_CODE) { + + if (/^\W$/.test(e.key)) { + e.preventDefault(); + } + } + } onBeforeMount(mounted) - - return { myvalue, countryname, @@ -810,6 +816,7 @@ export default defineComponent({ getTitleEditor, myrow, shared_consts, + nameKeydown, } } }) diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index 57acb4af..337da556 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -142,6 +142,7 @@ ? `password` : `text` " + @keydown="nameKeydown($event, col)" @keyup.enter.stop @update:model-value="changevalRec" autofocus diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 043705ad..58fc9559 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -711,6 +711,7 @@ export interface IColGridTable { remote_key?: string remote_field?: string field_extra1?: string + field_toduplicate_nospace?: string subfield_extra1?: string allowNewValue?: boolean showpicprofile_ifnotset?: boolean diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index d981987f..ffdd70df 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -475,7 +475,7 @@ const msg_it = { note_payment: 'Note Aggiuntive', country_pay: 'Paese di Destinazione Pagamenti', username_telegram: 'Username Telegram', - groupname: 'Link Pagina (senza spazi)', + groupname: 'Il link della pagina diventerà:', firstname_telegram: 'Nome Telegram', lastname_telegram: 'Cognome Telegram', telegram: 'Chat Telegram \'{botname}\'', diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index f4520f50..1ee02e36 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -62,6 +62,7 @@ function AddCol(params: IColGridTable) { disable: (params.disable === undefined) ? false : params.disable, titlepopupedit: (params.titlepopupedit === undefined) ? '' : params.titlepopupedit, field_extra1: (params.field_extra1 === undefined) ? '' : params.field_extra1, + field_toduplicate_nospace: (params.field_toduplicate_nospace === undefined) ? '' : params.field_toduplicate_nospace, subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1, allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue, showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset, @@ -672,12 +673,14 @@ export const colmyUserPeople = [ export const colmyUserGroup = [ // AddCol({ name: '_id', label_trans: 'reg.id' }), - AddCol({ name: 'title', label_trans: 'reg.name', required: true, noshowlabel: true, maxlength: 40 }), + AddCol({ name: 'title', label_trans: 'reg.name', + field_toduplicate_nospace: 'groupname', + required: true, noshowlabel: true, maxlength: 40 }), AddCol({ - name: 'groupname', label_trans: 'reg.groupname', required: true, + name: 'groupname', label_trans: 'reg.groupname', required: false, maxlength: 30, allowchar: costanti.ALLOWCHAR_CODE, - showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage, + showWhen: costanti.showWhen.InPage + costanti.showWhen.InEdit }), AddCol({ name: 'idCity', @@ -761,7 +764,7 @@ export const colmyUserGroup = [ }), AddCol({ name: 'note', label_trans: 'reg.detailsPage', fieldtype: costanti.FieldType.html, - titlepopupedit: 'detailsPage', field_extra1: 'groupname', subfield_extra1: '' + titlepopupedit: 'detailsPage', field_extra1: 'groupname', subfield_extra1: '', }), AddCol(ModifRec), AddCol(DeleteRec), diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 5ef70baf..3bd51a8e 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -4423,11 +4423,22 @@ export const tools = { return mystr.replace(/\s+/g, '') }, - removespaces_slash(mystr: string) { + removespecial_chars(mystr: string) { mystr = mystr.replace(/\s+/g, '') mystr = mystr.replace(/\//g, '') mystr = mystr.replace(/:/g, '') - mystr = mystr.replace(/./g, '') + mystr = mystr.replace(/,/g, '') + mystr = mystr.replace(/'/g, '') + mystr = mystr.replace(/&/g, '') + mystr = mystr.replace(/@/g, '') + mystr = mystr.replace(/\?/g, '') + mystr = mystr.replace(/#/g, '') + return mystr + }, + + removespaces_slash(mystr: string) { + mystr = mystr.replace(/\s+/g, '') + mystr = mystr.replace(/\//g, '') mystr = mystr.replace(/,/g, '') mystr = mystr.replace(/'/g, '') return mystr @@ -7220,7 +7231,7 @@ export const tools = { } catch (e) { console.error('err getDirectoryGall', e) } - console.log('getDirectoryGall', ris) + // console.log('getDirectoryGall', ris) return ris },