public function SetBlockTypeProperties()
 {
     if (!ac_utils::is_frontend_request()) {
         $AC =& ac_utils::get_module('AdvancedContent');
         $multi_input_ids = ac_utils::CleanArray(explode(',', $this->GetProperty('inputs')));
         $blockType =& acContentBlockManager::GetBlockType('multi_input');
         $multiInput_props = $blockType['props'];
         foreach ($multi_input_ids as $k1 => $multi_input_id) {
             if (!isset($multiInput_props[$multi_input_id])) {
                 $multiInput_props = array_merge($multiInput_props, ac_admin_ops::GetMultiInputFull($multi_input_ids));
                 if (!isset($multiInput_props[$multi_input_id])) {
                     continue;
                 }
                 $multiInput_props[$multi_input_id]['template'] = $AC->GetTemplate($multiInput_props[$multi_input_id]['tpl_name']);
                 $matches = array();
                 $result = preg_match_all(AC_BLOCK_PATTERN, $multiInput_props[$multi_input_id]['input_fields'], $matches);
                 if ($result && count($matches[1]) > 0) {
                     foreach ($matches[1] as $k2 => $wholetag) {
                         if (!($inputBlock = acContentBlockManager::CreateContentBlock($this->content_obj, acContentBlockManager::GetTagParams($wholetag)))) {
                             continue;
                         }
                         if ($inputBlock->Type() == 'multi_input') {
                             continue;
                         }
                         # ToDo: display message?
                         $multiInput_props[$multi_input_id]['elements'][$k2] = $inputBlock;
                     }
                 }
             }
         }
         acContentBlockManager::SetBlockTypeProperties('multi_input', $multiInput_props);
     }
 }
    if ($error == false) {
        if (!ac_admin_ops::UpdateMultiInput($input_id, $multi_input[$input_id]['input_fields'])) {
            $error = true;
            $errormessage .= $this->lang('error_updating_multi_input') . '<br />';
        } else {
            if (!ac_admin_ops::UpdateTplAssoc('multi_input', $input_id, $multi_input[$input_id]['tpl_name'])) {
                $error = true;
                $errormessage .= $this->lang('error_updating_multi_input_assocs') . '<br />';
            } else {
                $this->Redirect($id, 'defaultadmin', $returnid, array('message' => 'multi_input_updated', 'active_tab' => 'multi_input', 'submit' => true));
            }
        }
    }
}
################################################################################
# smarty stuff
$this->smarty->assign('start_form', $this->CreateFormStart($id, 'editMultiInput', $returnid, 'post', 'multipart/form-data'));
$this->smarty->assign('end_form', $this->CreateFormEnd());
$this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', lang('submit')));
$this->smarty->assign('cancel', $this->CreateInputSubmit($id, 'cancel', lang('cancel')));
$this->smarty->assign('input_id_text', $this->lang('input_id'));
$this->smarty->assign('input_id_input', $input_id);
$this->smarty->assign('input_tpl_text', $this->lang('multi_input_tpl'));
$this->smarty->assign('input_tpl_input', $this->CreateInputDropdown($id, 'input_tpl', ac_admin_ops::GetTplList('multi_input'), '', $multi_input[$input_id]['tpl_name']));
$this->smarty->assign('input_fields_text', $this->lang('input_fields'));
$this->smarty->assign('input_fields_input', $this->CreateTextArea(false, $id, $multi_input[$input_id]['input_fields'], 'input_fields', '', 'input_fields') . $this->CreateInputHidden($id, 'input_id', $input_id));
if ($error) {
    echo $this->ShowErrors($errormessage);
}
# Display the populated template
echo $this->_pp() . $this->ProcessTemplate('addMultiInput.tpl');
Пример #3
0
# User Settings goup display
$flds = "user_id I, content_id I, template_id I, item_id X, item_display I";
$sqlarray = $dict->CreateTableSQL(cms_db_prefix() . "module_AdvancedContent_groupdisplay", $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
# multiple inputs
$flds = "input_id C(64) KEY, input_fields X";
$sqlarray = $dict->CreateTableSQL(cms_db_prefix() . "module_AdvancedContent_multi_inputs", $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
# multiple input tpl assocs
$flds = "input_id C(64), tpl_name X";
$sqlarray = $dict->CreateTableSQL(cms_db_prefix() . "module_AdvancedContent_multi_input_tpl_assocs", $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
$this->CreatePermission('Manage AdvancedContent Preferences', 'Manage AdvancedContent Preferences');
$this->CreatePermission('Manage All AdvancedContent Blocks', 'Manage All AdvancedContent Blocks');
$this->CreatePermission('Manage AdvancedContent Options', 'Manage AdvancedContent Options');
$this->CreatePermission('Manage AdvancedContent MultiInputs', 'Manage AdvancedContent MultiInputs');
$this->CreatePermission('Manage AdvancedContent MultiInput Templates', 'Manage AdvancedContent MultiInput Templates');
$this->SetTemplate('multi_input_SampleTemplate', '<div class="pageoverflow">
<p>
{foreach from=$inputs item=elm}
	{$elm->GetProperty(\'label\')}:&nbsp;{$elm->GetInput()}&nbsp;
{/foreach}
</p>
</div>');
ac_admin_ops::AddMultiInput('SampleInput', '
{content block="module_select" label="Select a module" block_type="dropdown" items="|News|Menu" values="|News|MenuManager"}
{content block="module_params" label="Enter module parameters here" block_type="text" oneline=true size="56"}');
ac_admin_ops::AddTplAssoc('multi_input', 'SampleInput', 'multi_input_SampleTemplate');
$this->SetPreference('default_multi_input_tpl', 'multi_input_SampleTemplate');
$this->AddEventHandler('Core', 'ContentEditPost', false);
$this->Audit(0, $this->Lang('AdvancedContent'), $this->Lang('installed', $this->GetVersion()));
 /**
  * @internal
  * @access private
  */
 public static function _register_content_block(&$content_obj, &$contentBlock)
 {
     # do not process blocks with same id twice
     if (isset(self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')])) {
         self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')]->SetProperty('multiple', true);
         return;
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $block_id = $contentBlock->GetProperty('id');
     # this block has been added to the template after page has been created?
     if (!$content_obj->HasProperty($block_id)) {
         $contentBlock->SetProperty('new_block', true);
     }
     # ToDo: how remove the backend stuff from this class without need to loop through all content blocks again?
     if (!ac_utils::is_frontend_request()) {
         $type = $contentBlock->Type();
         if (!isset(self::$_block_types[$type])) {
             self::$_block_types[$type] = array('content_blocks' => array(), 'header_html_called' => false, 'props' => array());
         }
         self::$_block_types[$type]['content_blocks'][$block_id] = $block_id;
         acTabManager::SetTabs($content_obj, $contentBlock);
         if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE) {
             if ($contentBlock->GetProperty('smarty')) {
                 foreach ($contentBlock->GetProperties() as $propName => $propValue) {
                     $contentBlock->SetProperty($propName, ac_utils::DoSmarty($content_obj, $propValue));
                 }
             }
             $value = $contentBlock->GetContent();
             if ($content_obj->Id() < 0 && $value == '' || $value == '' && !$contentBlock->GetProperty('allow_none') || $contentBlock->GetProperty('new_block')) {
                 $value = $contentBlock->GetProperty('default');
             }
             $content_obj->SetPropertyValueNoLoad($block_id, $value);
             $block_display = true;
             if ($contentBlock->GetProperty('collapsible')) {
                 $block_display = ac_admin_ops::GetVisibility('block', $block_id, $content_obj->Id(), $content_obj->TemplateId(), !$contentBlock->GetProperty('collapse'));
                 $contentBlock->SetProperty('pref_url', str_replace('&amp);', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_block'), array('item_type' => 'block', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => !$block_display), '', true)));
             }
             $contentBlock->SetProperty('display', $block_display);
         }
         if (strtolower($contentBlock->GetProperty('label')) == 'content_en') {
             $contentBlock->SetProperty('label', lang('content'));
         }
         if ($contentBlock->GetProperty('translate_labels')) {
             $contentBlock->SetProperty('label', $AC->lang($contentBlock->GetProperty('label')));
         }
         # deprecated (should not be needed since CMSms 1.11)
         if ($contentBlock->GetProperty('multiple') && ac_admin_ops::GetVisibility('message', $block_id, $content_obj->Id(), $content_obj->TemplateId())) {
             $hide_link = str_replace('&amp;', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_message'), array('item_type' => 'message', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => 0), '', false, '', 'onclick="jQuery.get(this.href); jQuery(\'#' . $block_id . '_message\').toggle(\'fast\',function(){jQuery(this).remove()}); return false;"'));
             $contentBlock->SetProperty('message', $AC->lang('notice_duplicatecontent', $contentBlock->GetProperty('name')) . ' (' . $hide_link . ')');
         }
         #---
         $contentBlock->SetBlockTypeProperties();
     }
     if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE && ac_utils::is_frontend_request() || !ac_utils::is_frontend_request()) {
         $content_obj->AddExtraProperty($block_id);
         # backward compatibility (deprecated)
         self::$_content_blocks[$content_obj->Id()][$block_id] = $contentBlock;
     }
 }
Пример #5
0
        $multi_inputs[$multi_input['input_id']]['checkbox'] = $this->CreateInputCheckbox($id, "multi_input-" . $multi_input['input_id'], $multi_input['input_id'], '');
    }
    $this->smarty->assign('selectall', $this->CreateInputCheckbox($id, 'multi_input', true, false, 'id="' . $id . 'multi_input" onclick="AdvancedContent.selectAll(this)"'));
    $this->smarty->assign_by_ref('multi_input_array', $multi_inputs);
    $this->smarty->assign('add_multi_input', $this->CreateLink($id, 'addMultiInput', $returnid, cmsms()->variables['admintheme']->DisplayImage('icons/system/newobject.gif', '', '', '', 'systemicon') . '&nbsp;' . $this->lang('add_multi_input')));
    $this->smarty->assign('start_form', $this->CreateFormStart($id, 'deleteMultiInput', $returnid, 'post', 'multipart/form-data'));
    $this->smarty->assign('end_form', $this->CreateFormEnd());
    $this->smarty->assign('submit_bulkaction', $this->CreateInputSubmit($id, 'submit_bulkaction', $this->lang('delete_selected'), '', '', $this->lang('confirm_delete_selected')));
    $this->smarty->assign('input_id_text', $this->lang('input_id'));
    $this->smarty->assign('template_text', lang('template'));
    $tabs['multi_input']['tabcontent'] = $this->StartTab('multi_input') . $this->ProcessTemplate('multiInputTab.tpl') . $this->EndTab();
}
if ($this->CheckPermission('Manage AdvancedContent MultiInput Templates')) {
    $tabs['multi_input_tpl']['tabheader'] = $this->SetTabHeader('multi_input_tpl', $this->lang('multi_input_tpl'), $active_tab == 'multi_input_tpl' ? true : '');
    $multi_input_tpls = array();
    foreach (ac_admin_ops::GetTemplates('multi_input') as $tpl) {
        $multi_input_tpls[$tpl['tpl_id']]['edit_link'] = $this->CreateLink($id, 'editMultiInputTpl', $returnid, cmsms()->variables['admintheme']->DisplayImage('icons/system/edit.gif', '', '', '', 'systemicon'), array('tpl_id' => $tpl['tpl_id']));
        $multi_input_tpls[$tpl['tpl_id']]['name_link'] = $this->CreateLink($id, 'editMultiInputTpl', $returnid, $tpl['tpl_name'], array('tpl_id' => $tpl['tpl_id']));
        $multi_input_tpls[$tpl['tpl_id']]['delete_link'] = '&nbsp;';
        $multi_input_tpls[$tpl['tpl_id']]['checkbox'] = '&nbsp';
        if ($this->GetPreference('default_multi_input_tpl', 'multi_input_SampleTemplate') != $tpl['tpl_id'] && !$tpl['is_used']) {
            $multi_input_tpls[$tpl['tpl_id']]['delete_link'] = $this->CreateLink($id, 'deleteMultiInputTpl', $returnid, cmsms()->variables['admintheme']->DisplayImage('icons/system/delete.gif', '', '', '', 'systemicon'), array('tpl_id' => $tpl['tpl_id']), $this->lang('confirm_delete'));
            $multi_input_tpls[$tpl['tpl_id']]['checkbox'] = $this->CreateInputCheckbox($id, "multi_input_tpl-" . $tpl['tpl_id'], $tpl['tpl_id'], '');
        }
        if ($this->GetPreference('default_multi_input_tpl', 'multi_input_SampleTemplate') != $tpl['tpl_id']) {
            $multi_input_tpls[$tpl['tpl_id']]['set_default_link'] = $this->CreateLink($id, 'savePrefs', $returnid, cmsms()->variables['admintheme']->DisplayImage('icons/system/false.gif', '', '', '', 'systemicon'), array('set_default' => 'multi_input', 'tpl_id' => $tpl['tpl_id'], 'active_tab' => 'multi_input_tpl'));
        } else {
            $multi_input_tpls[$tpl['tpl_id']]['set_default_link'] = cmsms()->variables['admintheme']->DisplayImage('icons/system/true.gif', '', '', '', 'systemicon');
        }
    }
    $this->smarty->assign('selectall', $this->CreateInputCheckbox($id, 'multi_input_tpl', true, false, 'id="' . $id . 'multi_input_tpl" onclick="AdvancedContent.selectAll(this)"'));
        foreach ($params as $param_name => $param_value) {
            if (startswith($param_name, 'multi_input-')) {
                $items[] = $param_value;
            }
        }
    }
}
if (ac_admin_ops::DeleteMultiInput($items)) {
    $_params['message'] = 'multi_input_deleted';
    $message .= $this->lang('multi_input_deleted') . "<br />";
} else {
    $error = true;
    $_params['errormessage'] = 'error_delete_multi_input';
    $errormessage .= $this->lang('error_delete_multi_input') . "<br />";
}
if (!$error && !ac_admin_ops::DeleteTplAssoc('multi_input', $items)) {
    $_params['errormessage'] = 'error_delete_multi_input_tpl_assocs';
    $errormessage .= $this->lang('error_delete_multi_input_tpl_assocs') . "<br />";
}
$_params['active_tab'] = 'multi_input';
if (isset($params['ajax'])) {
    @ob_end_clean();
    @ob_start();
    if ($errormessage) {
        echo '<div class="pageerrorcontainer"><ul class="pageerror"><li>' . $errormessage . '</li></ul></div>';
    }
    if ($message) {
        echo '<div class="pagemcontainer"><p class="pagemessage">' . $message . '</p></div>';
    }
    ob_end_flush();
    exit;
#          CMS Made Simple is (c) 2004-2013 by Ted Kulp
#          The projects homepage is: cmsmadesimple.org
# Version: 0.9.4
# File   : event.Core.ContentEditPost.php
# Purpose: copys the expand/collapse status of blocks when page is copied
# License: GPL
#
#-------------------------------------------------------------------------------
if (!function_exists('cmsms') || !is_object(cmsms())) {
    exit;
}
if (basename($_SERVER['PHP_SELF']) == 'copycontent.php' && isset($params['content']) && is_object($params['content']) && $params['content']->Type() == 'advanced_content') {
    if (isset($_GET['content_id'])) {
        $old_content_id = $_GET['content_id'];
    } else {
        $old_content_id = $params['content']->Id();
    }
    foreach ($params['content']->GetContentBlocks() as $contentBlock) {
        ac_admin_ops::SetVisibility('block', $contentBlock->GetProperty('id'), $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('block', $contentBlock->GetProperty('id'), $old_content_id, $params['content']->TemplateId(), !$contentBlock->GetProperty('collapse')));
    }
    foreach (acTabManager::GetTabs() as $tab) {
        foreach ($tab['block_groups'] as $groupInfo) {
            ac_admin_ops::SetVisibility('group', $groupInfo['group_id'], $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('group', $groupInfo['group_id'], $old_content_id, $params['content']->TemplateId(), !$this->GetPreference('collapse_group_default', 1)));
        }
        foreach ($tab['block_tabs'] as $block_tab) {
            foreach ($block_tab['block_groups'] as $groupInfo) {
                ac_admin_ops::SetVisibility('group', $groupInfo['group_id'], $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('group', $groupInfo['group_id'], $old_content_id, $params['content']->TemplateId(), !$this->GetPreference('collapse_group_default', 1)));
            }
        }
    }
}
 /**
  * @todo plugin changelog
  */
 public function GetChangeLog()
 {
     if (isset($_GET['action']) && $_GET['action'] == 'showmoduleabout' || isset($_POST['name']) && $_POST['name'] == $this->GetName()) {
         $blockChangeLog = array();
         foreach (ac_admin_ops::GetCustomBlockTypes() as $blockType) {
             $blockChangeLog[] = $blockType->GetChangeLog();
         }
         $blockChangeLog = implode('', $blockChangeLog);
         $changeLog = $this->_pp();
         if ($blockChangeLog) {
             $changeLog .= $this->StartTabHeaders() . $this->SetTabHeader('help', lang('help'), true) . $this->SetTabHeader('custom_blocktypes', $this->lang('custom_blocktypes'), false) . $this->EndTabHeaders() . $this->StartTabContent() . $this->StartTab('help');
         }
         $changeLog .= file_get_contents(dirname(__FILE__) . '/doc/changelog.html');
         if ($blockChangeLog) {
             $changeLog .= $this->EndTab() . $this->StartTab('custom_blocktypes') . $blockChangeLog . $this->EndTab() . $this->EndTabContent();
         }
         return $changeLog;
     }
     return true;
 }
Пример #9
0
 private static function _set_block_group($content_obj, &$contentBlock)
 {
     if ($contentBlock->GetProperty('block_group') == '') {
         return;
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $page_tab_id = $contentBlock->GetProperty('page_tab');
     $block_tab_id = $contentBlock->GetProperty('block_tab');
     $group_name = $contentBlock->GetProperty('block_group');
     $group_id = ($block_tab_id ? $block_tab_id : $page_tab_id) . '_' . ac_utils::CleanStrId($group_name);
     $tab_array = $block_tab_id ? self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['block_groups'] : self::$_tabs[$page_tab_id]['block_groups'];
     if (!isset($tab_array[$group_id])) {
         $collapsible = $contentBlock->GetProperty('collapsible');
         $group_display = $collapsible ? ac_admin_ops::GetVisibility('group', $group_id, $content_obj->Id(), $content_obj->TemplateId(), !$AC->GetPreference('collapse_group_default', 1)) : true;
         $pref_url = $collapsible ? str_replace('&amp;', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_group'), array('item_type' => 'group', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $group_id, 'item_display' => !$group_display), '', true)) : '#';
         $tab_array[$group_id] = array('group_id' => $group_id, 'group_name' => $group_name, 'collapsible' => $collapsible, 'display' => $group_display, 'pref_url' => $pref_url);
     }
     $block_id = $contentBlock->GetProperty('id');
     $tab_array[$group_id]['content_blocks'][$block_id] = $block_id;
     if ($block_tab_id) {
         self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['block_groups'] = $tab_array;
         unset(self::$_tabs[$page_tab_id]['block_tabs'][$block_tab_id]['content_blocks'][$block_id]);
     } else {
         self::$_tabs[$page_tab_id]['block_groups'] = $tab_array;
     }
     unset(self::$_tabs[$page_tab_id]['content_blocks'][$block_id]);
 }
Пример #10
0
    }
    if (isset($params['custom_params'])) {
        $this->SetPreference('custom_params', $params['custom_params']);
    }
    if (isset($params['custom_params_smarty'])) {
        $this->SetPreference('custom_params_smarty', $params['custom_params_smarty']);
    }
    if (isset($params['inherit_custom_params'])) {
        $this->SetPreference('inherit_custom_params', $params['inherit_custom_params']);
    }
    if (isset($params['feu_action'])) {
        $this->SetPreference('feu_action', $params['feu_action']);
    }
    if (isset($params['hide_menu_item'])) {
        $this->SetPreference('hide_menu_item', $params['hide_menu_item']);
    }
}
if (isset($params['item_type']) && isset($params['item_display'])) {
    ac_admin_ops::SetVisibility($params['item_type'], $params['item_id'], $params['content_id'], $params['template_id'], $params['item_display']);
}
if (isset($params['set_default'])) {
    $this->SetPreference('default_' . $params['set_default'] . '_tpl', $params['tpl_id']);
}
if (isset($params['ajax'])) {
    echo '<div class="pagemcontainer"><p class="pagemessage">' . $this->lang('prefsupdated') . '</p></div>';
    exit;
} elseif (isset($params['edit_content'])) {
    redirect($_SERVER['HTTP_REFERER']);
} else {
    $this->Redirect($id, 'defaultadmin', $returnid, array('message' => 'prefsupdated', 'submit' => true));
}
 function display_single_element($one, $adding)
 {
     if (in_array($one, $this->_advancedAttribs)) {
         return;
     }
     if (!($ret = ac_admin_ops::DisplayAttributes($this, $one, $adding))) {
         $ret = parent::display_single_element($one, $adding);
     }
     return $ret;
 }