<commit_before><?php
    /**
     * @class  layoutView
     * @author NHN (<EMAIL>)
     * admin view class of the layout module
     **/

    class layoutView extends layout {

        /**
         * Initialization
		 * @return void
         **/
        function init() {
            $this->setTemplatePath($this->module_path.'tpl');
        }

        /**
         * Pop-up layout details(conf/info.xml)
		 * @return void
         **/
        function dispLayoutInfo() {
            // Get the layout information
            $oLayoutModel = &getModel('layout');
            $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
            if(!$layout_info) exit();
            Context::set('layout_info', $layout_info);
            // Set the layout to be pop-up
            $this->setLayoutFile('popup_layout');
            // Set a template file
            $this->setTemplateFile('layout_detail_info');
        }


		/**
		 * Preview a layout with module.
		 * 
		 * @return Object
		 **/
		public function dispLayoutPreviewWithModule()
		{
			// admin check
			// this act is admin view but in normal view because do not load admin css/js files
			$logged_info = Context::get('logged_info');
			if($logged_info->is_admin != 'Y')
			{
				return $this->stop('msg_invalid_request');
			}

			$layoutSrl = Context::get('layout_srl');
			$moduleSrl = Context::get('module_srl');
			$module = Context::get('module');
			$mid = Context::get('mid');
			$skin = Context::get('skin');
			$skinVars = Context::get('skin_vars');
			$skinVars = json_decode($skinVars);

			// Get the layout information.
			if(!$mid && !$moduleSrl)
			{
				return new Object(-1, 'msg_invalid_request');
			}

			if($layoutSrl)
			{
				$oLayoutModel = getModel('layout');
				$layoutInfo = $oLayoutModel->getLayout($layoutSrl);

				if(!$layoutInfo) 
				{
					return new Object(-1, 'msg_invalid_request');
				}

				// Set names and values of extra_vars to $layout_info
				if($layoutInfo->extra_var_count) 
				{
					foreach($layoutInfo->extra_var as $var_id => $val) 
					{
						$layoutInfo->{$var_id} = $val->value;
					}
				}

				// menu in layout information becomes an argument for Context:: set
				if($layoutInfo->menu_count) 
				{
					foreach($layoutInfo->menu as $menu_id => $menu) 
					{
						if(file_exists($menu->php_file)) @include($menu->php_file);
						Context::set($menu_id, $menu);
					}
				}

				Context::set('layout_info', $layoutInfo);
			}

			// Get the module information.
			$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
			$oModuleHandler->act = '';<commit_msg>issue 2367 update preview  when change the layout setting.<commit_after><?php
    /**
     * @class  layoutView
     * @author NHN (<EMAIL>)
     * admin view class of the layout module
     **/

    class layoutView extends layout {

        /**
         * Initialization
		 * @return void
         **/
        function init() {
            $this->setTemplatePath($this->module_path.'tpl');
        }

        /**
         * Pop-up layout details(conf/info.xml)
		 * @return void
         **/
        function dispLayoutInfo() {
            // Get the layout information
            $oLayoutModel = &getModel('layout');
            $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
            if(!$layout_info) exit();
            Context::set('layout_info', $layout_info);
            // Set the layout to be pop-up
            $this->setLayoutFile('popup_layout');
            // Set a template file
            $this->setTemplateFile('layout_detail_info');
        }


		/**
		 * Preview a layout with module.
		 * 
		 * @return Object
		 **/
		public function dispLayoutPreviewWithModule()
		{
			// admin check
			// this act is admin view but in normal view because do not load admin css/js files
			$logged_info = Context::get('logged_info');
			if($logged_info->is_admin != 'Y')
			{
				return $this->stop('msg_invalid_request');
			}

			$layoutSrl = Context::get('layout_srl');
			$layoutVars = Context::get('layout_vars');
			$layoutVars = json_decode($layoutVars);

			$moduleSrl = Context::get('module_srl');
			$module = Context::get('module');
			$mid = Context::get('mid');
			$skin = Context::get('skin');
			$skinVars = Context::get('skin_vars');
			$skinVars = json_decode($skinVars);

			// Get the layout information.
			if(!$mid && !$moduleSrl)
			{
				return new Object(-1, 'msg_invalid_request');
			}

			if($layoutSrl)
			{
				$oLayoutModel = getModel('layout');
				$layoutInfo = $oLayoutModel->getLayout($layoutSrl);

				if(!$layoutInfo) 
				{
					return new Object(-1, 'msg_invalid_request');
				}

				// Set names and values of extra_vars to $layout_info
				if($layoutInfo->extra_var_count) 
				{
					foreach($layoutInfo->extra_var as $var_id => $val) 
					{
						$layoutInfo->{$var_id} = $val->value;
					}
				}

				if($layoutVars)
				{
					foreach($layoutVars as $key => $val) 
					{
						$layoutInfo->{$key} = $val;
					}
				}

				// menu in layout information becomes an argument for Context:: set
				if($layoutInfo->menu_count) 
				{
					foreach($layoutInfo->menu as $menu_id => $menu) 
					{
						if(file_exists($menu->php_file)) @include($menu->php_file);
						Context::set($menu_id, $menu);
					}
				}

				Context::set('layout_info', $layoutInfo);
			}

			// Get the module information.
			$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
			$oModuleHandler->act = '';
{'fraction_non_alphanumeric': 0.15076923076923077, 'fraction_numerical': 0.0014479638009049773, 'mean_word_length': 2.495256166982922, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '337839', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1698, 'n_words': 355}