Line 2: |
Line 2: |
| // User Interface Rendering | | // User Interface Rendering |
| console.log('Interface handler loading'); | | console.log('Interface handler loading'); |
| + | |
| + | function interfaceMediaContainer ( wbp, idxb ) { |
| + | |
| + | this.renderInterface = function( sqitch ) { |
| + | switch( sqitch ) { |
| + | case 'controller_id': |
| + | controller_render(); |
| + | break; |
| + | case 'personal_data_id': |
| + | pd_site_render(); |
| + | break; |
| + | case 'interface_button_id': |
| + | pd_edit_render(); |
| + | break; |
| + | } |
| + | } |
| + | |
| + | async function controller_render(){ |
| + | console.log("this function is done by the current page controller for now"); |
| + | } |
| + | |
| + | async function pd_site_render(){ |
| + | |
| + | }; |
| + | |
| + | async function pd_edit_render(){ |
| + | var k = idxb.EnqueuePDIO('update record'); |
| + | var m = wbproc.checkentity( { this_concerns: [ wbEStructure['concernsRelation'], wbEStructure['IDPropLoc'], wbEStructure['IDName'] ] } ); |
| + | var l = wbproc.checkentity( { default_value: [ wbEStructure['defaultValRelation'], wbEStructure['IDPropLoc'] ] } ); //defal |
| + | k.then( function(result) { |
| + | console.log("required data from idxb"); |
| + | mw.loader.using( 'oojs-ui-core' ).done( function () { |
| + | |
| + | console.log("loaded uicore") |
| + | |
| + | var button_save = [], |
| + | button_delete = [], |
| + | textInput = []; |
| + | |
| + | var extrafield = Object-keys(result[m[0]]).length; |
| + | |
| + | button_save[ extrafield ] = new OO.ui.ButtonWidget( { label: "Save", classes: "pddh" } ); |
| + | textInput[ extrafield ] = new OO.ui.TextInputWidget( { |
| + | placeholder: l[0], |
| + | classes: "pddh" |
| + | } ); |
| + | button_save[extrafield].onClick = function () { |
| + | idxb.EnqueuePDIO('update record', m[0], data, 'holdplace') |
| + | } |
| + | $( '#mw-content-text' ).prepend( textInput[extrafield].$element ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | $( '#mw-content-text' ).prepend( button_save[extrafield].$element ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | |
| + | if ( extrafield > 0) { |
| + | Object.keys( result[m[0]] ).forEach( function(data) { |
| + | |
| + | button_save[data] = new OO.ui.ButtonWidget( { label: "Save", classes: "pddh" } ); |
| + | button_delete[data] = new OO.ui.ButtonWidget( { label: "Delete", classes: "pddh" } ); |
| + | textInput[data] = new OO.ui.TextInputWidget( { |
| + | value: k[m][data], /// |
| + | placeholder: l[0], |
| + | classes: "pddh" |
| + | } ); |
| + | button_save[data].onClick = function () { |
| + | idxb.EnqueuePDIO('update record', m[0], data, 'holdplace') |
| + | } |
| + | $( '#mw-content-text' ).prepend( textInput[data].$element ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | $( '#mw-content-text' ).prepend( button_delete[data].$element ); |
| + | $( '#mw-content-text' ).prepend( button_save[data].$element ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | $( '#mw-content-text' ).prepend( '<br>' ); |
| + | |
| + | |
| + | |
| + | }); |
| + | |
| + | } |
| + | }); |
| + | }); |
| + | }; |
| + | } |