コード例 #1
0
ファイル: form_fields.php プロジェクト: vazahat/dudex
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $output = '<div class="color_input"><input type="text" id="colorh_' . $this->getId() . '" name="' . $this->getName() . '" ' . ($this->getValue() !== null ? '" value="' . $this->getValue() . '"' : '') . ' />' . '&nbsp;<input type="button" class="color_button" id="color_' . $this->getId() . '" style="background:' . ($this->getValue() !== null ? $this->getValue() : '') . '" />
     <div style="display:none;"><div id="colorcont_' . $this->getId() . '"></div></div></div>';
     $varName = rand(10, 100000);
     $js = "var callback" . $varName . " = function(color){\n            \$('#colorh_" . $this->getId() . "').attr('value', color);\n            \$('#color_" . $this->getId() . "').css({backgroundColor:color});\n            window.colorPickers['" . $this->getId() . "'].close();\n        };\n        new ColorPicker(\$('#colorcont_" . $this->getId() . "'), callback" . $varName . ", '" . $this->getValue() . "');\n        \$('#color_" . $this->getId() . "').click(\n            function(){\n                if( !window.colorPickers )\n                {\n                    window.colorPickers = {};\n                }\n                window.colorPickers['" . $this->getId() . "'] = new OW_FloatBox({\$contents:\$('#colorcont_" . $this->getId() . "'), \$title:'Color Picker'});\n            }\n        );";
     OW::getDocument()->addOnloadScript($js);
     return $output;
 }
コード例 #2
0
ファイル: avatar_field.php プロジェクト: hardikamutech/hammu
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $deleteLabel = OW::getLanguage()->text('base', 'delete');
     $markup = '<div class="ow_avatar_field">';
     $markup .= UTIL_HtmlTag::generateTag('input', $this->attributes);
     $markup .= '<div class="ow_avatar_field_preview" style="display: none;"><img src="" alt="" /><span title="' . $deleteLabel . '"></span></div>';
     $markup .= '<input type="hidden" name="" value="" class="ow_avatar_field_value" />';
     $markup .= '</div>';
     return $markup;
 }
コード例 #3
0
ファイル: user_select_field.php プロジェクト: vazahat/dudex
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $staticUrl = OW::getPluginManager()->getPlugin('mcompose')->getStaticUrl();
     OW::getDocument()->addStyleSheet($staticUrl . 'select2.css');
     OW::getDocument()->addScript($staticUrl . 'select2.js');
     OW::getDocument()->addStyleSheet($staticUrl . 'style.css');
     OW::getDocument()->addScript($staticUrl . 'script.js');
     $this->addAttribute('type', 'hidden');
     $this->addAttribute('style', 'width: 100%');
     $imagesUrl = OW::getPluginManager()->getPlugin('base')->getStaticCssUrl();
     $css = array('.mc-tag-bg { background-image: url(' . $imagesUrl . 'images/tag_bg.png); };');
     OW::getDocument()->addStyleDeclaration(implode("\n", $css));
     return UTIL_HtmlTag::generateTag('input', $this->attributes) . '<div class="us-field-fake"><input type="text" class="ow_text invitation" value="' . $this->invitation . '" /></div>';
 }
コード例 #4
0
ファイル: upload_slide_field.php プロジェクト: vazahat/dudex
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $elementId = 'file_' . $this->uniqName;
     $router = OW::getRouter();
     $respUrl = $this->slideId ? $router->urlForRoute('slideshow.update-file', array('slideId' => $this->slideId)) : $router->urlForRoute('slideshow.upload-file', array('uniqName' => $this->uniqName));
     $params = array('elementId' => $elementId, 'fileResponderUrl' => $respUrl);
     $script = "window.uploadSlideFields = {};\n        \twindow.uploadSlideFields['" . $this->uniqName . "'] = new uploadSlideField(" . json_encode($params) . ");\n\t\t\twindow.uploadSlideFields['" . $this->uniqName . "'].init();";
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("slideshow")->getStaticJsUrl() . 'upload_slide_field.js');
     OW::getDocument()->addOnloadScript($script);
     $fileAttr = array('type' => 'file', 'id' => $elementId);
     $fileField = UTIL_HtmlTag::generateTag('input', $fileAttr);
     $hiddenAttr = array('type' => 'hidden', 'name' => $this->getName(), 'id' => 'hidden_' . $this->uniqName);
     $hiddenField = UTIL_HtmlTag::generateTag('input', $hiddenAttr);
     return '<span class="' . $elementId . '_cont">' . $fileField . '</span>' . $hiddenField;
 }
