<commit_before>/**
 * @version		$Id$
 * @category	Nooku
 * @package     Nooku_Components
 * @subpackage  Terms
 * @copyright	Copyright (C) 2009 - 2010 <NAME> and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

var Terms = new Class({
	Extends: Request,
	element : null,
	form    : null,
	
	options: {
		action      : '',
		evalScripts : false,
		
        onComplete: function() {
			if (this.response && this.response.text) {
				this.element.empty().set('html', this.response.text);
				new Terms(this.element);
			} else {
				this.get(this.url);
			}
        }
	},
	
	initialize: function(element, options) {
		options = options || {};
		this.element = $(element);
		var that = this;
		this.element.getElements('a[data-action]').addEvent('click', function(e) {
			e.stop();
			that.execute(this.get('data-action'), this.get('data-id'));
		});
		this.form = this.element.getElement('form');
		this.url = this.form.getProperty('action');
		
		options.url = this.url;
		this.parent(options);
		
		this.form.addEvent('submit', function(e) {
			e.stop();
			this.execute('add');
      	}.bind(this));
    },
    
    execute: function(action, data)
    {
    	var method = '_action'+action.capitalize();
    	
    	if($type(this[method]) == 'function') 
    	{
    		this.options.action = action;
    		this[method].call(this, data);
    	}
    },
    
    _actionDelete: function(data)
    {
    	this.options.url = [this.options.url, 'id='+data].join('&');
    	
    	this.delete(this.form);
    },
    
    _actionAdd: function(data)
    {
    	this.put(this.form);
    },
});

window.addEvent('domready', function() {
	new Terms('terms-list');<commit_msg>Use post instead of put<commit_after>/**
 * @version		$Id$
 * @category	Nooku
 * @package     Nooku_Components
 * @subpackage  Terms
 * @copyright	Copyright (C) 2009 - 2010 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

var Terms = new Class({
	Extends: Request,
	element : null,
	form    : null,
	
	options: {
		action      : '',
		evalScripts : false,
		
        onComplete: function() {
			if (this.response && this.response.text) {
				this.element.empty().set('html', this.response.text);
				new Terms(this.element);
			} else {
				this.get(this.url);
			}
        }
	},
	
	initialize: function(element, options) {
		options = options || {};
		this.element = $(element);
		var that = this;
		this.element.getElements('a[data-action]').addEvent('click', function(e) {
			e.stop();
			that.execute(this.get('data-action'), this.get('data-id'));
		});
		this.form = this.element.getElement('form');
		this.url = this.form.getProperty('action');
		
		options.url = this.url;
		this.parent(options);
		
		this.form.addEvent('submit', function(e) {
			e.stop();
			this.execute('add');
      	}.bind(this));
    },
    
    execute: function(action, data)
    {
    	var method = '_action'+action.capitalize();
    	
    	if($type(this[method]) == 'function') 
    	{
    		this.options.action = action;
    		this[method].call(this, data);
    	}
    },
    
    _actionDelete: function(data)
    {
    	this.options.url = [this.options.url, 'id='+data].join('&');
    	
    	this.delete(this.form);
    },
    
    _actionAdd: function(data)
    {
    	this.post(this.form);
    },
});

window.addEvent('domready', function() {
	new Terms('terms-list');
{'fraction_non_alphanumeric': 0.1814033086138049, 'fraction_numerical': 0.00513405590416429, 'mean_word_length': 2.770967741935484, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '1534055', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1229, 'n_words': 206}