diff options
author | Andrew Manning <tamanning@zoho.com> | 2018-02-24 06:48:56 -0500 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2018-02-24 06:48:56 -0500 |
commit | 497ebca54f5eaa74a1e9c9e4c5183c5565ce09e8 (patch) | |
tree | 784b6afd1e7b5f855dce8c4d1d703697cdac56e6 | |
parent | 64ee42fc3d00765bc5c60e451b86230ea38ffdfb (diff) | |
parent | f6d024cb3f2663cd1d61e5fc18546adb93b9a7db (diff) | |
download | volse-hubzilla-497ebca54f5eaa74a1e9c9e4c5183c5565ce09e8.tar.gz volse-hubzilla-497ebca54f5eaa74a1e9c9e4c5183c5565ce09e8.tar.bz2 volse-hubzilla-497ebca54f5eaa74a1e9c9e4c5183c5565ce09e8.zip |
Merge branch 'dev' into oauth2
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Cloud.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Cover_photo.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Embedphotos.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Go.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Import.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Profile_photo.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Account.php | 2 | ||||
-rw-r--r-- | Zotlabs/Storage/Browser.php | 5 | ||||
-rw-r--r-- | Zotlabs/Update/_1204.php | 34 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/channel.php | 5 | ||||
-rw-r--r-- | install/schema_mysql.sql | 6 | ||||
-rw-r--r-- | install/schema_postgres.sql | 6 | ||||
-rw-r--r-- | view/js/mod_cover_photo.js | 83 | ||||
-rw-r--r-- | view/js/mod_new_channel.js | 3 | ||||
-rw-r--r-- | view/js/mod_profile_photo.js | 83 | ||||
-rw-r--r-- | view/tpl/cloud_header.tpl | 5 | ||||
-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 |
22 files changed, 306 insertions, 21 deletions
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index ca181d5f8..b7c558ce7 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -299,7 +299,7 @@ class Site { '$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ], - '$banner' => array('banner', t("Banner/Logo"), $banner, ""), + '$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index 2215507ca..8b5476efc 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -110,6 +110,9 @@ class Cloud extends \Zotlabs\Web\Controller { elseif($err instanceof \Sabre\DAV\Exception\Forbidden) { notice( t('Permission denied') . EOL); } + elseif($err instanceof \Sabre\DAV\Exception\NotImplemented) { + notice( t('Please refresh page') . EOL); + } else { notice( t('Unknown error') . EOL); } diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index cfb513365..047bcf3d4 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -357,12 +357,17 @@ class Cover_photo extends \Zotlabs\Web\Controller { '$user' => \App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), - '$title' => t('Upload Cover Photo'), + '$title' => t('Change Cover Photo'), '$submit' => t('Upload'), '$profiles' => $profiles, + '$embedPhotos' => t('Use a photo from your albums'), + '$embedPhotosModalTitle' => t('Use a photo from your albums'), + '$embedPhotosModalCancel' => t('Cancel'), + '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("cover_photo"), /// @FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') + '$select' => t('Select existing photo'), + )); call_hooks('cover_photo_content_end', $o); diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php index 15cc68d7f..bcbb0e116 100644 --- a/Zotlabs/Module/Embedphotos.php +++ b/Zotlabs/Module/Embedphotos.php @@ -53,7 +53,7 @@ class Embedphotos extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false)); } - json_return_and_die(array('status' => true, 'photolink' => $photolink)); + json_return_and_die(array('status' => true, 'photolink' => $photolink, 'resource_id' => $resource_id)); } } diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php index 2c2dcf460..d23e940c3 100644 --- a/Zotlabs/Module/Go.php +++ b/Zotlabs/Module/Go.php @@ -33,6 +33,7 @@ class Go extends \Zotlabs\Web\Controller { $options = [ 'profile_photo' => t('Upload a profile photo'), + 'cover_photo' => t('Upload a cover photo'), 'profiles' => t('Edit your default profile'), 'suggest' => t('View friend suggestions'), 'directory' => t('View the directory to find other interesting channels'), diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 2b16ff4e1..36bd72310 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -64,7 +64,7 @@ class Import extends \Zotlabs\Web\Controller { notice( t('Nothing to import.') . EOL); return; } else if(strpos($old_address, '@')) { - // if you copy the identity address from your profile page, make it work for convenience + // if you copy the identity address from your profile page, make it work for convenience - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit. $old_address = str_replace('@', '@', $old_address); } diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 222b92721..c772f0ed3 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -441,14 +441,17 @@ class Profile_photo extends \Zotlabs\Web\Controller { '$importfile' => (($importing) ? \App::$data['importfile'] : ''), '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), - '$title' => (($importing) ? t('Use Photo for Profile') : t('Upload Profile Photo')), + '$title' => (($importing) ? t('Use Photo for Profile') : t('Change Profile Photo')), '$submit' => (($importing) ? t('Use') : t('Upload')), '$profiles' => $profiles, '$single' => ((count($profiles) == 1) ? true : false), '$profile0' => $profiles[0], + '$embedPhotos' => t('Use a photo from your albums'), + '$embedPhotosModalTitle' => t('Use a photo from your albums'), + '$embedPhotosModalCancel' => t('Cancel'), + '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("profile_photo"), - // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . z_root() . '">' . t('skip this step') . '</a>' : '<a href="'. z_root() . '/photos/' . \App::$channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') + '$select' => t('Select existing photo'), )); call_hooks('profile_photo_content_end', $o); diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index af7bc7658..79f205a22 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,10 +12,16 @@ class Pubstream extends \Zotlabs\Web\Controller { if($load) $_SESSION['loadtime'] = datetime_convert(); - if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) { + if((observer_prohibited(true))) { return login(); } + if(! intval(get_config('system','open_pubstream',1))) { + if(! get_observer_hash()) { + return login(); + } + } + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php index 18890e89f..9643c5958 100644 --- a/Zotlabs/Module/Settings/Account.php +++ b/Zotlabs/Module/Settings/Account.php @@ -113,7 +113,7 @@ class Account { '$origpass' => array('origpass', t('Current Password'), ' ',''), '$password1'=> array('npassword', t('Enter New Password'), '', ''), '$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')), - '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience matched to your comfort level'), $techlevels ], + '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ], '$techlock' => $techlock, '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index c21b68971..f1c95802b 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -264,7 +264,10 @@ class Browser extends DAV\Browser\Plugin { $this->server->emit('onHTMLActionsPanel', array($parent, &$output, $path)); } - + $deftiles = (($is_owner) ? 0 : 1); + $tiles = ((array_key_exists('cloud_tiles',$_SESSION)) ? intval($_SESSION['cloud_tiles']) : $deftiles); + $_SESSION['cloud_tiles'] = $tiles; + $html .= replace_macros(get_markup_template('cloud.tpl'), array( '$header' => t('Files') . ": " . $this->escapeHTML($path) . "/", '$total' => t('Total'), diff --git a/Zotlabs/Update/_1204.php b/Zotlabs/Update/_1204.php new file mode 100644 index 000000000..93c2e4e3f --- /dev/null +++ b/Zotlabs/Update/_1204.php @@ -0,0 +1,34 @@ +<?php + +namespace Zotlabs\Update; + +class _1204 { + + function run() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE poll ADD poll_guid text NOT NULL"); + $r2 = q("create index \"poll_guid_idx\" on poll \"poll_guid\""); + $r3 = q("ALTER TABLE poll_elm ADD pelm_guid text NOT NULL"); + $r4 = q("create index \"pelm_guid_idx\" on poll_elm \"pelm_guid\""); + $r5 = q("ALTER TABLE vote ADD vote_guid text NOT NULL"); + $r6 = q("create index \"vote_guid_idx\" on vote \"vote_guid\""); + + $r = ($r1 && $r2 && $r3 && $r4 && $r5 && $r6); + } + else { + $r1 = q("ALTER TABLE `poll` ADD `poll_guid` VARCHAR(191) NOT NULL, ADD INDEX `poll_guid` (`poll_guid`) "); + $r2 = q("ALTER TABLE `poll_elm` ADD `pelm_guid` VARCHAR(191) NOT NULL, ADD INDEX `pelm_guid` (`pelm_guid`) "); + $r3 = q("ALTER TABLE `vote` ADD `vote_guid` VARCHAR(191) NOT NULL, ADD INDEX `vote_guid` (`vote_guid`) "); + + $r = ($r1 && $r2 && $r3); + } + + if($r) + return UPDATE_SUCCESS; + + return UPDATE_FAILED; + + } + +} @@ -53,7 +53,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '3.1.12' ); define ( 'ZOT_REVISION', '1.3' ); -define ( 'DB_UPDATE_VERSION', 1203 ); +define ( 'DB_UPDATE_VERSION', 1204 ); define ( 'PROJECT_BASE', __DIR__ ); diff --git a/include/channel.php b/include/channel.php index 625ce16c8..a8ddfa978 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1449,6 +1449,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa '$reddress' => $reddress, '$rating' => '', '$contact_block' => $contact_block, + '$change_photo' => t('Change your profile photo'), '$editmenu' => profile_edit_menu($profile['uid']) )); @@ -1897,7 +1898,7 @@ function get_profile_fields_basic($filter = 0) { $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null); if(! $profile_fields_basic) - $profile_fields_basic = array('fullname','pdesc','chandesc','comms','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); + $profile_fields_basic = array('fullname','pdesc','chandesc','comms','gender','dob','dob_tz','region','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); $x = array(); if($profile_fields_basic) @@ -1912,7 +1913,7 @@ function get_profile_fields_advanced($filter = 0) { $basic = get_profile_fields_basic($filter); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); if(! $profile_fields_advanced) - $profile_fields_advanced = array('partner','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','employment','education'); + $profile_fields_advanced = array('address','locality','postal_code','partner','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','employment','education'); $x = array(); if($basic) diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 36cd2539b..e1a63c1e3 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -964,11 +964,13 @@ CREATE TABLE IF NOT EXISTS `photo` ( CREATE TABLE IF NOT EXISTS `poll` ( `poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `poll_guid` varchar(191) NOT NULL, `poll_channel` int(10) unsigned NOT NULL DEFAULT 0 , `poll_desc` text NOT NULL, `poll_flags` int(11) NOT NULL DEFAULT 0 , `poll_votes` int(11) NOT NULL DEFAULT 0 , PRIMARY KEY (`poll_id`), + KEY `poll_guid` (`poll_guid`), KEY `poll_channel` (`poll_channel`), KEY `poll_flags` (`poll_flags`), KEY `poll_votes` (`poll_votes`) @@ -976,11 +978,13 @@ CREATE TABLE IF NOT EXISTS `poll` ( CREATE TABLE IF NOT EXISTS `poll_elm` ( `pelm_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `pelm_guid` varchar(191) NOT NULL, `pelm_poll` int(10) unsigned NOT NULL DEFAULT 0 , `pelm_desc` text NOT NULL, `pelm_flags` int(11) NOT NULL DEFAULT 0 , `pelm_result` float NOT NULL DEFAULT 0 , PRIMARY KEY (`pelm_id`), + KEY `pelm_guid` (`pelm_guid`), KEY `pelm_poll` (`pelm_poll`), KEY `pelm_result` (`pelm_result`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; @@ -1258,12 +1262,14 @@ CREATE TABLE IF NOT EXISTS `verify` ( CREATE TABLE IF NOT EXISTS `vote` ( `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `vote_guid` varchar(191) NOT NULL, `vote_poll` int(11) NOT NULL DEFAULT 0 , `vote_element` int(11) NOT NULL DEFAULT 0 , `vote_result` text NOT NULL, `vote_xchan` char(191) NOT NULL DEFAULT '', PRIMARY KEY (`vote_id`), UNIQUE KEY `vote_vote` (`vote_poll`,`vote_element`,`vote_xchan`), + KEY `vote_guid` (`vote_guid`), KEY `vote_poll` (`vote_poll`), KEY `vote_element` (`vote_element`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 082817a60..84b6a554a 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -942,6 +942,7 @@ create index "photo_os_storage" on photo ("os_storage"); CREATE TABLE "poll" ( "poll_id" serial NOT NULL, + "poll_guid" text NOT NULL, "poll_channel" bigint NOT NULL DEFAULT '0', "poll_desc" text NOT NULL, "poll_flags" bigint NOT NULL DEFAULT '0', @@ -949,17 +950,20 @@ CREATE TABLE "poll" ( PRIMARY KEY ("poll_id") ); +create index "poll_guid" on poll ("poll_guid"); create index "poll_channel" on poll ("poll_channel"); create index "poll_flags" on poll ("poll_flags"); create index "poll_votes" on poll ("poll_votes"); CREATE TABLE "poll_elm" ( "pelm_id" serial NOT NULL, + "pelm_guid" text NOT NULL, "pelm_poll" bigint NOT NULL DEFAULT '0', "pelm_desc" text NOT NULL, "pelm_flags" bigint NOT NULL DEFAULT '0', "pelm_result" float NOT NULL DEFAULT '0', PRIMARY KEY ("pelm_id") ); +create index "pelm_guid" on poll_elm ("pelm_guid"); create index "pelm_poll" on poll_elm ("pelm_poll"); create index "pelm_result" on poll_elm ("pelm_result"); @@ -1227,6 +1231,7 @@ create index "verify_meta" on verify ("meta"); create index "verify_created" on verify ("created"); CREATE TABLE "vote" ( "vote_id" serial NOT NULL, + "vote_guid" text NOT NULL, "vote_poll" bigint NOT NULL DEFAULT '0', "vote_element" bigint NOT NULL DEFAULT '0', "vote_result" text NOT NULL, @@ -1234,6 +1239,7 @@ CREATE TABLE "vote" ( PRIMARY KEY ("vote_id"), UNIQUE ("vote_poll","vote_element","vote_xchan") ); +create index "vote_guid" on vote ("vote_guid"); create index "vote_poll" on vote ("vote_poll"); create index "vote_element" on vote ("vote_element"); CREATE TABLE "xchan" ( 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_new_channel.js b/view/js/mod_new_channel.js index 7ae59032a..e78de2596 100644 --- a/view/js/mod_new_channel.js +++ b/view/js/mod_new_channel.js @@ -11,6 +11,9 @@ $("#help_name").html(""); zFormError("#help_name",data.error); } + else { + $("#newchannel-submit-button").removeAttr('disabled'); + } $("#name-spinner").hide(); }); }); 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/cloud_header.tpl b/view/tpl/cloud_header.tpl index 468f2febc..307dc8956 100644 --- a/view/tpl/cloud_header.tpl +++ b/view/tpl/cloud_header.tpl @@ -1,14 +1,15 @@ <div class="section-title-wrapper"> - {{if $actionspanel}} <div class="pull-right"> <a href="cloud_tiles/{{$cpath}}" class="btn btn-sm btn-outline-secondary"><i class="fa fa-fw {{if $tiles}}fa-list-ul{{else}}fa-table{{/if}}"></i></a> + {{if $actionspanel}} {{if $is_owner}} <a href="/sharedwithme" class="btn btn-sm btn-outline-secondary"><i class="fa fa-cloud-download"></i> {{$shared}}</a> {{/if}} <button id="files-create-btn" class="btn btn-sm btn-primary" onclick="openClose('files-mkdir-tools'); closeMenu('files-upload-tools');"><i class="fa fa-folder-o"></i> {{$create}}</button> <button id="files-upload-btn" class="btn btn-sm btn-success" onclick="openClose('files-upload-tools'); closeMenu('files-mkdir-tools');"><i class="fa fa-arrow-circle-o-up"></i> {{$upload}}</button> + {{/if}} </div> - {{/if}} + <h2>{{$header}}</h2> <div class="clear"></div> </div> 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> |