/* global List */ 'use strict'; var WPMailSMTP = window.WPMailSMTP || {}; WPMailSMTP.Admin = WPMailSMTP.Admin || {}; /** * WP Mail SMTP Admin area Code Snippets module. * * @since 4.9.0 */ WPMailSMTP.Admin.CodeSnippets = WPMailSMTP.Admin.CodeSnippets || ( function( document, window, $ ) { /** * Public functions and properties. * * @since 4.9.0 * * @type {object} */ var app = { /** * List.js instance for the snippet grid. * * @since 4.9.0 * * @type {object} */ snippetSearch: null, /** * Start the engine. DOM is not ready yet, use only to init something. * * @since 4.9.0 */ init: function() { $( app.ready ); }, /** * DOM is fully loaded. * * @since 4.9.0 */ ready: function() { app.snippetSearch = new List( 'wp-mail-smtp-wpcode-snippets-list', { valueNames: [ 'wp-mail-smtp-wpcode-snippet-title' ], } ); app.events(); }, /** * Bind events. * * @since 4.9.0 */ events: function() { // Fallback overlay button installs WPCode directly. $( '.wp-mail-smtp-wpcode-fallback-install-plugin' ).on( 'click', app.onFallbackInstallClick ); // Card "Install Snippet" (WPCode absent) opens the install-plugin popup. $( '.wp-mail-smtp-wpcode-install-plugin' ).on( 'click', app.openInstallPluginPopup ); // Card "Install Snippet" (WPCode installed but inactive) activates WPCode, then installs. $( '.wp-mail-smtp-wpcode-activate-plugin' ).on( 'click', app.onActivatePluginClick ); // "View" opens the code-preview modal. $( '.wp-mail-smtp-wpcode-view-snippet' ).on( 'click', app.openViewSnippetModal ); // Active-state "Install Snippet" shows an installing state before navigating to WPCode. $( '.wp-mail-smtp-wpcode-install-snippet' ).on( 'click', app.installSnippet ); $( '#wp-mail-smtp-wpcode-snippet-search' ).on( 'keyup search', function() { app.searchSnippet( this ); } ); }, /** * POST to an admin-ajax action with the nonce attached. * * @since 4.9.0 * * @param {string} action admin-ajax action name. * @param {object} extra Action-specific fields merged into the request. * * @returns {object} The jQuery jqXHR promise. */ post: function( action, extra ) { var data = $.extend( { action: action, nonce: window.wp_mail_smtp.nonce, }, extra || {} ); return $.post( window.wp_mail_smtp.ajax_url, data ); }, /** * Enter the installing state: hide the badge/label and overlay a spinner * on the button (CSS keeps the button width). * * @since 4.9.0 * * @param {object} $label Badge or "installing" label element. * @param {object} $button Action button element. */ setInstalling: function( $label, $button ) { $label.addClass( 'wp-mail-smtp-wpcode-installing-in-progress' ).text( window.wp_mail_smtp_code_snippets.installing_text ); $button.addClass( 'wp-mail-smtp-btn-loading' ); }, /** * Leave the installing state (used when a flow fails and the UI stays put). * * @since 4.9.0 * * @param {object} $label Badge or "installing" label element. * @param {object} $button Action button element. */ clearInstalling: function( $label, $button ) { $label.removeClass( 'wp-mail-smtp-wpcode-installing-in-progress' ).text( '' ); $button.removeClass( 'wp-mail-smtp-btn-loading' ); }, /** * Filter the snippet grid against the search field value. * * @since 4.9.0 * * @param {object} searchField The search field HTML element. */ searchSnippet: function( searchField ) { var searchTerm = $( searchField ).val(); var searchResults = app.snippetSearch.search( searchTerm ); var $noResults = $( '#wp-mail-smtp-wpcode-no-results' ); if ( searchResults.length === 0 ) { $noResults.show(); } else { $noResults.hide(); } }, /** * Active-state "Install Snippet": show an installing state, then let the * link navigate to WPCode's install screen (perceived-load only, no AJAX). * * @since 4.9.0 */ installSnippet: function() { var $button = $( this ); // Edit is a plain navigation to the WPCode edit screen; no JS needed. if ( $button.data( 'action' ) === 'edit' ) { return; } app.setInstalling( $button.closest( '.wp-mail-smtp-wpcode-snippet' ).find( '.wp-mail-smtp-wpcode-snippet-badge' ), $button ); }, /** * Card "Install Snippet" when WPCode is installed but inactive: activate * WPCode, then navigate to the snippet's install URL. On activation * failure, show the activation popup. * * @since 4.9.0 * * @param {object} event The click event. */ onActivatePluginClick: function( event ) { event.preventDefault(); var $button = $( this ); var $badge = $button.closest( '.wp-mail-smtp-wpcode-snippet' ).find( '.wp-mail-smtp-wpcode-snippet-badge' ); app.setInstalling( $badge, $button ); app.activatePluginThenInstallSnippet( $button.data( 'library-id' ), $button.data( 'plugin' ), function() { app.clearInstalling( $badge, $button ); app.showManualActivationPluginPopup(); } ); }, /** * Activate WPCode via AJAX, then resolve the snippet's install URL via a * second AJAX request and navigate there. If activation fails, run the * provided callback; if only the URL lookup fails, reload so the tab * re-renders in its active state. * * @since 4.9.0 * * @param {number} libraryId The snippet library id. * @param {string} plugin WPCode plugin path. * @param {Function} onActivateFail Called when activation fails. */ activatePluginThenInstallSnippet: function( libraryId, plugin, onActivateFail ) { app.post( 'wp_mail_smtp_ajax', { task: 'about_plugin_activate', plugin: plugin } ) .done( function( response ) { if ( ! response || ! response.success ) { onActivateFail(); return; } app.navigateToSnippetInstall( libraryId ); } ) .fail( function() { onActivateFail(); } ); }, /** * Resolve a snippet's WPCode install URL (now that WPCode is active) via * AJAX and navigate to it. Falls back to a reload if the URL can't be * resolved, so the tab still re-renders in its active state. * * @since 4.9.0 * * @param {number} libraryId The snippet library id. */ navigateToSnippetInstall: function( libraryId ) { var extra = {}; extra['library_id'] = libraryId; // eslint-disable-line dot-notation app.post( 'wp_mail_smtp_get_wpcode_snippet_install_url', extra ) .done( function( response ) { if ( response && response.success && response.data && response.data.install_url ) { window.location.href = response.data.install_url; return; } window.location.reload(); } ) .fail( function() { window.location.reload(); } ); }, /** * Install and activate WPCode via AJAX. Runs onDone on full success, or * onError('install') if the install failed / errored, or onError('activate') * if WPCode installed but silent activation failed. * * WP returns logical failures with HTTP 200 + success:false, so a failed * install lands in .done (not .fail) and must be checked explicitly. * * @since 4.9.0 * * @param {string} plugin WPCode download URL. * @param {Function} onDone Called after a successful install + activation. * @param {Function} onError Called with 'install' or 'activate' on failure. */ installAndActivatePlugin: function( plugin, onDone, onError ) { app.post( 'wp_mail_smtp_ajax', { task: 'about_plugin_install', plugin: plugin } ) .done( function( response ) { if ( ! response || ! response.success ) { onError( 'install' ); return; } if ( response.data && response.data.is_activated === false ) { onError( 'activate' ); return; } onDone(); } ) .fail( function() { onError( 'install' ); } ); }, /** * Show the activate-WPCode popup. Its button forwards to the Plugins page * activation action for the installed WPCode plugin. * * @since 4.9.0 */ showManualActivationPluginPopup: function() { var l10n = window.wp_mail_smtp_code_snippets; $.confirm( { title: l10n.activate_popup_title, container: '#wp-mail-smtp', boxWidth: '600px', useBootstrap: false, closeIcon: true, draggable: false, content: '
' + l10n.activate_popup_desc + '
', buttons: { activate: { text: l10n.activate_popup_btn, btnClass: 'btn btn-confirm', action: function( button ) { button.addClass( 'wp-mail-smtp-btn-loading' ); window.location.href = l10n.activate_url; // Keep the popup open so the loader stays visible during navigation. return false; }, }, }, } ); }, /** * Map a snippet code_type to a CodeMirror mode. * * @since 4.9.0 * * @param {string} codeType Snippet code type. * * @returns {string} CodeMirror mode. */ mapMode: function( codeType ) { switch ( codeType ) { case 'js': case 'javascript': return 'javascript'; case 'css': return 'css'; case 'html': return 'htmlmixed'; default: return 'text/x-php'; } }, /** * Open the read-only code-preview modal for a snippet. * * @since 4.9.0 * * @param {object} event The click event. */ openViewSnippetModal: function( event ) { event.preventDefault(); var $btn = $( this ); var libraryId = $btn.data( 'library-id' ); var installUrl = $btn.data( 'install-url' ); var plugin = $btn.data( 'plugin' ); var l10n = window.wp_mail_smtp_code_snippets; // $.dialog has no jconfirm button row (whose styles can't be overridden // cleanly) — the action button is rendered inside our own content. $.dialog( { title: l10n.loading_text, container: '#wp-mail-smtp', boxWidth: '720px', useBootstrap: false, closeIcon: true, draggable: false, content: 'We develop a feedback theory of tuition inflation. Our analysis shows that competition between colleges for reputation, students, and resources triggers tuition escalation. The article makes several recommendations for controlling cost inflation. It also demonstrates how to apply feedback analysis to economic problems, which is the domain of feedback economics.
Pavlov, O.V. and E. Katsamakas. “Tuition too high? Blame competition.” Journal of Economic Behavior & Organization, 213, 2023: 409-431.
]]>The effect of declining enrollments on colleges
The approaching decline in the U.S. college-age population, sometimes referred to as a “demographic storm,” has been identified as an existential threat to the future of American colleges and universities. This article conducts a model-driven analysis of three plausible college-level responses to declining applications. It draws on systems theory to conceptualize a tuition-dependent college as a complex service system and to develop a system dynamics model that captures key causal interrelationships and multiple feedback effects between faculty, facilities, tuition revenue, financials, reputation, and outcomes. Simulations with the college model suggest that common solutions such as reducing faculty or adding campus facilities may improve the college’s short-term financial position, but they are insufficient to ensure the long-term viability without the continuous tuition hikes. This model contributes to the research literature on the economics of higher education, and model-driven academic management and strategy. It also provides useful implications and insights that can inform policy-makers and college leaders.

Causal structure of the college model. The model has six stocks, shown as rectangles. It captures the many causal and feedback effects between elements of a representative tuition-based college, which include faculty, facilities, tuition revenue, endowment, debt, reputation, and educational outcomes. This model tracks numerous simultaneous effects triggered by the external operating environment and by the management decisions.
Publications:
Pavlov O.V. and E. Katsamakas. “Will colleges survive the storm of declining enrollments? A computational model.” PLoS ONE, 15(8), 2020: e0236872.
Ginzberg M. and O. Pavlov. “Dynamic Modeling for Higher Education Planning.” Optimal Insights. June 29, 2020.
The effect of COVID-19 on college finances
The COVID-19 pandemic has had a significant impact on higher education. Steering academic institutions through the pandemic is a complex and multifaceted task that can be supported with model-based scenario analysis. This article studies the short-term and long-term effects of the pandemic on the financial health of a college using scenario analysis and stress testing with a system dynamics model of a representative tuition-dependent college. We find that different combinations of the pandemic mitigation protocols have varying effects on the financial sustainability of an academic institution. By simulating six individual components of the COVID-19 shock, we learn that due to the causal complexity, nonlinear responses and delays in the system, the negative shocks can propagate widely through the college, sometimes with considerable delays and disproportionate effects. Scenario analysis shows that some pandemic mitigation choices may destabilize even financially healthy institutions. The article concludes that higher education needs new sustainable business models.
Six components of the COVID-19 shock and their impact on a college.
S1: Fewer students on campus; S2: Lower enrollments; S3: COVID-19 preparedness of the campus; S4: Health and safety measures; S5: Greater financial need; S6: Calls to reduce tuition.

Publication:
Pavlov, O. and E. Katsamakas. “COVID-19 and Financial Sustainability of Academic Institutions.” Sustainability. 13 (7), 2021.
This project applies the service science framework to higher education. To understand the reasons behind the success and failure of academic programs, we build on the previous literature that conceptualizes education as a service delivered by universities which are complex systems. We introduce the Service Canvas as a tool for identifying components of academic programs.

Funding: The Coleman Foundation
Publications:
Pavlov, O. and F. Hoy. “Toward the Service Science of Education.” In Maglio, P. P., Kieliszewski, C. A., Spohrer, J. C., Lyons, K., Patricio, L. & Sawatani, Y. (Eds.). Handbook of Service Science, Volume II. New York: Springer. 2019: 545-566.
Pavlov, O. and F. Hoy. “Entrepreneurship Education as a Service.” In Bosio, G., T. Minola, F. Origo and S. Tomelleri (Eds.). Rethinking the Entrepreneurial Human Capital: The Role of Innovation and Collaboration. Cham, Switzerland: Springer. 2018: 107-127.
Conference presentations:
Pavlov, O. and F. Hoy. “Higher Education as a Service.” 44th Annual Meeting of the Eastern Economic Association. Boston, MA. March 1-4, 2018
Pavlov, O. and F. Hoy. “Toward the Service Science View of Education.” EDULEARN17: 9th International Conference on Education and New Learning Technologies. Barcelona, Spain. July 3-5, 2017.
Pavlov, O. and F. Hoy. “Education as a Service System.” Contributed Talk, Session WC54: Service Science. INFORMS Annual Meeting. Philadelphia, PA. November 4, 2015.
During the nineteenth century, Sicily underwent a series of political and land reforms that led to dismantling of large land ownership and culminated in the unification with the Italian state in 1861. But the new Italian government was ineffective at enforcing the rule of law on the island. Banditry and a general sense of lawlessness proliferated. In that environment, the mafia emerged as a private response to the inadequate protection by the state. The mafia offered private protection from bandits to landowners who could not rely on protection and enforcement of property rights by the state. The mafia, however, was not equally active on the entire island. This study uses economic principles to explain the emergence of the mafia in wealthier regions and its absence in the poorer districts despite the greater levels of banditry. We develop a feedback model that incorporates causal relationships between the mafia’s activities, predation, law enforcement, and the profitability of the local businesses. Using computational experiments, we explore how various factors impact the mafia’s activities.

The feedback model. Rectangles are state variables Peasants, Bandits and Mafia. If the economy is bad, some peasants turn to banditry; the mafia members are recruited from among the bandits. Arrows indicate causal relationships between variables. If an arrow is positive, the relationship between the cause and effect is positive. A negative arrow implies that an increase in one variable causes a decline in the other variable. Circular causal links form reinforcing and balancing feedback loops. A reinforcing loop is shown with the letter R and a balancing loop is shown with the letter B.
Publication
Pavlov, O. and J. Sardell. “Economic Origins of the Sicilian Mafia: A Simulation Feedback Model.” In: Cavana, R.Y, B.C. Dangerfield , O.V. Pavlov, M.J. Radzicki and I.D. Wheat (Eds). Feedback Economics: Economic Modeling with System Dynamics. New York: Springer. 2021: 137-161. Pre-print on SSRN.
]]>A Game-Based Pedagogical Framework for Promoting Systems Thinking Skills
The systems thinking skills required to understand complex systems have been recognized in education as a core aspect of science literacy and more recently as critical 21st century skills that young Americans need to succeed in today’s competitive global society. The current national standards for science education reflect this perspective by explicitly calling for the incorporation of systems thinking concepts and practices into science education. While this perspective represents an important step forward, how can teachers actually put it into practice? Video games offer affordances to support systems thinking skills. Using games in STEM domains can increase students’ interest and engagement. However, despite increasing research interest, little is yet known about designing game-based curricula that facilitate systems thinking skills. Simply playing a game without a systematic pedagogical approach is insufficient because the game remains a “black box” to students even if they implicitly understand how the system operates. To address this gap, we propose Game-Based Structural Debriefing (GBSD), a pedagogical innovation to help teachers cultivate systems thinking skills by introducing games into the classroom. The framework is based on the literature of systems thinking and system dynamics modeling. This study uses the design‐based research method to refine the framework and investigate its efficacy at both teacher and student levels.