コード例 #5
0
ファイル: tags_field.php プロジェクト: vazahat/dudex
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     OW::getDocument()->addStyleDeclaration("\n            ul.oa_tags_field{\n                background:#fff;\n                padding:5px;\n                font-family:Arial;\n                cursor:text;\n                border: 1px solid #ced1da;\n                border-top: 1px solid #abadb3;\n                border-left:1px solid #abadb3;\n                width:95%;\n            }\n\n            ul.oa_tags_field input{\n                background:none;\n                border:none;\n            }\n\n            ul.oa_tags_field li.tag{\n                display:inline-block;\n                background:#e3e3e3;\n                padding: 3px 4px 4px 5px;\n                margin-right:5px;\n                margin-bottom:4px;\n                border:1px solid #e3e3e3;\n            }\n\n            ul.oa_tags_field li.tag:hover{\n                border:1px solid #666;\n            }\n\n            ul.oa_tags_field li.new_tag{\n                display:inline-block;\n            }\n\n            ul.oa_tags_field li.tag a{\n                display: inline-block;\n                background:red;\n                color:#fff;\n                padding:0 3px;\n                margin-left:4px;\n                line-height:14px;\n                font: bold 11px Arial;\n            }\n\n            ul.oa_tags_field li.tag a:hover{\n                text-decoration:none;\n            }\n        ");
     $values = $this->getValue();
     $valuesString = '<span class="values">';
     $liString = '';
     if (!empty($values)) {
         foreach ($values as $value) {
             $valuesString .= '<input type="hidden" name="' . $this->getName() . '[]" value="' . $value . '" class="tag-' . str_replace(' ', '_', $value) . '" />';
             $liString .= '<li class="tag tag-' . str_replace(' ', '_', $value) . '"><span>' . $value . '</span><a href="javascript://">x</a></li>';
         }
     }
     $valuesString .= '</span>';
     return '<div id="' . $this->getId() . '">' . $valuesString . '<ul class="oa_tags_field">' . $liString . '<li class="new_tag"><input type="text" style="width:18px;" /></ul></div>';
 }
コード例 #6
0
ファイル: avatar_field.php プロジェクト: ZyXelP/oxwall
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $deleteLabel = OW::getLanguage()->text('base', 'delete');
     if ($this->value) {
         // hide the input
         $this->attributes = array_merge($this->attributes, array('style' => 'display:none'));
     }
     $markup = '<div class="ow_avatar_field">';
     $markup .= UTIL_HtmlTag::generateTag('input', $this->attributes);
     if (!$this->value) {
         $markup .= '<div class="ow_avatar_field_preview" style="display: none;"><img src="" alt="" /><span title="' . $deleteLabel . '"></span></div>';
     } else {
         $markup .= '<div class="ow_avatar_field_preview" style="display: block;"><img src="' . $this->value . '" alt="" /><span title="' . $deleteLabel . '"></span></div>';
         $markup .= '<input type="hidden" id="' . $this->getId() . '_preload_avatar" name="avatarPreloaded" value="1" />';
     }
     $markup .= '<input type="hidden" name="' . $this->attributes['name'] . '" value="' . $this->value . '" class="ow_avatar_field_value" />';
     $markup .= '</div>';
     return $markup;
 }
コード例 #7
0
ファイル: ajax_file_upload.php プロジェクト: vazahat/dudex
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $fileElementId = $this->getId() . '_file';
     $entityId = $this->getValue();
     if (empty($entityId)) {
         $entityId = uniqid('upload');
     }
     $iframeUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Mailbox', 'fileUpload', array('entityId' => $entityId, 'formElementId' => $fileElementId));
     $attachFileHtml = '<div id="file_attachment" class="ow_mailbox_attachment">
                            <span class="ow_mailbox_attachment_icon ow_ic_attach ">&nbsp;</span>
                            <a class="file" href="javascript://"></a> (<span class="filesize"></span>)
                            <a rel="40" class="ow_delete_attachment ow_lbutton ow_hidden" href="javascript://" style="display: none;">' . OW::getLanguage()->text('mailbox', 'attache_file_delete_button') . '</a>
                        </div>';
     $fileList = array();
     if (!empty($entityId)) {
         $fileService = MAILBOX_BOL_FileUploadService::getInstance();
         $uploadFileDtoList = $fileService->findUploadFileList($entityId);
         foreach ($uploadFileDtoList as $uploadFileDto) {
             $file = array();
             $file['hash'] = $uploadFileDto->hash;
             $file['filesize'] = round($uploadFileDto->fileSize / 1024, 2) . 'Kb';
             $file['filename'] = $uploadFileDto->fileName;
             $file['fileUrl'] = $fileService->getUploadFileUrl($uploadFileDto->hash, UTIL_File::getExtension($uploadFileDto->fileName));
             $fileList[] = $file;
         }
     }
     $params = array('elementId' => $fileElementId, 'ajaxResponderUrl' => OW::getRouter()->urlFor("MAILBOX_CTRL_Mailbox", "responder"), 'fileResponderUrl' => $iframeUrl, 'attachFileHtml' => $attachFileHtml, 'fileList' => $fileList);
     $script = "  window.fileUpload_" . $this->getId() . " = new fileUpload(" . json_encode($params) . ");\n                        window.fileUpload_" . $this->getId() . ".init();";
     OW::getDocument()->addOnloadScript($script);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("mailbox")->getStaticJsUrl() . 'ajax_file_upload.js');
     $hiddenAttr = array('id' => $this->getId(), 'type' => 'hidden', 'name' => $this->getName(), 'value' => $entityId);
     $fileAttr = $this->attributes;
     unset($fileAttr['name']);
     $fileAttr['id'] = $fileElementId;
     return UTIL_HtmlTag::generateTag('input', $hiddenAttr) . '<span class="' . $fileElementId . '_class">' . UTIL_HtmlTag::generateTag('input', $fileAttr) . '</span>
             <div id="' . $fileElementId . '_list" class="ow_small ow_smallmargin">
                 <div class="ow_attachments_label mailbox_attachments_label ow_hidden">' . OW::getLanguage()->text('mailbox', 'attachments') . ' :</div>
             </div>';
 }
