Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 90: Line 90:
     const FN_METRICS = 'Metrics';
     const FN_METRICS = 'Metrics';
     const FN_REPORT = 'Report';
     const FN_REPORT = 'Report';
    const FN_COLLAB = 'Collaboration';


     const fnImages = {};
     const fnImages = {};
Line 97: Line 98:
     fnImages[FN_METRICS] = '/index.php/Special:FilePath/File:Func_metrics.svg';
     fnImages[FN_METRICS] = '/index.php/Special:FilePath/File:Func_metrics.svg';
     fnImages[FN_REPORT] = '/index.php/Special:FilePath/File:Func_report.svg';
     fnImages[FN_REPORT] = '/index.php/Special:FilePath/File:Func_report.svg';
    fnImages[FN_COLLAB] = '/index.php/Special:FilePath/File:Func_collaboration.svg';


     const sourcesLayout = [
     const sourcesLayout = [
Line 168: Line 170:
             'Visualization options',
             'Visualization options',
             'PDF export'
             'PDF export'
        ];
        const collaborationFunctions = [
            'Multiuser',
            'Permission management',
            'Inbox workflow',
            'Approval workflows'
         ];
         ];


Line 179: Line 187:
                         analysisFunctions.map(func => '|?' + func).join('') +
                         analysisFunctions.map(func => '|?' + func).join('') +
                         metricsFunctions.map(func => '|?' + func).join('') +
                         metricsFunctions.map(func => '|?' + func).join('') +
                         reportFunctions.map(func => '|?' + func).join('');
                         reportFunctions.map(func => '|?' + func).join('') +
                        collaborationFunctions.map(func => '|?' + func).join('')
                        ;
 
         const dctQueryUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(dctQuery);
         const dctQueryUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(dctQuery);
         const dctResponse = await fetch(dctQueryUrl).then(response => response.json());
         const dctResponse = await fetch(dctQueryUrl).then(response => response.json());
Line 202: Line 213:
             if (hasFunction(dctResult, metricsFunctions)) dct.functions.push(FN_METRICS);
             if (hasFunction(dctResult, metricsFunctions)) dct.functions.push(FN_METRICS);
             if (hasFunction(dctResult, reportFunctions)) dct.functions.push(FN_REPORT);
             if (hasFunction(dctResult, reportFunctions)) dct.functions.push(FN_REPORT);
            if (hasFunction(dctResult, collaborationFunctions)) dct.functions.push(FN_COLLAB);


             return dct;
             return dct;
Line 270: Line 282:
                 const identifier = escapeAttr(curr.name);
                 const identifier = escapeAttr(curr.name);
                 return acc +
                 return acc +
                 '<div ' + (idx === 0 ? ' class="filter-group-start">' : '>') +  
                 '<div ' + (idx === 0 ? ' class="filter-group-start">' : '>') +
                 '<input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' +
                 '<input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' +
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'

Revision as of 15:42, 15 June 2022

Development verstion of the DCT List.
Not ready for production!