Перейти к содержанию
CMSTOOLS.org - форум поддержки и развития CMS

[Модуль] Фотоальбомы в сообщества


Рекомендуемые сообщения

1. Открываем .htaccess
 Перед :

# Альбомы

Вставить:

# Альбомы в группах
        RewriteRule ^albums-([0-9]+)(/?)+$ index.php?go=groups_albums&uid=$1 [L]
        RewriteRule ^albums-([0-9]+)_([0-9]+)/add(/?)+$ index.php?go=groups_albums&act=add&aid=$2&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)_([0-9]+)(/?)+$ index.php?go=groups_albums&act=view&aid=$2&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)_([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=groups_albums&act=view&aid=$2&page=$3&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)/comments(/?)+$ index.php?go=groups_albums&act=all_comments&uid=$1 [L]
        RewriteRule ^albums-([0-9]+)/comments/page/([0-9]+)(/?)+$ index.php?go=groups_albums&act=all_comments&uid=$1&page=$3 [L]
        RewriteRule ^albums-([0-9]+)_([0-9]+)/comments(/?)+$ index.php?go=groups_albums&act=all_comments&aid=$2&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)_([0-9]+)/comments/page/([0-9]+)(/?)+$ index.php?go=groups_albums&act=all_comments&aid=$2&page=$2&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)/editphotos/([0-9]+)(/?)+$ index.php?go=groups_albums&act=edit_pos_photos&aid=$2&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)/newphotos(/?)+$ index.php?go=groups_albums&act=new_photos&pid=$1 [L]
        RewriteRule ^albums-([0-9]+)/newphotos/([0-9]+)(/?)+$ index.php?go=groups_albums&act=new_photos&page=$2&pid=$1 [L]
        
# Просмотр фото в группах
        RewriteRule ^photo-([0-9]+)_([0-9]+)_([0-9]+)(/?)+$ index.php?go=groups_albums&act=view&pid=$1&aid=$3 [L]

2. Открываем  ../Default/style/style.css в самый низ добавляем

