Skip to content

Commit 0a1a59a

Browse files
committed
add multicolumn template
1 parent 2138076 commit 0a1a59a

File tree

10 files changed

+204
-1
lines changed

10 files changed

+204
-1
lines changed

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
ImpressPages-extra-plugins
22
==========================
33

4-
some plugins for ImpressPages CMS
4+
some additional plugins for ImpressPages CMS
5+
6+
Usage
7+
-----
8+
For git-style deployment, just clone this repo as `extra` into `ip_plugins` folder:
9+
10+
cd {cms_path}\ip_plugins
11+
git clone https://github.com/greybyte/ImpressPages-extra-plugins.git extra
12+
13+
Alternatively, create `extra` folder in `{cms_path}\ip_plugins` and extract files from zipfile.
14+
15+
For description of individual plugins, please see README.md in respective module folder.

multicolumn/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
MultiColumn Widget for ImpressPages CMS
2+
=======================================
3+
4+
This widget allows to insert multiple columns into a page, at any location
5+
where content can be placed. Each column can hold arbitrary widgets.
6+
7+
Installation
8+
------------
9+
1. Upload `multicolumn` to `ip_plugins\extra` folder of your website.
10+
2. Login to administration area
11+
3. Go to "Developer -> Modules" and press "install".
12+
4. Visit your website. You should now have multicolumn widget in widget area.
13+
14+
Usage
15+
-----
16+
Just drag the multicolumn widget into any editable block on the page, select
17+
column template to use. After that, the new columns will appear on the page,
18+
which can be filled with Text, Images, ...
19+
20+
Note to template designers
21+
--------------------------
22+
The default preview templates for Multi Column Widget use tables to achieve
23+
the column effect, because the plugin cannot know which grid system is used
24+
in an actual template. If your template has a proper grid system, it is
25+
strongly recommended to override the given templates with the correct markup
26+
for grid columns. To do this, simply create a folder
27+
28+
`modules\extra\multicolumn\widget\IpMultiColumn\preview`
29+
30+
in your template's root folder and add column templates there.
31+
32+
Installation Note
33+
-----------------
34+
At the time of this writing, this plugin requires patches to the core, see
35+
https://github.com/greybyte/ImpressPages-CMS/tree/block_widget_nesting

