diff options
| -rw-r--r-- | LibertyContent.php | 4 | ||||
| -rw-r--r-- | list_content.php | 2 | ||||
| -rw-r--r-- | plugins/data.addjstabs.php | 99 | ||||
| -rw-r--r-- | plugins/data.addtabs.php | 2 | ||||
| -rw-r--r-- | plugins/data.img.php | 15 | ||||
| -rw-r--r-- | plugins/data.jstabs.php | 8 | ||||
| -rw-r--r-- | templates/edit_format.tpl | 20 | ||||
| -rw-r--r-- | templates/edit_textarea.tpl | 5 | ||||
| -rw-r--r-- | templates/mime/default/attachment.tpl | 4 | ||||
| -rw-r--r-- | templates/mime/default/inline.tpl | 2 | ||||
| -rw-r--r-- | templates/mime/default/storage.tpl | 2 | ||||
| -rw-r--r-- | templates/mime/default/upload.tpl | 2 | ||||
| -rw-r--r-- | templates/plugins/filter_htmlpurifier_admin.tpl | 11 |
13 files changed, 145 insertions, 31 deletions
diff --git a/LibertyContent.php b/LibertyContent.php index 93dc137..e13d9b1 100644 --- a/LibertyContent.php +++ b/LibertyContent.php @@ -127,6 +127,10 @@ class LibertyContent extends LibertyBase implements BitCacheable { } + public function isCacheableObject() { + return parent::isCacheableObject() && !empty( $this->mContentId ); + } + public function getCacheKey() { if( $this->isValid() ) { return $this->mContentId; diff --git a/list_content.php b/list_content.php index f13dbef..a46281c 100644 --- a/list_content.php +++ b/list_content.php @@ -65,7 +65,7 @@ if( !empty( $_REQUEST['output'] )) { * Recommend that this be standardized, but * a package dependency somewhere is likely an issue */ - require_once( UTIL_PKG_PATH.'javascript/libs/suggest/suggest_lib.php' ); + require_once( UTIL_PKG_PATH.'javascript/suggest/suggest_lib.php' ); foreach( array_keys( $contentList ) as $row ) { $xmlList[$contentList[$row]['content_id']] = $contentList[$row]['title']; } 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 ' '; } diff --git a/templates/edit_format.tpl b/templates/edit_format.tpl index 04b66af..5226808 100644 --- a/templates/edit_format.tpl +++ b/templates/edit_format.tpl @@ -15,8 +15,8 @@ <input type="hidden" name="i18n[from_id]" value="{$translateFrom->mContentId}" /> {/if} <select name="i18n[lang_code]" id="lang_code"> - {foreach from=$translationsList key=langCode item=lang} - <option value="{$langCode}" {if $smarty.request.i18n.lang_code==$langCode || $contentObject->mInfo.lang_code==$langCode || ( $langCode==$gBitSystem->getConfig('bitlanguage') && !$smarty.request.i18n.lang_code && !$contentObject->getField('lang_code') )}selected="selected" {/if}>{$lang.native_name}</option> + {foreach from=$translationsList key=codeKey item=lang} + <option value="{$codeKey}" {if $smarty.request.i18n.lang_code==$codeKey || $langCode==$codeKey || ($codeKey==$gBitSystem->getConfig('bitlanguage') && !$smarty.request.i18n.lang_code && !$langCode)}selected="selected" {/if}>{$lang.native_name}</option> {/foreach} </select> {formhelp note="The language of this page"} @@ -45,9 +45,12 @@ {forminput label="radio"} {if $numformat > 1} <input type="radio" name="{$format_guid_variable|default:"format_guid"}" value="{$plugin.edit_field}" - {if $contentObject->mInfo.format_guid eq $plugin.plugin_guid} checked="checked" - {elseif !$contentObject->mInfo.format_guid and $plugin.plugin_guid eq $gBitSystem->getConfig('default_format', 'tikiwiki')} checked="checked" + {if $formatGuid eq $plugin.plugin_guid} checked="checked" + {elseif !$formatGuid and $plugin.plugin_guid eq $gBitSystem->getConfig('default_format', 'tikiwiki')} checked="checked" {assign var=formatGuid value='tikiwiki'} {/if} onclick=" + {if $gBitSystem->isPackageActive('ckeditor')} + if($(this).val() == 'bithtml') { createCkEditor('{$textarea_id}'); } else { destroyCkEditor('{$textarea_id}'); } + {/if} {if $gBitSystem->isPackageActive('quicktags')} {foreach from=$gLibertySystem->mPlugins item=tag key=guid} {if $tag.is_active eq 'y' and $tag.edit_field and $tag.plugin_type eq 'format'} @@ -68,7 +71,7 @@ {if $plugin.plugin_guid == "tikiwiki"} {if !$gBitSystem->isFeatureActive('content_force_allow_html')} {if $gBitUser->hasPermission( 'p_liberty_enter_html' ) || $gBitSystem->isFeatureActive('content_allow_html')} - <input type="checkbox" name="preferences[content_enter_html]" value="y" id="html" {if $contentObject->mPrefs.content_enter_html}checked="checked" {/if}/> {tr}Allow HTML{/tr} + <label class="inline-block checkbox"><input type="checkbox" name="preferences[content_enter_html]" value="y" id="{$textarea_id}-html" {if $contentObject->mPrefs.content_enter_html}{if $gBitSystem->isPackageActive('ckeditor')}contenteditable="true"{/if} checked="checked" {/if} {*if $gBitSystem->isPackageActive('ckeditor')}onclick="if($(this).is(':checked')) createCkEditor('{$textarea_id}'); else destroyCkEditor('{$textarea_id}');{/if*}"/> {tr}Allow HTML{/tr}</label> {elseif is_object($contentObject) && $contentObject->getPreference( 'content_enter_html' )} [ {tr}HTML will remain as HTML{/tr} ] {else} @@ -101,4 +104,11 @@ <input type="hidden" name="{$format_guid_variable|default:"format_guid"}" value="{if $numformat eq 1}{$singleplugin.edit_field}{else}{$gBitSystem->getConfig('default_format','tikiwiki')}{/if}" /> {/if} +{if $gBitSystem->isPackageActive('ckeditor') && ($formatGuid=='bithtml')}{* || (is_object($contentObject) && $formatGuid=='tikiwiki' && $contentObject->getPreference('content_enter_html')))} *} +<script type="text/javascript"> +$(document).ready( function() { +createCkEditor('{$textarea_id}'); +} ); +</script> +{/if} {/strip} diff --git a/templates/edit_textarea.tpl b/templates/edit_textarea.tpl index 120997c..cb25c82 100644 --- a/templates/edit_textarea.tpl +++ b/templates/edit_textarea.tpl @@ -16,7 +16,7 @@ {forminput} {formfeedback error=$textarea_error} {if !$textarea_id}{assign var=textarea_id value=$smarty.const.LIBERTY_TEXT_AREA}{/if} - <textarea {$textarea_class} {$textarea_attributes} {if $textarea_maxchars}onkeydown="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');" onkeyup="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');"{/if} {spellchecker width=$cols height=$rows} id="{$textarea_id}" name="{$textarea_name|default:edit}" {$textarea_style}>{$textarea_edit|escape}</textarea> + <textarea {$textarea_class} {$textarea_attributes} {if $textarea_maxchars}onkeydown="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');" onkeyup="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');"{/if} {spellchecker width=$cols height=$rows} id="{$textarea_id}" name="{$textarea_name|default:edit}" {$textarea_style}>{$textarea_edit}</textarea> {if $textarea_required}{required}{/if} {if $textarea_maxchars} @@ -35,7 +35,4 @@ {formhelp note=$textarea_help} {/forminput} - {if $gBitSystem->isPackageActive('ckeditor')} - {assign var=wysiwygEdit value=true} - {/if} </div> diff --git a/templates/mime/default/attachment.tpl b/templates/mime/default/attachment.tpl index fe33bfb..f5272c8 100644 --- a/templates/mime/default/attachment.tpl +++ b/templates/mime/default/attachment.tpl @@ -7,9 +7,9 @@ <{$wrapper.wrapper|default:'span'} class="{$wrapper.class|default:'att-plugin'}"{if $wrapper.style} style="{$wrapper.style|default:'display:inline-block'}{/if}"> {if $wrapper.display_url}<a {$wrapper.href_class} href="{$wrapper.display_url}">{/if} {if $thumbsize == 'original'} - <img class="thumb" src="{$attachment.source_url}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if} /> + <img class="img-responsive" src="{$attachment.source_url}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if} /> {elseif $attachment.thumbnail_url.$thumbsize} - <img class="thumb" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if}/> + <img class="img-responsive" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if}/> {/if} {if $wrapper.description_parsed} <div class="caption">{$wrapper.description_parsed}</div> diff --git a/templates/mime/default/inline.tpl b/templates/mime/default/inline.tpl index b869b7c..3823b81 100644 --- a/templates/mime/default/inline.tpl +++ b/templates/mime/default/inline.tpl @@ -4,7 +4,7 @@ {if $attachment.thumbnail_url.$thumbsize} {if !$attachment.is_primary or ( $attachment.is_primary and !$hideprimary )} <a href="{$attachment.display_url}"> - <img class="thumb" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$attachment.filename}" title="{$attachment.filename}"/> + <img class="img-responsive" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$attachment.filename}" title="{$attachment.filename}"/> </a> {/if} {else} diff --git a/templates/mime/default/storage.tpl b/templates/mime/default/storage.tpl index b869b7c..3823b81 100644 --- a/templates/mime/default/storage.tpl +++ b/templates/mime/default/storage.tpl @@ -4,7 +4,7 @@ {if $attachment.thumbnail_url.$thumbsize} {if !$attachment.is_primary or ( $attachment.is_primary and !$hideprimary )} <a href="{$attachment.display_url}"> - <img class="thumb" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$attachment.filename}" title="{$attachment.filename}"/> + <img class="img-responsive" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$attachment.filename}" title="{$attachment.filename}"/> </a> {/if} {else} diff --git a/templates/mime/default/upload.tpl b/templates/mime/default/upload.tpl index 54e70eb..76925ad 100644 --- a/templates/mime/default/upload.tpl +++ b/templates/mime/default/upload.tpl @@ -4,7 +4,7 @@ {formlabel label="Upload File(s)"} {forminput} {if $gBitSystem->getConfig("liberty_attachment_style") == "multiple"} - <script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/multifile.js"></script> + <script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/multifile.js"></script> <div id="upload_div"></div> <input type="file" name="upload" size="40" id="uploads" /> <script type="text/javascript"> diff --git a/templates/plugins/filter_htmlpurifier_admin.tpl b/templates/plugins/filter_htmlpurifier_admin.tpl index 620fdc4..e1fff82 100644 --- a/templates/plugins/filter_htmlpurifier_admin.tpl +++ b/templates/plugins/filter_htmlpurifier_admin.tpl @@ -11,23 +11,22 @@ {formlabel label="Blacklisted HTML tags" for="blacklisted_html_tags"} {formfeedback warning=$errors.blacklist} {forminput} - <input type="text" id="blacklisted_html_tags" name="blacklisted_html_tags" size="50" maxlength="250" value="{$gBitSystem->getConfig('blacklisted_html_tags')|escape}" /> + <input type="text" id="blacklisted_html_tags" name="blacklisted_html_tags" class="form-control" maxlength="250" value="{$gBitSystem->getConfig('blacklisted_html_tags')|escape}" /> {formhelp note="A comma seperated list of tags that should NOT be allowed in any content."} {/forminput} </div> {foreach from=$htmlPurifier key=item item=output} <div class="form-group"> - {formlabel label=`$output.label` for=$item} - {forminput} - {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item, $output.default) labels=false id=$item} - {formhelp note=`$output.note` page=`$output.page`} + {forminput label="checkbox"} + {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item, $output.default) labels=false id=$item} {tr}{$output.label}{/tr} + {formhelp note=$output.note page=$output.page} {/forminput} </div> {/foreach} <div class="form-group submit"> - <input type="submit" name="apply" value="{tr}Save Plugin Settings{/tr}" /> + <input type="submit" class="btn btn-default" name="apply" value="{tr}Save Plugin Settings{/tr}" /> </div> {/form} </div><!-- end .body --> |
