diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-02-24 08:42:25 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-02-24 08:42:25 +0100 |
commit | f6d024cb3f2663cd1d61e5fc18546adb93b9a7db (patch) | |
tree | d4067d517bfa67c20e9bae0a41d3a882f419735d /view | |
parent | 1c750dac4187c3872e29c79f0c0856ec8a29331e (diff) | |
parent | e6f9f284bf04f0dc0471fa08d7dac118effe4ccb (diff) | |
download | volse-hubzilla-f6d024cb3f2663cd1d61e5fc18546adb93b9a7db.tar.gz volse-hubzilla-f6d024cb3f2663cd1d61e5fc18546adb93b9a7db.tar.bz2 volse-hubzilla-f6d024cb3f2663cd1d61e5fc18546adb93b9a7db.zip |
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'view')
-rw-r--r-- | view/js/mod_cover_photo.js | 83 | ||||
-rw-r--r-- | view/js/mod_profile_photo.js | 83 | ||||
-rwxr-xr-x | view/tpl/cover_photo.tpl | 25 | ||||
-rwxr-xr-x | view/tpl/profile_photo.tpl | 30 | ||||
-rwxr-xr-x | view/tpl/profile_vcard.tpl | 2 |
5 files changed, 218 insertions, 5 deletions
diff --git a/view/js/mod_cover_photo.js b/view/js/mod_cover_photo.js new file mode 100644 index 000000000..b9af8ce5c --- /dev/null +++ b/view/js/mod_cover_photo.js @@ -0,0 +1,83 @@ + var initializeEmbedPhotoDialog = function () { + $('.embed-photo-selected-photo').each(function (index) { + $(this).removeClass('embed-photo-selected-photo'); + }); + getPhotoAlbumList(); + $('#embedPhotoModalBodyAlbumDialog').off('click'); + $('#embedPhotoModal').modal('show'); + }; + + var choosePhotoFromAlbum = function (album) { + $.post("embedphotos/album", {name: album}, + function(data) { + if (data['status']) { + $('#embedPhotoModalLabel').html("{{$modalchooseimages}}"); + $('#embedPhotoModalBodyAlbumDialog').html('\ + <div><div class="nav nav-pills flex-column">\n\ + <li class="nav-item"><a class="nav-link" href="#" onclick="initializeEmbedPhotoDialog();return false;">\n\ + <i class="fa fa-chevron-left"></i> \n\ + {{$modaldiffalbum}}\n\ + </a>\n\ + </li>\n\ + </div><br></div>') + $('#embedPhotoModalBodyAlbumDialog').append(data['content']); + $('#embedPhotoModalBodyAlbumDialog').click(function (evt) { + evt.preventDefault(); + var image = document.getElementById(evt.target.id); + if (typeof($(image).parent()[0]) !== 'undefined') { + var imageparent = document.getElementById($(image).parent()[0].id); + $(imageparent).toggleClass('embed-photo-selected-photo'); + } + }); + $('#embedPhotoModalBodyAlbumListDialog').addClass('d-none'); + $('#embedPhotoModalBodyAlbumDialog').removeClass('d-none'); + $('#embed-photo-OKButton').click(function () { + $('.embed-photo-selected-photo').each(function (index) { + var href = $(this).attr('href'); + $.post("embedphotos/photolink", {href: href}, + function(ddata) { + if (ddata['status']) { + window.location.href = 'cover_photo/use/' + ddata['resource_id']; + } else { + window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']); + } + return false; + }, + 'json'); + }); + $('#embedPhotoModalBodyAlbumDialog').html(''); + $('#embedPhotoModalBodyAlbumDialog').off('click'); + $('#embedPhotoModal').modal('hide'); + }); + } else { + window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']); + } + return false; + }, + 'json'); + }; + + var getPhotoAlbumList = function () { + $.post("embedphotos/albumlist", {}, + function(data) { + if (data['status']) { + var albums = data['albumlist']; //JSON.parse(data['albumlist']); + $('#embedPhotoModalLabel').html("{{$modalchoosealbum}}"); + $('#embedPhotoModalBodyAlbumList').html('<ul class="nav nav-pills flex-column"></ul>'); + for(var i=0; i<albums.length; i++) { + var albumName = albums[i].text; + var jsAlbumName = albums[i].jstext; + var albumLink = '<li class="nav-item">'; + albumLink += '<a class="nav-link" href="#" onclick="choosePhotoFromAlbum(\'' + jsAlbumName + '\'); return false;">' + albumName + '</a>'; + albumLink += '</li>'; + $('#embedPhotoModalBodyAlbumList').find('ul').append(albumLink); + } + $('#embedPhotoModalBodyAlbumDialog').addClass('d-none'); + $('#embedPhotoModalBodyAlbumListDialog').removeClass('d-none'); + } else { + window.console.log("{{$modalerrorlist}}" + ':' + data['errormsg']); + } + return false; + }, + 'json'); + }; diff --git a/view/js/mod_profile_photo.js b/view/js/mod_profile_photo.js new file mode 100644 index 000000000..76b120684 --- /dev/null +++ b/view/js/mod_profile_photo.js @@ -0,0 +1,83 @@ + var initializeEmbedPhotoDialog = function () { + $('.embed-photo-selected-photo').each(function (index) { + $(this).removeClass('embed-photo-selected-photo'); + }); + getPhotoAlbumList(); + $('#embedPhotoModalBodyAlbumDialog').off('click'); + $('#embedPhotoModal').modal('show'); + }; + + var choosePhotoFromAlbum = function (album) { + $.post("embedphotos/album", {name: album}, + function(data) { + if (data['status']) { + $('#embedPhotoModalLabel').html("{{$modalchooseimages}}"); + $('#embedPhotoModalBodyAlbumDialog').html('\ + <div><div class="nav nav-pills flex-column">\n\ + <li class="nav-item"><a class="nav-link" href="#" onclick="initializeEmbedPhotoDialog();return false;">\n\ + <i class="fa fa-chevron-left"></i> \n\ + {{$modaldiffalbum}}\n\ + </a>\n\ + </li>\n\ + </div><br></div>') + $('#embedPhotoModalBodyAlbumDialog').append(data['content']); + $('#embedPhotoModalBodyAlbumDialog').click(function (evt) { + evt.preventDefault(); + var image = document.getElementById(evt.target.id); + if (typeof($(image).parent()[0]) !== 'undefined') { + var imageparent = document.getElementById($(image).parent()[0].id); + $(imageparent).toggleClass('embed-photo-selected-photo'); + } + }); + $('#embedPhotoModalBodyAlbumListDialog').addClass('d-none'); + $('#embedPhotoModalBodyAlbumDialog').removeClass('d-none'); + $('#embed-photo-OKButton').click(function () { + $('.embed-photo-selected-photo').each(function (index) { + var href = $(this).attr('href'); + $.post("embedphotos/photolink", {href: href}, + function(ddata) { + if (ddata['status']) { + window.location.href = 'profile_photo/use/' + ddata['resource_id']; + } else { + window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']); + } + return false; + }, + 'json'); + }); + $('#embedPhotoModalBodyAlbumDialog').html(''); + $('#embedPhotoModalBodyAlbumDialog').off('click'); + $('#embedPhotoModal').modal('hide'); + }); + } else { + window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']); + } + return false; + }, + 'json'); + }; + + var getPhotoAlbumList = function () { + $.post("embedphotos/albumlist", {}, + function(data) { + if (data['status']) { + var albums = data['albumlist']; //JSON.parse(data['albumlist']); + $('#embedPhotoModalLabel').html("{{$modalchoosealbum}}"); + $('#embedPhotoModalBodyAlbumList').html('<ul class="nav nav-pills flex-column"></ul>'); + for(var i=0; i<albums.length; i++) { + var albumName = albums[i].text; + var jsAlbumName = albums[i].jstext; + var albumLink = '<li class="nav-item">'; + albumLink += '<a class="nav-link" href="#" onclick="choosePhotoFromAlbum(\'' + jsAlbumName + '\'); return false;">' + albumName + '</a>'; + albumLink += '</li>'; + $('#embedPhotoModalBodyAlbumList').find('ul').append(albumLink); + } + $('#embedPhotoModalBodyAlbumDialog').addClass('d-none'); + $('#embedPhotoModalBodyAlbumListDialog').removeClass('d-none'); + } else { + window.console.log("{{$modalerrorlist}}" + ':' + data['errormsg']); + } + return false; + }, + 'json'); + }; diff --git a/view/tpl/cover_photo.tpl b/view/tpl/cover_photo.tpl index 4352501ae..7ad4482e4 100755 --- a/view/tpl/cover_photo.tpl +++ b/view/tpl/cover_photo.tpl @@ -21,9 +21,30 @@ </form> <br /> - <br /> <div id="profile-photo-link-select-wrapper"> - {{$select}} + <button id="embed-photo-wrapper" class="btn btn-default btn-primary" title="{{$embedPhotos}}" onclick="initializeEmbedPhotoDialog();return false;"> + <i id="embed-photo" class="fa fa-file-image-o"></i> {{$select}} + </button> </div> </div> </div> +<div class="modal" id="embedPhotoModal" tabindex="-1" role="dialog" aria-labelledby="embedPhotoLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h4> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <div class="modal-body" id="embedPhotoModalBody" > + <div id="embedPhotoModalBodyAlbumListDialog" class="d-none"> + <div id="embedPhotoModalBodyAlbumList"></div> + </div> + <div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button> + <button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> +</div><!-- /.modal --> diff --git a/view/tpl/profile_photo.tpl b/view/tpl/profile_photo.tpl index ca107bfcc..1f468c2e5 100755 --- a/view/tpl/profile_photo.tpl +++ b/view/tpl/profile_photo.tpl @@ -22,6 +22,8 @@ <input type="hidden" name="profile" value="{{$profile0.id}}" /> {{else}} + + <label id="profile-photo-profiles-label" class="form-label" for="profile-photo-profiles">{{$lbl_profiles}}</label> <select name="profile" id="profile-photo-profiles" class="form-control" > {{foreach $profiles as $p}} @@ -33,6 +35,8 @@ <br /> {{/if}} + + <div id="profile-photo-submit-wrapper"> <input type="submit" name="submit" id="profile-photo-submit" value="{{$submit}}"> </div> @@ -40,9 +44,31 @@ </form> <br /> - <br /> <div id="profile-photo-link-select-wrapper"> - {{$select}} + <button id="embed-photo-wrapper" class="btn btn-default btn-primary" title="{{$embedPhotos}}" onclick="initializeEmbedPhotoDialog();return false;"> + <i id="embed-photo" class="fa fa-file-image-o"></i> {{$select}} + </button> </div> </div> </div> + +<div class="modal" id="embedPhotoModal" tabindex="-1" role="dialog" aria-labelledby="embedPhotoLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h4> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <div class="modal-body" id="embedPhotoModalBody" > + <div id="embedPhotoModalBodyAlbumListDialog" class="d-none"> + <div id="embedPhotoModalBodyAlbumList"></div> + </div> + <div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button> + <button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> +</div><!-- /.modal --> diff --git a/view/tpl/profile_vcard.tpl b/view/tpl/profile_vcard.tpl index 0f30e5816..07e6dcc0a 100755 --- a/view/tpl/profile_vcard.tpl +++ b/view/tpl/profile_vcard.tpl @@ -1,6 +1,6 @@ <div class="vcard h-card"> {{if ! $zcard}} - <div id="profile-photo-wrapper"><img class="photo u-photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.fullname}}"></div> + <div id="profile-photo-wrapper">{{if $editmenu}}<a href="profile_photo" title="{{$change_photo}}">{{/if}}<img class="photo u-photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.fullname}}">{{if $editmenu}}</a>{{/if}}</div> {{/if}} {{if $connect}} <div class="connect-btn-wrapper"><a href="{{$connect_url}}" class="btn btn-block btn-success btn-sm"><i class="fa fa-plus"></i> {{$connect}}</a></div> |