Funding: Spencer Foundation
Publications
Pavlov, O., Y.J. Kim and C. Whitlock. “Food Fight: Teaching Systems Thinking and Ecosystems.” In Schrier, Karen (Ed.). Learning, Education, & Games, Volume 3: 100 Games to Use in the Classroom and Beyond. Pittsburgh, PA: ETC Press. 2019: 150-155.
Kim, Y.J. and O. Pavlov. “Game-Based Structural Debriefing: How Can Teachers Design Game-Based Curricula for Systems Thinking?” Information and Learning Sciences. 120 (9/10), 2019: 567-588.
Conference presentations
Pavlov, O. and Y.J. Kim. “A Learning Sciences Investigation of Game-Based Structural Debriefing.” In the Proceedings of the 35th International Conference of the System Dynamics Society. Boston, MA. July 16-20, 2017.
Kim, Y.J. and O. Pavlov. “Game-Based Structural Debriefing: A Design Tool for Systems Thinking Curriculum.” In the Proceedings of “EDULEARN17: 9th International Conference on Education and New Learning Technologies.” Barcelona, Spain. July 3-5, 2017.
Kim, Y.J. and O. Pavlov. “Game-Based Structural Debriefing: Development of a Pedagogical Framework for Promoting Systems Thinking Skills.” In the Proceedings of the 2016 AERA Annual Meeting. Washington, D.C., April 8-12, 2016
Keywords: debriefing; structural debriefing; simulation; simulators; black-box simulation; business training; LITTLEFIELD; operations management; system dynamics
Learn more:
Pavlov, O., K. Saeed, and L. Robinson. “A Structural Debriefing of a Business Simulation Exercise.” In the Proceedings of the 17th Annual Irish Academy of Management Conference. Kemmy Business School, University of Limerick. Limerick, Ireland. September 3-5, 2014.
]]>This project investigates the effects of network topologies on asset price dynamics. We introduce network communications into a simple asset pricing model with heterogeneous beliefs. The agents may switch between several belief types according to their performance. The performance information is available to the agents only locally through their own experience and the experience of other agents directly connected to them. We model the communications with four commonly considered network topologies: a fully connected network, a regular lattice, a small world, and a random graph. The results show that the network topologies influence asset price dynamics in terms of the regions of stability, amplitudes of fluctuations and statistical properties.
Keywords: Asset pricing, Local interactions, Networks, Random graph, Small world, Heterogeneous beliefs, Price dynamics
Learn more:
Panchenko, V., S. Gerasymchuk, and O. Pavlov. “Asset Price Dynamics with Heterogeneous Beliefs and Local Network Interactions.” Journal of Economic Dynamics and Control. v. 37 (12), 2013: 2623–2642. Paper link.
]]>We propose a generic model that explains why political systems tend toward certain outcomes. The model identifies possible economic and psychological paths toward change in a metaphorical political economy consisting of farmers, bandits and soldiers. In addition to economic factors, we also consider how two psychological factors, broadly categorized as group identity and exposure to violence, affect the behavior of metaphorical agents. We find that though outcomes tend to be similar with and without the psychological influences, the psychological influences accelerate the adjustment process and create additional policy space for interventions. A methodological contribution of the paper also is the use of summary performance measures represented as phase plots that have the potential to be used with advantage in system dynamics analyses.
Learn more:
Saeed, K., O. Pavlov, J. Skorinko, and A. Smith. “Farmers, Bandits and Soldiers: A Generic System for Addressing Peace Agendas. “ System Dynamics Review. v. 29 (4), 2013: 237–252.
]]>