Skip to content

Commit

Permalink
settings rewrite, themes activation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Powers committed Mar 15, 2013
1 parent 9f21096 commit 252b9d7
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 206 deletions.
17 changes: 10 additions & 7 deletions editor/editor.actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
function pl_editor_actions(){

$post = $_POST;
$response_object = array();
$response = array();
$response['post'] = $post;

if($post['mode'] == 'themes'){
$themes = new EditorThemesHandler;

$theme = new EditorThemeHandler;

if($post['run'] == 'activate')
$response = $theme->activate( $response );
elseif($post['run'] == 'preview')
$response = $theme->set_preview( $response );
}




$response_object['post'] = $post;

// RESPONSE
echo json_encode( $response_object, JSON_FORCE_OBJECT);
echo json_encode( $response, JSON_FORCE_OBJECT);

die(); // don't forget this, always returns 0 w/o
}
Expand Down
6 changes: 4 additions & 2 deletions editor/editor.init.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/


//return;
// return;

// Make sure user can handle this.
if (!defined('PL_UX_DEV') || !PL_UX_DEV)
Expand Down Expand Up @@ -85,6 +85,8 @@ function load_libs(){

$this->map = new EditorMap( $this->templates, $this->draft);

$this->themer = new EditorThemeHandler;

// Must come before settings
$this->foundry = new PageLinesFoundry;
$this->typography = new EditorTypography( $this->foundry );
Expand All @@ -96,7 +98,7 @@ function load_libs(){

$plopts = $this->opts = new PageLinesOpts( $this->page, $this->draft );

$this->interface = new EditorInterface( $this->page, $this->siteset, $this->draft, $this->templates, $this->map, $this->extensions );
$this->interface = new EditorInterface( $this->page, $this->siteset, $this->draft, $this->templates, $this->map, $this->extensions, $this->themer );

$this->handler = new PageLinesTemplateHandler( $this->interface, $this->page, $this->siteset, $this->foundry, $this->map, $this->draft, $this->opts, $this->layout, $this->extensions );

Expand Down
48 changes: 33 additions & 15 deletions editor/editor.interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
class EditorInterface {


function __construct( PageLinesPage $pg, EditorSettings $siteset, EditorDraft $draft, EditorTemplates $templates, EditorMap $map, EditorExtensions $extensions ) {
function __construct( PageLinesPage $pg, EditorSettings $siteset, EditorDraft $draft, EditorTemplates $templates, EditorMap $map, EditorExtensions $extensions, EditorThemeHandler $theme ) {

$this->theme = $theme;
$this->page = $pg;
$this->draft = $draft;
$this->siteset = $siteset;
Expand All @@ -25,7 +26,7 @@ function __construct( PageLinesPage $pg, EditorSettings $siteset, EditorDraft $d


if ( $this->draft->show_editor() ){

add_action( 'wp_footer', array( &$this, 'pagelines_toolbox' ) );
add_action( 'wp_enqueue_scripts', array(&$this, 'pl_editor_scripts' ) );
add_action( 'wp_enqueue_scripts', array(&$this, 'pl_editor_styles' ) );
Expand Down Expand Up @@ -177,58 +178,73 @@ function toolbar_config(){
'panel' => array(
'heading' => "<i class='icon-random'></i> Drag to Add",
'add_section' => array(
'name' => 'Add Sections',
'name' => 'Your Sections',
'icon' => 'icon-random',
'clip' => 'Drag on to page to add',
'type' => 'call',
'call' => array(&$this, 'add_new_callback'),
'filter'=> '*'
),
'more_sections' => array(
'name' => 'Get More Sections',
'icon' => 'icon-download',
'flag' => 'link-storefront'
),
'heading2' => "<i class='icon-filter'></i> Filters",
'components' => array(
'name' => 'Components',
'href' => '#add_section',
'filter'=> '.component'
'filter'=> '.component',
'icon' => 'icon-circle-blank'
),
'layouts' => array(
'name' => 'Layouts',
'href' => '#add_section',
'filter'=> '.layout'
'filter'=> '.layout',
'icon' => 'icon-columns'
),
'formats' => array(
'name' => 'Post Formats',
'href' => '#add_section',
'filter'=> '.format'
'filter'=> '.format',
'icon' => 'icon-th'
),
'galleries' => array(
'name' => 'Galleries',
'href' => '#add_section',
'filter'=> '.gallery'
'filter'=> '.gallery',
'icon' => 'icon-camera'
),
'navigation' => array(
'name' => 'Navigation',
'href' => '#add_section',
'filter'=> '.nav'
'filter'=> '.nav',
'icon' => 'icon-circle-arrow-right'
),
'features' => array(
'name' => 'Features',
'href' => '#add_section',
'filter'=> '.feature'
'filter'=> '.feature',
'icon' => 'icon-picture'
),

'social' => array(
'name' => 'Social',
'href' => '#add_section',
'filter'=> '.social'
'filter'=> '.social',
'icon' => 'icon-comments'
),
'widgets' => array(
'name' => 'Widgetized',
'href' => '#add_section',
'filter'=> '.widgetized'
'filter'=> '.widgetized',
'icon' => 'icon-retweet'
),
'misc' => array(
'name' => 'Miscellaneous',
'href' => '#add_section',
'filter'=> '.misc'
'filter'=> '.misc',
'icon' => 'icon-star'
),
)
),
Expand All @@ -254,13 +270,13 @@ function toolbar_config(){
'icon' => 'icon-picture',
'panel' => array(
'heading' => "Select Theme",
'tmp_load' => array(
'avail_themes' => array(
'name' => '<i class="icon-picture"></i> Available Themes',
'call' => array(&$this, 'themes_dashboard'),
),
'tmp_save' => array(
'more_themes' => array(
'name' => '<i class="icon-download"></i> Get More Themes',
'call' => array(&$this->templates, 'save_templates'),
'flag' => 'link-storefront'
)
)

Expand Down Expand Up @@ -521,6 +537,7 @@ function pagelines_toolbox(){
</li>
</ul>
</div>
<?php pagelines_register_hook('before_toolbox_panel'); // Hook ?>
<div class="toolbox-panel-wrap">
<div class="toolbox-panel">
<div class="toolbox-content fix">
Expand Down Expand Up @@ -664,6 +681,7 @@ function themes_dashboard(){
else
$splash = $t->get_stylesheet();

$class[] = 'x-item-size-10';

$args = array(
'id' => $theme,
Expand Down
Loading

0 comments on commit 252b9d7

Please sign in to comment.