Wikinoticias:Diálogo/do/uso

De Wikinoticias, la fuente libre de noticias

Comportamiento[editar]

Esta acción de diálogo realiza cualquiera de varias operaciones. Poner todas estas operaciones en una sola acción permite operaciones secuenciales mucho más rápidas, ya que no hay necesidad de cargas de páginas separadas entre operaciones.

Incoming dialog parameter verb selects the operation. If this parameter is omitted, or if its value is unrecognized, operation view is selected.

Si la página de acción no se accede a través de una solicitud de acción de diálogo, pero la URL de acceso contiene parámetros de consulta incluyendo uno llamado verb, los parámetros de consulta de la URL son convertidos a la acción de diálogo solicitada.

Verbo: view[editar]

La operación view muestra una página especificada, con modificaciones en la pantalla basadas en parámetros de diálogo entrantes. La página que se muestra se denomina por el parámetro de diálogo entrante page. El procesamiento de páginas tiene cuatro fases.

  1. Si la página especificada solicita un parámetro de plantilla con el nombre de un parámetro de diálogo proporcionado, se sustituye el parámetro de plantilla. Los parámetros de plantilla se ignoran si contienen anidamiento (por lo tanto, {{{foo|{{{bar|quux}}}}}} permitiría la sustitución para bar pero no para foo). También, ciertos parámetros de la plantilla se tratan especialmente; vea abajo.
  2. Cualquier llamada a {{Diálogo/init}} es procesada, posiblemente sobreescribiendo los valores de parámetros de diálogo entrantes, pero sin efecto en la sustitución de parámetros de plantilla ya que ya ha ocurrido.
  3. La página en su conjunto está expandida por la plantilla y formateada para su visualización, según el software wiki.
  4. Si cualquier campo interactivo del diálogo en la página especificada tiene el mismo nombre (ID) que un parámetro de diálogo entrante (o es proporcionado a través de {{Diálogo/init}}), el valor del parámetro se sustituye como el contenido inicial de ese campo interactivo.

Los parámetros reservados —cualquier parámetro de diálogo cuyo nombre empiece con mayúsculas y no contenga letras minúsculas— no se puede pasar a través de botones y no se puede anular mediante {{Diálogo/init}}; cualquier intento de pasarlos o anularlos es ignorado.

Los parámetros locales —cualquier parámetro de diálogo cuyo nombre empiece por local— no se pueden pasar directamente a través de los botones, sino que pueden pasar a través de {{Diálogo/init}}; cualquier parámetro local proporcionado por el solicitante se convierte en un parámetro reservado cambiando su nombre a todos los mayúsculas y prefijados INCOMING-.

Varios parámetros reservados se sustituyen por los valores extraídos de otros lugares. Algunos de ellos siempre se asignan cuando están disponibles; Otros no se obtienen a menos que se produzcan como parámetros de plantilla (pero una vez obtenidos, también están disponibles para inicializar campos de diálogo).

  • INCOMING-AUTHENTICATED Es el nombre de página de origen autenticado de la solicitud entrante o indefinido si la solicitud entrante no está autenticada.
  • REQUESTING-PAGE Es el nombre de página de la solicitud entrante, aunque no esté autenticado.
  • ACTIVE-PARAMETERS Es una lista de parámetros de diálogo simplemente pasada explícitamente por un botón; La lista es tanto &-separada y &-delimitada. Esto puede usarse para distinguir los parámetros deliberadamente establecidos de los parámetros llevados por delegación.
  • USERNAME Es el nombre de cuenta Wikimedia bajo el cual el usuario está editando o en blanco si el usuario no ha iniciado sesión.
  • USER-GROUPS Es una lista de los grupos de usuarios a los que pertenece el usuario, separados por espacios.
  • SUBJECT-EXISTS es cualquier true o false, dependiendo de si la página denominada por parámetro de diálogo subject existe.
  • SUBJECT-CONTENT Si se obtiene, es el contenido bruto de código wiki de la página de asunto.
  • SUBJECT-TIMESTAMP Si se obtiene, es la marca de tiempo de la revisión más reciente de la página de asunto.
  • SUBJECT-CATEGORIES Si se obtiene, es una lista de los nombres de todas las categorías a las que pertenece la página de asunto, delimitadas por comillas dobles y separadas por espacios.
  • SUBJECT-FLAGGED Si se obtiene, es el estado Flagged Revs de la página de asunto: never, pending, o current.
  • PRELOAD-PAGENAME Es el nombre de página de la página de precarga asociada a la página que se está viendo.
  • PRELOAD-CONTENT Si se obtiene, es el contenido bruto de código wiki de la página de precarga, con las directivas de inclusión procesadas para la transclusión.
  • DIALOG-GADGET-VERSION Identifica la versión en uso del gadget de diálogo.
  • DIALOG-RECEIVE-VERSION Identifica la versión en uso del módulo receive.
  • DIALOG-DO-VERSION dentifica la versión en uso de la acción do.

