From abe7b76c98b75097932a0f3afff584ee1ab165de Mon Sep 17 00:00:00 2001 From: chschy Date: Wed, 7 Sep 2011 08:45:00 +0000 Subject: [PATCH] Add admin editor page (not complated lang file) git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9084 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/conf/module.xml | 13 +- modules/editor/editor.admin.controller.php | 175 +++++++-------- modules/editor/editor.admin.view.php | 49 ++++- modules/editor/editor.model.php | 33 ++- modules/editor/editor.view.php | 51 ++++- modules/editor/lang/lang.xml | 69 +++--- .../editor/ruleset/componentOrderAndUse.xml | 7 + modules/editor/ruleset/generalConfig.xml | 9 + modules/editor/skins/dreditor/editor.html | 2 +- modules/editor/skins/xpresseditor/editor.html | 2 +- modules/editor/tpl/admin_index.html | 206 ++++++++++++++---- modules/editor/tpl/config_preview.html | 18 ++ modules/editor/tpl/js/editor_admin.js | 30 +-- modules/editor/tpl/js/editor_module_config.js | 61 +++--- 14 files changed, 469 insertions(+), 256 deletions(-) create mode 100644 modules/editor/ruleset/componentOrderAndUse.xml create mode 100644 modules/editor/ruleset/generalConfig.xml create mode 100644 modules/editor/tpl/config_preview.html diff --git a/modules/editor/conf/module.xml b/modules/editor/conf/module.xml index 46fb6c83a..a616467de 100644 --- a/modules/editor/conf/module.xml +++ b/modules/editor/conf/module.xml @@ -6,22 +6,21 @@ - + + - - - - - - + + + + diff --git a/modules/editor/editor.admin.controller.php b/modules/editor/editor.admin.controller.php index 66ca52641..f0f906958 100644 --- a/modules/editor/editor.admin.controller.php +++ b/modules/editor/editor.admin.controller.php @@ -12,99 +12,69 @@ **/ function init() { } - - /** - * @brief Activate components - **/ - function procEditorAdminEnableComponent() { - $site_module_info = Context::get('site_module_info'); - - $args->component_name = Context::get('component_name'); - $args->enabled = 'Y'; - $args->site_srl = (int)$site_module_info->site_srl; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args); - else $output = executeQuery('editor.updateSiteComponent', $args); - if(!$output->toBool()) return $output; - - $oEditorController = &getController('editor'); + + /** + * @brief 컴포넌트 사용설정, 목록 순서 변경 + **/ + function procEditorAdminCheckUseListOrder(){ + $enables = Context::get('enables'); + $component_names = Context::get('component_names'); + $unables = array_diff($component_names, $enables); + + + $output = $this->editorCheckUse($enables,$unables); + if(!$output->toBool()) return new Object(); + + $output = $this->editorListOrder($component_names); + if(!$output->toBool()) return new Object(); + + $oEditorController = &getController('editor'); $oEditorController->removeCache($args->site_srl); - - $this->setMessage('success_updated'); - } - - /** - * @brief Deactivate components + $this->setRedirectUrl(Context::get('error_return_url')); + } + + /** + * @brief check use component + **/ + function editorCheckUse($enables,$unables){ + if(is_array($enables)){ + $args->enabled = 'Y'; + foreach($enables as $component_name){ + $args->component_name = $component_name; + $output = executeQuery('editor.updateComponent', $args); + } + } + if(!$output->toBool()) return new Object(); + + if(is_array($unables)){ + $args->enabled = 'N'; + foreach($unables as $component_name){ + $args->component_name = $component_name; + $output = executeQuery('editor.updateComponent', $args); + } + } + if(!$output->toBool()) return new Object(); + unset($args->enabled); + return $output; + } + + /** + * @brief list order componet **/ - function procEditorAdminDisableComponent() { - $site_module_info = Context::get('site_module_info'); - - $args->component_name = Context::get('component_name'); - $args->enabled = 'N'; - $args->site_srl = (int)$site_module_info->site_srl; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args); - else $output = executeQuery('editor.updateSiteComponent', $args); - if(!$output->toBool()) return $output; - - $oEditorController = &getController('editor'); - $oEditorController->removeCache($args->site_srl); - - $this->setMessage('success_updated'); - } - - /** - * @brief Change a location of the component - **/ - function procEditorAdminMoveListOrder() { - $site_module_info = Context::get('site_module_info'); - $args->site_srl = (int)$site_module_info->site_srl; - $args->component_name = Context::get('component_name'); - $mode = Context::get('mode'); - // Get a full list of components from the DB - if(!$args->site_srl) $output = executeQuery('editor.getComponentList', $args); - else $output = executeQuery('editor.getSiteComponentList', $args); - - $db_list = $output->data; - foreach($db_list as $key => $val) { - if($val->component_name == $args->component_name) break; - } - - if($mode=="up") { - if($key == 2) return new Object(-1,'msg_component_is_first_order'); - - $prev_args->component_name = $db_list[$key-1]->component_name; - $prev_args->list_order = $db_list[$key]->list_order; - $prev_args->site_srl = $args->site_srl; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $prev_args); - else $output = executeQuery('editor.updateSiteComponent', $prev_args); - - $cur_args->component_name = $db_list[$key]->component_name; - $cur_args->list_order = $db_list[$key-1]->list_order; - if($prev_args->list_order == $cur_args->list_order) $cur_args->list_order--; - $cur_args->site_srl = $args->site_srl; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $cur_args); - else $output = executeQuery('editor.updateSiteComponent', $cur_args); - } else { - if($key == count($db_list)-1) return new Object(-1,'msg_component_is_last_order'); - - $next_args->component_name = $db_list[$key+1]->component_name; - $next_args->list_order = $db_list[$key]->list_order; - $next_args->site_srl = $args->site_srl; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $next_args); - else $output = executeQuery('editor.updateSiteComponent', $next_args); - - $cur_args->component_name = $db_list[$key]->component_name; - $cur_args->list_order = $db_list[$key+1]->list_order; - $cur_args->site_srl = $args->site_srl; - if($next_args->list_order == $cur_args->list_order) $cur_args->list_order++; - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $cur_args); - else $output = executeQuery('editor.updateSiteComponent', $cur_args); - } - - $oEditorController = &getController('editor'); - $oEditorController->removeCache($args->site_srl); - - $this->setMessage('success_updated'); - } + function editorListOrder($component_names){ + $list_order_num = '30'; + if(is_array($component_names)) { + foreach($component_names as $name){ + $args->list_order = $list_order_num; + $args->component_name = $name; + $output = executeQuery('editor.updateComponent', $args); + + if(!$output->toBool()) return new Object(); + $list_order_num++; + } + } + return $output; + } /** * @brief Set components @@ -142,6 +112,29 @@ exit; } } + + /** + * @brief Config components + **/ + + function procEditorAdminGeneralConfig(){ + $oModuleController = &getController('module'); + $configVars = Context::getRequestVars(); + + $config->editor_skin = $configVars->editor_skin; + $config->editor_height = $configVars->editor_height; + $config->comment_editor_skin = $configVars->comment_editor_skin; + $config->comment_editor_height = $configVars->comment_editor_height; + $config->content_style = $configVars->content_style; + $config->content_font = $configVars->content_font; + $config->content_font_size= $configVars->content_font_size.'px'; + $config->sel_editor_colorset= $configVars->sel_editor_colorset; + $config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset; + + $oModuleController->insertModuleConfig('editor',$config); + $this->setRedirectUrl(Context::get('error_return_url')); + + } /** * @brief Add a component to DB diff --git a/modules/editor/editor.admin.view.php b/modules/editor/editor.admin.view.php index 84818a035..a4aec5549 100644 --- a/modules/editor/editor.admin.view.php +++ b/modules/editor/editor.admin.view.php @@ -17,15 +17,51 @@ * @brief Administrator Setting page * Settings to enable/disable editor component and other features **/ - function dispEditorAdminIndex() { + function dispEditorAdminIndex() { + $component_count = 0; $site_module_info = Context::get('site_module_info'); - $site_srl = (int)$site_module_info->site_srl; + $site_srl = (int)$site_module_info->site_srl; + // Get a type of component $oEditorModel = &getModel('editor'); - $component_list = $oEditorModel->getComponentList(false, $site_srl, true); - - Context::set('component_list', $component_list); - + $oModuleModel = &getModel('module'); + $editor_config = $oModuleModel->getModuleConfig('editor'); + + $component_list = $oEditorModel->getComponentList(false, $site_srl, true); + $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); + + $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); + + $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); + for($i=0,$c=count($contents);$i<$c;$i++) { + $style = $contents[$i]; + $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); + $content_style_list[$style]->title = $info->title; + } + + // Get install info, update info, count + $oAutoinstallModel = &getModel('autoinstall'); + foreach($component_list as $component_name => $xml_info) { + $component_count++; + $xml_info->path = './modules/editor/components/'.$xml_info->component_name; + $xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); + $xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); + if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; + } + $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); + foreach($component_list as $component_name => $xml_info) { + if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; + } + $editor_config_default = array( "editor_height" => "500", "comment_editor_height" => "120","content_font_size"=>"12"); + + Context::set('editor_config', $editor_config); + Context::set('editor_skin_list', $editor_skin_list); + Context::set('editor_colorset_list', $skin_info->colorset); + Context::set('content_style_list', $content_style_list); + Context::set('component_list', $component_list); + Context::set('component_count', $component_count); + Context::set('editor_config_default', $editor_config_default); + $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('admin_index'); } @@ -71,6 +107,5 @@ $this->setTemplateFile('setup_component'); $this->setLayoutFile("popup_layout"); } - } ?> diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index bc67c11a4..812b231c6 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -22,14 +22,16 @@ /** * @brief Return editor setting for each module **/ - function getEditorConfig($module_srl) { - if(!$GLOBALS['__editor_module_config__'][$module_srl]) { + function getEditorConfig($module_srl = null) { + if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) { // Get trackback settings of the selected module $oModuleModel = &getModel('module'); $GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl); } - - $editor_config = $GLOBALS['__editor_module_config__'][$module_srl]; + $editor_config = $GLOBALS['__editor_module_config__'][$module_srl]; + + $oModuleModel = &getModel('module'); + $editor_default_config = $oModuleModel->getModuleConfig('editor'); if(!is_object($editor_config)) $editor_config = null; @@ -42,14 +44,20 @@ if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); - if(!$editor_config->editor_height) $editor_config->editor_height = 500; - if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 120; if($editor_config->enable_autosave!='N') $editor_config->enable_autosave = "Y"; - - if(!$editor_config->editor_skin) $editor_config->editor_skin = 'xpresseditor'; - if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'xpresseditor'; - if(!$editor_config->content_style) $editor_config->content_style = 'default'; - + + if(!$editor_config->editor_height) if($editor_default_config->editor_height? $editor_config->editor_height = $editor_default_config->editor_height : $editor_config->editor_height = 500); + if(!$editor_config->comment_editor_height) if($editor_default_config->comment_editor_height? $editor_config->comment_editor_height = $editor_default_config->comment_editor_height : $editor_config->comment_editor_height = 120); + if(!$editor_config->editor_skin) if($editor_default_config->editor_skin? $editor_config->editor_skin = $editor_default_config->editor_skin : $editor_config->editor_skin = 'xpresseditor'); + if(!$editor_config->comment_editor_skin) if($editor_default_config->comment_editor_skin? $editor_config->comment_editor_skin = $editor_default_config->comment_editor_skin : $editor_config->comment_editor_skin = 'xpresseditor'); + if(!$editor_config->content_style) if($editor_default_config->content_style? $editor_config->content_style = $editor_default_config->content_style : $editor_config->content_style = 'default'); + + if(!$editor_config->content_font && $editor_default_config->content_font) $editor_config->content_font = $editor_default_config->content_font; + if(!$editor_config->content_font_size && $editor_default_config->content_font_size) $editor_config->content_font_size = $editor_default_config->content_font_size; + + if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) $editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset; + if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset; + if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style) $editor_config->comment_content_style = $editor_default_config->comment_content_style; return $editor_config; } @@ -195,7 +203,8 @@ // Default font setting Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); - // Option setting to allow auto-save + + // Option setting to allow auto-save if(!$option->enable_autosave) $enable_autosave = false; elseif(Context::get($option->primary_key_name)) $enable_autosave = false; else $enable_autosave = true; diff --git a/modules/editor/editor.view.php b/modules/editor/editor.view.php index 8ebd7feb8..2331ecd72 100644 --- a/modules/editor/editor.view.php +++ b/modules/editor/editor.view.php @@ -120,9 +120,56 @@ function dispEditorSkinColorset(){ $skin = Context::get('skin'); $oModuleModel = &getModel('module'); - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin); + $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin); $colorset = $skin_info->colorset; - Context::set('colorset', $colorset); + + Context::set('colorset', $colorset); } + + function dispEditorConfigPreview() { + $oEditorModel = &getModel('editor'); + $config = $oEditorModel->getEditorConfig(); + + $option->allow_fileupload = false; + $option->content_style = $config->content_style; + $option->content_font = $config->content_font; + $option->content_font_size = $config->content_font_size; + $option->enable_autosave = false; + $option->enable_default_component = true; + $option->enable_component = true; + $option->disable_html = false; + $option->height = $config->editor_height; + $option->skin = $config->editor_skin; + $option->content_key_name = 'dummy_content'; + $option->primary_key_name = 'dummy_key'; + $option->colorset = $config->sel_editor_colorset; + $editor = $oEditorModel->getEditor(0, $option); + + Context::set('editor', $editor); + + $option_com->allow_fileupload = false; + $option_com->content_style = $config->content_style; + $option_com->content_font = $config->content_font; + $option_com->content_font_size = $config->content_font_size; + $option_com->enable_autosave = false; + $option_com->enable_default_component = true; + $option_com->enable_component = true; + $option_com->disable_html = false; + $option_com->height = $config->comment_editor_height; + $option_com->skin = $config->comment_editor_skin; + $option_com->content_key_name = 'dummy_content2'; + $option_com->primary_key_name = 'dummy_key2'; + $option_com->content_style = $config->comment_content_style; + $option_com->colorset = $config->sel_comment_editor_colorset; + + $editor_comment = $oEditorModel->getEditor(0, $option_com); + + Context::set('editor_comment', $editor_comment); + + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('config_preview'); + + } } ?> diff --git a/modules/editor/lang/lang.xml b/modules/editor/lang/lang.xml index 70a1aefda..b69a1cd18 100644 --- a/modules/editor/lang/lang.xml +++ b/modules/editor/lang/lang.xml @@ -152,7 +152,7 @@ - + @@ -547,53 +547,38 @@ Bài viết tự động lưu sẽ tự động hủy sau khi bạn hoàn thành - - - + + + - - + + - - + + - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + diff --git a/modules/editor/ruleset/componentOrderAndUse.xml b/modules/editor/ruleset/componentOrderAndUse.xml new file mode 100644 index 000000000..27e72cf1e --- /dev/null +++ b/modules/editor/ruleset/componentOrderAndUse.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/modules/editor/ruleset/generalConfig.xml b/modules/editor/ruleset/generalConfig.xml new file mode 100644 index 000000000..372263f01 --- /dev/null +++ b/modules/editor/ruleset/generalConfig.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/modules/editor/skins/dreditor/editor.html b/modules/editor/skins/dreditor/editor.html index 0fc7ce2b7..bd7860fe1 100644 --- a/modules/editor/skins/dreditor/editor.html +++ b/modules/editor/skins/dreditor/editor.html @@ -83,7 +83,7 @@ diff --git a/modules/editor/skins/xpresseditor/editor.html b/modules/editor/skins/xpresseditor/editor.html index d32dab320..3867059ed 100644 --- a/modules/editor/skins/xpresseditor/editor.html +++ b/modules/editor/skins/xpresseditor/editor.html @@ -59,7 +59,7 @@ diff --git a/modules/editor/tpl/admin_index.html b/modules/editor/tpl/admin_index.html index 1d42c1c66..52b661a8f 100644 --- a/modules/editor/tpl/admin_index.html +++ b/modules/editor/tpl/admin_index.html @@ -1,40 +1,170 @@ - + -

{$lang->editor} {$lang->cmd_management}

+
+

WYSIWYG Editor

+

Editor Preview

+ + + 미리보기 + +
+ - - - - - - - - - - - - - - - - - - - - - - - - - -
{$lang->description}
{$lang->component_author}
{$lang->component_version}
{$lang->component_date}
{$xml_info->title} ({$component_name})
{$lang->cmd_setup} - - {$lang->cmd_enable} - - {$lang->cmd_disable} - - {$lang->cmd_move_up}{$lang->cmd_move_down}
{nl2br($xml_info->description)} - - {$author->name} - - {$xml_info->version}{$xml_info->date}
+
+

Editor Option

+
    +
  • +

    본문 에디터를 선택하세요.

    +

    + + editor_skin)-->checked="checked" /> + + +
    + +

    +
  • +
  • +

    +

    px

    +
  • +
  • +

    댓글 에디터를 선택하세요.

    +

    + + comment_editor_skin)-->checked="checked" /> + + +
    + +

    +
  • +
  • +

    +

    px

    +
  • +
  • +

    본문 서식을 선택하세요.

    +

    + + content_style||!$editor_config->content_style&&$key=='default')-->checked="checked"> + +

    +
  • +
  • +

    본문 글꼴을 선택하세요.

    + +

    + content_font)-->checked="checked" />
    + + content_font==$name)-->checked="checked" />
    + +

    +
  • +
  • +

    + +

    px

    +
  • + +
