1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Plugin/Theme modal fixes and improved commercial plugin/theme handling.

This commit is contained in:
Cameron 2015-07-17 23:09:36 -07:00
parent 60d9d0751a
commit a3514ca716
6 changed files with 66 additions and 36 deletions

View File

@ -484,7 +484,7 @@ class pluginManager{
$badge = $this->compatibilityLabel($row['compatibility']);;
$featured = ($row['featured']== 1) ? " <span class='label label-info'>".EPL_ADLAN_91."</span>" : '';
$price = ($row['price'] > 0) ? "<span class='label label-info'>".EPL_ADLAN_92."</span>" : "<span class='label label-success'>".EPL_ADLAN_93."</span>";
$price = (!empty($row['price'])) ? "<span class='label label-primary'>".$row['price']." ".$row['currency']."</span>" : "<span class='label label-success'>".EPL_ADLAN_93."</span>";
$data[] = array(
'plugin_id' => $row['params']['id'],
@ -504,7 +504,7 @@ class pluginManager{
'plugin_website' => vartrue($row['authorUrl']),
'plugin_url' => $row['urlView'],
'plugin_notes' => '',
// 'plugin_price' => $price,
'plugin_price' => $row['price'],
'plugin_license' => $price
);
@ -600,9 +600,10 @@ class pluginManager{
// $url = e_SELF.'?action=download&amp;src='.base64_encode($d);//$url.'&amp;action=download';
$id = 'plug_'.$data['plugin_id'];
//<button type='button' data-target='{$id}' data-loading='".e_IMAGE."/generic/loading_32.gif' class='btn btn-primary e-ajax middle' value='Download and Install' data-src='".$url."' ><span>Download and Install</span></button>
$modalCaption = (!empty($data['plugin_price'])) ? "Purchase ".$data['plugin_name']." ".$data['plugin_version'] : 'Downloading and Installing '.$data['plugin_name']." ".$data['plugin_version'];
$url = e_SELF.'?mode=download&amp;src='.base64_encode($d);
$dicon = '<a title="Download and Install" class="e-modal btn btn-default" href="'.$url.'" rel="external" data-loading="'.e_IMAGE.'/generic/loading_32.gif" data-cache="false" data-modal-caption="Downloading and Installing '.$data['plugin_name']." ".$data['plugin_version'].'" target="_blank" >'.ADMIN_INSTALLPLUGIN_ICON.'</a>';
$dicon = '<a title="Download and Install" class="e-modal btn btn-default" href="'.$url.'" rel="external" data-loading="'.e_IMAGE.'/generic/loading_32.gif" data-cache="false" data-modal-caption="'.$modalCaption.'" target="_blank" >'.ADMIN_INSTALLPLUGIN_ICON.'</a>';
// Temporary Pop-up version.
@ -628,11 +629,16 @@ class pluginManager{
$string = base64_decode($_GET['src']);
parse_str($string, $data);
if(!empty($data['plugin_price']))
{
e107::getRedirect()->go($data['plugin_url']);
return true;
}
$mp = $this->getMarketplace();
// $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
// print_a($data);
// Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers)
$mes->addSuccess(EPL_ADLAN_94);

View File

@ -36,17 +36,19 @@ e107::css("inline","
require_once(e_HANDLER."theme_handler.php");
$themec = new themeHandler;
// print_a($_GET);
$mode = varset($_GET['mode'],'main'); // (e_QUERY) ? e_QUERY :"main" ;
if(e_AJAX_REQUEST)
if(!empty($_GET['action']))
{
define('e_IFRAME',true);
}
if(e_AJAX_REQUEST)
if(!empty($_GET['action']))
{
require_once("auth.php");
switch ($_GET['action'])
{
case 'login':
@ -74,7 +76,7 @@ if(e_AJAX_REQUEST)
$string = base64_decode($_GET['src']);
parse_str($string,$p);
echo $themec->renderThemeInfo($p);
exit;
break;
case 'preview':
@ -82,7 +84,7 @@ if(e_AJAX_REQUEST)
$tm = (string) $_GET['id'];
$data = $themec->getThemeInfo($tm);
echo $themec->renderThemeInfo($data);
exit;
// exit;
break;
}
@ -108,10 +110,14 @@ if(e_AJAX_REQUEST)
*/
// Theme Info Ajax
// FIXME addd action=preview to the url, remove this block
if(!empty($_GET['id']))
{
$tm = (string) $_GET['id'];
$data = $themec->getThemeInfo($tm);
echo $themec->renderThemeInfo($data);
}
require_once(e_ADMIN."footer.php");
exit;
}
@ -151,10 +157,17 @@ if($mode == 'download' && !empty($_GET['src']))
$string = base64_decode($_GET['src']);
parse_str($string, $data);
if(!empty($data['price']))
{
e107::getRedirect()->go($data['url']);
return true;
}
$mp = $themec->getMarketplace();
$mes->addSuccess("Connecting...");
if($mp->download($data['id'], $data['mode'], 'theme'))
if($mp->download($data['id'], $data['mode'], 'theme')) // download and unzip theme.
{
// Auto install?
// $text = e107::getPlugin()->install($data['plugin_folder']);

View File

@ -585,6 +585,7 @@ class themeHandler
'livedemo' => $r['livedemo'],
);
$text .= $this->renderTheme(FALSE, $theme);
$c++;
@ -813,7 +814,7 @@ class themeHandler
$preview = "<a href='".SITEURL."news.php?themepreview.".$theme['id']."' title='".TPVLAN_9."' >".($theme['preview'] ? "<img src='".$theme['preview']."' style='border: 1px solid #000;width:200px' alt='' />" : "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' title='".TPVLAN_12."' alt='' />")."</a>";
$description = vartrue($theme['description'],'');
$compat = (intval($theme['compatibility']) == 2) ? "<span class='label label-warning'>".number_format($theme['compatibility'], 1, '.','')."</span><span class='text-warning'> Recommended!</span>": vartrue(number_format($theme['compatibility'], 1, '.',''),'1.0');
$price = ($theme['price'] > 0) ? "<span class='label label-info'><i class='icon-shopping-cart icon-white'></i> ".$theme['price']."</span>" : "<span class='label label-success'>".Free."</span>";
$price = (!empty($theme['price'])) ? "<span class='label label-primary'><i class='icon-shopping-cart icon-white'></i> ".$theme['price']."</span>" : "<span class='label label-success'>Free</span>";
$text = "<table class='table table-striped'>";
@ -910,19 +911,20 @@ class themeHandler
if(count($theme['preview']))
{
$text .= "<tr><td colspan='2'>";
$text .= "<div class='clearfix'>";
foreach($theme['preview'] as $pic)
{
$picFull = (substr($pic,0,4) == 'http') ? $pic : e_THEME.$theme['path']."/".$pic;
$text .= "<div style='padding:5px;width:700px'>
<img src='".$picFull."' alt=\"".$theme['name']."\" />
$text .= "<div class='col-md-6'>
<img class='img-responsive' src='".$picFull."' alt=\"".$theme['name']."\" />
</div>";
}
$text .= "</div>";
// $text .= "</td>
// </tr>";
@ -1042,7 +1044,7 @@ class themeHandler
// $preview = "<a href='".e_BASE."news.php?themepreview.".$theme['id']."' title='".TPVLAN_9."' >".($theme['preview'] ? "<img src='".$theme['preview']."' style='border: 1px solid #000;width:200px' alt='' />" : "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' title='".TPVLAN_12."' alt='' />")."</a>";
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['id']."]' alt=\"".TPVLAN_10."\" title=\"".TPVLAN_10."\" >".$tp->toGlyph('fa-home',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
// $info_icon = "<a data-toggle='modal' data-target='".e_SELF."' href='#themeInfo_".$theme['id']."' class='e-tip' title='".TPVLAN_7."'><img src='".e_IMAGE_ABS."admin_images/info_32.png' alt='' class='icon S32' /></a>";
$info_icon = "<a class='btn btn-default btn-small btn-sm btn-inverse' data-toggle='modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".e_SELF."?id=".$theme['path']."' data-target='#uiModal' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
$info_icon = "<a class='btn btn-default btn-small btn-sm btn-inverse e-modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".e_SELF."?mode=".$_GET['mode']."&id=".$theme['path']."&action=info' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
// $preview_icon = "<a title='Preview : ".$theme['name']."' rel='external' class='e-dialog' href='".e_BASE."index.php?themepreview.".$theme['id']."'>".E_32_SEARCH."</a>";
$admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectadmin[".$theme['id']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" >".$tp->toGlyph('fa-gears',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
$price = '';
@ -1095,8 +1097,8 @@ class themeHandler
//$main_icon = "<a data-src='".$downloadUrl."' href='{$downloadUrl}' data-target='{$id}' data-loading='".e_IMAGE."/generic/loading_32.gif' class='-e-ajax' title='".$LAN_DOWNLOAD."' ><img class='top' src='".e_IMAGE_ABS."icons/download_32.png' alt='' /></a> ";
// $main_icon = "<a data-toggle='modal' data-modal-caption=\"".$caption."\" href='{$downloadUrl}' data-cache='false' data-target='#uiModal' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a> ";
$main_icon = "<a class='e-modal btn-default btn btn-sm btn-small btn-inverse' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='{$downloadUrl}' data-cache='false' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a>";
$modalCaption = (empty($theme['price'])) ? 'Downloading '.$theme['name']." ".$theme['version'] : 'Purchase '.$theme['name']." ".$theme['version'];
$main_icon = "<a class='e-modal btn-default btn btn-sm btn-small btn-inverse' data-modal-caption=\"".$modalCaption."\" rel='external' href='{$downloadUrl}' data-cache='false' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a>";
@ -1104,15 +1106,14 @@ class themeHandler
// $main_icon = "<a class='e-modal btn btn-small btn-inverse' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='{$viewUrl}' data-cache='false' title='".$LAN_DOWNLOAD."' >".$tp->toGlyph('download',array('size'=>'2x'))."</a> ";
$info_icon = "<a class='btn btn-default btn-sm btn-small btn-inverse' data-toggle='modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".$infoUrl."' data-cache='false' data-target='#uiModal' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
$info_icon = "<a class='btn btn-default btn-sm btn-small btn-inverse e-modal' data-toggle='modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".$infoUrl."' data-cache='false' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
if($theme['livedemo'])
{
$previewPath = $theme['livedemo'];
}
//XXX modal-Cache is currently enabled by default. Awaiting inclusion of data-cache feature.
// See here: https://github.com/twitter/bootstrap/pull/4224
$price = ($theme['price'] > 0) ? "<span class='label label-primary pull-right'><i class='icon-shopping-cart icon-white'></i> ".$theme['price']."</span>" : "<span class='label label-success pull-right'>".Free."</span>";
$price = (!empty($theme['price'])) ? "<span class='label label-primary pull-right'>".$theme['price']."</span>" : "<span class='label label-success pull-right'>".Free."</span>";
}

View File

@ -202,8 +202,8 @@ function poll_list()
$text .= "
<td class='center' style='white-space:nowrap'>
<button class='btn btn-large' type='submit' name='edit[{$poll_id}]' value='edit' alt='".LAN_EDIT."' title='".LAN_EDIT."' >".ADMIN_EDIT_ICON."</button>
<button class='btn btn-large action delete' type='submit' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
<button class='btn btn-default btn-large' type='submit' name='edit[{$poll_id}]' value='edit' alt='".LAN_EDIT."' title='".LAN_EDIT."' >".ADMIN_EDIT_ICON."</button>
<button class='btn btn-default btn-large action delete' type='submit' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" title='".LAN_DELETE."' >".ADMIN_DELETE_ICON."</button>
</td>
</tr>";
}

View File

@ -140,7 +140,7 @@ td.options .btn-group { display: flex; }
.table .nav-tabs a,
.table th a, .table td a { text-decoration: none }
.table > thead > tr > th { padding: 15px 10px; font-weight:bold; font-variant: small-caps; }
.table > thead > tr > th, tr > th { padding: 15px 10px; font-weight:bold; font-variant: small-caps; }
.label, .badge { text-shadow: 1px 1px 0px #000; box-shadow: 1px 1px 0px #000; }
@ -1121,14 +1121,14 @@ li.rssRow > div {
.notifications.top-left{left:10px;top:25px;}
.notifications.bottom-left{left:10px;bottom:25px;}
.notifications.bottom-right{right:10px;bottom:25px;}
.notifications>div{position:relative;z-index:9999;margin:5px 0px;}
.notifications>div{ position:relative;z-index:9999;margin:5px 0;}
.notifications.center{top:30%;left:0;width:100%;}.notifications.center>div{margin:5px auto;width:20%;text-align:center;}
/* Theme selection */
.admin-theme-thumb { 200px; height:130px;overflow:hidden;border:1px solid black; margin:0px; margin-bottom:10px; padding:0px; }
.admin-theme-thumb { width:100%; height:130px;overflow:hidden;border:1px solid black; margin:0; margin-bottom:10px; padding:0; }
.admin-theme-thumb:hover { opacity:0.4 }
.admin-theme-options {
@ -1142,7 +1142,9 @@ li.rssRow > div {
padding-top:50px;
white-space:nowrap;
background-color:black;
display:block;position:relative; text-align:center; vertical-align:middle; top:-141px;}
display:block;position:relative;
vertical-align:middle; top:-141px;
}
.admin-theme-options:hover { opacity:0.85; }
.admin-theme-options .fa-check { color: #FAA732 }

View File

@ -206,6 +206,14 @@ $(document).ready(function()
{
e.preventDefault();
if($(this).attr('data-cache') == 'false')
{
$('#uiModal').on('shown.bs.modal', function () {
$(this).removeData('bs.modal');
});
}
var url = $(this).attr('href');
var caption = $(this).attr('data-modal-caption');
var height = ($(window).height() * 0.7) - 50;