A non-blank value for local-error via {{Diálogo/init}} initiates delegation to an error-handling page, whose name appends /error to the name of the current dialog page. Since any incoming dialog parameter starting with local is diverted to a reserved parameter, local-error can only be non-blank via {{Diálogo/init}}. Delegation requires that the name of the current dialog page not end with error, and that the error-handling page exist. The current field values are delegated to the error-handling page (except that page becomes the name of the error-handling page). The error-handling page receives the REQUESTING-PAGE of the delegating page, and its INCOMING-AUTHENTICATED; the local parameter is diverted, per above, to reserved parameter INCOMING-LOCAL-ERROR.

Several reserved template parameters starting with SUBJECT-HISTORY- request information about the revision history of the page named by subject. The request must be confirmed by non-blank local-subject-history through {{Diálogo/init}}. Information is gathered on up to 50 revisions. The data is placed in reserved parameters SUBJECT-HISTORY-REVID, SUBJECT-HISTORY-TIMESTAMP, SUBJECT-HISTORY-USER, SUBJECT-HISTORY-MINOR, SUBJECT-HISTORY-SIZE, and SUBJECT-HISTORY-COMMENT; each is an &-delimited list of the named data for each revision. local-subject-history-direction can specify the direction of listing, with value newer listing revisions by increasing time, older by decreasing time. If there are more revisions after those reported, SUBJECT-HISTORY-CONTINUE contains a value that can be used to request further revisions, in a later request for page history, by placing the value in local-subject-history-continue.

Several reserved template parameters starting with CATEGORY-MEMBERS- request information about the members of the category whose page is named by category. Remember to include prefix Category: in the page name. The request must be confirmed by non-blank local-category-members through {{Diálogo/init}}. Information is gathered on up to 50 members, and placed in reserved parameters CATEGORY-MEMBERS-TITLE, CATEGORY-MEMBERS-TYPE, and CATEGORY-MEMBERS-TIMESTAMP; each is an &-delimited list of the named data for each member. local-category-members-direction, local-category-members-type, and local-category-members-sort can modulate the resultant list; see mw:API:Categorymembers. If there are more members after those reported, CATEGORY-MEMBERS-CONTINUE contains a value that can be used to request further revisions, in a later request for category members, by placing the value in local-category-members-continue.

Reserved template parameter EXPANDED-TEXT requests template-expansion of the raw wiki markup contained in non-blank local-text-to-expand.

Various reserved template parameters starting with FILE-INFO- request information about the file whose page is named by file. The request must be confirmed by nonblack local-file-info. Basic information about the unscaled image is placed in reserved parameters FILE-INFO-SIZE, FILE-INFO-WIDTH, and FILE-INFO-HEIGHT. Metadata is placed in reserved parameters starting with FILE-INFO-META-; see mw:API:Imageinfo, particularly extmetadata.

If there are any dialog states saved on the internal stack, the number of them is provided as reserved parameter STACK-DEPTH. If the current page is fully protected, non-blank local-pop names another incoming dialog parameter; if the named parameter is non-blank, an attempt is made to "pop" a state from the stack, i.e., remove the most recent saved state from the stack and enter that state. Otherwise, if the current page is fully protected, non-blank local-push names an incoming dialog parameter and if the named parameter is non-blank, an attempt is made to "push" the dialog state from which the current request was made, i.e., save it onto the top of the stack. Push is only allowed if the current request did not delegate and the stack was not already full. If the push succeeds, reserved parameter INCOMING-PUSH is assigned non-blank, otherwise reserved parameter INCOMING-PUSH-ERROR is assigned an error message explaining the failure.

Verbo: edit[editar]

Operation edit modifies or creates a specified page, mediated by a form page that determines both permissibility of the action and new content of the modified or created page. Dialog parameter subject names the page to be modified or created, and form names the mediating page. These two parameters are required. The form page must exist and must be fully protected.

