<commit_before><?php

/**
 * @package Widgets
 *
 * @file Wall.php
 * This file is part of MOVIM.
 *
 * @brief The configuration form
 *
 * @author <NAME> <edhelas_at_gmail_dot_com>
 *
 * @version 1.0
 * @date 28 October 2010
 *
 * Copyright (C)2010 MOVIM project
 *
 * See COPYING for licensing information.
 */

class Config extends WidgetBase
{
    function WidgetLoad()
    {
		$this->addcss('config.css');
		$this->addjs('color/jscolor.js');
        $this->registerEvent('config', 'onConfig');
    }
    
    function onConfig(array $data)
    {
        $this->user->setConfig($data);
    }

	function ajaxSubmit($data) {
        $config = $this->user->getConfig();
        if(isset($config))
            $data = array_merge($config, $data);

        $s = new moxl\StorageSet();
        $s->setXmlns('movim:prefs')
          ->setData(serialize($data))
          ->request();
	}

	function ajaxGet() {
        $s = new moxl\StorageGet();
        $s->setXmlns('movim:prefs')
          ->request();
	}

	function build()
	{
            $languages = load_lang_array();
            /* We load the user configuration */
            $conf = $this->user->getConfig('language');
            $color = $this->user->getConfig('color');

            $submit = $this->genCallAjax('ajaxSubmit', "movim_parse_form('general')")
                . "this.className='button icon loading'; setTimeout(function() {location.reload(true)}, 2000);";
    ?><commit_msg>- Prevent cache reload on Config submit<commit_after><?php

/**
 * @package Widgets
 *
 * @file Wall.php
 * This file is part of MOVIM.
 *
 * @brief The configuration form
 *
 * @author <NAME> <edhelas_at_gmail_dot_com>
 *
 * @version 1.0
 * @date 28 October 2010
 *
 * Copyright (C)2010 MOVIM project
 *
 * See COPYING for licensing information.
 */

class Config extends WidgetBase
{
    function WidgetLoad()
    {
		$this->addcss('config.css');
		$this->addjs('color/jscolor.js');
        $this->registerEvent('config', 'onConfig');
    }
    
    function onConfig(array $data)
    {
        $this->user->setConfig($data);
    }

	function ajaxSubmit($data) {
        $config = $this->user->getConfig();
        if(isset($config))
            $data = array_merge($config, $data);

        $s = new moxl\StorageSet();
        $s->setXmlns('movim:prefs')
          ->setData(serialize($data))
          ->request();
	}

	function ajaxGet() {
        $s = new moxl\StorageGet();
        $s->setXmlns('movim:prefs')
          ->request();
	}

	function build()
	{
            $languages = load_lang_array();
            /* We load the user configuration */
            $conf = $this->user->getConfig('language');
            $color = $this->user->getConfig('color');

            $submit = $this->genCallAjax('ajaxSubmit', "movim_parse_form('general')")
                . "this.className='button icon loading'; setTimeout(function() {location.reload(false)}, 2000);";
    ?>
{'fraction_non_alphanumeric': 0.16524119055764624, 'fraction_numerical': 0.01094765651727677, 'mean_word_length': 2.539951573849879, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 43, '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': '2875412', 'n_tokens_mistral': 965, 'n_tokens_neox': 919, 'n_words': 186}