multicolumn/install/plugin.ini

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version:1.00
2+
module_title:MultiColumn
3+
module_key:multicolumn
4+
module_group_title:Extra
5+
module_group_key:extra
6+
module_managed:0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* @package ImpressPages
4+
5+
*
6+
*/
7+
namespace Modules\extra\multicolumn\widget;
8+
9+
if (!defined('CMS')) exit;
10+
11+
class IpMultiColumn extends \Modules\standard\content_management\Widget {
12+
13+
public function getTitle() {
14+
//global $parametersMod;
15+
//return $parametersMod->getValue('standard', 'content_management', 'widget_text', 'menu_mod_multicolumn');
16+
return "Multi Column";
17+
}
18+
19+
public function managementHtml($instanceId, $data, $layout) {
20+
// use $instanceId as seed for the names of our blocks because it is unique.
21+
// but since we will get a new instanceId after page is published, we need
22+
// to persist it in widget data.
23+
if (!array_key_exists('base_id', $data) || !$data['base_id']) {
24+
$data['base_id'] = $instanceId;
25+
}
26+
return parent::managementHtml($instanceId, $data, $layout);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
This is widget management template.
3+
Add management tools here.
4+
They will be loaded when user press to edit your widget.
5+
-->
6+
<p><em>Please select one of the available column templates from the dropdown menu on the right</em></p>
7+
<form>
8+
<input name="base_id" type="hidden" value="<?=$base_id?>"/>
9+
</form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* preview / layout template for multicolumn widget. This template needs to render
4+
* the required markup for columns, and generate a unique block inside of each
5+
* column. To make block unique, use $base_id which is provided by controller.
6+
*
7+
* For example, to generate two bootstrap columns, markup could look like this:
8+
*
9+
* <div class="row">
10+
* <div class="span4"><?php echo $site->generateBlock('multicol'.$base_id.'left') ?></div>
11+
* <div class="span8"><?php echo $site->generateBlock('multicol'.$base_id.'right') ?></div>
12+
* </div>
13+
*
14+
* The following code based on <table> is ONLY included to support templates which do
15+
* not have a grid system. Templates which do have a proper grid system should really
16+
* override this.
17+
*
18+
*/
19+
?>
20+
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
21+
<tr>
22+
<td style="width: 25%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'1')->exampleContent(' '); ?></td>
23+
<td style="width: 25%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'2')->exampleContent(' '); ?></td>
24+
<td style="width: 25%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'3')->exampleContent(' '); ?></td>
25+
<td style="width: 25%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'4')->exampleContent(' '); ?></td>
26+
</tr>
27+
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* preview / layout template for multicolumn widget. This template needs to render
4+
* the required markup for columns, and generate a unique block inside of each
5+
* column. To make block unique, use $base_id which is provided by controller.
6+
*
7+
* For example, to generate two bootstrap columns, markup could look like this:
8+
*
9+
* <div class="row">
10+
* <div class="span4"><?php echo $site->generateBlock('multicol'.$base_id.'left') ?></div>
11+
* <div class="span8"><?php echo $site->generateBlock('multicol'.$base_id.'right') ?></div>
12+
* </div>
13+
*
14+
* The following code based on <table> is ONLY included to support templates which do
15+
* not have a grid system. Templates which do have a proper grid system should really
16+
* override this.
17+
*
18+
*/
19+
?>
20+
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
21+
<tr>
22+
<td style="width: 33%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'1')->exampleContent(' '); ?></td>
23+
<td style="width: 33%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'2')->exampleContent(' '); ?></td>
24+
<td style="width: 33%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'3')->exampleContent(' '); ?></td>
25+
</tr>
26+
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* preview / layout template for multicolumn widget. This template needs to render
4+
* the required markup for columns, and generate a unique block inside of each
5+
* column. To make block unique, use $base_id which is provided by controller.
6+
*
7+
* For example, to generate two bootstrap columns, markup could look like this:
8+
*
9+
* <div class="row">
10+
* <div class="span4"><?php echo $site->generateBlock('multicol'.$base_id.'left') ?></div>
11+
* <div class="span8"><?php echo $site->generateBlock('multicol'.$base_id.'right') ?></div>
12+
* </div>
13+
*
14+
* The following code based on <table> is ONLY included to support templates which do
15+
* not have a grid system. Templates which do have a proper grid system should really
16+
* override this.
17+
*
18+
*/
19+
?>
20+
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
21+
<tr>
22+
<td style="width: 50%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'1')->exampleContent(' '); ?></td>
23+
<td style="width: 50%; vertical-align: top;"><?php echo $site->generateBlock('multicol'.$base_id.'2')->exampleContent(' '); ?></td>
24+
</tr>
25+
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
*
3+
* IpMultiColumn Widget Controller
4+
*
5+
* @package ImpressPages
6+
* @copyright Copyright (C) 2011 ImpressPages LTD.
7+
* @license GNU/GPL, see ip_license.html
8+
*/
9+
10+
function IpWidget_IpMultiColumn(widgetObject) {
11+
12+
this.widgetObject = widgetObject;
13+
this.manageInit = manageInit;
14+
this.prepareData = prepareData;
15+
16+
function manageInit() {
17+
//get widget data currently stored in the database
18+
var instanceData = this.widgetObject.data('ipWidget').data;
19+
20+
//if widget has been already initialized
21+
if (instanceData.base_id) {
22+
//set input value
23+
this.widgetObject.find('input[name="base_id"]').val(instanceData.base_id);
24+
} else {
25+
//leave input empty
26+
}
27+
}
28+
29+
function prepareData() {
30+
//create simple data object. It will be returned as the data to be stored.
31+
var data = Object();
32+
data.base_id = this.widgetObject.find('input[name="base_id"]').val();
33+
$(this.widgetObject).trigger('preparedWidgetData.ipWidget', [ data ]);
34+
}
35+
36+
};
219 Bytes
Loading

0 commit comments

Comments
 (0)