Skip to content

Commit

Permalink
*6339* Removing LegacyLinkAction usage
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Sep 26, 2012
1 parent 83874d7 commit b7b7949
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions classes/submission/common/PKPAction.inc.php
Expand Up @@ -50,6 +50,7 @@ function editCitations(&$request, &$submission) {
$templateMgr->addJavaScript('lib/pkp/js/functions/jqueryValidatorI18n.js');
$templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.splitter.js');

$citationEditorConfigurationError = null;

// Check whether the citation editor requirements are complete.
// 1) Citation editing must be enabled for the journal.
Expand Down
122 changes: 122 additions & 0 deletions js/controllers/grid/filter/form/FilterFormHandler.js
@@ -0,0 +1,122 @@
/**
* @defgroup js_controllers_grid_filter_form
*/
// Create the namespace.
jQuery.pkp.controllers.grid.filter =
jQuery.pkp.controllers.grid.filter ||
{ form: { } };

/**
* @file js/controllers/grid/filter/form/FilterFormHandler.js
*
* Copyright (c) 2000-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class FilterFormHandler.js
* @ingroup js_controllers_grid_filter_form
*
* @brief Handle the filter configuration form.
*/
(function($) {


/**
* @constructor
*
* @extends $.pkp.controllers.form.AjaxFormHandler
*
* @param {jQuery} $form the wrapped HTML form element.
* @param {Object} options form options.
*/
$.pkp.controllers.grid.filter.form.FilterFormHandler =
function($form, options) {

this.parent($form, options);

if (options.noMoreTemplates === true || options.filterTemplates === true) {
this.disableFormControls();
$(options.pulldownSelector).change(
this.callbackWrapper(this.selectOptionHandler_));
// When a selection is made from the pulldown, the form will
// be replaced in the DOM with a new one. To prevent the modal
// from being closed, absorb this event.
if (options.filterTemplates) {
this.bind('pkpRemoveHandler', this.callbackWrapper(this.removeHandler_));
}
}

this.editFilterUrlTemplate_ = options.editFilterUrlTemplate;

};
$.pkp.classes.Helper.inherits(
$.pkp.controllers.grid.filter.form.FilterFormHandler,
$.pkp.controllers.form.AjaxFormHandler);


//
// Private properties
//
/**
* The URL template for the edit filter form.
* @private
* @type {string?}
*/
$.pkp.controllers.grid.filter.form.FilterFormHandler.prototype.editFilterUrlTemplate_ = null;


//
// Private helper methods
//
/**
* Respond to a filter dropdown selection
*
* @param {HTMLElement} sourceElement The element that
* issued the event.
* @param {Event} event The triggering event.
* @private
*/
$.pkp.controllers.grid.filter.form.FilterFormHandler.prototype.selectOptionHandler_ =
function(sourceElement, event) {

$(sourceElement).hide();
$.get(this.editFilterUrlTemplate_
.replace('DUMMY_FILTER_TEMPLATE_ID', $(sourceElement).val()),
this.callbackWrapper(this.getFilterForm_), 'json');
};


/**
* Respond to a handler removal event
*
* @param {HTMLElement} sourceElement The element that
* issued the event.
* @param {Event} event The triggering event.
* @private
*/
$.pkp.controllers.grid.filter.form.FilterFormHandler.prototype.removeHandler_ =
function(sourceElement, event) {

this.unbind('pkpRemoveHandler');
};


/**
* Set the list of available items.
*
* @param {Object} ajaxContext The AJAX request context.
* @param {Object} jsonData A parsed JSON response object.
* @private
*/
$.pkp.controllers.grid.filter.form.FilterFormHandler.prototype.getFilterForm_ =
function(ajaxContext, jsonData) {

jsonData = this.handleJson(jsonData);

// Replace the current form with the new one.
this.remove();
this.getHtmlElement().replaceWith($(jsonData.content));
};


/** @param {jQuery} $ jQuery closure. */
})(jQuery);

0 comments on commit b7b7949

Please sign in to comment.