コード例 #8
0
ファイル: form_element.php プロジェクト: vBulleteen/oxwall
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.tagsinput.js');
     $this->addAttribute('value', $this->value ? implode(',', $this->value) : '');
     $markup = UTIL_HtmlTag::generateTag('input', $this->attributes);
     return $markup;
 }
コード例 #9
0
ファイル: theme.php プロジェクト: ZyXelP/oxwall
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $output = '';
     if ($this->value !== null && trim($this->value) !== 'none') {
         if (!strstr($this->value, 'http')) {
             $resultString = substr($this->value, strpos($this->value, 'images/') + 7);
             $this->value = 'url(' . OW::getThemeManager()->getSelectedTheme()->getStaticImagesUrl($this->mobile) . substr($resultString, 0, strpos($resultString, ')')) . ')';
         }
         $randId = 'if' . rand(10, 10000000);
         $script = "\$('#" . $randId . "').click(function(){\n                new OW_FloatBox({\$title:'" . OW::getLanguage()->text('admin', 'themes_settings_graphics_preview_cap_label') . "', \$contents:\$('#image_view_" . $this->getName() . "'), width:'550px'});\n            });";
         OW::getDocument()->addOnloadScript($script);
         $output .= '<div class="clearfix"><a id="' . $randId . '" href="javascript://" class="theme_control theme_control_image" style="background-image:' . $this->value . ';"></a>
             <div style="float:left;padding:10px 0 0 10px;"><a href="javascript://" onclick="window.location=\'' . OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('ADMIN_CTRL_Theme', 'resetGraphics'), array('name' => $this->getName())) . '\'">' . OW::getLanguage()->text('admin', 'themes_settings_reset_label') . '</a></div></div>
             <div style="display:none;"><div class="preview_graphics" id="image_view_' . $this->getName() . '" style="background-image:' . $this->value . '"></div></div>';
     }
     $output .= '<input type="file" name="' . $this->getName() . '" />';
     return $output;
 }