The incoming action request must be authenticated against the form viewed in noinclude mode. That is, the form page must transclude template {{Diálogo/null requirement}} or {{Diálogo/require origin}} to specify where the incoming action request is permitted to come from. Template parameters and {{Diálogo/init}} calls are processed as for verb view. When not authenticating, best practice introduces an explicit call to {{Diálogo/require origin}} (so that even a surreptitiously inserted {{Diálogo/null requirement}} cannot induce authentication).

Dialog parameters local-basetimestamp and local-creation specify the expected pre-existing status of the subject page. One or the other, but not both, must be provided, necessarily via {{Diálogo/init}} since they're local. If local-basetimestamp is provided, the subject page must exist and have that timestamp. If local-creation is provided it must have value required, prohibited, or optional; when required the subject page must not exist, when prohibited the subject must exist.

For the new content of the subject page, the form is loaded as if transcluded at the subject page. Again, template parameters and {{Diálogo/init}} calls are processed as for verb view. {{Diálogo/init}} calls are processed before noinclude directives, so they are unaffected by choice of transcluding page. A custom edit summary for use on success may be provided through dialog parameter local-summary.

Further variations of the operation are possible through dialog parameters local-section, local-sectiontitle, local-minor, and local-notminor; see mw:API:Edit#Parameters.

After successful subject modification or creation, if dialog parameter page is provided, all the dialog parameters passed to this action are passed on to verb view. If no dialog parameter page is provided, the user is left viewing the modified/created page.

If the action tries, but fails, to authenticate, a custom error message may be provided through dialog parameter local-error. The action considers passing the dialog parameters to another page, named by appending /error to the name of the form; if this page exists and is fully protected, its name is copied to dialog parameter page and the dialog parameters are passed to verb view. If that page doesn't exist or isn't fully protected, or if the action fails for some other reason, an error message is reported to the user and, if possible, the user is returned to the dialog state from which the edit request was made. If the previous dialog state cannot be restored, a list of options is provided, advising the user on what to do next.

Secuencias de acción[editar]

Under circumscribed conditions, a single button click can cause a series of actions without further user intervention. This is a potent capability and should be used with caution, as a significant amount of damage could be caused by a single click. During an ongoing action-sequence, a STOP SEQUENCE button appears at the top of the page, which does not abort an action already in the pipeline but prevents the sequence from continuing (after an apparent lag of one or two actions before the stop button takes effect).

The maximum action-sequence length as of this writing is 10 actions (the minimum necessary to avoid the "small" feeling of single-digit numbers). A viewed page automatically triggers the next action in a sequence if all of the following conditions are met:

  • The page assigns a non-blank value to dialog parameter local-sequence via {{Diálogo/init}}.
  • Exactly one button on the page is marked as a sequence button; see {{Diálogo/button}}.
  • The sequence button delegates to action do.
  • The page has outgoing authentication.
  • The page does not use {{Diálogo/preview}}.

As a corollary of outgoing authentication, the page must be fully protected. local-sequence therefore cannot be forged since {{Diálogo/init}} only functions when it occurs directly on the page; and as long as one sequence-button is provided on the page, the sequence cannot be hijacked by transcluding an additional button (through some unprotected template used on the page) because a sequence does not proceed when presented with multiple sequence-buttons.

Conversión de URL[editar]

If the action page is accessed without a dialog action request, and the access url contains query parameters including one called verb, the url query parameters are converted into a dialog action request.

If the link to the action page is followed from within a page view via verb view, the link is converted, when clicked, into a delegating action request. In this case, a query parameter FIELDS may specify a comma-separated list of fields to be passed through the action request as if by a button; these may also use colon-notation as a button to pass a field value under a different parameter name.

Otherwise, a new action ID number is usually allocated for the converted dialog action request. Action ID numbers distinguish different action requests from each other, so that dialog data can be stored under that ID, and one can navigate one's web browser away from the request, come back to it, and (up to a point) the stored data is recovered. A non-delegating button click embeds a freshly allocated ID number in the url of the action page access, in a query parameter called wndialogid; and verb view does the same for any url-based action query linked on the viewed page. However, a querying url does not contain an embedded ID; so if you navigate away from it and come back, a fresh action request is issued with a freshly allocated action ID.

Pseduo-action WN:Dialog provides a more general, but slower, form of url conversion. That pseudo-action is capable of generating an authenticated action request, always allocates a fresh ID and accesses the resulting url, and always produces a url with restorable state, for any action (not just do), at the cost of about two seconds for the intermediate page access.

Véase también[editar]