<commit_before><?php
/** 
 * Something like igoogle
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright &copy; 2007, Telaxus LLC
 * @license SPL
 * @version 0.1
 * @package epesi-base-extra
 * @subpackage activeboard
 */
defined("_VALID_ACCESS") || die('Direct access forbidden');

class Base_ActiveBoard extends Module {
	private $lang;
	private $set_default_js='';
	
	public function body() {
		$this->lang = $this->init_module('Base/Lang');
		Base_ActionBarCommon::add('add','Add applet',$this->create_callback_href(array($this,'applets_list')));
		load_js($this->get_module_dir().'ab.js');
		print('<div id="activeboard">');
		for($j=0; $j<3; $j++) {
			print('<div id="activeboard_applets_'.$j.'" style="float:left;width:33%;min-height:100px">');
			
			$ret = DB::Execute('SELECT id,module_name FROM base_activeboard_applets WHERE col=%d AND user_login_id=%d ORDER BY pos',array($j,Base_UserCommon::get_my_user_id()));
			while($row = $ret->FetchRow()) {
				if(ModuleManager::is_installed($row['module_name'])==-1) {//if its invalid entry
					$this->delete_applets($row['module_name']);
					continue;
				}
					
				$m = $this->init_module($row['module_name'],null,$row['id']);
				$th = $this->init_module('Base/Theme');
				$th->assign('handle_class','handle');
				$th->assign('caption',call_user_func(array($row['module_name'].'Common', 'applet_caption')));
				$th->assign('toggle','<a class="toggle">=</a>');
				$th->assign('remove','<a class="remove" '.$this->create_confirm_callback_href($this->lang->t('Delete this applet?'),array($this,'delete_applet'),$row['id']).'>x</a>');
				if(method_exists($row['module_name'].'Common', 'applet_settings'))
					$th->assign('configure','<a class="configure" '.$this->create_callback_href(array($this,'configure_applet'),array($row['id'],$row['module_name'])).'>c</a>');
				$th->assign('content','<div class="content">'.
						$this->get_html_of_module($m,array($this->get_values($row['id'],$row['module_name']), $row['id']),'applet').
						'</div>');
				print('<div class="applet" id="ab_item_'.$row['id'].'">');
				$th->display();
				print('</div>');
			}
			print('</div>');
		}
		print('</div>');
//		eval_js('activeboard_activate()');
		eval_js('wait_while_null(\'Sortable\',\'activeboard_activate()\')');
	}
	
	public function applets_list() {
		$fc = $this->get_module_variable('first_conf');
		if(isset($fc)) {
			$mod = $this->get_module_variable('mod_conf');
			if(!$this->configure_applet($fc,$mod)) {
				$this->unset_module_variable('first_conf');
				$this->unset_module_variable('mod_conf');
				return false;
			}
			return true;
		}

		if($this->is_back()) return false;		<commit_msg>bug fix<commit_after><?php
/** 
 * Something like igoogle
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright &copy; 2007, Telaxus LLC
 * @license SPL
 * @version 0.1
 * @package epesi-base-extra
 * @subpackage activeboard
 */
defined("_VALID_ACCESS") || die('Direct access forbidden');

class Base_ActiveBoard extends Module {
	private $lang;
	private $set_default_js='';
	
	public function body() {
		$this->lang = $this->init_module('Base/Lang');
		Base_ActionBarCommon::add('add','Add applet',$this->create_callback_href(array($this,'applets_list')));
		load_js($this->get_module_dir().'ab.js');
		print('<div id="activeboard">');
		for($j=0; $j<3; $j++) {
			print('<div id="activeboard_applets_'.$j.'" style="float:left;width:33%;min-height:100px">');
			
			$ret = DB::Execute('SELECT id,module_name FROM base_activeboard_applets WHERE col=%d AND user_login_id=%d ORDER BY pos',array($j,Base_UserCommon::get_my_user_id()));
			while($row = $ret->FetchRow()) {
				if(ModuleManager::is_installed($row['module_name'])==-1) {//if its invalid entry
					$this->delete_applets($row['module_name']);
					continue;
				}
					
				$m = $this->init_module($row['module_name'],null,$row['id']);
				$th = $this->init_module('Base/Theme');
				$th->assign('handle_class','handle');
				$th->assign('caption',call_user_func(array($row['module_name'].'Common', 'applet_caption')));
				$th->assign('toggle','<a class="toggle">=</a>');
				$th->assign('remove','<a class="remove" '.$this->create_confirm_callback_href($this->lang->t('Delete this applet?'),array($this,'delete_applet'),$row['id']).'>x</a>');
				if(method_exists($row['module_name'].'Common', 'applet_settings'))
					$th->assign('configure','<a class="configure" '.$this->create_callback_href(array($this,'configure_applet'),array($row['id'],$row['module_name'])).'>c</a>');
				$th->assign('content','<div class="content">'.
						$this->get_html_of_module($m,array($this->get_values($row['id'],$row['module_name']), $row['id']),'applet').
						'</div>');
				print('<div class="applet" id="ab_item_'.$row['id'].'">');
				$th->display();
				print('</div>');
			}
			print('</div>');
		}
		print('</div>');
		eval_js('activeboard_activate()');
	}
	
	public function applets_list() {
		$fc = $this->get_module_variable('first_conf');
		if(isset($fc)) {
			$mod = $this->get_module_variable('mod_conf');
			if(!$this->configure_applet($fc,$mod)) {
				$this->unset_module_variable('first_conf');
				$this->unset_module_variable('mod_conf');
				return false;
			}
			return true;
		}

		if($this->is_back()) return false;		
{'fraction_non_alphanumeric': 0.23300970873786409, 'fraction_numerical': 0.00533028745478774, 'mean_word_length': 5.779354838709677, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 91, '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': '921684', 'n_tokens_mistral': 2082, 'n_tokens_neox': 1834, 'n_words': 242}