/* GROUPS ALBUMS */
.page_album_row {margin: 10px 10px 0px;width: 140px;height: 118px;overflow: hidden;display: inline-block;vertical-align: top;background: #EEE;}
.page_album_row a {position: relative;display: block;text-align: center; cursor: pointer;}
.page_photo_thumb_big {vertical-align: top;max-width: 140px;}
.page_album_title_wrap:not([dummy]) {-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled='false')";}
.page_album_title_wrap {background: rgba(0, 0, 0, 0.5);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#7f000000', endColorstr='#7f000000')";color: white;position: absolute;top: 0px;width: 178px;margin-top: 98px;text-align: left;padding: 4px 0px 10px;line-height: 12px;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.page_album_title {white-space: nowrap;overflow: hidden;-o-text-overflow: ellipsis;text-overflow: ellipsis;max-width: 125px;font-weight: bold;margin-left: 6px;}
.page_album_camera {background: url(../images/camera_white.png) 0 2px no-repeat;padding-left: 14px;font-weight: bold;margin: 0px 6px;}
.page_album_description {max-width: 166px;margin: 5px 6px 0px;font-size: 0.9em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;-o-text-overflow: ellipsis;text-overflow: ellipsis;}
.page_album_title_wrap_descr:hover .page_album_title_wrap {margin-top:81px;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.photo_row {padding: 9px 9px 0px 10px;width: 250px;height: 196px;overflow: hidden;display: inline-block;vertical-align: top;}
.photo_row a.img_link {position: relative;display: block;width: 250px;height: 185px;overflow: hidden;text-align: center;background: #F1F1F1;}
.photo_row img {vertical-align: top;max-width:250px;}
.photo_album_title:not([dummy]) {-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled='false')";}
.photo_album_title {background: rgba(0, 0, 0, 0.5);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#7f000000', endColorstr='#7f000000')";color: white;position: absolute;top: 0px;width: 250px;margin-top: 163px;text-align: left;padding: 4px 0px 10px;line-height: 12px;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.photo_album_title div.description {margin-top: 5px;max-width: 250px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;-o-text-overflow: ellipsis;text-overflow: ellipsis;}
.photo_album_title div {margin: 0 7px;}
.photo_album_title div.ge_photos_album {white-space: nowrap;overflow: hidden;-o-text-overflow: ellipsis;text-overflow: ellipsis;max-width: 208px;font-weight: bold;margin-right: 5px;}
.photo_album_title div.camera {background: url(../images/camera_white.png) 0 2px no-repeat;padding-left: 14px;font-weight: bold;}
.photo_row .img_link.no_photo {background: #F1F1F1 url('../images/camera_big.png') 50% 60px no-repeat !important;}
.photo_row a.img_link {position: relative;display: block;width: 250px;height: 185px;overflow: hidden;text-align: center;background: #F1F1F1;}
.photo_row .no_photo div.camera, .photo_row .no_photo img {display: none;}
.photo_album_title_show:hover .photo_album_title{margin-top:144px;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
#albums_load_more {display: block;background: #eef2ee;margin: 0px 18px 15px;padding: 10px;text-align: center;color: #739273;}
#photos_load_more .progress, #albums_load_more .progress {margin: 0px auto;}
.progress, .progress_inv, .progress_inv_img {display: none;width: 32px;height: 13px;background: url(../images/upload.gif) no-repeat 50% 50%;}
#albums_load_more:hover {text-decoration: none;background: #e8f0e8;}
#photos_upload_area {background: #eef2ee;padding: 24px;text-align: center;border-bottom: 1px solid #e3ece3;color: #739273;font-size: 1.18em;line-height: 16px;display: block;}
#photos_upload_area:hover {background: #e8f0e8;text-decoration:none}
.photos_upload_area_img {background: url('../images/camera.png') left 0px no-repeat;padding: 3px 0px 3px 35px;}
.photo_row .photo_album_info, .photo_row .photo_album_privacy {position: absolute;top: 6px;right: 6px;width: 19px;height: 19px;}
.photo_row .photo_album_info_back {position: absolute;top: 0px;right: 0px;background-color: black;opacity: 0;filter: alpha(opacity=0);width: 20px;height: 20px;-webkit-border-radius: 2px;-moz-border-radius: 2px;border-radius: 2px;-webkit-transition: all 400ms ease-in-out;-moz-transition: all 400ms ease-in-out;-o-transition: all 400ms ease-in-out;transition: all 400ms ease-in-out;}
.photo_row .photo_album_info_cont {position: absolute;background: url(../images/photo_icons.png) 0px -47px no-repeat;top: 0px;right: 0px;opacity: 0;filter: alpha(opacity=0);width: 13px;height: 13px;padding: 0px;margin: 4px;-webkit-transition: all 400ms ease-in-out;-moz-transition: all 400ms ease-in-out;-o-transition: all 400ms ease-in-out;transition: all 400ms ease-in-out;}
.edit_owner:hover .photo_album_info_back {opacity:0.6;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.edit_owner:hover .photo_album_info_cont {opacity:1;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.photo_comment_info {float:left;width: 427px;}

/* PHOTO GROUPS */
.pv_can_edit:hover {cursor: pointer;margin: -5px 0px 10px;background: #E9EDF1;padding: 5px;}
.pv_can_edit, .pv_cant_edit {overflow: hidden;line-height: 1.37em;margin:-5px 0px 10px;padding: 5px;}
.pv_desc_edit {color: #777;}
.inpst_comments {vertical-align: top;width: 386px;height: 65px;margin-bottom: 10px;border:1px solid #c6dcc6;padding:3px 4px;}

/* COMMENTS ICONS */
.reply_actions_wrap {position: relative;z-index: 10;}
.reply_actions {height: 11px;width: 32px;padding-top: 4px;position: absolute;right: 0;}
.reply_delete_button, .reply_edit_button {background: url(../images/statusx_op.gif) 0 0 no-repeat;opacity:0;cursor: pointer;height: 11px;width: 11px;margin-left: 5px;}
.reply_edit_button {background-image: url(../images/statusedit.gif);opacity:0}
.wall_fast_block:hover .reply_delete_button, .wall_fast_block:hover .reply_edit_button {opacity:0.3;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.wall_fast_block:hover .reply_delete_button:hover {opacity:1;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.wall_fast_block:hover .reply_edit_button:hover {opacity:1;-webkit-transition: all 200ms ease-in-out;-moz-transition: all 200ms ease-in-out;-o-transition: all 200ms ease-in-out;transition: all 200ms ease-in-out;}
.reply_to_title {display: block;padding: 10px 5px 0px;white-space: nowrap;overflow: hidden;-o-text-overflow: ellipsis;text-overflow: ellipsis;}

3. Открываем ../Default/js/profile.js
Перед:

//PHOTOS

Вставляем:

//ALBUMS GROUPS
var AlbumsGroups = {
        CreatAlbum: function(j){
                var pid = '&pid='+$('#pid').val();
                Page.Loading('start');
                $.post('/index.php?go=groups_albums&act=create_page'+pid, {pid: j},  function(data){
                        Box.Show('albums', 410, lang_title_new_album, data, lang_box_canсel, 'Создать альбом', 'StartCreatAlbum(); return false;', 0, 0, 0, 0);
                        $('#name').focus();
                        Page.Loading('stop');
                });
        },
        Delete: function(id, hash){
                Box.Show('del_album_'+id, 410, 'Удаление альбома', '<div style="padding:15px;">'+lang_del_album+'</div>', lang_box_canсel, 'Удалить', 'AlbumsGroups.StartDelete('+id+', \''+hash+'\'); return false;');
        },
        StartDelete: function(id, hash){
                var pid = '&pid='+$('#pid').val();
                $('#box_loading').show();
                $.post('/index.php?go=groups_albums&act=del_album'+pid, {id: id, hash: hash}, function(d){
                        Box.Close('del_album_'+id);
                        $('#album_'+id).remove();
                        updateNum('#albums_num');
                        if($('.albums').size() < 1)
                                Page.Go(location.href);
                });
        },
        Drag: function(){
                var pid = '&pid='+$('#pid').val();
                $("#dragndrop ul").sortable({
                        cursor: 'move',
                        opacity: 0.9,
                        scroll: true,
                        update: function(){
                                var order = $(this).sortable("serialize");
                                $.post("/index.php?go=groups_albums&act=save_pos_albums"+pid, order, function(){});
                        }
                });
        },
        EditBox: function(id){
                var pid = '&pid='+$('#pid').val();
                Page.Loading('start');
                $.post('/index.php?go=groups_albums&act=edit_page'+pid, {id: id}, function(d){
                        Page.Loading('stop');
                        Box.Show('edit_albums_'+id, 410, lang_edit_albums, d, lang_box_canсel, lang_box_save, 'AlbumsGroups.SaveDescr('+id+'); return false', 0, 0, 0, 0);
                        $('#name_'+id).focus();
                });
        },
        SaveDescr: function(id){
                var pid = '&pid='+$('#pid').val();
                var name = $("#name_"+id).val();
                var descr = $("#descr_t"+id).val();
                var privated = $('#privated').val();
                if(name != 0){
                        $("#name_"+id).css('background', '#fff');
                        $('#box_loading').show();
                        $.post('/index.php?go=groups_albums&act=save_album'+pid, {id: id, name: name, descr: descr, privated: privated}, function(data){
                                $('#box_loading').hide();
                                if(data == 'no_name'){
                                        $('.err_red').show().text(lang_empty);
                                        ge('box_but').disabled = false;
                                } else if(data == 'no'){
                                        $('.err_red').show().text(lang_nooo_er);
                                        ge('box_but').disabled = false;
                                } else {
                                        Box.Close('edit_albums_'+id);
                                        row = data.split('|#|||#row#|||#|');
                                        $('#descr_'+id).html(row[1]);
                                        $('#albums_name_'+id).html(row[0]);
                                }
                        });
                } else {
                        $("#name_"+id).css('background', '#ffefef');
                        setTimeout("$('#name_"+id+"').css('background', '#fff').focus()", 800);
                        $('#box_loading').hide();
                }
        },
        EditCover: function(id, page_num){
                var pid = '&pid='+$('#pid').val();
                if(page_num)
                        page = '&page='+page_num;
                else {
                        page = '';
                        page_num = 1;
                }
                
                Box.Page(
                        '/index.php?go=groups_albums&act=edit_cover'+pid, //URL
                        'id='+id+page, //POST данные
                        'edit_cover_'+id+page_num, //ID
                        627, //Ширина окна
                        lang_edit_cover_album, //Заголовок окна
                        lang_box_canсel, //Имя кнопки для закртие окна
                        0, //Текст кнопки выполняющая функцию
                        0, //Сама функция для выполнения
                        400, //Высота окна
                        'overflow', //Скролл
                        'bg_show_top', //Внутреняя тень окна верх
                        'bg_show_bottom', //Внутреняя тень окна низ
                        '',
                        1
                );
        },
        SetCover: function(id, aid, photo){
                var pid = '&pid='+$('#pid').val();
                $('#box_loading').show();
                $.get('/index.php?go=groups_albums&act=set_cover'+pid, {id: id}, function(){
                        $('#cover_'+aid).attr('src', photo);
                        Box.Close('edit_cover_'+aid);
                        $('#box_loading').hide();
                });
        },
        MovePhoto: function(aid){
                var pid = '&pid='+$('#pid').val();
                $('#box_loading').show();
                $.get('/index.php?go=groups_albums&act=box_move_photo'+pid, {aid: aid}, function(data){
                        Box.Show('movephotos', 400, 'Перемещение фотографии', data, lang_msg_close);
                });
        },
        ChangeMove: function(aid){
                $('#value_album').val($('#change_move_box_album :selected').val());
        },
        MovingPhotos: function(id, aid){
                var pid = '&pid='+$('#pid').val();
                var from_aid = $('#value_album').val();
                $('#box_loading').show();
                $.get('/index.php?go=groups_albums&act=move_photo'+pid, {user_id: id, id: aid, from_album: from_aid}, function(data){
                        Box.Close('movephotos');
                });
        }
}
//PHOTOS GROUPS
var PhotoGroups = {
        Drag: function(){
                var pid = '&pid='+$('#pid').val();
                $("#dragndrop ul").sortable({
                        cursor: 'move',
                        scroll: false,
                        update: function(){
                                var order = $(this).sortable("serialize");
                                $.post("/index.php?go=groups_albums&act=save_pos_photos"+pid, order);
                        }
                });
        },
        Show: function(h){
                Distinguish.GeneralClose();
                var id = h.split('_');
                var uid = id[0].split('photo');
                var section = h.split('sec=');
                var fuser = h.split('wall/fuser=');
                var note_id = h.split('notes/id=');
                var msg_id = h.split('msg/id=');
                
                if(fuser[1])
                        section[1] = 'wall';
                        
                if(note_id[1]){
                        section[1] = 'notes';
                        fuser[1] = note_id[1];
                }
                
                if(msg_id[1]){
                        section[1] = 'msg';
                        fuser[1] = msg_id[1];
                }

                $('.photo_view').hide();
                
                if(is_moz && !is_chrome) scrollTopForFirefox = $(window).scrollTop();
                $('html').css('overflow', 'hidden');
                if(is_moz && !is_chrome) $(window).scrollTop(scrollTopForFirefox);

                if(ge('photo_view_'+id[1])){
                        $('#photo_view_'+id[1]).show();
                        history.pushState({link:h}, null, h);
                } else {
                        Photo.Loading('start');
                        $.post('/index.php?go=photo_groups', {uid: uid[1], pid: id[1], section: section[1], fuser: fuser[1]}, function(d){
                                if(d == 'no_photo'){
                                        Photo.Loading('stop');
                                        Box.Info('no_video', lang_dd2f_no, lang_photo_info_text, 300);
                                        $('html, body').css('overflow-y', 'auto');
                                        return false;
                                } else if(d == 'err_privacy'){
                                        Photo.Loading('stop');
                                        addAllErr(lang_pr_no_title);
                                        $('html, body').css('overflow-y', 'auto');
                                }
                                
                                if(section[1] != 'loaded')
                                        history.pushState({link:h}, null, h);
                                
                                $('body').append(d);
                                $('#photo_view_'+id[1]).show();

                                Photo.Loading('stop');
                        });
                }
        },
        Profile: function(uid, photo, type){
                Photo.Loading('start');
                $.post('/index.php?go=photo_groups&act=profile', {uid: uid, photo: photo, type: type}, function(d){
                        Photo.Loading('stop');
                        if(d == 'no_photo'){
                                Box.Info('no_video', lang_dd2f_no, lang_photo_info_text, 300);
                                $('html, body').css('overflow-y', 'auto');
                        } else {
                                $('body').append(d);
                                $('#photo_view').show();
                                $('html, body').css('overflow-y', 'hidden');
                        }
                });
        },
        Prev: function(h){
                var id = h.split('_');
                $('.photo_view').hide();
                $('html, body').css('overflow', 'hidden');

                $('.pinfo, .photo_prev_but, .photo_next_but').show();
                $('.save_crop_text').hide();
                $('.ladybug_ant').imgAreaSelect({remove: true});
                
                if(ge('photo_view_'+id[1])){
                        $('#photo_view_'+id[1]).show();
                        return false;
                } else {
                        Photo.Show(h);
                }
        },
        Close: function(close_link){
                $('.ladybug_ant').imgAreaSelect({remove: true});
                
                $('.photo_view').remove();
                $('html, body').css('overflow-y', 'auto');
                
                if(is_moz && !is_chrome) $(window).scrollTop(scrollTopForFirefox);

                if(close_link != false)
                        history.pushState({link: close_link}, null, close_link);
        },
        Loading: function(f){
                if(f == 'start'){
                        if(is_moz && !is_chrome) scrollTopForFirefox = $(window).scrollTop();
                        $('html').css('overflow', 'hidden');
                        if(is_moz && !is_chrome) $(window).scrollTop(scrollTopForFirefox);
                        var loadcontent = '<div class="photo_view" id="photo_load" style="padding-right:17px" onClick="PhotoGroups.setEvent(event, false)">'+
                        '<div class="photo_close" onClick="PhotoGroups.LoadingClose(); return false" style="right:15px;"></div>'+
                        '<div class="photo_bg" style="height:310px;padding-top:290px;">'+
                        '<center><img src="/templates/Default/images/progress.gif" alt="" /></center>'+
                        '</div>'+
                        '</div>';
                        $('body').append(loadcontent);
                        $('#photo_load').show();
                }
                if(f == 'stop')
                        $('#photo_load').remove();
        },
        LoadingClose: function(){
                $('#photo_load').remove();
                $('html, body').css('overflow-y', 'auto');
        },
        Init: function(target){
                this.target = $(target);
                var that = this;
                $(window).scroll(function(){
                        if ($(document).height() - $(window).height() <= $(window).scrollTop()){
                                alert(1);
                        }
                });
        },
        Panel: function(id, f){
                if(f == 'show')
                        $('#albums_photo_panel_'+id).show();
                else
                        $('#albums_photo_panel_'+id).hide();
        },
        MsgDelete: function(id, aid, type){
                Box.Show('del_photo_'+id, '400', lang_title_del_photo, '<div style="padding:15px;">'+lang_del_photo+'</div>', lang_box_canсel, lang_box_yes, 'PhotoGroups.Delete('+id+', '+aid+', '+type+'); return false');
        },
        Delete: function(id, aid, type){
                var pid = '&pid='+$('#pid').val();
                $('#box_loading').show();
                $.get('/index.php?go=groups_albums&act=del_photo'+pid, {id: id}, function(){
                        Box.Close('del_photo_'+id);
                        if(!type){
                                $('#a_photo_'+id).remove();
                                $('#p_jid'+id).remove();
                                
                                updateNum('#photo_num');
                        } else
                                $('#pinfo_'+id).html(lang_photo_info_delok);
                });
        },
        SetCover: function(id, jid){
                var pid = '&pid='+$('#pid').val();
                Page.Loading('start');
                $.get('/index.php?go=groups_albums&act=set_cover'+pid, {id: id}, function(){
                        $('.albums_new_cover').fadeOut();
                        $('#albums_new_cover_'+jid).fadeIn();
                        Page.Loading('stop');
                });
        },
        EditBox: function(id, r){
                var pid = '&pid='+$('#pid').val();
                Page.Loading('start');
                $.get('/index.php?go=groups_albums&act=editphoto'+pid, {id: id}, function(data){
                        Box.Show('edit_photo_'+id, '400', 'Редактирование фотографии', '<div class="box_ppad"><div  style="color:#888;padding-bottom:5px;"><b>Описание фотографии</b></div><textarea class="inpst" id="descr_'+id+'" style="width:355px;height:71px;">'+data+'</textarea></div>', 'Отмена', 'Сохранить', 'Photo.SaveDescr('+id+', '+r+'); return false');
                        Page.Loading('stop');
                });
        },
        SaveDescr: function(id, r){
                var pid = '&pid='+$('#pid').val();
                var descr = $('#descr_'+id).val();
                $('#box_loading').show();
                $.post('/index.php?go=groups_albums&act=save_descr'+pid, {id: id, descr: descr}, function(d){
                        Box.Close('edit_photo_'+id);
                        if(r == 1)
                                $('.photo_view').remove();
                        else
                                $('#photo_descr_'+id).html(d);
                });
        },
        setEvent: function(event, close_link){
                var oi = (event.target) ? event.target.id: ((event.srcElement) ? event.srcElement.id : null);
                var el = oi.substring(0, 10);
                if(el == 'photo_view' || el == 'photo_load')
                        Photo.Close(close_link);
        },
        Rotation: function(pos, id){
                $('#loading_gradus'+id).show();
                $.post('/index.php?go=photo_groups&act=rotation', {id: id, pos: pos}, function(d){
                        var rndval = new Date().getTime();
                        $('#ladybug_ant'+id).attr('src', d+'?'+rndval);
                        $('#loading_gradus'+id).hide();
                });
        },
        loadingAlbums: function(){
                var page_cnt = $('#page_cnt_albums').val();
                var count_albums = parseInt($('#num_albums').text());
                if($('#loading_albums').val() == 1 && (page_cnt*6)<=count_albums) {
                        $('#loading_albums').val(0);
                        $.post('/index.php?go=groups_albums&uid='+$('#pid').val(), {page_cnt: page_cnt}, function(d){
                                $('#page_cnt_albums').val(parseInt($('#page_cnt_albums').val())+1);
                                $('#dragndrop').find('ul').append(d);
                                if($('#dragndrop').find('ul > div').length>=count_albums) {$('#albums_load_more').detach();}
                                $('#loading_albums').val(1);
                        });
                }
        },
        loadingPhotos: function(){
                var page_cnt = $('#page_cnt_photos').val();
                var count_photos = parseInt($('#num_photos').val());
                if($('#loading_photos').val() == 1 && (page_cnt*30)<=count_photos) {
                        $('#loading_photos').val(0);
                        $.post('/index.php?go=groups_albums&uid='+$('#pid').val(), {page_cnt_photos: page_cnt}, function(d){
                                $('#page_cnt_photos').val(parseInt($('#page_cnt_photos').val())+1);
                                $('#page').append(d);
                                $('#loading_photos').val(1);
                        });
                }
        },
        wall_add_like: function(rec_id, user_id){
                if($('#wall_like_cnt'+rec_id).text()) var wall_like_cnt = parseInt($('#wall_like_cnt'+rec_id).text())+1;
                else {
                        $('#public_likes_user_block'+rec_id).show();
                        $('#update_like'+rec_id).val('1');
                        var wall_like_cnt = 1;
                }
                
                $('#wall_like_cnt'+rec_id).html(wall_like_cnt).css('color', '#2e782e');
                $('#wall_active_ic'+rec_id).addClass('public_wall_like_yes');
                $('#wall_like_link'+rec_id).attr('onClick', 'PhotoGroups.wall_remove_like('+rec_id+', '+user_id+')');
                $('#like_user'+user_id+'_'+rec_id).show();
                updateNum('#like_text_num'+rec_id, 1);
                
                $.post('/index.php?go=groups_albums&act=wall_like_yes', {rec_id: rec_id});
        },
        wall_remove_like: function(rec_id, user_id){
                var wall_like_cnt = parseInt($('#wall_like_cnt'+rec_id).text())-1;
                if(wall_like_cnt <= 0){
                        var wall_like_cnt = '';
                        $('#public_likes_user_block'+rec_id).hide();
                }
                
                $('#wall_like_cnt'+rec_id).html(wall_like_cnt).css('color', '#95c095');
                $('#wall_active_ic'+rec_id).removeClass('public_wall_like_yes');
                $('#wall_like_link'+rec_id).attr('onClick', 'PhotoGroups.wall_add_like('+rec_id+', '+user_id+')');
                $('#Xlike_user'+user_id+'_'+rec_id).hide();
                $('#like_user'+user_id+'_'+rec_id).hide();
                updateNum('#like_text_num'+rec_id);

                $.post('/index.php?go=groups_albums&act=wall_like_remove', {rec_id: rec_id});
        },
        wall_like_users_five: function(rec_id){
                $('.public_likes_user_block').hide();
                if(!ge('like_cache_block'+rec_id) && $('#wall_like_cnt'+rec_id).text() && $('#update_like'+rec_id).val() == 0){
                        $.post('/index.php?go=groups_albums&act=wall_like_users_five', {rec_id: rec_id}, function(data){
                                $('#likes_users'+rec_id).html(data+'<span id="like_cache_block'+rec_id+'"></span>');
                                $('#public_likes_user_block'+rec_id).show();
                        });
                } else
                        if($('#wall_like_cnt'+rec_id).text()) $('#public_likes_user_block'+rec_id).show();
        },
        wall_like_users_five_hide: function(){$('.public_likes_user_block').hide();},
        wall_all_liked_users: function(rid, page_num, liked_num){
                $('.public_likes_user_block').hide();
                
                if(page_num) page = '&page='+page_num;
                else {page = '';page_num = 1;}
                if(!liked_num) liked_num = 1;
                        
                Box.Page('/index.php?go=groups_albums&act=all_liked_users', 'rid='+rid+'&liked_num='+liked_num+page, 'all_liked_users_'+rid+page_num, 525, lang_wall_liked_users, lang_msg_close, 0, 0, 345, 1, 1, 1, 0, 1);
        }
}
// PHOTOS GROUPS COMMENTS
var commentsGroups = {
        add: function(id){
                var comment = $('#textcom_'+id).val();
                if(comment != 0){
                        butloading('add_comm', '56', 'disabled', '');
                        $.post('/index.php?go=photo_groups&act=addcomm', {pid: id, comment: comment},  function(data){
                                if(data == 'err_privacy'){
                                        addAllErr(lang_pr_no_title);
                                } else {
                                        $('#comments_'+id).append(data);
                                        $('#textcom_'+id).val('');
                                }
                                butloading('add_comm', '56', 'enabled', lang_box_send);
                        });
                } else {
                        $('#textcom_'+id).val('');
                        $('#textcom_'+id).focus();
                }
        },
        delet: function(id, hash){
                textLoad('del_but_'+id);
                $.post('/index.php?go=photo_groups&act=del_comm', {hash: hash}, function(){
                        $('#comment_'+id).html('<div style="padding-bottom:5px;color:#777;">'+lang_del_comm+'</div>');
                });
        },
        delet_page_comm: function(id, hash){
                textLoad('full_del_but_'+id);
                $.post('/index.php?go=photo_groups&act=del_comm', {hash: hash}, function(){
                        $('#comment_all_'+id).html('<div style="padding:25px;color:#777;">'+lang_del_comm+'</div>');
                });
        },
        all: function(id, num){
                textLoad('all_lnk_comm_'+id);
                $('#all_href_lnk_comm_'+id).attr('onClick', '').attr('href', '#');
                $.post('/index.php?go=photo_groups&act=all_comm', {pid: id, num: num}, function(d){
                        $('#all_href_lnk_comm_'+id).hide();
                        $('#all_comments_'+id).html(d);
                });
        },
}

4. Открываем ../Default/public/main.tpl
После:

 <span id="del_pho_but" class="{display-ava}"><a href="/" onClick="groups.delphoto('{id}'); return false;"><div>Удалить фотографию</div></a></span>

Вставляем:

   <a href="/albums-{public-id}" onClick="Page.Go(this.href); return false"><div>Альбомы</div></a>

Ищем:

[discussion]<div class="page_bg border_radius_5 margin_top_10" style="padding-bottom:0px">

Перед ней вставляем:

 [albums]<div class="b_albums {b_albums}"><div class="page_bg border_radius_5 margin_top_10"><a href="/albums-{public-id}" onClick="Page.Go(this.href); return false" style="text-decoration:none"><div class="albtitle albtitle2"><div class="profile_ic_albums fl_l"></div>Альбомы <span>{albums-num}</span></div></a>{albums}<div class="clear"></div></div>
 </div>[/albums]

 5. Открываем /system/mod.php
Ищем:

        //Регистрация
        case "register":
                include ENGINE_DIR.'/modules/register.php';
        break;

После вставляем:

                //Альбомы
        case "groups_albums":
                include ENGINE_DIR.'/modules/albums_groups.php';
        break;
        
        case "photo_groups":
                include ENGINE_DIR.'/modules/photo_groups.php';
        break;

6. Открываем /system/modules/functions.php
Ищем:

        //Выводим все фотографии из альбома и обновляем их позицию только для просмотра альбома
        if($uid AND $aid){
                $sql_ = $db->super_query("SELECT id FROM `".PREFIX."_photos` WHERE album_id = '{$aid}' ORDER by `position` ASC", 1);
                $count = 1;
                foreach($sql_ as $row){
                        $db->query("UPDATE LOW_PRIORITY `".PREFIX."_photos` SET position = '{$count}' WHERE id = '{$row['id']}'");
                        $photo_info .= $count.'|'.$row['id'].'||';
                        $count++;
                }
                mozg_create_cache('user_'.$uid.'/position_photos_album_'.$aid, $photo_info);
        }
}
function CheckFriends($friendId){
        global $user_info;
        
        $openMyList = mozg_cache("user_{$user_info['user_id']}/friends");

        if(stripos($openMyList, "u{$friendId}|") !== false)
                return true;
        else
                return false;
}
function CheckDemand($demandId){
    global $db, $user_info;

Заменяем на:

        //Выводим все фотографии из альбома и обновляем их позицию только для просмотра альбома
        if($uid AND $aid){
                $sql_ = $db->super_query("SELECT id FROM `".PREFIX."_photos` WHERE album_id = '{$aid}' ORDER by `position` ASC", 1);
                $count = 1;
                foreach($sql_ as $row){
                        $db->query("UPDATE LOW_PRIORITY `".PREFIX."_photos` SET position = '{$count}' WHERE id = '{$row['id']}'");
                        $photo_info .= $count.'|'.$row['id'].'||';
                        $count++;
                }
                mozg_create_cache('user_'.$uid.'/position_photos_album_'.$aid, $photo_info);
        }
}
function GenerateAlbumPhotosPositionGroups($uid, $aid = false){
        global $db;
        
        //Выводим все фотографии из альбома и обновляем их позицию только для просмотра альбома
        if($uid AND $aid){
                $sql_ = $db->super_query("SELECT SQL_CALC_FOUND_ROWS id FROM `".PREFIX."_communities_photos` WHERE album_id = '{$aid}' ORDER by `position` ASC", 1);
                $count = 1;
                foreach($sql_ as $row){
                        $db->query("UPDATE LOW_PRIORITY `".PREFIX."_communities_photos` SET position = '{$count}' WHERE id = '{$row['id']}'");
                        $photo_info .= $count.'|'.$row['id'].'||';
                        $count++;
                }
                mozg_create_cache('user_'.$uid.'/position_photos_album_groups_'.$aid, $photo_info);
        }
}
function CheckFriends($friendId){
        global $user_info;
        
        $openMyList = mozg_cache("user_{$user_info['user_id']}/friends");

        if(stripos($openMyList, "u{$friendId}|") !== false)
                return true;
        else
                return false;
}
function CheckDemand($demandId){
    global $db, $user_info;

7. Открываем /system/modules/groups.php
Ищем:

@chmod(ROOT_DIR.'/uploads/groups/'.$cid.'/photos/', 0777);

Ниже добавляем:

                                @mkdir(ROOT_DIR.'/uploads/groups/'.$cid.'/albums/', 0777);
                                @chmod(ROOT_DIR.'/uploads/groups/'.$cid.'/albums/', 0777);

      
8. Загружаем запрос vii.sql
9. Добавляем файлы из архива
        

Фотоальбомы в сообщества.rar

Ссылка на комментарий
Поделиться на другие сайты

PS: Есть один баг - все фото во всех сообществах будут идти от одного и того-же юзера (того, кто в бд будет идти первой строчкой, обычно /u1)

Ссылка на комментарий
Поделиться на другие сайты

PS: Есть один баг - все фото во всех сообществах будут идти от одного и того-же юзера (того, кто в бд будет идти первой строчкой, обычно /u1)

Как исправить?

Ссылка на комментарий
Поделиться на другие сайты

  • 8 месяцев спустя...

PS: Есть один баг - все фото во всех сообществах будут идти от одного и того-же юзера (того, кто в бд будет идти первой строчкой, обычно /u1)

Как исправить?

Ссылка на комментарий
Поделиться на другие сайты

×
×
  • Создать...