Domanda

I'm trying to add a section to a corporate wiki which will serve as a sort of front-end to a Documentum-based data warehouse (since there's no search function and poor internal organization). The idea is to create an article stub for each document with metadata and a direct link, and use Semantic Mediawiki to track and organize the articles in the system.

I'm using Semantic Forms to manage the article creation (after an initial push from a few spreadsheets using the API), but I'd like to automate the article naming as well so the system holds users' hand from beginning to end. All of the titles will be things like MBMA-00001, so I'd like a button on the MBMA page that, when pressed, searches Category:MBMA, determines the highest number MBMA-n currently in the system, and takes the user to a Semantic Form template with MBMA-n+1 already input as the title.

Extensions such as InputBox, CreateBox, and CreateArticle don't seem to support this function, but is there another extension that I can add that will do so? Or will I have to figure out how to write my own?

È stato utile?

Soluzione

I was going to say that you'll probably need to create your own, since your requirements seem so specialized, but then I came across the DPL Page Name S/N Maker extension which appears to match them exactly.

There's also a variant of the extension using Semantic Forms, which you might prefer.

Altri suggerimenti

The template linked above was just what I needed, but didn't actually work as written. For anyone else with this need in the future, here's a cleaned-up and corrected version which removes the problematic string functions and works perfectly:

{{#if: {{{form|}}}
  |  {{#ifexist: Form:{{{form|}}} 
       |
       | <strong class="error">Warning! The form "{{{form|}}}" may not be a valid form name!</strong>
     }}
  |
}}<!---
-->{{#if: {{{form|}}}
     | {{#ifeq: {{lc:{{NS:{{{namespace|}}} }} }} 
         | {{lc:{{{namespace|}}} }}
         | 
         | <strong class="error">Warning! "{{{namespace}}}" may not be a valid namespace name!</strong>
       }}
     |
   }}<!---
-->The next document number is '''<!--
-->{{#if: {{{namespace|}}} | {{{namespace|}}}: }}{{{prefix|}}}<!--
   -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
      -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
         -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
            -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
               -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                  -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                  -->| namespace = {{{namespace|}}}<!--
                  -->| order = descending<!--
                  -->| mode = userformat<!--
                  -->| format = ,%PAGE%<!--
                  -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                  -->| count = 1
                  }}
               |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
               |\2
               }}
            | {{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
            |
            }}
         +1
         }}
     | {{{pad|5}}}
     | 0
     }}'''
----
{{#if: {{{form|}}}
  | {{#forminput: {{{form|}}}
      | {{{width|20}}}
      | {{{prefix|}}}<!--
      -->{{padleft:<!----------- (X+1)                         =>  0000(X+1) 
         -->{{#expr:<!---------- 0000X+1                       =>  (X+1)
            -->{{replace|<!----- "Namespace:prefix0000X"       =>  "0000X" 
               -->{{replace|<!-- "*[[Namespace:prefix0000X]]"  =>  "Namespace:prefix0000X"
                  -->{{#dpl:<!-- return pages named "*[[Namespace:prefix0000X]]"
                     -->titleregexp =^{{{prefix|}}}[0-9]{{{{pad|5}}}}$<!--
                     -->| namespace = {{{namespace|}}}<!--
                     -->| order = descending<!--
                     -->| mode = userformat<!--
                     -->| format = ,%PAGE%<!--
                     -->| noresultsheader = {{padleft:0|{{{pad|5}}}|0}}<!--
                     -->| count = 1
                     }}
                  |/^([^{{!}}]+\{{!}}){1}([^\]]+).*/  
                  |\2
                  }}
               |{{#if: {{{namespace|}}} | {{{namespace|}}}:}}{{{prefix|}}}
               |
               }}
            +1
            }}
        | {{{pad|5}}}
        | 0
        }}
     | {{{buttonlabel|Add}}}
     | {{#if: {{{namespace|}}} | namespace = {{{namespace|}}} }}  
     }}
  | <includeonly><strong class="error">Warning! You haven't specified a SemanticForm for page creation! Please specify a SemanticForm name.</strong></includeonly>
}}<noinclude>{{documentation}}</noinclude>

And the documentation subpage:

{{documentation subpage}}
{{intricate template}}
== Parameters ==

All parameters to the template are optional.

{| class="wikitable"
|- 
! form
| Specifies a SemanticForm name, which will handle the pages you create.
|- 
! namespace
| Specifies a Namespace, which the new page will belong to.
|- 
! prefix
| Specifies a title fragment, which will prefix the generated number
|- 
! pad
| The number of digits required in the page number. The default value is "5".
|- 
! width
| Sets the width of the input box. The default value is "20".
|- 
! buttonlabel
| Sets the text of the Create button. The default value is "Add".
|}

== Example ==

<pre><nowiki>{{DPLSNMakerSF
 | form        = MBMA Document
 | namespace   =
 | prefix      = MBMA-
 | pad         = 5
 | width       = 30
 | buttonlabel = Create
}}
</nowiki></pre>

== See also ==

[[mw:extension:DPL Page Name S/N Maker (using SemanticForms)]]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top