<commit_before><?php
/**
 * Changes the order of the grid rows.
 * Should be added to a Grid; column of type 'order' should also be defined
 * 
 * Created on 15.06.2006 by *Camper* (<EMAIL>)
 */
class RecordOrder extends AbstractController{
	/**
	 * Field name by which the dataset will be ordered.
	 * By default this field value should by equal to id value. 
	 * You should take care of this by yourself
	 */
	private $field;
	
	function init(){
		parent::init();
		$this->api->addHook('post-init', array($this, 'process'));
	}
	function process(){
		if(isset($_GET[$this->name]))$this->act($_GET[$this->name], $_GET['action']);
	}
	function setField($field_name,$table=''){
		/**
		 * Sets the field by which dataset will be ordered
		 */
		$this->field=($table?$table.'.':'').$field_name;
		$this->owner->dq->order("coalesce($this->field, ".($table?$table.'.':'')."id)");
	}
	function getCell($id){
		if($this->recall('hl',null)){
			$left_pic='amodules3/templates/shared/move-here.gif';
			$left_act=$id==$this->recall('hl',null)?
				"":
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'mv'))->getString();
			$left_alt="Move marked row here";
			$right_pic='amodules3/templates/shared/xchg.gif';
			$right_act=$id==$this->recall('hl',null)?
				"":
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'xchg'))->getString();
			$right_alt="Exchange this row with marked";
		}else{
			$left_pic='amodules3/templates/shared/move-up.gif';
			$left_act=
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'up'))->getString();
			$left_alt="Move this row up once";
			$right_pic='amodules3/templates/shared/move-down.gif';
			$right_act=
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'dn'))->getString();
			$right_alt="Move this row down once";
		}
		$mark_pic=$id==$this->recall('hl',null)?'amodules3/templates/shared/unmark.gif':'amodules3/templates/shared/mark.gif';
		$mark_act="\n".$this->recall('hl',null)?
			$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'untag'))->getString():
			$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'tag'))->getString();
		$mark_alt=$this->recall('hl',null)?"Unmark this row":"Mark this row";
		$cell=
			'<img title="'.$left_alt.'" src="'.$left_pic.'" onclick="'.$left_act.'">' .
			'<img title="'.$mark_alt.'" src="'.$mark_pic.'" onclick="'.$mark_act.'">' .
			'<img title="'.$right_alt.'" src="'.$right_pic.'" onclick="'.$right_act.'">'
			;
		//Ajax:ajaxFunc() adds a \n to the end of function, that causes a problem with inlines
		$cell=implode('', explode("\n", $cell));
		return $cell; 
	}
	function act($id, $action){
		$aid=array();
		$ord=array();<commit_msg>Record order small fix<commit_after><?php
/**
 * Changes the order of the grid rows.
 * Should be added to a Grid; column of type 'order' should also be defined
 * 
 * Created on 15.06.2006 by *Camper* (<EMAIL>)
 */
class RecordOrder extends AbstractController{
	/**
	 * Field name by which the dataset will be ordered.
	 * By default this field value should by equal to id value. 
	 * You should take care of this by yourself
	 */
	private $field;
	
	function init(){
		parent::init();
		$this->api->addHook('post-init', array($this, 'process'));
	}
	function process(){
		if(isset($_GET[$this->name]))$this->act($_GET[$this->name], $_GET['action']);
	}
	function setField($field_name,$table=''){
		/**
		 * Sets the field by which dataset will be ordered
		 */
		$this->field=($table?$table.'.':'').$field_name;
		$this->owner->dq->order("coalesce($this->field, ".($table?$table.'.':'')."id)");
	}
	function getCell($id){
		if($this->recall('hl',null)){
			$left_pic='amodules3/templates/shared/move-here.gif';
			$left_act=$id==$this->recall('hl',null)?
				"":
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'mv'))->getString();
			$left_alt="Move marked row here";
			$right_pic='amodules3/templates/shared/xchg.gif';
			$right_act=$id==$this->recall('hl',null)?
				"":
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'xchg'))->getString();
			$right_alt="Exchange this row with marked";
		}else{
			$left_pic='amodules3/templates/shared/move-up.gif';
			$left_act=
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'up'))->getString();
			$left_alt="Move this row up once";
			$right_pic='amodules3/templates/shared/move-down.gif';
			$right_act=
				$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'dn'))->getString();
			$right_alt="Move this row down once";
		}
		$mark_pic=$id==$this->recall('hl',null)?'amodules3/templates/shared/unmark.gif':'amodules3/templates/shared/mark.gif';
		$mark_act="\n".($this->recall('hl',null)?
			$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'untag'))->getString():
			$this->add('Ajax')->reloadRegion('Content', array($this->name=>$id, 'action'=>'tag'))->getString());
		$mark_alt=$this->recall('hl',null)?"Unmark this row":"Mark this row";
		$cell=
			'<img title="'.$left_alt.'" src="'.$left_pic.'" onclick="'.$left_act.'">' .
			'<img title="'.$mark_alt.'" src="'.$mark_pic.'" onclick="'.$mark_act.'">' .
			'<img title="'.$right_alt.'" src="'.$right_pic.'" onclick="'.$right_act.'">'
			;
		//Ajax:ajaxFunc() adds a \n to the end of function, that causes a problem with inlines
		$cell=implode('', explode("\n", $cell));
		return $cell; 
	}
	function act($id, $action){
		$aid=array();
		$ord=array();
{'fraction_non_alphanumeric': 0.24113980409617097, 'fraction_numerical': 0.004986642920747996, 'mean_word_length': 5.0257510729613735, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 115, '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': '5244178', 'n_tokens_mistral': 2108, 'n_tokens_neox': 1951, 'n_words': 362}