Il link di un gruppo non può contenere la barra... o altri caratteri speciali

This commit is contained in:
Surya Paolo
2022-11-29 17:35:41 +01:00
parent d6f537473e
commit b8f2320c0a
7 changed files with 46 additions and 16 deletions

View File

@@ -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

View File

@@ -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,
}
}
})

View File

@@ -142,6 +142,7 @@
? `password`
: `text`
"
@keydown="nameKeydown($event, col)"
@keyup.enter.stop
@update:model-value="changevalRec"
autofocus

View File

@@ -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

View File

@@ -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}\'',

View File

@@ -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),

View File

@@ -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
},