public function get_edit_element($page_id, $element_id)
 {
     //LOAD JS LIBS
     Asset::container('footer')->add('form', 'bundles/cms/js/jquery.form.js', 'jquery');
     Asset::container('footer')->add('count', 'bundles/cms/js/jquery.charcount.js', 'jquery');
     Asset::container('footer')->add('slug', 'bundles/cms/js/jquery.stringtoslug.js', 'jquery');
     //CKEDITOR
     if (IS('cms::settings.wysiwyg', 'ckeditor')) {
         Asset::container('footer')->add('ckeditor', 'bundles/cms/ckeditor/ckeditor.js', 'form');
         Asset::container('footer')->add('jqadapter', 'bundles/cms/ckeditor/adapters/jquery.js', 'form');
         Asset::container('footer')->add('ckcms', 'bundles/cms/js/ck.cms.js', 'jqadapter');
     }
     //MARKITUP
     if (IS('cms::settings.wysiwyg', 'markitup')) {
         Asset::container('footer')->add('markitup', 'bundles/cms/markitup/jquery.markitup.js', 'form');
         Asset::container('footer')->add('sethtml', 'bundles/cms/markitup/sets/html/set.js', 'markitup');
         Asset::container('footer')->add('ckcms', 'bundles/cms/js/ck.cms.js', 'jqadapter');
         Asset::container('header')->add('csshtml', 'bundles/cms/markitup/sets/html/style.css');
         Asset::container('header')->add('cssmarkitup', 'bundles/cms/markitup/skins/markitup/style.css');
     }
     //PLUPLOAD
     Asset::container('footer')->add('plupload', 'bundles/cms/js/plupload.js', 'jquery');
     Asset::container('footer')->add('plupload_html4', 'bundles/cms/js/plupload.html4.js', 'plupload');
     Asset::container('footer')->add('plupload_html5', 'bundles/cms/js/plupload.html5.js', 'plupload');
     //LOAD FANCYBOX LIBS
     Asset::container('header')->add('fancyboxcss', 'bundles/cms/css/fancybox.css', 'main');
     Asset::container('footer')->add('fancybox', 'bundles/cms/js/jquery.fancybox.js', 'jquery');
     //SORTING
     Asset::container('footer')->add('sortable', 'bundles/cms/js/jquery.sortable.js', 'jquery');
     Asset::container('footer')->add('serialize', 'bundles/cms/js/jquery.serializetree.js', 'sortable');
     Asset::container('footer')->add('elements', 'bundles/cms/js/sections/elements_edit.js', 'cms');
     $this->layout->header_data = array('title' => LL('cms::title.element_edit', CMSLANG));
     $this->layout->top_data = array('search' => false);
     if (!empty($element_id)) {
         //GET ELEMENT DATA
         $element = CmsElement::find($element_id);
         if (!empty($element)) {
             //GET PAGE DATA
             $page = CmsPage::find($page_id);
             //GET ELEMENTS DATA
             $elements = $page->elements;
             //GET FILE DATA
             $files = $page->files;
             // LOAD LAYOUT PREVIEW
             $preview_layout = CmsPage::preview_layout_create($page->layout);
             $this->layout->content = View::make('cms::interface.pages.element_new_edit')->with('role_fail', CmsRole::role_fail($page_id))->with('title', LL('cms::title.element_edit', CMSLANG))->with('page_id', $page_id)->with('element_id', $element_id)->with('element_name', $element->name)->with('element_label', $element->label)->with('element_text', $element->text)->with('element_zones', CmsElement::select_zone($page_id))->with('element_zone_selected', $element->zone)->with('element_is_valid', (bool) $element->is_valid)->with('elements', $elements)->with('media', $files)->with('page_header_selected', $page->header)->with('page_footer_selected', $page->footer)->with('page_layout_preview', $preview_layout);
         } else {
             $this->layout->content = View::make('cms::interface.pages.not_found')->with('message', LL('cms::alert.not_found', CMSLANG));
         }
     } else {
         $this->layout->content = View::make('cms::interface.pages.not_found')->with('message', LL('cms::alert.not_found', CMSLANG));
     }
 }
 public function post_preview_layout()
 {
     if (Input::has('layout')) {
         $layout = Input::get('layout');
         return CmsPage::preview_layout_create($layout);
     }
 }