コード例 #10
0
ファイル: form_fields.php プロジェクト: ZyXelP/oxwall
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     if ($this->disabled) {
         $attributes = $this->attributes;
         unset($attributes['name']);
         $message = OW::getLanguage()->text('admin', 'possible_values_disable_message');
         $event = new OW_Event('admin.get.possible_values_disable_message', array('name' => $this->getName(), 'id' => $this->getId()), $message);
         OW::getEventManager()->trigger($event);
         $message = $event->getData();
         return UTIL_HtmlTag::generateTag('div', $attributes, true, $message);
     }
     parent::renderInput($params);
     $template = '
                     <div class="clearfix question_value_block" style="cursor:move;">
                             <span class="tag">
                                 <input type="hidden" value="{$value}">
                                 <span class="label" style="max-width:250px;overflow:hidden;">{$label}</span>
                                 <a title=' . json_encode(OW::getLanguage()->text('admin', 'remove_value')) . ' class="remove" href="javascript://"></a>
                             </span>
                     </div>';
     $template = UTIL_String::replaceVars($template, array('label' => '', 'value' => 0));
     $addButtonName = $this->getName() . '_add_button';
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "questions.js");
     $json = json_encode(array('tagFieldId' => $this->tag->getId(), 'dataFieldId' => $this->getId(), 'value' => $this->value, 'order' => array_keys($this->value), 'template' => $template));
     OW::getDocument()->addOnloadScript("\n            if ( !window.addQuestionValues )\n            {\n                window.addQuestionValues = {};\n            }\n\n            window.addQuestionValues[" . json_encode($this->getId()) . "] = new questionValuesField(" . $json . "); ");
     OW::getLanguage()->addKeyForJs('admin', 'questions_edit_delete_value_confirm_message');
     $inputValues = array();
     foreach ($this->value as $key => $val) {
         $inputValues[] = array($key => $val);
     }
     $html = '<div class="values_list">
             </div>
             <input type="hidden" id=' . json_encode($this->getId()) . ' name=' . json_encode($this->getName()) . ' value=' . json_encode($inputValues) . ' />
             <input type="hidden" id=' . json_encode($this->getId() . "_deleted_values") . ' name=' . json_encode($this->getName() . "_deleted_values") . ' value="" />
             <div style="padding-left: 4px;" class="ow_smallmargin">' . OW::getLanguage()->text('admin', 'add_question_value_description') . '</div>
             <div class="clearfix">
                 <div class="ow_left" style="width: 260px;">' . $this->tag->renderInput() . '</div>
                 <div class="ow_right">
                     <span class="ow_button">
                         <span class="ow_ic_add">
                             <input type="button" value=' . json_encode(OW::getLanguage()->text('admin', 'add_button')) . ' class="ow_ic_add" name="' . $addButtonName . '">
                         </span>
                     </span>
                 </div>
             </div>';
     return $html;
 }
コード例 #11
0
ファイル: base.php プロジェクト: jorgemunoz8807/havanabook
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     for ($hour = 0; $hour <= 23; $hour++) {
         $valuesArray[$hour . ':0'] = array('label' => $this->getTimeString($hour, '00'), 'hour' => $hour, 'minute' => 0);
         $valuesArray[$hour . ':30'] = array('label' => $this->getTimeString($hour, '30'), 'hour' => $hour, 'minute' => 30);
     }
     $optionsString = UTIL_HtmlTag::generateTag('option', array('value' => ""), true, OW::getLanguage()->text('event', 'time_field_invitation_label'));
     $allDayAttrs = array('value' => "all_day");
     if ($this->allDay) {
         $allDayAttrs['selected'] = 'selected';
     }
     $optionsString = UTIL_HtmlTag::generateTag('option', $allDayAttrs, true, OW::getLanguage()->text('event', 'all_day'));
     foreach ($valuesArray as $value => $labelArr) {
         $attrs = array('value' => $value);
         if (!empty($this->value) && $this->value['hour'] === $labelArr['hour'] && $this->value['minute'] === $labelArr['minute']) {
             $attrs['selected'] = 'selected';
         }
         $optionsString .= UTIL_HtmlTag::generateTag('option', $attrs, true, $labelArr['label']);
     }
     return UTIL_HtmlTag::generateTag('select', $this->attributes, true, $optionsString);
 }
コード例 #12
0
ファイル: meta_edit.php プロジェクト: vazahat/dudex
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $output = '<div class="oa_urledit_field" id="' . $this->getId() . '"><span class="cst_nedit">' . OW_URL_HOME . '</span>';
     $pathArr = explode('/', $this->getValue());
     $js = "\n            var oaCntedHandl = function(){ \$('input', \$(this).parent()).val(\$(this).html()); };\n            \$('.oa_urledit_field').click( function(){ \$('.oa_contenteditable', this)[0].focus();} );\n            \$('.oa_urledit_field .oa_contenteditable').click(function(e){e.stopPropagation()}).focus(function(){ \$(this).closest('.oa_urledit_field').css({backgroundColor:'#FBFCEB'});})\n            .blur(function(){ \$(this).closest('.oa_urledit_field').css({backgroundColor:'#fff'});})\n                .keyup(oaCntedHandl).mouseup(oaCntedHandl);\n            \n         ";
     for ($i = 0; $i < sizeof($pathArr); $i++) {
         if (strstr($pathArr[$i], ':')) {
             $output .= '<span class="cst_nedit">' . ($i === 0 ? '' : '/') . ':var</span>';
         } else {
             $id = uniqid('oa_uf');
             $output .= ($i === 0 ? '' : '<span class="cst_nedit">/</span>') . '<span><span class="oa_contenteditable" contenteditable="true">' . $pathArr[$i] . '</span><input class="oa_contenteditable_input" value="' . $pathArr[$i] . '" id="' . $id . '" type="hidden" name="' . $pathArr[$i] . '"></span>';
         }
     }
     OW::getDocument()->addOnloadScript($js);
     $output .= '</div>';
     return $output;
 }