Ejemplo n.º 1
0
 function switch_to_editor()
 {
     self::$session->frame();
     $e = new Editor($this->session);
     $e->wait_until_loaded();
     return $e;
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @group deep
  * @group ck
  * @group frame
  */
 public function number_of_paragraphs()
 {
     $e = new Editor($this->session);
     $e->open()->wait_until_loaded();
     $t = $e->switch_to_textarea();
     $this->assertEquals($t->how_many_paragraphs(), 6);
 }
Ejemplo n.º 3
0
 public function save_plus($data)
 {
     // event save
     $this->save($data);
     // editor save
     App::import('Model', 'Editor');
     $Editor = new Editor();
     $user = $this->_getCurrentUser();
     $relation['Editor']['account_id'] = $user['id'];
     $relation['Editor']['event_id'] = $this->getLastInsertID();
     return $Editor->save($relation);
 }
Ejemplo n.º 4
0
 /**
  * @return AbstractEditor
  */
 public function getEditor()
 {
     if ($this->isGuest) {
         return Editor::model()->findByPk(EDitor::DEFAULT_EDITOR_ID);
     }
     return $this->getUser()->company->editor;
 }
Ejemplo n.º 5
0
 /**
  * Constructor ContactForm
  * @param Page $page_object 
  * @param string $send_method 
  * @param string $table_style 
  */
 function __construct($page_object, $send_method, $table_style = '')
 {
     parent::__construct();
     if (!isset($page_object) || !isset($send_method)) {
         throw new NewException("2 arguments for " . get_class($this) . "::__construct() are mandatory", 0, getDebugBacktrace(1));
     }
     if (gettype($page_object) != "object" || !is_subclass_of($page_object, "Page")) {
         throw new NewException("Argument page_object for " . get_class($this) . "::__construct() error", 0, getDebugBacktrace(1));
     }
     $this->page_object = $page_object;
     $this->mail_to = SMTP_MAIL;
     $this->mail_to_name = SMTP_NAME;
     $table_main = new Table();
     $table_main->setClass($table_style);
     $form = new Form($this->page_object);
     $name = new TextBox($form, "contact_name");
     $name_validation = new LiveValidation();
     $name->setLiveValidation($name_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_NAME)));
     $table_main->addRowColumns(__(CONTACTFORM_NAME) . ": ", $name->setFocus())->setColumnWidth(2, "100%");
     $email = new TextBox($form, "contact_email");
     $email_validation = new LiveValidation();
     $email->setLiveValidation($email_validation->addValidateEmail()->addValidatePresence()->setFieldName(__(CONTACTFORM_EMAIL)));
     $table_main->addRowColumns(__(CONTACTFORM_EMAIL) . ": ", $email);
     $subject = new TextBox($form, "contact_subject");
     $subject_validation = new LiveValidation();
     $subject->setLiveValidation($subject_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_SUBJECT)));
     $table_main->addRowColumns(__(CONTACTFORM_SUBJECT) . ": ", $subject);
     $table_main->addRow();
     $editor = new Editor($form, "contact_message");
     $editor_validation = new LiveValidation();
     $editor->setLiveValidation($editor_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_MESSAGE)));
     $editor->setToolbar(Editor::TOOLBAR_SIMPLE);
     $table_main->addRow(new Object(__(CONTACTFORM_MESSAGE) . ": ", "<br/>", $editor))->setColspan(3)->setAlign(RowTable::ALIGN_LEFT);
     $table_main->addRow();
     $this->captcha = new Captcha($form, "contact_captcha");
     $table_main->addRow($this->captcha)->setColspan(3);
     $table_main->addRow();
     $this->send_button = new Button($form, "contact_send", "", __(CONTACTFORM_SEND));
     $this->send_button->assignEnterKey()->onClick($send_method)->setAjaxEvent();
     $table_main->addRow($this->send_button)->setColspan(3);
     $table_main->addRow();
     $form->setContent($table_main);
     $this->render = $form;
 }
 public function GenEditorData($a_attr)
 {
     $data = array();
     $data['ownerid'] = $a_attr['ownerid'];
     $data['type'] = "input_gallery";
     $data['name'] = $a_attr['name'];
     $data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
     $locdata = Locales::ReadData($a_attr['id']);
     $data['images'] = $locdata['images'];
     Editor::AddData(DATA_MODULE_DATA, $data);
 }
