public function initAttachments($feedAutoId, Form $form)
    {
        ow::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.onStatusUpdate_' . $feedAutoId . ' = function( r ) {
                $("#newsfeed_status_input").val("");
                $("#newsfeed-att-file").val("");
                $("#newsfeed-att-file-prevew img").hide();
                $("#newsfeed-att-file-prevew span").empty();
                
                $("#newsfeed_status_save_btn_c").removeClass("owm_preloader_circle");

                if ( r.error ) {
                    OWM.error(r.error); return;
                }

                if ( r.item ) {
                    window.ow_newsfeed_feed_list[{$autoId}].loadNewItem(r.item, false);
                }
                
                if ( r.message ) {
                    OWM.info(r.message);
                }
                
                OWM.getActiveFloatBox().close();
            }', array('autoId' => $feedAutoId)));
    }
Exemple #2
0
function toconsolex(BASE_EventCollector $e)
{
    /*
    $e->add(
                array(
                    BASE_CMP_Console::DATA_KEY_URL => OW::getRouter()->urlForRoute('mailbox_default'),
                    BASE_CMP_Console::DATA_KEY_ICON_CLASS => 'ow_ic_mail',
                    BASE_CMP_Console::DATA_KEY_TITLE => OW::getLanguage()->text('mailbox', 'mailbox'),
                )
            );
    */
    $curent_url = OW_URL_HOME;
    $config = OW::getConfig();
    $id_user = OW::getUser()->getId();
    $is_admin = OW::getUser()->isAdmin();
    //function current_url() {
    //return sprintf("http://%s%s",$_SERVER["HTTP_HOST"],$_SERVER["REQUEST_URI"]);
    //}
    if ($id_user > 0) {
        //$curent_url .="photo/";
        if (OW::getConfig()->getValue('search', 'turn_off_topsearchbar') != 1) {
            $url_spr = sprintf("http://%s%s", $_SERVER["HTTP_HOST"], $_SERVER["REQUEST_URI"]);
            $url_spr = substr($url_spr, strlen($curent_url), strlen($url_spr));
            list($url_spr) = explode("/", $url_spr);
            //echo $url_spr;exit;
            if ($url_spr != "admin") {
                $width_topsearchbar = OW::getConfig()->getValue('search', 'width_topsearchbar');
                if (!$width_topsearchbar) {
                    $width_topsearchbar = 350;
                }
                if ($width_topsearchbar < 60) {
                    $width_topsearchbar = 60;
                }
                $height_topsearchbar = OW::getConfig()->getValue('search', 'height_topsearchbar');
                if (!$height_topsearchbar) {
                    $height_topsearchbar = 22;
                }
                $left_margin = OW::getConfig()->getValue('search', 'horizontal_position');
                if ($left_margin == "" or $left_margin == 0) {
                    $left_margin_tab = "margin-left:-300px;";
                } else {
                    $left_margin_tab = " margin-left:" . $left_margin . "px;";
                }
                $top_margin = OW::getConfig()->getValue('search', 'vertical_position');
                if ($top_margin != "0" and $top_margin != "") {
                    $top_margin = " margin-top:" . $top_margin . "px;";
                } else {
                    $top_margin = "";
                }
                $search_position = OW::getConfig()->getValue('search', 'search_position');
                if (!$search_position) {
                    $search_position_bar = "position:absolute;";
                } else {
                    $search_position_bar = "position:" . $search_position . ";";
                }
                if ($search_position == "absolute") {
                    $left_margin_tab = "margin-left:-300px;";
                    $search_position_bar .= "left:" . $left_margin . "px;";
                }
                //$search_position_bar="";
                //if ($search_position=="absolute"){
                //    $with_console_search=$width_topsearchbar;
                //}else{
                $with_console_search = "1";
                //}
                $z_index = OW::getConfig()->getValue('search', 'zindex_position');
                if ($z_index != "" and $z_index != "0") {
                    $z_index = "z-index:" . $z_index . ";";
                } else {
                    $z_index = " z-index:99;";
                }
                if ($config->getValue('search', 'search_position') == "oxwall15") {
                    if ($left_margin != "") {
                        $ml = $left_margin;
                    } else {
                        $ml = 325;
                    }
                    /*
                        if (!$is_admin){
                            if (!$ml) $ml=0;
                            $ml=$ml-70;
                        }
                    */
                    $style_main = "width:" . $width_topsearchbar . "px;display:inline-block;margin-top:0px;margin-right:" . $ml . "px;" . $z_index . "   background:none;border:0;";
                    $class_main = "ow_console_item ow_console_dropdownC";
                    $style_console = "width:" . $width_topsearchbar . "px;height:" . ($height_topsearchbar + 2) . "px;        padding: 0;margin: 0;border:0;";
                    $class_console = "ow_console_body";
                    //    $style_input="position:relative;display:inline-block;float:left;left:3px;top:-1px;width:".($width_topsearchbar-40)."px;font-size:120%;";
                    //-----ousde
                    //    $style_input="position:relative;display:inline-block;float:left;left:3px;top:0px;width:".($width_topsearchbar-40)."px;max-height:".($height_topsearchbar+1)."px;font-size:120%;";
                    //----inline
                    $style_input = "text-indent: 20px;position:relative;display:inline-block;float:left;left:3px;top:0px;width:" . $width_topsearchbar . "px;max-height:" . ($height_topsearchbar + 1) . "px;font-size:120%;";
                } else {
                    $style_main = $search_position_bar . $z_index . "width:" . $with_console_search . "px;margin:auto;";
                    $class_main = "ow_console clearfix";
                    $style_console = "width:" . $width_topsearchbar . "px;" . $left_margin_tab . $top_margin;
                    $class_console = "";
                    //-----outside
                    //    $style_input="position:relative;display:inline-block;float:left;left:3px;top:1px;width:".($width_topsearchbar-40)."px;font-size:120%;";
                    //----inline
                    $style_input = "position:relative;display:inline-block;float:left;left:3px;top:1px;width:" . $width_topsearchbar . "px;font-size:120%;";
                }
                $content_seaerch = "";
                //$content_seaerch .= "<div class=\"ow_console clearfix\" style=\"".$style_main."\">";
                //$content_seaerch .= "<div class=\"ow_console_item ow_console_dropdownC\" style=\"".$style_main."\">";
                $content_seaerch .= "<div class=\"" . $class_main . "\" style=\"" . $style_main . "\">";
                $content_seaerch .= "<div class=\"" . $class_console . " console_item common_shortcuts\" style=\"" . $style_console . "\">";
                //        $content_seaerch .= "<div class=\"ow_ic_lens\" style=\"width:16px;height:16px;margin:3px;position:relative;display:inline-block;float:left;top:4px;background-position: center;background-repeat: no-repeat;\">&nbsp;</div>";
                //----outside
                //        $content_seaerch .= "<div class=\"ow_ic_lens\" style=\"width:16px;height:16px;margin:3px;position:relative;display:inline-block;float:left;top:1px;background-position: center;background-repeat: no-repeat;\">&nbsp;</div>";
                //----inline
                $content_seaerch .= "<div class=\"ow_ic_lens\" style=\"width:16px;height:16px;margin:3px;position:absolute;left: 10px;z-index: 9;display:inline-block;float:left;background-position: center;background-repeat: no-repeat;\">&nbsp;</div>";
                $content_seaerch .= "<div class=\"fake_node\" id=\"main_im_tab_container0\">";
                //        echo "<div class=\"ow_ic_lens\" style=\"width:16px;height:16px;margin:3px;position:relative;display:inline-block;float:left;top:4px;\">&nbsp;</div>";
                $content_seaerch .= "<form id=\"searchform\" metod=\"get\" action=\"" . $curent_url . "query\" style=\"display:inline;\">";
                //        echo "<input style=\"margin:1px;auto;padding:auto;position:relative;display:inline-block;float:left;left:3px;top:1px;width:".($width_topsearchbar-40)."px;font-size:120%;\" type=\"text\" id=\"query\" name=\"query\" value=\"".stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion'))."\" onblur=\"if(this.value == '') { this.value='".stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion'))."'};\" onfocus=\"if (this.value == '".stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion'))."') {this.value=''};\" autocomplete=\"off\" spellcheck=\"false\" >";
                if (OW::getConfig()->getValue('search', 'hmanyitems_show_topsearchbarlist') > 0) {
                    $content_seaerch .= "<input style=\"" . $style_input . "\" type=\"text\" id=\"query\" name=\"query\" value=\"" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "\" onblur=\"if(this.value == '') { this.value='" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "'};\" onfocus=\"if (this.value == '" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "') {this.value=''};\" autocomplete=\"off\" spellcheck=\"false\" >";
                } else {
                    $content_seaerch .= "<input style=\"" . $style_input . "\" type=\"text\" id=\"query_d\" name=\"query\" value=\"" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "\" onblur=\"if(this.value == '') { this.value='" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "'};\" onfocus=\"if (this.value == '" . stripslashes(OW::getLanguage()->text('search', 'tips_default_sugestion')) . "') {this.value=''};\" autocomplete=\"off\" spellcheck=\"false\" >";
                }
                $content_seaerch .= "</form>";
                //        echo "<div id=\"aron_results_qqsearch\" style=\"width:100%;meight:300px;border:1px solid #eee;position:absolute;z-index:9999995;margin-top:30px;background-color:#fff;display:none;\">&nbsp;</div>";
                $content_seaerch .= "</div>";
                //        $content_seaerch .= "<div id=\"aron_results_qqsearch\" style=\"min-width:".($width_topsearchbar-30)."px;margin:auto;border:1px solid #eee;position:absolute;z-index:9999995;margin-top:30px;background-color:#fff;display:none;\">&nbsp;</div>";
                //        $content_seaerch .= "<div class=\"ow_content\" id=\"aron_results_qqsearch\" style=\"min-width:".($width_topsearchbar-30)."px;width: auto;margin:auto;border:1px solid #eee;position:absolute;z-index:9999995;margin-top:30px;background-color:#fff;display:none;\">&nbsp;</div>";
                //        $content_seaerch .= "<div class=\"ow_content\" id=\"aron_results_qqsearch\" style=\"min-width:".($width_topsearchbar-30)."px;width: auto;margin:auto;border:1px solid #eee;position:absolute;z-index:9999995;margin-top:30px;background-color:#fff;display:none;\">&nbsp;</div>";
                //display: block;
                //display:none;
                //margin-top:30px;
                //border:1px solid #eee;
                //position:absolute;
                //z-index:9999995;
                if (OW::getConfig()->getValue('search', 'bg_results_topsearchbar')) {
                    $bg_results_topsearchbar = "background-color: " . OW::getConfig()->getValue('search', 'bg_results_topsearchbar') . ";";
                } else {
                    $bg_results_topsearchbar = "";
                }
                $content_seaerch .= "<div id=\"aron_results_qqsearch_main\" class=\"OW_ConsoleItemContent ow_content\" \nstyle=\"display: none;\nmin-width:" . ($width_topsearchbar - 30) . "px;\nwidth: auto;\nmargin:auto;\nborder:0;\nposition:absolute;\nz-index:0;\nbackground-color:transparent;\n\">\n    <div class=\"ow_tooltip  console_tooltip ow_tooltip_top_right\" style=\"opacity: 1; top: 22px;\">\n\n        <div class=\"ow_tooltip_tail\">\n            <span></span>\n        </div>\n        <div class=\"ow_tooltip_body\" id=\"aron_results_qqsearch\" style=\"" . $bg_results_topsearchbar . "\">";
                /*        
                                <ul class=\"ow_console_dropdown\">
                                        <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/user/admin\" class=\"hint-target\">My Profile</a>
                                </div>
                            </li>
                                    <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/profile/edit\">Profile Edit</a>
                                </div>
                            </li>
                                    <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/profile/preference\">My Preferences</a>
                                </div>
                            </li>
                                    <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/uploaded-video/latest\">Videos Upload</a>
                                </div>
                            </li>
                                    <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/profile/privacy\">Privacy</a>
                                </div>
                            </li>
                        
                                    <li><div class=\"ow_console_divider\"></div></li>
                                                <li class=\" ow_dropdown_menu_item ow_cursor_pointer\">
                                <div class=\"ow_console_dropdown_cont\">
                                    <a href=\"http://mycollegesocial.com/sign-out\">Sign Out</a>
                                </div>
                            </li>
                        
                            </ul>
                */
                $content_seaerch .= "</div>\n\n    </div>\n</div>";
                $content_seaerch .= "</div>";
                //echo "</div>";
                $content_seaerch .= "</div>";
                if ($config->getValue('search', 'search_position') != "oxwall15") {
                    echo $content_seaerch;
                } else {
                    $content_seaerch = str_replace("\r\n", " ", $content_seaerch);
                    $content_seaerch = str_replace("\r", " ", $content_seaerch);
                    $content_seaerch = str_replace("\n", " ", $content_seaerch);
                    $content_seaerch = str_replace("'", "\\'", $content_seaerch);
                }
                $script = "";
                $script .= "<style media=\"all\">\n\n.aron_dropdown_hover:hover{background-color:#eee;color:#222;}\n\n</style>\n";
                $script .= "<script type=\"text/javascript\">\n";
                //echo "$('h2').insertBefore($('.container'));";
                $script .= "\n\$(document).ready(function() {\n";
                if ($config->getValue('search', 'search_position') == "oxwall15") {
                    $script .= "\$('.ow_console .ow_console_body div div').first().before('" . $content_seaerch . "'); ";
                    //    $('.ow_console .ow_console_body div').first().append('".$content_seaerch."');
                    //    $('.ow_console .ow_console_body DIV').html('ssss<hr/>');
                }
                $script .= "  mouse_is_inside=true; \n    \$('#search_submit_more').click(function() {\n        alert('sss');\n    });\n\n//    \$('#query').keypress(function(event) {\n    \$('#query').keyup(function(event) {\n        var valuekey = event.charCode;\n        var c = String.fromCharCode(event.which);\n        if (\$(this).val().length>1){\n//alert(valuekey+'--'+c);\n\n\n    \$.ajax({\n        type     : 'POST',\n        url      : '" . $curent_url . "qquery',\n        data     : {\n            query : \$(this).val(),\n            action : 'search'\n        },\n        success : function(msg) {\n            \$('#aron_results_qqsearch').html(msg);\n            \$('#aron_results_qqsearch').show();\n\$('#aron_results_qqsearch_main').show();\n        },\n        complete : function(r) {\n            \$('#loading').hide();\n        },\n        error:    function(error) {\n        }\n    });\n\n        }else{\n            \$('#aron_results_qqsearch').hide();\n\$('#aron_results_qqsearch_main').hide();\n        }\n    }).on('keydown', function(e) {\n        if (e.keyCode==8){\n            \$('#query').trigger('keypress');\n        }else if (e.keyCode==13){\n            \$('#aron_results_qqsearch').hide();\n\$('#aron_results_qqsearch_main').hide();\n            \$('#searchform').attr('action', '" . $curent_url . "query/search');\n            \$('#searchform').submit();\n        \n        }\n     });\n\n\n    \$('#query').focusout(function() {\n        if(!mouse_is_inside) {\n            \$('#aron_results_qqsearch').hide();\n\$('#aron_results_qqsearch_main').hide();\n        }\n    });\n\n\n    \$('#aron_results_qqsearch').mouseenter(function(){\n        mouse_is_inside=true; \n    }).mouseleave(function(){\n        mouse_is_inside=false; \n    });\n\n    \$('#aron_results_qqsearch').mouseover(function(){\n        mouse_is_inside=true; \n    }).mouseout(function(){\n        mouse_is_inside=false; \n    });\n\n\n\n\n})\n";
                //echo "function querychck(){"
                //echo "if (query.length>2){";
                //echo "alert(query);";
                //echo "}";
                //echo "}";
                $script .= "</script>\n";
                //echo $script;
                ow::getDocument()->appendBody($script);
                /*
                $con="<input tyle=\"text\" style=\"width:250px;\" name=\"query\" value=\"Wyszukaj osoby, miejsca i inne...\"  onblur=\"if(this.value == '') { this.value='Wyszukaj osoby, miejsca i inne...'}\" onfocus=\"if (this.value == 'Wyszukaj osoby, miejsca i inne...') {this.value=''}\" autocomplete=\"off\" spellcheck=\"false\" >";
                $e->add(
                            array(
                //                BASE_CMP_Console::DATA_KEY_URL => OW::getRouter()->urlForRoute('mailbox_default'),
                //                BASE_CMP_Console::DATA_KEY_URL => 'javascript://',
                                BASE_CMP_Console::DATA_KEY_URL => '',
                
                //                BASE_CMP_Console::DATA_KEY_ICON_CLASS => 'ow_ic_mail',
                //                BASE_CMP_Console::DATA_KEY_ICON_CLASS => 'ow_ic_file',
                                BASE_CMP_Console::DATA_KEY_ICON_CLASS => 'ow_ic_lens',
                
                                BASE_CMP_Console::DATA_KEY_TITLE => OW::getLanguage()->text('searchplus', 'Quick_Search'),
                                BASE_CMP_Console::DATA_KEY_ITEMS_LABEL => $con,
                                BASE_CMP_Console::DATA_KEY_ID => 'main_aron_tab',
                
                                BASE_CMP_Console::DATA_KEY_BLOCK => true,
                                BASE_CMP_Console::DATA_KEY_BLOCK_ID =>'main_aron_search',
                
                //                BASE_CMP_Console::DATA_KEY_HIDDEN_CONTENT => 'bbbbbbb',
                
                //                BASE_CMP_Console::DATA_KEY_BLOCK_CLASS => 'ow_mild_green'
                                BASE_CMP_Console::DATA_KEY_BLOCK_CLASS => 'main_aron_tab_container',
                //                BASE_CMP_Console::DATA_KEY_ITEMS_LABEL => OW::getLanguage()->text('searchplus', 'Quick_Search')
                            )
                        );
                */
            }
            //if not admin
        }
        //if not off
    }
    //if $id_user >0
}