Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boostrap themes fix #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
.pshare {
padding: 10px 0 10px 7px;
}

.pshare a {
text-decoration:none !important;
.pwg-button.pshare-open {
font-size: 17px;
}

#pshare_form {
Expand Down
20 changes: 17 additions & 3 deletions main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function pshare_init()
global $conf;

load_language('plugin.lang', PSHARE_PATH);

global $template;

$template->set_template_dir(PSHARE_PATH.'template/');
}

add_event_handler('get_admin_plugin_menu_links', 'pshare_admin_menu');
Expand Down Expand Up @@ -199,7 +203,7 @@ function pshare_section_init()
exit();
}

$template->set_filename('shared_picture', realpath(PSHARE_PATH.'template/shared_picture.tpl'));
$template->set_filename('shared_picture', 'shared_picture.tpl');

$derivative = new DerivativeImage(ImageStdParams::get_by_type(IMG_MEDIUM), $src_image);

Expand Down Expand Up @@ -248,6 +252,16 @@ function pshare_section_init()
}
}

add_event_handler('loc_begin_picture', 'pshare_begin_picture');
function pshare_begin_picture()
{
global $template;

$template->set_filename('pshare_button_share', 'button_private_share_picture.tpl');
$template->add_picture_button($template->parse('pshare_button_share', true), 50);
}


add_event_handler('loc_end_picture', 'pshare_end_picture');
function pshare_end_picture()
{
Expand All @@ -267,8 +281,8 @@ function pshare_end_picture()

if (!isset($conf['use_pshare_picture_template']) or $conf['use_pshare_picture_template'])
{
$template->set_filename('pshare_picture', realpath(PSHARE_PATH.'template/picture.tpl'));
$template->assign_var_from_handle('PSHARE_CONTENT', 'pshare_picture');
$template->set_filename('pshare_picture', 'private_share_picture.tpl');
$template->parse('pshare_picture');
}
}

Expand Down
163 changes: 163 additions & 0 deletions patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
diff --git a/css/style.css b/css/style.css
index 9e7bd5a..cca6d9f 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,9 +1,5 @@
-.pshare {
- padding: 10px 0 10px 7px;
-}
-
-.pshare a {
- text-decoration:none !important;
+.pwg-button.pshare-open {
+ font-size: 17px;
}

#pshare_form {
diff --git a/main.inc.php b/main.inc.php
index 831eadf..b9d097c 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -26,6 +26,10 @@ function pshare_init()
global $conf;

load_language('plugin.lang', PSHARE_PATH);
+
+ global $template;
+
+ $template->set_template_dir(PSHARE_PATH.'template/');
}

add_event_handler('get_admin_plugin_menu_links', 'pshare_admin_menu');
@@ -199,7 +203,7 @@ SELECT
exit();
}

- $template->set_filename('shared_picture', realpath(PSHARE_PATH.'template/shared_picture.tpl'));
+ $template->set_filename('shared_picture', 'shared_picture.tpl');

$derivative = new DerivativeImage(ImageStdParams::get_by_type(IMG_MEDIUM), $src_image);

@@ -248,6 +252,16 @@ SELECT *
}
}

+add_event_handler('loc_begin_picture', 'pshare_begin_picture');
+function pshare_begin_picture()
+{
+ global $template;
+
+ $template->set_filename('pshare_button_share', 'button_private_share_picture.tpl');
+ $template->add_picture_button($template->parse('pshare_button_share', true), 50);
+}
+
+
add_event_handler('loc_end_picture', 'pshare_end_picture');
function pshare_end_picture()
{
@@ -267,8 +281,8 @@ function pshare_end_picture()

if (!isset($conf['use_pshare_picture_template']) or $conf['use_pshare_picture_template'])
{
- $template->set_filename('pshare_picture', realpath(PSHARE_PATH.'template/picture.tpl'));
- $template->assign_var_from_handle('PSHARE_CONTENT', 'pshare_picture');
+ $template->set_filename('pshare_picture', 'private_share_picture.tpl');
+ $template->parse('pshare_picture');
}
}

