<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3AFinalConfig_-_ASSET_-_JAVASCRIPT</id>
	<title>ICT:FinalConfig - ASSET - JAVASCRIPT - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3AFinalConfig_-_ASSET_-_JAVASCRIPT"/>
	<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:FinalConfig_-_ASSET_-_JAVASCRIPT&amp;action=history"/>
	<updated>2026-07-23T01:57:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mwiki.costasano.club/index.php?title=ICT:FinalConfig_-_ASSET_-_JAVASCRIPT&amp;diff=693&amp;oldid=prev</id>
		<title>Mngr: Created page with &quot;&lt;pre&gt; // MediaWiki:DigitalAsset.js $(document).ready(function () {      function getField(name) {         return $(&quot;[name=&#039;DigitalAsset[&quot; + name + &quot;]&#039;]&quot;);     }      function generateIdentifier() {         const chapter = getField(&quot;chapter_id&quot;).val();         const place = getField(&quot;place_id&quot;).val();         const org = getField(&quot;organisation_id&quot;).val();          // Exclusivity check         if (place &amp;&amp; org) {             alert(&quot;Select either a Place OR an Organisation,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:FinalConfig_-_ASSET_-_JAVASCRIPT&amp;diff=693&amp;oldid=prev"/>
		<updated>2026-02-13T21:28:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; // MediaWiki:DigitalAsset.js $(document).ready(function () {      function getField(name) {         return $(&amp;quot;[name=&amp;#039;DigitalAsset[&amp;quot; + name + &amp;quot;]&amp;#039;]&amp;quot;);     }      function generateIdentifier() {         const chapter = getField(&amp;quot;chapter_id&amp;quot;).val();         const place = getField(&amp;quot;place_id&amp;quot;).val();         const org = getField(&amp;quot;organisation_id&amp;quot;).val();          // Exclusivity check         if (place &amp;amp;&amp;amp; org) {             alert(&amp;quot;Select either a Place OR an Organisation,...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
// MediaWiki:DigitalAsset.js&lt;br /&gt;
$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
    function getField(name) {&lt;br /&gt;
        return $(&amp;quot;[name=&amp;#039;DigitalAsset[&amp;quot; + name + &amp;quot;]&amp;#039;]&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function generateIdentifier() {&lt;br /&gt;
        const chapter = getField(&amp;quot;chapter_id&amp;quot;).val();&lt;br /&gt;
        const place = getField(&amp;quot;place_id&amp;quot;).val();&lt;br /&gt;
        const org = getField(&amp;quot;organisation_id&amp;quot;).val();&lt;br /&gt;
&lt;br /&gt;
        // Exclusivity check&lt;br /&gt;
        if (place &amp;amp;&amp;amp; org) {&lt;br /&gt;
            alert(&amp;quot;Select either a Place OR an Organisation, not both.&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (!chapter || (!place &amp;amp;&amp;amp; !org)) {&lt;br /&gt;
            return; // Not enough info yet&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Call Lua module&lt;br /&gt;
        new mw.Api().get({&lt;br /&gt;
            action: &amp;quot;scribunto-console&amp;quot;,&lt;br /&gt;
            title: &amp;quot;Module:DigitalAssetID&amp;quot;,&lt;br /&gt;
            question: &amp;quot;return require(&amp;#039;Module:DigitalAssetID&amp;#039;).generate{chapter_id=&amp;#039;&amp;quot; +&lt;br /&gt;
                chapter + &amp;quot;&amp;#039;, place_id=&amp;#039;&amp;quot; + place + &amp;quot;&amp;#039;, organisation_id=&amp;#039;&amp;quot; + org + &amp;quot;&amp;#039;}&amp;quot;&lt;br /&gt;
        }).done(function (data) {&lt;br /&gt;
&lt;br /&gt;
            const result = JSON.parse(data.return);&lt;br /&gt;
&lt;br /&gt;
            if (result.error) {&lt;br /&gt;
                alert(result.error);&lt;br /&gt;
                return;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            // Fill fields&lt;br /&gt;
            getField(&amp;quot;identifier&amp;quot;).val(result.identifier).prop(&amp;quot;readonly&amp;quot;, true);&lt;br /&gt;
            getField(&amp;quot;sequence_number&amp;quot;).val(result.sequence_number);&lt;br /&gt;
&lt;br /&gt;
            // Override page name&lt;br /&gt;
            $(&amp;quot;input[name=&amp;#039;pfFormPageName&amp;#039;]&amp;quot;).val(result.identifier);&lt;br /&gt;
&lt;br /&gt;
            // Override file name on upload&lt;br /&gt;
            $(&amp;quot;input[type=&amp;#039;file&amp;#039;]&amp;quot;).on(&amp;quot;change&amp;quot;, function () {&lt;br /&gt;
                const file = this.files[0];&lt;br /&gt;
                if (!file) return;&lt;br /&gt;
&lt;br /&gt;
                const ext = file.name.split(&amp;#039;.&amp;#039;).pop();&lt;br /&gt;
                const newName = result.identifier + &amp;quot;.&amp;quot; + ext;&lt;br /&gt;
&lt;br /&gt;
                $(this).attr(&amp;quot;data-filename&amp;quot;, newName);&lt;br /&gt;
            });&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Trigger generation when fields change&lt;br /&gt;
    getField(&amp;quot;chapter_id&amp;quot;).change(generateIdentifier);&lt;br /&gt;
    getField(&amp;quot;place_id&amp;quot;).change(generateIdentifier);&lt;br /&gt;
    getField(&amp;quot;organisation_id&amp;quot;).change(generateIdentifier);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mngr</name></author>
	</entry>
</feed>