<commit_before><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxReorder page is used for reordering objects in the Symphony
	 * backend through Javascript. At the moment this is only supported for
	 * Pages and Sections.
	 */
	Class contentAjaxReorder extends AjaxPage{

		const kREORDER_PAGES = 0;
		const kREORDER_SECTIONS = 1;
		const kREORDER_EXTENSION = 2;
		const kREORDER_UNKNOWN = 3;

		public function view(){

			$destination = self::kREORDER_UNKNOWN;

			if($this->_context[0] == 'blueprints' && $this->_context[1] == 'pages') $destination = self::kREORDER_PAGES;
			elseif($this->_context[0] == 'blueprints' && $this->_context[1] == 'sections') $destination = self::kREORDER_SECTIONS;
			elseif($this->_context[0] == 'extensions') $destination = self::kREORDER_EXTENSION;

			$items = $_REQUEST['items'];

			if(!is_array($items) || empty($items)) return;

			switch($destination){
				case self::kREORDER_PAGES:
					foreach($items as $id => $position) {
						if(!PageManager::edit($id, array('sortorder' => $position))) {
							$this->_status = self::STATUS_ERROR;
							$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
							break;
						}

					}
					break;

				case self::kREORDER_SECTIONS:
					foreach($items as $id => $position) {
						if(!SectionManager::update($id, array('sortorder' => $position))) {
							$this->_status = self::STATUS_ERROR;
							$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
							break;
						}
					}
					break;

				case self::kREORDER_EXTENSION:
					// TODO
					break;

				case self::kREORDER_UNKNOWN:
				default:
					$this->_status = self::STATUS_BAD;
					break;

			}

		}

	}<commit_msg>Ensure PageManager and SectionManager classes are available for /ajax/reorder/. Fixes #976<commit_after><?php
	/**
	 * @package content
	 */
	/**
	 * The AjaxReorder page is used for reordering objects in the Symphony
	 * backend through Javascript. At the moment this is only supported for
	 * Pages and Sections.
	 */
	require_once(TOOLKIT . '/class.pagemanager.php');
	require_once(TOOLKIT . '/class.sectionmanager.php');

	Class contentAjaxReorder extends AjaxPage{

		const kREORDER_PAGES = 0;
		const kREORDER_SECTIONS = 1;
		const kREORDER_EXTENSION = 2;
		const kREORDER_UNKNOWN = 3;

		public function view(){
			$items = $_REQUEST['items'];

			if(!is_array($items) || empty($items)) return;

			$destination = self::kREORDER_UNKNOWN;
			if($this->_context[0] == 'blueprints' && $this->_context[1] == 'pages') $destination = self::kREORDER_PAGES;
			elseif($this->_context[0] == 'blueprints' && $this->_context[1] == 'sections') $destination = self::kREORDER_SECTIONS;
			elseif($this->_context[0] == 'extensions') $destination = self::kREORDER_EXTENSION;

			switch($destination){
				case self::kREORDER_PAGES:
					foreach($items as $id => $position) {
						if(!PageManager::edit($id, array('sortorder' => $position))) {
							$this->_status = self::STATUS_ERROR;
							$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
							break;
						}
					}
					break;

				case self::kREORDER_SECTIONS:
					foreach($items as $id => $position) {
						if(!SectionManager::edit($id, array('sortorder' => $position))) {
							$this->_status = self::STATUS_ERROR;
							$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
							break;
						}
					}
					break;

				case self::kREORDER_EXTENSION:
					// TODO
					break;

				case self::kREORDER_UNKNOWN:
				default:
					$this->_status = self::STATUS_BAD;
					break;

			}

		}

	}
{'fraction_non_alphanumeric': 0.14726775956284152, 'fraction_numerical': 0.005737704918032787, 'mean_word_length': 3.5253399258343636, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '7474292', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1128, 'n_words': 260}