diff --git a/template/picture.tpl b/template/picture.tpl
deleted file mode 100644
index 157c4b7..0000000
--- a/template/picture.tpl
+++ /dev/null
@@ -1,88 +0,0 @@
-{combine_css path="plugins/private_share/css/fontello/css/pshare-fontello.css"}
-
-{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
-{combine_css id='colorbox' path='themes/default/js/plugins/colorbox/style2/colorbox.css'}
-{combine_css path='plugins/private_share/css/style.css'}
-
-<div class="pshare"><a href="#pshare" title="{'Share'|translate}" class="pshare-open pshare-icon-share">{'Share'|translate}</a></div>
-
-{footer_script require='jquery'}
-// popup
-jQuery('.pshare-open').colorbox({
- inline:true,
- href:"#pshare_form"
-});
-
-jQuery(document).on('click', '.pshare-close', function(e) {
- jQuery("#pshare_form .formInfo").css('visibility', 'hidden');
- jQuery("[name=pshare_form]").trigger("reset");
- jQuery('.pshare-open').colorbox.close();
- e.preventDefault();
-});
-
-jQuery('#pshare_form').submit(function(e){
- jQuery(".formActions .loading").css("visibility", "visible");
-
- jQuery.ajax({
- url: "ws.php?format=json&method=pshare.share.create",
- type:"POST",
- data: jQuery(this).serialize(),
- success:function(data) {
- var data = jQuery.parseJSON(data);
- if (data.stat == 'ok') {
- var html_message = '<span class="success">&#x2714; '+data.result.message+'</span>';
- html_message+= ' <a href="#" class="pshare-icon-cancel-circled pshare-close">{'Close'|translate}</a>';
-
- jQuery("#pshare_form .formInfo")
- .html(html_message)
- .css('visibility', 'visible')
- ;
- }
- else {
- jQuery("#pshare_form .formInfo")
- .html('<span class="error">&#x2718; '+data.message+'</span>')
- .css('visibility', 'visible')
- ;
- }
-
- jQuery(".formActions .loading").css("visibility", "hidden");
- },
- error:function(XMLHttpRequest, textStatus, errorThrows) {
- alert("error calling Piwigo API");
- }
- });
-
- e.preventDefault();
-});
-{/footer_script}
-
-<div style="display:none;">
- <form id="pshare_form" name="pshare_form" action="{$F_ACTION}" method="post">
- <div class="formInfo"><span class="success">&#x2718; oups, problem occured</span> <a href="#pshare-close" class="icon-cancel-circled pshare-close">{'Close'|translate}</a></div>
- <input type="hidden" name="image_id" value="{$PSHARE_IMAGE_ID}">
- <table>
- <tr>
- <th>{'Email address'|@translate}</th>
- <td><input type="text" name="email"></td>
- </tr>
- <tr>
- <th>{'Expires in'|@translate}</th>
- <td>
- <select name="expires_in">
- <option value="7">{'%d week'|translate:1}</option>
- <option value="15">{'%d weeks'|translate:2}</option>
- <option value="30">{'%d month'|translate:1}</option>
- <option value="90">{'%d months'|translate:3}</option>
- </select>
- </td>
- </tr>
- </table>
-
- <p class="formActions">
- <input type="submit" value="{'Send email'|translate}">
- <a href="#pshare-close" class="pshare-close">{'Cancel'|translate}</a>
- <img class="loading" src="themes/default/images/ajax-loader-small.gif">
- </p>
-
- </form>
-</div>
\ No newline at end of file
4 changes: 4 additions & 0 deletions template/button_private_share_picture.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<a class="pwg-state-default pwg-button pshare-open" href="#pshare" title="{'Share'|translate}" rel="nofollow">
<i class="pshare-icon-share"></i>
<span class="pwg-button-text">{'Share'|translate}</span>
</a>
2 changes: 0 additions & 2 deletions template/picture.tpl → template/private_share_picture.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
{combine_css id='colorbox' path='themes/default/js/plugins/colorbox/style2/colorbox.css'}
{combine_css path='plugins/private_share/css/style.css'}

<div class="pshare"><a href="#pshare" title="{'Share'|translate}" class="pshare-open pshare-icon-share">{'Share'|translate}</a></div>

{footer_script require='jquery'}
// popup
jQuery('.pshare-open').colorbox({
Expand Down