Ejemplo n.º 7
0
 public function store(HelpRequest $helpRequest, User $user)
 {
     $help = new Help();
     $help->fill($helpRequest->all());
     $help->content = $helpRequest->input(\Editor::input());
     $help->save();
     $log = new Log();
     $log->user_id = $user->id;
     $log->log = "新建帮助" . $help->id;
     $log->save();
     return redirect()->action('AdminController@getHelp');
 }
 function On_Editor_SaveModuleFragmentObject($a_data)
 {
     $object = $a_data->object;
     // Save
     if ($object['type'] == "iterator" && $object['childs']) {
         foreach ($object['childs'] as $childs) {
             Database::Query("INSERT INTO `" . DB_TBL_DATA . "` (`type`, `name`, `owner`, `moduleid`) VALUES ('itr', '" . $object['name'] . "', '" . $a_data->owner . "', '" . $a_data->moduleid . "')");
             $id = Database::GetLastIncrId();
             Editor::SaveModuleFragment($childs, -$id);
         }
     }
 }
 public function GenEditorData($a_attr)
 {
     $data = array();
     $data['ownerid'] = $a_attr['ownerid'];
     $data['type'] = "input_img";
     $data['name'] = $a_attr['name'];
     $data['width'] = $a_attr['width'];
     $data['height'] = $a_attr['height'];
     $unn = Locales::ReadData($a_attr['id']);
     $data['hash'] = $unn['hash'];
     $data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
     Editor::AddData(DATA_MODULE_DATA, $data);
 }
 public function GenEditorData($a_attr)
 {
     $data = array();
     $data['ownerid'] = $a_attr['ownerid'];
     $data['type'] = "input_string";
     $data['name'] = $a_attr['name'];
     $data['width'] = $a_attr['width'];
     $data['tooltip'] = Locales::getStringOrJSONLocale($a_attr['tooltip']);
     $data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
     $data['datepicker'] = isset($a_attr['datepicker']) ? true : false;
     $locdata = Locales::ReadData($a_attr['id']);
     $data['locales'] = $locdata['text'];
     Editor::AddData(DATA_MODULE_DATA, $data);
 }
Ejemplo n.º 11
0
 /**
  * Listener for 'bootstrap_loaded' hook.
  * Adds in required JS files for the editor to display
  *
  * @return array
  */
 public function hookBootstrapLoaded()
 {
     if ($this->loadEditor === true && Registry::has('theme')) {
         foreach (new DirectoryIterator($this->_zula->getDir('js') . '/tinymce/plugins') as $file) {
             if (substr($file, 0, 1) != '.' && $file->isDir()) {
                 $tinyMcePlugins[] = $file->getFileName();
             }
         }
         $tinyMcePlugins = implode(',', $tinyMcePlugins);
         $this->_theme->addHead('js', array(), 'var tcmEditor = {defaultFormat: "' . Editor::defaultFormat() . '", tinymcePlugins: "' . $tinyMcePlugins . '"};');
         $this->_theme->addJsFile('tinymce/jquery.tinymce.js');
         $this->_theme->addJsFile('js/init.js', true, 'editor');
     }
     return true;
 }
Ejemplo n.º 12
0
 private static function initCK()
 {
     include CORE_ROOT . 'class/Editor/Ckeditor.php';
     self::$oCKeditor = new CKEditor();
     self::$oCKeditor->returnOutput = true;
     // Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
     //   self::$oCKeditor->basePath = '/ckeditor/'
     // If not set, CKEditor will try to detect the correct path.
     self::$oCKeditor->basePath = BASE_PATH . 'js/ckeditor/';
     //		CKFinder::SetupCKEditor(self::$oCKeditor, BASE_PATH . 'js/ckfinder/');
     self::$oCKeditor->config['filebrowserBrowseUrl'] = BASE_PATH . 'admin/api/finder';
     // Set global configuration (will be used by all instances of CKEditor).
     //		self::$oCKeditor->config['width'] = 600;
     // Change default textarea attributes
     //		self::$oCKeditor->textareaAttributes = array("cols" => "*", "rows" => 10);
 }
 public function GenEditorData($a_attr)
 {
     $data = array();
     $data['ownerid'] = $a_attr['ownerid'];
     $data['type'] = "input_link";
     $data['name'] = $a_attr['name'];
     $data['tooltip_url'] = Locales::getStringOrJSONLocale($a_attr['tooltip_url']);
     $data['tooltip_title'] = Locales::getStringOrJSONLocale($a_attr['tooltip_title']);
     $data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
     $locdata = Locales::ReadData($a_attr['id']);
     $data['link_url'] = $locdata['link_url'];
     $data['link_title'] = $locdata['link_title'];
     /*foreach (Locales::$m_locales as $loc) {
           $link_data = Locales::ReadStringData($a_attr['id'], $loc);
           $data['link_url'] = $link_data['link_url'];               
           $data['link_title'][$loc] = $link_data['link_title'];               
       }*/
     Editor::AddData(DATA_MODULE_DATA, $data);
 }
