summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/data.addjstabs.php99
-rw-r--r--plugins/data.addtabs.php2
-rw-r--r--plugins/data.img.php15
-rw-r--r--plugins/data.jstabs.php8
4 files changed, 114 insertions, 10 deletions
diff --git a/plugins/data.addjstabs.php b/plugins/data.addjstabs.php
new file mode 100644
index 0000000..5fbdea9
--- /dev/null
+++ b/plugins/data.addjstabs.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * @version $Revision$
+ * @package liberty
+ * @subpackage plugins_data
+ */
+ * +----------------------------------------------------------------------+
+ * | Copyright (c) 2015, bitweaver.org
+ * +----------------------------------------------------------------------+
+ * | All Rights Reserved. See below for details and a complete list of authors.
+ * | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
+ * |
+ * | For comments, please use phpdocu.sourceforge.net documentation standards!!!
+ * | -> see http://phpdocu.sourceforge.net/
+ * +----------------------------------------------------------------------+
+ * | Author: StarRider <starrrider@users.sourceforge.net>
+ * | port to jstabs <lester@lsces.co.uk>
+ * +----------------------------------------------------------------------+
+ */
+
+/**
+ * definitions
+ */
+define( 'PLUGIN_GUID_DATAADDJSTABS', 'dataaddjstabs' );
+global $gLibertySystem;
+global $gContent;
+$pluginParams = array (
+ 'tag' => 'ADDJSTABS',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => FALSE,
+ 'load_function' => 'data_addjstabs',
+ 'title' => 'AddJSTabs',
+ 'help_page' => 'DataPluginAddJSTabs',
+ 'description' => tra("Will join the contents from several sources in a Tabbed Interface."),
+ 'help_function' => 'data_addjstabs_help',
+ 'syntax' => "{ADDTABS tab1= tab2= tab3= . . . tab99= }",
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADDTABS, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADDTABS );
+
+/**
+ * Help Function
+ */
+function data_addjstabs_help() {
+ $help =
+ '<table class="data help">'
+ .'<tr>'
+ .'<th>' . tra( "Key" ) . '</th>'
+ .'<th>' . tra( "Type" ) . '</th>'
+ .'<th>' . tra( "Comments" ) . '</th>'
+ .'</tr>'
+ .'<tr class="odd">'
+ .'<td>tab1 - tab99</td>'
+ .'<td>' . tra( "numeric") . '<br />' . tra("(optional)") . '</td>'
+ .'<td>' . tra( "Will create a Tab interface on a page using jstab format. The name on each tab is the name given to the imported page.The value sent with the TabX parameter is a Numeric Content Id. This allows blog posts, images, wiki pages . . . (and more) to be added.")
+ . tra("<br /><strong>Note 1:</strong> A listing of Content Id's can be found ")
+ . '<a href="'.LIBERTY_PKG_URL.'list_content.php" title="Launch BitWeaver Content Browser in New Window" onkeypress="javascript:BitBase.popUpWin(this.href,\'standard\',800,800);" onclick="javascript:BitBase.popUpWin(this.href,\'standard\',800,800);return false;">' . tra( "Here" ) . '</a>'
+ . tra("<br /><strong>Note 2:</strong> The order used when the tabs are specified does not matter. The Tabname does - Tab1 is always first and Tab99 will always be last.</td>")
+ .'</tr>'
+ .'</table>'
+ . tra("Example: ") . '{ADDTABS tab1=15 tab2=12 tab3=11}';
+ return $help;
+}
+
+function data_addjstabs($data, $params) {
+ global $gBitSmarty;
+ $gBitSmarty->loadPlugin( 'smarty_block_jstab' );
+ $gBitSmarty->loadPlugin( 'smarty_block_jstabs' );
+
+ extract ($params, EXTR_SKIP);
+ $id = 1000000 * microtime();
+ $html = '';
+ $good = false;
+
+ for ($i = 1; $i <= 99; $i++) {
+ if( isset( ${'tab'.$i} ) ) {
+ if (is_numeric( ${'tab'.$i} ) ) {
+ if( $obj = LibertyBase::getLibertyObject( ${'tab'.$i} ) ) {
+ $params['title'] = $obj->getTitle();
+ $html .= smarty_block_jstab( $params, $obj->mInfo['parsed_data'], $gBitSmarty, '' );
+ $good=True;
+ }
+ }
+ else {
+ $good=false;
+ }
+ }
+ }
+ if( !$good ) {
+ $html = tra("The plugin AddTabs requires valid parameters. Numeric content id numbers can use the parameter names 'tab1' thru 'tab99'");
+ }
+ if( !empty( $html )) {
+ return smarty_block_jstabs( array(), $html, $gBitSmarty, '' );
+ } else {
+ return $html;
+ }
+}
+?>
diff --git a/plugins/data.addtabs.php b/plugins/data.addtabs.php
index b0d52ca..1e16c17 100644
--- a/plugins/data.addtabs.php
+++ b/plugins/data.addtabs.php
@@ -71,7 +71,7 @@ function data_addtabs($data, $params) {
if( isset( ${'tab'.$i} ) ) {
if (is_numeric( ${'tab'.$i} ) ) {
if( $obj = LibertyBase::getLibertyObject( ${'tab'.$i} ) ) {
- $ret .= '<div class="tabpage"><h4 id="tab_'.$id.'_'.$i.'" class="tab">'.$obj->getTitle().'</h4>'.$obj->getPreview().'</div>';
+ $ret .= '<div class="tabpage"><h4 id="tab_'.$id.'_'.$i.'" class="tab">'.$obj->getTitle().'</h4>'.$obj->mInfo['parsed_data'].'</div>';
$good=True;
}
}
diff --git a/plugins/data.img.php b/plugins/data.img.php
index 79fb3c9..c064572 100644
--- a/plugins/data.img.php
+++ b/plugins/data.img.php
@@ -56,7 +56,8 @@ function data_img_help() {
}
function data_img( $pData, $pParams ) {
- $img_style = '';
+ $cssStyle = '';
+ $cssClass = '';
foreach( $pParams as $key => $value ) {
if( !empty( $value ) ) {
@@ -65,15 +66,18 @@ function data_img( $pData, $pParams ) {
case 'width':
case 'height':
if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) {
- $img_style .= $key.':'.$value.';';
+ $cssStyle .= $key.':'.$value.';';
} elseif( preg_match( "/^\d+$/", $value ) ) {
- $img_style .= $key.':'.$value.'px;';
+ $cssStyle .= $key.':'.$value.'px;';
}
// remove values from the hash that they don't get used in the div as well
$pParams[$key] = NULL;
break;
+ case 'class':
+ $cssClass .= $value.' ';
+ break;
case 'style':
- $img_style .= ';'.$value;
+ $cssStyle .= ';'.$value;
break;
}
}
@@ -89,7 +93,8 @@ function data_img( $pData, $pParams ) {
' alt="'. $alt.'"'.
' title="'.$alt.'"'.
' src="' .$pParams['src'].'"'.
- ' style="'.$img_style.'"'.
+ ' style="'.$cssStyle.'"'.
+ ' class="'.$cssClass.'"'.
' />';
// if this image is linking to something, wrap the image with the <a>
diff --git a/plugins/data.jstabs.php b/plugins/data.jstabs.php
index 0ac2f16..e226b23 100644
--- a/plugins/data.jstabs.php
+++ b/plugins/data.jstabs.php
@@ -35,8 +35,8 @@ $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAJSTABS )
function data_jstabs( $pData, $pParams, $pCommonObject ) {
global $gBitSmarty;
- $gBitSmarty->loadPlugin( 'smarty_modifier_jstab' );
- $gBitSmarty->loadPlugin( 'smarty_modifier_jstabs' );
+ $gBitSmarty->loadPlugin( 'smarty_block_jstab' );
+ $gBitSmarty->loadPlugin( 'smarty_block_jstabs' );
// collect all tabs
$tabs = preg_split( "!\n---tab:\s*!i", $pData );
@@ -57,13 +57,13 @@ function data_jstabs( $pData, $pParams, $pCommonObject ) {
$parseHash['no_cache'] = TRUE;
$parseHash['data'] = $split[2];
- $html .= smarty_block_jstab( $params, $pCommonObject->parseData( $parseHash ), $gBitSmarty );
+ $html .= smarty_block_jstab( $params, $pCommonObject->parseData( $parseHash ), $gBitSmarty, '' );
}
}
}
if( !empty( $html )) {
- return smarty_block_jstabs( array(), $html, $gBitSmarty );
+ return smarty_block_jstabs( array(), $html, $gBitSmarty, '' );
} else {
return ' ';
}