<commit_before>﻿using System;

public partial class Settings : System.Web.UI.Page
{
  //---------------------------------------------------------------------------

  protected void Page_Load( object sender, EventArgs e )
  {
    // Don't allow people to skip the login page.
    if( Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == null ||
        (bool)Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == false )
    {
      Response.Redirect( "Default.aspx" );
    }

    dataSource.ConnectionString = Database.DB_CONNECTION_STRING;
    NewSetting.Click += OnNewClick;
  }

  //---------------------------------------------------------------------------

  void OnNewClick( object sender, EventArgs e )
  {
    Database.ExecSql( "DELETE FROM Setting WHERE [Key]='New Key'" );
    Database.ExecSql( "INSERT INTO Setting VALUES ( 'New Key', 'New Value' )" );
    
    settingsView.DataBind();
  }

  //---------------------------------------------------------------------------
}<commit_msg>Fix for 'new' setting button triggering if you hit enter when editing a setting.<commit_after>﻿using System;

public partial class Settings : System.Web.UI.Page
{
  //---------------------------------------------------------------------------

  protected void Page_Load( object sender, EventArgs e )
  {
    // Don't allow people to skip the login page.
    if( Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == null ||
        (bool)Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == false )
    {
      Response.Redirect( "Default.aspx" );
    }

    dataSource.ConnectionString = Database.DB_CONNECTION_STRING;
    NewSetting.Click += OnNewClick;
    settingsView.Focus();
  }

  //---------------------------------------------------------------------------

  void OnNewClick( object sender, EventArgs e )
  {
    Database.ExecSql( "DELETE FROM Setting WHERE [Key]='New Key'" );
    Database.ExecSql( "INSERT INTO Setting VALUES ( 'New Key', 'New Value' )" );
    
    settingsView.DataBind();
    settingsView.Focus();
  }

  //---------------------------------------------------------------------------
}
{'fraction_non_alphanumeric': 0.30641330166270786, 'fraction_numerical': 0.0, 'mean_word_length': 1.480565371024735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4983160', 'n_tokens_mistral': 539, 'n_tokens_neox': 520, 'n_words': 131}