Ejemplo n.º 14
0
 /**
  * @param $modelName
  */
 public function __construct($modelName = '', array $datas = [])
 {
     parent::__construct();
     $this->modelName = $modelName;
     $this->datas = $datas;
 }
Ejemplo n.º 15
0
 /**
  * Execute an upload
  * @param  Editor $editor Calling Editor instance
  * @return int Primary key value
  */
 public function exec($editor)
 {
     $id = null;
     $upload = $_FILES['upload'];
     // Validation - PHP standard validation
     if ($upload['error'] !== UPLOAD_ERR_OK) {
         if ($upload['error'] === UPLOAD_ERR_INI_SIZE) {
             $this->_error = "File exceeds maximum file upload size";
         } else {
             $this->_error = "There was an error uploading the file (" . $upload['error'] . ")";
         }
         return false;
     }
     // Validation - acceptable file extensions
     if (is_array($this->_extns)) {
         $extn = pathinfo($upload['name'], PATHINFO_EXTENSION);
         if (in_array(strtolower($extn), array_map('strtolower', $this->_extns)) === false) {
             $this->_error = $this->_extnError;
             return false;
         }
     }
     // Validation - custom callback
     for ($i = 0, $ien = count($this->_validators); $i < $ien; $i++) {
         $res = $this->_validators[$i]($upload);
         if (is_string($res)) {
             $this->_error = $res;
             return false;
         }
     }
     // Commit to the database
     if ($this->_dbTable) {
         $id = $this->_dbExec($editor->db());
     }
     // Perform file system actions
     return $this->_actionExec($id);
 }
Ejemplo n.º 16
0
function getRecordAsEditTableCells( IdStack $idPath, Editor $editor, Structure $visibleStructure, Record $record, &$startColumn = 0 ) {
	$result = '';
	$childEditorMap = $editor->getAttributeEditorMap();
	
	foreach ( $visibleStructure->getAttributes() as $visibleAttribute ) {
		$childEditor = $childEditorMap->getEditorForAttribute( $visibleAttribute );
		
		if ( $childEditor != null ) {
			$attribute = $childEditor->getAttribute();
			$type = $attribute->type;
			$value = $record->getAttributeValue( $attribute );
			$idPath->pushAttribute( $attribute );
				
			if ( $childEditor instanceof RecordTableCellEditor ) {
				$result .= getRecordAsEditTableCells( $idPath, $childEditor, $visibleAttribute->type, $value, $startColumn );
			} else {
				if ( $childEditor->showEditField( $idPath ) ) {
					$displayValue = $childEditor->edit( $idPath, $value );
				} else {
					$displayValue = "";
				}
				$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $displayValue . '</td>';
					
				$startColumn++;
			}
			
			$idPath->popAttribute();
		}
		else {
			$result .= "<td/>";
		}
	}
	return $result;
}
Ejemplo n.º 17
0
function ticket_row_editor()
{
    global $c, $id, $editor, $can_write_principal, $privilege_names;
    $ticketrow = new Editor("Tickets", "access_ticket");
    $ticketrow->SetSubmitName('ticketrow');
    if ($can_write_principal && $ticketrow->IsSubmit()) {
        $username = $editor->Value('username');
        $ugly_path = $_POST['target'];
        if ($ugly_path == '/' . $username || $ugly_path == '/' . $username . '/') {
            $target_collection = $id;
        } else {
            $username_len = strlen($username) + 2;
            $sql = "SELECT collection_id FROM collection WHERE dav_name = :exact_name";
            $sql .= " AND substring(dav_name FROM 1 FOR {$username_len}) = '/{$username}/'";
            $params = array(':exact_name' => $ugly_path);
            if (!preg_match('#/$#', $ugly_path)) {
                $sql .= " OR dav_name = :truncated_name OR dav_name = :trailing_slash_name";
                $params[':truncated_name'] = preg_replace('#[^/]*$#', '', $ugly_path);
                $params[':trailing_slash_name'] = $ugly_path . "/";
            }
            $sql .= " ORDER BY LENGTH(dav_name) DESC LIMIT 1";
            $qry = new AwlQuery($sql, $params);
            if ($qry->Exec() && $qry->rows() > 0) {
                $row = $qry->Fetch();
                $target_collection = $row->collection_id;
            } else {
                $c->messages[] = translate('Can only add tickets for existing collection paths which you own');
                return $ticketrow;
            }
        }
        $_POST['dav_owner_id'] = $id;
        $_POST['target_collection_id'] = $target_collection;
        $ticket_id = check_by_regex($_POST['ticket_id'], '/[A-Za-z0-9]+/');
        $ticketrow->SetWhere('dav_owner_id=' . $id . ' AND ticket_id=' . AwlQuery::quote($ticket_id));
        if (isset($_POST['ticket_privileges'])) {
            $privilege_bitpos = array_flip($privilege_names);
            $priv_names = array_keys($_POST['ticket_privileges']);
            $privs_dec = privilege_to_bits($priv_names);
            $_POST['privileges'] = sprintf('%024s', decbin($privs_dec));
            $ticketrow->Assign('privileges', $privs_dec);
        }
        $c->messages[] = translate('Creating new ticket granting privileges to this Principal');
        $ticketrow->Write();
    }
    return $ticketrow;
}
Ejemplo n.º 18
0
      )->width($this->Config('editor', 'width')
      )->height($height
      )->html(
    );
    $data = $v;
    ob_start();
    include($this->path_view('write.php'));
    $v['content'] = ob_get_contents();
    ob_end_clean();
  } else {
    $v['content'] = Widget::Inst()->Parse(
      $this->TBN(),
      'wr_no',
      $v['wr_no'],
      'wr_content',
      Editor::Inst('', $this->Config('editor', 'name'))->db_out($v['wr_content'])
    );
    if($v['wr_subject']) {
      if($v['wr_category']) $v['content'] = "<div class=\"{$v['wr_category']}\"></div>".$v['content'];
      $v['content'] = "<h2>{$v['wr_subject']}</h2>".$v['content'];
    }

    if(!$key && $mode!='write' && $this->Config('mb','admin') && Widget::Inst()->Config('is_page')) {
      $v['content'].= '<input class="order" type="hidden" name="order[]" value="'.$v['wr_no'].'"/>';
      $v['href_modify'] = $this->Link('modify', $v['wr_no']);
      $v['href_delete'] = $this->Link('delete', $v['wr_no']);
    }
  }
  $this->list[$k] = $v;
}
	protected function getVisibleStructureForEditor( Editor $editor, $showPropertyColumn, array &$suffixAttributes ) {
		$leadingAttributes = array();
		$childEditors = $editor->getEditors();
		
		for ( $i = $showPropertyColumn ? 0 : 1; $i < 2; $i++ ) {
			$leadingAttributes[] = $childEditors[$i]->getAttribute();
		}

		return new Structure( array_merge( $leadingAttributes, $suffixAttributes ) );
	}
