Procházet zdrojové kódy

fix friends search - refs #15171

Alex Aragón před 6 roky
rodič
revize
d86d02908c

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/file.php

@@ -393,7 +393,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
                 </div>';
                 break;
             case FormValidator::LAYOUT_HORIZONTAL:
-                if($attributes['custom']){
+                if(isset($attributes['custom'])){
                     $template = '
                         <div class="form-group">
                             <div class="col-sm-1"></div>

+ 20 - 2
main/inc/lib/pear/HTML/QuickForm/text.php

@@ -102,6 +102,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
     public function getTemplate($layout)
     {
         $size = $this->getColumnsSize();
+        $attributes = $this->getAttributes();
 
         if (empty($size)) {
             $sizeTemp = $this->getInputSize();
@@ -162,13 +163,30 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
                 </div>';
                 break;
             case FormValidator::LAYOUT_BOX_NO_LABEL:
-                return '
+                if(isset($attributes['custom']) && $attributes['custom']==true){
+                    $template = '
+                        <label {label-for}>{label}</label>
+                        <div class="input-group">
+                            {icon}
+                            {element}
+                            <div class="input-group-btn">
+                                <button class="btn btn-default" type="submit">
+                                    <em class="fa fa-search"></em>
+                                </button>
+                            </div>
+                        </div>  
+                    ';
+                } else {
+                    $template = '
                         <label {label-for}>{label}</label>
                         <div class="input-group">
-                            
                             {icon}
                             {element}
                         </div>';
+                }
+
+
+                return $template;
                 break;
         }
     }

+ 8 - 6
main/social/home.php

@@ -217,24 +217,26 @@ $social_group_block = Display::panelCollapse(
 $wallSocialAddPost = SocialManager::getWallForm(api_get_self());
 $socialAutoExtendLink = SocialManager::getAutoExtendLink($user_id, $countPost);
 
-$form = new FormValidator(
+$formSearch = new FormValidator(
     'find_friends_form',
     'get',
     api_get_path(WEB_CODE_PATH).'social/search.php?search_type=1',
     null,
     null,
-    'inline'
+    'box-no-label'
 );
-$form->addHidden('search_type', 1);
-$form->addText(
+$formSearch->addHidden('search_type', 1);
+$formSearch->addText(
     'q',
     get_lang('Search'),
     false,
     [
         'aria-label' => get_lang('SearchUsers'),
+        'custom' => true,
+        'placeholder' => get_lang('ByName')
     ]
 );
-$form->addButtonSearch(get_lang('Search'));
+//$formSearch->addButtonSearch(get_lang('Search'));
 
 $tpl = new Template(get_lang('SocialNetwork'));
 SocialManager::setSocialUserBlock($tpl, $user_id, 'home');
@@ -242,7 +244,7 @@ $tpl->assign('social_wall_block', $wallSocialAddPost);
 $tpl->assign('social_post_wall_block', $posts);
 $tpl->assign('social_menu_block', $social_menu_block);
 $tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
-$tpl->assign('search_friends_form', $form->returnForm());
+$tpl->assign('search_friends_form', $formSearch->returnForm());
 $tpl->assign('social_friend_block', $friend_html);
 //$tpl->assign('session_list', $social_session_block);
 $tpl->assign('social_search_block', $social_search_block);