* Add a warning for non-descriptive filenames at Special:Upload
authorRaimond Spekking <raymond@users.mediawiki.org>
Fri, 7 Sep 2007 08:42:39 +0000 (08:42 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Fri, 7 Sep 2007 08:42:39 +0000 (08:42 +0000)
* Some tweaks to RELEASE-NOTES

RELEASE-NOTES
includes/SpecialUpload.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index 616d9f6..95edd9a 100644 (file)
@@ -18,9 +18,10 @@ will be made on the development trunk and appear in the next quarterly release.
 Those wishing to use the latest code instead of a branch release can obtain
 it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 
-=== Configuration changes since 1.11 ===
+=== Configuration changes in 1.12 ===
 
 === New features in 1.12 ===
+* Add a warning for non-descriptive filenames at Special:Upload
 
 === Bug fixes in 1.12 ===
 
@@ -50,7 +51,7 @@ At this time we still recommend 4.0, but 4.1/5.0 will work fine in most cases.
 
 == Upgrading ==
 
-1.12 has several database changes since 1.10, and will not work without schema
+1.12 has several database changes since 1.11, and will not work without schema
 updates.
 
 If upgrading from before 1.7, you may want to run refreshLinks.php to ensure
index 18c6dd9..14338d6 100644 (file)
@@ -542,6 +542,18 @@ class UploadForm {
                                        substr( $partname , 0, strpos( $partname , '-' ) +1 ) ) . '</li>';
                        }
                }
+
+               $filenamePrefix = self::getFilenamePrefix();
+               if ( count( $filenamePrefix ) ) {
+                       # Do the match
+                       foreach( $filenamePrefix as $prefix ) {
+                               if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) {
+                                       $warning .= '<li>' . wfMsgExt( 'filename-prefix', 'parseinline', $prefix ) . '</li>';
+                                       break;
+                               }
+                       }
+               }
+
                if ( $file->wasDeleted() ) {
                        # If the file existed before and was deleted, warn the user of this
                        # Don't bother doing so if the image exists now, however
@@ -553,6 +565,12 @@ class UploadForm {
                return $warning;
        }
 
+       /**
+        * Get a list of warnings
+        *
+        * @param string local filename, e.g. 'file exists', 'non-descriptive filename'
+        * @return array list of warning messages
+        */
        static function ajaxGetExistsWarning( $filename ) {
                $file = wfFindFile( $filename );
                if( !$file ) {
@@ -589,6 +607,34 @@ class UploadForm {
                return $output->getText();
        }
 
+       /**
+        * Get a list of filename prefixes from [[MediaWiki:filename-prefix-list]]
+        *
+        * @return array list of prefixes
+        */
+       public static function getFilenamePrefix() {
+               $message = wfMsgForContent( 'filename-prefix-list' );
+               if( $message && !( wfEmptyMsg( 'filename-prefix-list', $message ) || $message == '-' ) ) {
+                       $lines = explode( "\n", $message );
+                       foreach( $lines as $line ) {
+                               // Remove comment lines
+                               $comment = substr( trim( $line ), 0, 1 );
+                               if ( $comment == '#' || $comment == '' ) {
+                                       continue;
+                               }
+                               // Remove additional comments after a prefix
+                               $comment = strpos( $line, '#' );
+                               if ( $comment > 0 ) {
+                                       $line = substr( $line, 0, $comment-1 );
+                               }
+                               $filenamePrefix[] = trim( $line );
+                       }
+               } else {
+                       $filenamePrefix = array();
+               }
+               return $filenamePrefix;
+       }
+
        /**
         * Stash a file in a temporary directory for later processing
         * after the user has confirmed it.
index 7d4b637..df53966 100644 (file)
@@ -1073,6 +1073,8 @@ Bitte prüfe, ob du das Bild in voller Auflösung vorliegen hast und lade dieses
 'destfilename'                => 'Zielname',
 'watchthisupload'             => 'Diese Seite beobachten',
 'filewasdeleted'              => 'Eine Datei mit diesem Namen wurde schon einmal hochgeladen und zwischenzeitlich wieder gelöscht. Bitte prüfe zuerst den Eintrag im $1, bevor du die Datei wirklich speicherst.',
+'filename-prefix'             => 'Der Dateiname beginnt mit <strong>„$1“</strong>. Dies ist im allgemeinen der von einer Digitalkamera vorgegebener Dateiname und daher nicht sehr aussagekräftig.
+Bitte gebe der Datei einen Namen, der den Inhalt besser beschreibt.',
 
 'upload-proto-error'      => 'Falsches Protokoll',
 'upload-proto-error-text' => 'Die URL muss mit <code>http://</code> oder <code>ftp://</code> beginnen.',
index b2a7d2c..6e6763e 100644 (file)
@@ -1422,6 +1422,21 @@ If you have this image in full resolution upload this one, otherwise change the
 'destfilename'                => 'Destination filename',
 'watchthisupload'             => 'Watch this page',
 'filewasdeleted'              => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.',
+'filename-prefix'             => 'The name of the file you are uploading begins with <strong>"$1"</strong>, which is a non-descriptive name typically assigned automatically by digital cameras. Please choose a more descriptive name for your file.',
+'filename-prefix-list'        => ' #<!-- leave this line exactly as it is --> <pre>
+# Syntax is as follows: 
+#   * Everything from a "#" character to the end of the line is a comment
+#   * Every non-blank line is a prefix for typical file names assigned automatically by digital cameras
+CIMG # Casio
+DSC_ # Nikon
+DSCF # Fuji
+DSCN # Nikon
+DUW # some mobil phones
+IMG # generic
+JD # Jenoptik
+MGP # Pentax
+PICT # misc.
+ #</pre> <!-- leave this line exactly as it is -->', # only translate this message to other languages if you have to change it
 
 'upload-proto-error'      => 'Incorrect protocol',
 'upload-proto-error-text' => 'Remote upload requires URLs beginning with <code>http://</code> or <code>ftp://</code>.',
index 21734eb..77fcb75 100644 (file)
@@ -204,6 +204,7 @@ $wgOptionalMessages = array(
        'filerevert-backlink',
        'filedelete-backlink',
        'pagetitle',
+       'filename-prefix-list',
 );
 
 /** EXIF messages, which may be set as optional in several checks, but are generally mandatory */
index 0076303..3fafbac 100644 (file)
@@ -824,6 +824,8 @@ $wgMessageStructure = array(
                'destfilename',
                'watchthisupload',
                'filewasdeleted',
+               'filename-prefix',
+               'filename-prefix-list',
        ),
        'upload-errors' => array(
                'upload-proto-error',