Ejemplo n.º 20
0
 /**
  * Displays published articles for a given category (if any)
  *
  * @param string $category
  * @param bool $catSelector	Toggles the category selector
  * @return string
  */
 protected function displayArticles($category = false, $catSelector = true)
 {
     $this->setOutputType(self::_OT_CONTENT_INDEX);
     if (empty($category)) {
         $this->setTitle(t('Latest articles'));
         $categories = $this->_model()->getAllCategories();
         $cid = null;
     } else {
         /**
          * Attempt to get the single article category details, and check permission
          */
         try {
             $category = $this->_model()->getCategory($category, false);
             $this->setTitle($category['title']);
             $categories = array($category['id'] => $category);
             $cid = $category['id'];
             $resource = 'article-cat-' . $category['id'];
             if (!$this->_acl->resourceExists($resource) || !$this->_acl->check($resource)) {
                 throw new Module_NoPermission();
             }
         } catch (Article_CatNoExist $e) {
             throw new Module_ControllerNoExist();
         }
     }
     /**
      * Check how many to display per page, and what page we are on
      */
     try {
         $perPage = abs($this->_config->get('article/per_page'));
     } catch (Input_KeyNoExist $e) {
         $perPage = 12;
     }
     if ($this->inSector('SC') && $this->_input->has('get', 'page')) {
         $curPage = abs($this->_input->get('page') - 1);
     } else {
         $curPage = 0;
     }
     // Get the required articles and parse their first article part body
     $maxDisplayAge = $this->_config->get('article/max_display_age');
     $articles = array();
     foreach ($this->_model()->getAllArticles($perPage, $curPage * $perPage, $cid, false, $maxDisplayAge) as $tmpArticle) {
         if (isset($categories[$tmpArticle['cat_id']])) {
             $parts = $this->_model()->getArticleParts($tmpArticle['id']);
             $firstPart = current($parts);
             $editor = new Editor($firstPart['body']);
             $editor->setContentUrl($this->_router->makeUrl('article', 'view', $tmpArticle['identifier']));
             $tmpArticle['body'] = $editor->parse(true);
             $tmpArticle['category_title'] = $categories[$tmpArticle['cat_id']]['title'];
             $tmpArticle['category_identifier'] = $categories[$tmpArticle['cat_id']]['identifier'];
             $articles[] = $tmpArticle;
         }
     }
     $articleCount = $this->_model()->getCount();
     if ($articleCount > 0) {
         $pagination = new Pagination($articleCount, $perPage);
     }
     // Build up the view
     $view = $this->loadView('index/latest.html');
     $view->assign(array('META_FORMAT' => $this->getMetaFormat($this->_config->get('article/meta_format')), 'CAT_DETAILS' => $cid ? $category : null));
     $view->assignHtml(array('ARTICLES' => $articles, 'PAGINATION' => isset($pagination) ? $pagination->build() : null));
     if ($cid == false && $catSelector) {
         /** Prepend the category selector */
         $catSelectorView = $this->loadView('index/category_selector.html');
         $catSelectorView->assign(array('CATEGORIES' => $categories));
         return $catSelectorView->getOutput() . $view->getOutput(true);
     } else {
         return $view->getOutput(true);
     }
 }
