LEAP™ is a content editor’s dream (CMS), a designer’s best option, and the perfect framework for site development.
LEAP™ is simpleLEAPLEAP™ is secureLEAPLEAP™ is SEO-centric

Anatomy of a LEAP™ 5 Plugin

The layout of a LEAP™ 5 Plugin can be described in plain English as:

  1. Setup
  2. Process 
  3. If not admin, display mode
  4. If authenticated admin, edit

Storing individual instance configuration options: LEAP_manageFeatures

LEAP™ 5 has a flexible data map that is specific to the content plugin instance. 

An example plugin, "helloworld" is included below. It is set up to leverage LEAP_manageFeatures, rather than a table. Using LEAP_manageFeatures is appropriate for configuration data and low-volume content data, but not for larger volume text objects.

When larger volumes of data are to be stored, use the Master_Content table.

How a LEAP™ Plugin communicates with the Admin Sub-System

In order to achieve in-page editing, LEAP™ 5 does not use traditional GET or POST form submission for editing. Instead it makes extensive use of JSON communication which tends to be smaller, more compact and therefore faster than standard HTML.

LEAP™ 5 handles almost all this communication for you, however you need to ensure your form elements are appropriately tagged with the correct class. See "Edit mode: LEAP™ 5's form element pickups" for a detailed explanation.

The HelloWorld plugin

[
protect => {
	handle_error => { 
		$gv_debug_status ? log_critical('helloworld module error: '+error_currenterror)
	}
	local(jspath = '/lasso9/helloworld/helloworld.js')
	$isLassoApp == 0 ? #jspath = '/LEAP/MODULES/helloworld/helloworld.js'
	$page_requestedAssets->insert(#jspath)

	var(Feature_Map = map)
	LEAP_manageFeatures->populate
	local(featurelist = map(
			'aVar'		= 'yes'
		)
	)
	
	with i in #featurelist->keys do => {
		$Feature_Map->find(#i)->isA('void') ? 
			LEAP_manageFeatures->update(#i,#featurelist->find(#i)) 
	}

	if($actionis == 'save' && $gv_admin) => {
		if($ContentID > 0) => {
			LEAP_Audit->page(-contentid=$ContentID)
			with i in #featurelist->keys do => { 
				LEAP_manageFeatures->update(#i,string(client_param('LEAP_'+#i))->trim &) 
			}
			LEAP_manageFeatures->populate
			/* ==============================
				Other db save options go here 
			============================== */
		}
		$gv_admin = false
	else($actionis == 'cancel')
		$gv_admin = false
	}		
	if(!$gv_admin) => {^
		'Hello world, today\'s date is: ' + date
		'<br />aVar is currently: ' + $Feature_Map->find('aVar')
	else
]
<div class="LEAP_t-wrapper LEAP_modulebkgd">
	<div class="t-center">
		<table class="t-alt">
			<tbody>
				<tr>
					<th class="col-1eft border-none">Hello World Configuration</th>
				</tr>
			</tbody>
		</table>
		<div class="LEAP_moduleinner">
			<div class="leftwidth">
				<div class="LEAP_editgreen LEAP_tooltip" rel="helloworld:aVar">A Variable:</div>
				<div class="LEAP_clearme"></div>
				<input 
					size="12" type="text" 
					name="LEAP_aVar" 
					class="LEAP_mod[$ContentID]" 
					id="LEAP_aVar[$ContentID]" 
					value="[string($Feature_Map->find('aVar'))]" 
				/>
			</div>
			<ul class="LEAP_modulebutton_list_inpage" style="width: 100%;">
				<li>
					<a href="#" class="LEAP_done_but" id="finish_[$ContentID]"><span>Save</span></a>
				</li>
				<li>
					<a href="#" class="LEAP_cancel_but" id="cancel_[$ContentID]"><span>Cancel</span></a>
				</li>
			</ul>
		</div>
	</div>
</div>
[	
	^}
}
]

© Copyright LEAP™ 2017 | Privacy Policy | Design by Treefrog Inc.