+
+ +
+
+
+
+ +
+

Editor Component

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ All({$component_count}) +
이동{$lang->component_name} {$lang->user_name}{$lang->version}{$lang->author}{$lang->path}{$lang->use}{$lang->cmd_delete}
+ +

{$xml_info->title}

+

{nl2br($xml_info->description)}

+ +

이 항목 업데이트가 가능합니다. 업데이트 하시겠습니까?

+ +
{$xml_info->version} + + {$author->name} + + {$xml_info->path}enabled=='Y')--> checked="checked" /> + + Delete + +
+
+
+ +
+
+
+
diff --git a/modules/editor/tpl/config_preview.html b/modules/editor/tpl/config_preview.html new file mode 100644 index 000000000..9d256ea88 --- /dev/null +++ b/modules/editor/tpl/config_preview.html @@ -0,0 +1,18 @@ + + +
+

에디터 미리보기

+

본문 에디터

+
+ + + +

{$editor}

+

+

댓글 에디터

+
+ + +

{$editor_comment}

+
+
\ No newline at end of file diff --git a/modules/editor/tpl/js/editor_admin.js b/modules/editor/tpl/js/editor_admin.js index ccdb3ae15..1c8966f7a 100644 --- a/modules/editor/tpl/js/editor_admin.js +++ b/modules/editor/tpl/js/editor_admin.js @@ -2,34 +2,8 @@ * @author NHN (developers@xpressengine.com) * @version 0.1 * @brief 에디터 관리자 페이지용 스크립트 - **/ - -function doEnableComponent(component_name) { - var params = new Array(); - params['component_name'] = component_name; - - exec_xml('editor', 'procEditorAdminEnableComponent', params, completeUpdate); -} - -function doDisableComponent(component_name) { - var params = new Array(); - params['component_name'] = component_name; - - exec_xml('editor', 'procEditorAdminDisableComponent', params, completeUpdate); -} - -function doMoveListOrder(component_name, mode) { - var params = new Array(); - params['component_name'] = component_name; - params['mode'] = mode; - - exec_xml('editor', 'procEditorAdminMoveListOrder', params, completeUpdate); -} - -function completeUpdate(ret_obj) { - location.reload(); -} - + **/ + function doSetupComponent(component_name) { popopen(request_uri.setQuery('module','editor').setQuery('act','dispEditorAdminSetupComponent').setQuery('component_name',component_name), 'SetupComponent'); } diff --git a/modules/editor/tpl/js/editor_module_config.js b/modules/editor/tpl/js/editor_module_config.js index f4607f7f8..b3b440b18 100644 --- a/modules/editor/tpl/js/editor_module_config.js +++ b/modules/editor/tpl/js/editor_module_config.js @@ -1,37 +1,44 @@ -function getEditorSkinColorList(skin_name,selected_colorset,type){ +function getEditorSkinColorList(skin_name,selected_colorset,type,testid){ if(skin_name.length>0){ type = type || 'document'; var response_tags = new Array('error','message','colorset'); - exec_xml('editor','dispEditorSkinColorset',{skin:skin_name},resultGetEditorSkinColorList,response_tags,{'selected_colorset':selected_colorset,'type':type}); + exec_xml('editor','dispEditorSkinColorset',{skin:skin_name},resultGetEditorSkinColorList,response_tags,{'selected_colorset':selected_colorset,'type':type,'testid':testid}); } } function resultGetEditorSkinColorList(ret_obj,response_tags, params) { - var selectbox = null; - if(params.type == 'document'){ - selectbox = xGetElementById("sel_editor_colorset"); - }else{ - selectbox = xGetElementById("sel_comment_editor_colorset"); - } + jQuery(function($){ + selectbox = jQuery("#"+params.testid).next('label').next('select'); + selectbox.html(''); + + if(params.type == 'document'){ + $("select[name=sel_editor_colorset]").css('display','none'); + $("select[name=sel_editor_colorset]").removeAttr('name'); + selectbox.attr('name','sel_editor_colorset'); + }else{ + $("select[name=sel_comment_editor_colorset]").css('display','none'); + $("select[name=sel_comment_editor_colorset]").removeAttr('name'); + selectbox.attr('name','sel_comment_editor_colorset'); + } - if(ret_obj['error'] == 0 && ret_obj.colorset){ - var it = new Array(); - var items = ret_obj['colorset']['item']; - if(typeof(items[0]) == 'undefined'){ - it[0] = items; - }else{ - it = items; - } - var sel = 0; - for(var i=0,c=it.length;i'+it[i].title+'')); + } + selectbox.css('display',''); + }else{ + selectbox.css('display','none'); + selectbox.innerHTML=""; + } + }); }