Ejemplo n.º 21
0
echo TB_Form::label(__('publications.page_text_preview'));
?>
				<div class="col-sm-10">
					<?php 
echo Editor::CK('text_short', $obj->text_short, ['class' => 'form-control', 'rows' => 6], 'preview');
?>
				</div>
			</div>

			<div class="form-group">
				<?php 
echo TB_Form::label(__('publications.page_text'));
?>
				<div class="col-sm-10">
					<?php 
echo Editor::CK('text', $obj->text, ['class' => 'form-control', 'rows' => 6]);
?>
				</div>
			</div>

			<div class="form-group">
				<?php 
echo TB_Form::label(__('publications.page_date'));
?>
				<div class="col-sm-10">
					<?php 
echo Form::input('date', $obj->date ? $obj->date : date('Y-m-d'), ['class' => 'form-control']);
?>
				</div>
			</div>
Ejemplo n.º 22
0
<?php if(!defined("__MAGIC__")) exit; 

// 게시판 설정
$this->config = Board::Inst()->bo_no($this->bo_no);
// 현재위치 출력 모듈
$this->breadcrumb = PageElement::Inst('breadcrumb')->html();
// 에디터
$this->editor = Editor::Inst('wr_content', $this->config->bo_editor)->html();
// 파일관련 모듈 
$this->file = File::Inst()->wr_no($key)->Protection();
// 업데이트 주소
$this->action = $this->Link('insert');
// 목록으로 가기 주소
$this->link_list = $this->Link('list');

Ejemplo n.º 23
0
echo Form::open(null, ['class' => 'form-horizontal']);
?>

	<div class="tab-content">
		<div class="tab-pane fade in active" id="home">

			<div class="form-group<?php 
echo Form::has_error('text', $errors);
?>
">
				<?php 
echo TB_Form::label(__('home.page_text'));
?>
				<div class="col-sm-10">
					<?php 
echo Editor::CK('text', $data['text'], ['class' => 'form-control', 'rows' => 6]);
echo Form::error('text', $errors);
?>
				</div>
			</div>

		</div>
		<div class="tab-pane fade" id="seo">

			<?php 
echo View::factory('backend/v_seo', ['t' => [$data['meta_t'], __('home.meta_t_h'), true], 'd' => [$data['meta_d'], __('home.meta_d_h'), true], 'k' => [$data['meta_k'], __('home.meta_k_h'), true]])->bind('errors', $errors);
?>

		</div>
	</div>
