// @TFDCLERK_HEADER_START@ /* Copyright (C) 2015 Ben Kurtovic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // @TFDCLERK_HEADER_END@ TFD.prototype._do_close = function() { // TODO // rough mockup: // - post-submit ui updates // - result options -> result string // - disable comments box // - collapse/disable/fix actions // - add progress info area // - "Closing discussion..." // - add discussion close tags with result and comment, optional nac // - " done ([[diff]])" // - interface for closing each template // - replace gray buttons with progressive refresh button }; TFD.prototype._is_merge = function() { return this.head.nextUntil("h4").filter("p").first().find("b") .text() == "Propose merging"; }; TFD.prototype._get_close_action_choices = function() { // TODO: disable action options until transcluion info loads... // TODO: restrictions for close result // - ["delete", "keep", "redirect", "merge", "nomerge", "nocon", "other"]; return [{ id: "none", name: "Do nothing", help: "The script will not modify this template or pages related to " + "it. You will need to carry out the closure yourself.", on_select: null, on_close: null, restrict: {}, default: true }, { id: "holding-cell", name: "Move to holding cell", help: "The script will add {{being deleted}} to the template and " + "add an entry to the holding cell ([[WP:TFD/H]]).", on_select: null, // TODO: auto-select "to merge" if merging on_close: null, // TODO restrict: {results: ["delete", "redirect", "merge", "nocon", "other"]} }, { id: "keep", name: "Keep", // TODO: clarify? esp. for merges help: "The script will remove {{tfd}} or {{tfm}} from the template " + "and add {{Old TfD}} to its talk page.", on_select: null, on_close: null, // TODO restrict: {results: ["keep", "merge", "nomerge", "nocon", "other"]} // SPLIT OFF "merge" FOR "merge target"? }, { id: "redirect", name: "Redirect", // TODO: clarify? help: "TODO", // redirect main and subpages and double-redirects to user-selected // target; add {{TFD end}} on talk [or give option to redirect talk // instead?]; "Ensure page protection for the redirect matches that of // the template which the page now redirects to, and that page // protection for the target template is appropriate for the number of // transclusions which may have increased after the redirection.") on_select: null, on_close: null, restrict: {merge: false} // TODO: allow for merges? }, { id: "review-and-delete", name: "Review and delete", help: "TODO", on_select: null, on_close: null, restrict: {merge: false, used: true} }, { id: "orphan-and-delete", name: "Orphan and delete", help: "TODO", on_select: null, on_close: null, restrict: {merge: false, used: true} }, { id: "substitute-and-delete", name: "Substitute and delete", help: "TODO", on_select: null, on_close: null, restrict: {merge: false, used: true} }, { id: "delete", name: "Delete", help: "TODO", on_select: null, on_close: null, restrict: {merge: false, used: false} }]; }; TFD.prototype._on_close_result_change = function() { this._unblock_submit("no-close-result"); // TODO: possibly disable/enable individual close actions }; TFD.prototype._build_close_results = function() { if (this._is_merge()) var choices = [["Merge"], ["Do not merge", "nomerge"]]; else var choices = [["Delete"], ["Keep"], ["Redirect"]]; choices.push(["No consensus", "nocon"], ["Other"]); var self = this; var elems = $("
"); $("