Ejemplo n.º 24
0
 /**
  * Method prepareFieldsArray
  * @access public
  * @param mixed $properties [default value: array(]
  * @return mixed
  * @since 1.2.1
  */
 public function prepareFieldsArray($properties = array())
 {
     $this->fields_array = array();
     $list_attribute = $this->database_object->getDbTableAttributes();
     $list_attribute_type = $this->database_object->getDbTableAttributesType();
     $auto_increment_id = $this->database_object->getDbTableAutoIncrement();
     // Add properties to apply on all fields
     if (isset($properties[ModelViewMapper::PROPERTIES_ALL]) && is_array($properties[ModelViewMapper::PROPERTIES_ALL])) {
         $apply_all_array = $properties[ModelViewMapper::PROPERTIES_ALL];
         foreach ($apply_all_array as $property_name => $property_value) {
             for ($i = 0; $i < sizeof($list_attribute); $i++) {
                 $property[$property_name] = $property_value;
                 if (isset($properties[$list_attribute[$i]])) {
                     // Handle child override of global property
                     if (!isset($properties[$list_attribute[$i]][$property_name])) {
                         $properties[$list_attribute[$i]] = array_merge($properties[$list_attribute[$i]], $property);
                     }
                 } else {
                     $properties[$list_attribute[$i]] = $property;
                 }
             }
         }
     }
     // check foreign keys
     $db_table_foreign_keys = $this->database_object->getDbTableForeignKeys();
     foreach ($db_table_foreign_keys as $fk_attribute => $value) {
         if (isset($properties[$fk_attribute])) {
             $fk_property = $properties[$fk_attribute];
             if (isset($fk_property["fk_attribute"])) {
                 // create combobox
                 $cmb = new ComboBox($this->form_or_page);
                 // get foreign key data
                 $query = "select distinct " . $value["column"] . " as id, " . $fk_property["fk_attribute"] . " as value from " . $value["table"];
                 if (isset($fk_property["fk_where"])) {
                     $query .= " where " . $fk_property["fk_where"];
                 }
                 if (isset($fk_property["fk_orderby"])) {
                     $query .= " order by " . $fk_property["fk_orderby"];
                 }
                 $stmt = DataBase::getInstance()->prepareStatement($query);
                 $row = DataBase::getInstance()->stmtBindAssoc($stmt, $row);
                 while ($stmt->fetch()) {
                     $cmb->addItem(utf8encode($row['id']), utf8encode($row['value']));
                 }
                 // add combo box in properties
                 $value['cmb_obj'] = $cmb;
                 $properties[$fk_attribute] = array_merge($properties[$fk_attribute], $value);
             }
         }
     }
     foreach ($list_attribute as $i => $attribute) {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($properties[$attribute])) {
             $attribute_properties = $properties[$attribute];
         }
         if (isset($attribute_properties["display"]) && $attribute_properties["display"] == false) {
             continue;
         }
         $is_update_ok = true;
         if (isset($attribute_properties["update"]) && $attribute_properties["update"] == false) {
             $is_update_ok = false;
         }
         $method = "get" . $this->getFormatValue($attribute);
         $value = call_user_func_array(array($this->database_model_object, $method), array());
         if ($attribute != $auto_increment_id && $is_update_ok) {
             // get property cmb_obj
             if (isset($attribute_properties['cmb_obj'])) {
                 $field = $attribute_properties['cmb_obj'];
             } else {
                 if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
                     $wspobject = $attribute_properties["wspobject"];
                 } else {
                     if ($list_attribute_type[$i] == "datetime") {
                         $wspobject = "Calendar";
                     } else {
                         if ($list_attribute_type[$i] == "boolean") {
                             $wspobject = "CheckBox";
                         }
                     }
                 }
                 if ($wspobject == "Calendar") {
                     $field = new Calendar($this->form_or_page);
                 } else {
                     if ($wspobject == "CheckBox") {
                         $field = new CheckBox($this->form_or_page);
                     } else {
                         if ($wspobject == "TextArea") {
                             $field = new TextArea($this->form_or_page);
                         } else {
                             if ($wspobject == "Editor") {
                                 $field = new Editor($this->form_or_page);
                                 if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                                     $field->setToolbar($attribute_properties["editor_param"]);
                                 }
                             } else {
                                 if ($wspobject == "ComboBox") {
                                     $field = new ComboBox($this->form_or_page);
                                     if (isset($attribute_properties["combobox_values"])) {
                                         if (is_array($attribute_properties["combobox_values"])) {
                                             for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                                 $field->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                             }
                                         } else {
                                             throw new NewException(get_class($this) . "->prepareFieldsArray() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                         }
                                     }
                                 } else {
                                     $field = new TextBox($this->form_or_page);
                                     if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                         $field->setWidth(70);
                                     }
                                     if (in_array($attribute, $key_attributes)) {
                                         $lv = new LiveValidation();
                                         $field->setLiveValidation($lv->addValidatePresence());
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // Handle Checkbox case that only support value as "on" or "off"
             if (get_class($field) == "CheckBox") {
                 if ($value == "1") {
                     $field->setValue("on");
                 } else {
                     $field->setValue("off");
                 }
             } else {
                 if (get_class($field) == "Calendar") {
                     $field->setValue($value);
                 } else {
                     $field->setValue(utf8encode($value));
                 }
             }
             if (isset($attribute_properties["width"]) && method_exists($field, "setWidth")) {
                 $field->setWidth($attribute_properties["width"]);
             }
             if (isset($attribute_properties["height"]) && method_exists($field, "setHeight")) {
                 $field->setHeight($attribute_properties["height"]);
             }
             if (isset($attribute_properties["class"]) && method_exists($field, "setClass")) {
                 $field->setClass($attribute_properties["class"]);
             }
             if (isset($attribute_properties["style"]) && method_exists($field, "setStyle")) {
                 $field->setStyle($attribute_properties["style"]);
             }
             if (isset($attribute_properties["disable"])) {
                 if ($attribute_properties["disable"] == true && method_exists($field, "disable")) {
                     $field->disable();
                 } else {
                     if ($attribute_properties["disable"] == false && method_exists($field, "enable")) {
                         $field->enable();
                     }
                 }
             }
             if (get_class($field) != "Calendar") {
                 if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($field, "setStripTags")) {
                     if (isset($attribute_properties["allowable_tags"])) {
                         $field->setStripTags($attribute_properties["allowable_tags"]);
                     } else {
                         $field->setStripTags("");
                         // no tag allowed
                     }
                 }
             }
         } else {
             if (isset($attribute_properties['cmb_obj'])) {
                 $field_tmp = $attribute_properties['cmb_obj'];
                 $field_tmp->setValue($value);
                 $value = $field_tmp->getText();
             }
             if (get_class($value) == "DateTime") {
                 $value = $value->format("Y-m-d");
             }
             $field = new Object(utf8encode($value));
         }
         $this->fields_array[$attribute] = $field;
     }
     return $this->fields_array;
 }
Ejemplo n.º 25
0
<?php if(!defined("__MAGIC__")) exit; 

$tbn = $this->TBN();
$key = GV::Number($this->KN());
$board = Board::Inst()->bo_no($this->bo_no);
$bo_no = $board->bo_no;

$clear = $this->Clear();
$clear['wr_content'] = Editor::Inst('',$board->bo_editor)->db_in($_POST['wr_content']);

$clear['wr_state'] = 0;
if($_POST['opt_notice']) {
	$clear['wr_state'] = $clear['wr_state']|$this->Config('state', 'notice');
}
if($_POST['opt_secret']) {
	$clear['wr_state'] = $clear['wr_state']|$this->Config('state', 'secret');
}

// 비회원일 경우에 비밀번호 검사를 함
if(!$this->Config('mb','login')) {
	$clear['mb_no'] = 0;
	if($clear['wr_password']!=$_POST['wr_password_check'])
		Dialog::alert('[비밀번호/비밀번호확인]이 일치하지 않습니다.');
	if(!$clear['wr_password'])
		Dialog::alert('비밀번호를 입력해 주세요.');
	$clear['wr_password'] = $this->Sql('password', $clear['wr_password']);
} else {
	$clear['wr_writer'] = Member::Inst()->mb_nick;
}

// 최근게시글을 위해 게시글이 출력되는 아이디를 저장함
 public function Build()
 {
     // Get container type and define string
     $type = $this->m_container->getAttribute("type");
     $name = $this->m_container->getAttribute("name");
     $title = $this->m_container->getAttribute("title");
     $slots = $this->m_container->getAttribute("slots");
     // wrapepr for js
     if (Compiler::$Mode == COMPILER_MODE_EDITOR) {
         $this->m_container->addChild(new Template_TextNode('<div class="editor-container editor-container-' . $type . '" id="editor-container-' . $name . '" data-type="' . $type . '">'));
     }
     for ($slot = 0; $slot < $slots; $slot++) {
         // Load module in slot
         $result = Database::Query("SELECT * FROM `" . DB_TBL_MODULE . "` WHERE `container` = '" . $name . "' AND `pageid` = '" . $this->m_pageid . "' AND `slot` = '" . $slot . "'");
         if ($result->HasData()) {
             $row = $result->GetRow();
             // Build Module
             $module = new Module($row['id']);
             $module_tmpl = $module->Build();
             // insert after iterator
             $this->m_container->addChild($module_tmpl);
         }
         /*else { // Place holder
               // Create DOM object
               $doc = new DOMDocument();
               // Load template
               if (Compiler::$Mode == COMPILER_MODE_FRONTEND)
                   $doc->load(COMPILER_TEMPLATES_DIR . '/modules/' . $type . '/placeholder.tmpl');
               else
                   $doc->load(COMPILER_TEMPLATES_DIR . '/modules/' . $type . '/placeholder-editor.tmpl');
               
               $container_html .= $doc->saveHTML();
           }*/
     }
     if (Compiler::$Mode == COMPILER_MODE_EDITOR) {
         // Add container wrapper for js
         $this->m_container->addChild(new Template_TextNode('</div>'));
         // Add data
         $data = array();
         $data['name'] = $name;
         $data['title'] = Locales::getStringOrJSONLocale($title);
         $data['type'] = $type;
         $data['slots'] = $slots;
         Editor::AddData(DATA_CONTAINER, $data);
     }
     //$this->m_container->remove();
 }
Ejemplo n.º 27
0
                                   <img src="img/updates.png" alt="">
                              </a>
                         </li>
                    </ul>
               </div>
               
          </header>
          
          <section id="main" role="main">
               
               <!-- Left Sidebar -->
               <aside id="leftbar" class="pull-left">
                    <div class="sidebar-container">
                         <?php 
//Main Menu bar
Editor::navbar(array('index', 'typo', 'socialwall', 'widget', 'table', 'form', 'UI', 'chart', 'photo', 'sample'), 'ui-open-other');
?>
                    </div>
                    <span id="leftbar-toggle" class="visible-xs sidebar-toggle">
                         <i class="fa fa-angle-right"></i>
                    </span>
               </aside>
               
            <!-- Right Sidebar -->
            <aside id="rightbar" class="pull-right">
                <div class="sidebar-container">
                    
                    <!-- Profile -->
                    <div class="shadowed side-profile text-center">
                         <div class="banner">
                              <img src="img/profile-bg.jpg" alt="" class="banner-img">
Ejemplo n.º 28
0
 /**
  * FormHandler::editor()
  *
  * Create a editor on the form
  *
  * @param string $title: The title of the field
  * @param string $name: The name of the field
  * @param string $validator: The validator which should be used to validate the value of the field
  * @param string $path: Path on the server where we have to upload the files
  * @param string $toolbar: The toolbar we have to use
  * @param string $skin: The skin to use
  * @param int $width: The width of the field
  * @param int $height: The height of the field
  * @param boolean $useArrayKeyAsValue: If the array key's are the values for the options in the field
  * @param string $extra: CSS, Javascript or other which are inserted into the HTML tag
  * @return void
  * @access public
  * @author Teye Heimans
  */
 function editor($title, $name, $validator = null, $path = null, $toolbar = null, $skin = null, $width = null, $height = null, $config = null)
 {
     require_once FH_INCLUDE_DIR . 'fields/class.TextArea.php';
     require_once FH_INCLUDE_DIR . 'fields/class.Editor.php';
     // create a new editor
     $fld = new Editor($this, $name);
     if (!empty($validator)) {
         $fld->setValidator($validator);
     }
     if (!is_null($path)) {
         $fld->setServerPath($path);
     }
     if (!empty($toolbar)) {
         $fld->setToolbar($toolbar);
     }
     if (!empty($skin)) {
         $fld->setSkin($skin);
     }
     if (!empty($width)) {
         $fld->setWidth($width);
     }
     if (!empty($height)) {
         $fld->setHeight($height);
     }
     if (is_array($config)) {
         $fld->setConfig($config);
     }
     // register the field
     $this->_registerField($name, $fld, $title);
 }
Ejemplo n.º 29
0
 /**
  * function to return Json response for all Palette/Editor elements
  *
  * @since	 2.0.0
  *
  * @return	JSON data   
  *
  * @param	  Post data [action],[category] 
  */
 public function get_pallete_elements()
 {
     if (isset($_POST['category']) && $_POST['category'] == 'Palette') {
         //if pallete required
         try {
             header("Content-Type: application/json");
             $palette = new Palette();
             $elements = $palette->to_JSON();
             echo $elements;
         } catch (Exception $e) {
             echo '{"error":{"text":' . $e->getMessage() . '}}';
         }
     } else {
         //if editor elements required
         try {
             header("Content-Type: application/json");
             $instance = $_POST['instance'];
             $editor = new Editor($instance);
             $elements = $editor->to_JSON();
             echo $elements;
         } catch (Exception $e) {
             echo '{"error":{"text":' . $e->getMessage() . '}}';
         }
     }
     exit;
 }
Ejemplo n.º 30
0
<?php if(!defined('__MAGIC__')) exit;
$v = $this->Sql('fetch', $this->wr_no);
$editor = Editor::Inst('wr_content',$this->Config('editor', 'name')
	)->db_edit($v['wr_content']
	)->width($this->Config('editor', 'width')
	)->height($this->Config('editor', 'height')
	)->html(
);
?>
<form method="post" class="page" action="<?php echo $this->Link('update')?>">
<input type="hidden" name="wr_no" value="<?php echo $v['wr_no']?>"/>
<input type="hidden" name="wr_writer" value="페이지"/>
  <div><?php echo $editor?></div>

  <div class="center">
    <input type="image" class="adjust_button_line" src="<?php echo $this->path_img('btn_modify.gif')?>" value="수정"/>
    <a href="<?php echo $this->Link('list')?>"><img src="<?php echo $this->path_img('btn_cancel.gif')?>" alt="취소"/></a>
  </div>

</form>