diff --git a/libraries/cck/construction/field/cckintegration.php b/libraries/cck/construction/field/cckintegration.php
index 272e3e589..05fefd7f5 100644
--- a/libraries/cck/construction/field/cckintegration.php
+++ b/libraries/cck/construction/field/cckintegration.php
@@ -1,243 +1,225 @@
element['location'];
- $lang_default = $lang->setDefault( 'en-GB' );
- $lang->load( 'com_cck_default', JPATH_SITE );
- $lang->setDefault( $lang_default );
+class JFormFieldCckIntegration extends JFormField {
- // Init
- $actions = array(
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_DEFAULT_CONTENT_TYPE',
- 'name'=>'default_type',
- 'description'=>'COM_CCK_INTEGRATION_DEFAULT_CONTENT_TYPE_DESC',
- 'dev_fieldname'=>'core_dev_select',
- 'dev_override'=>array( 'defaultvalue'=>'', 'selectlabel'=>'None', 'bool8'=>0, 'css'=>'cck-integration' )
- ),
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_ADD_BUTTON',
- 'name'=>'add',
- 'description'=>'COM_CCK_INTEGRATION_ADD_BUTTON_DESC',
- 'dev_fieldname'=>'core_dev_select',
- 'dev_override'=>array( 'defaultvalue'=>'1', 'type'=>'radio', 'options'=>'PREFERENCES_OPTION_TOOLTIP=2||PREFERENCES_OPTION_MODAL_BOX=1||None=0', 'css'=>'cck-integration btn-group btn-group-yesno pull-left cck-integration-add' )
- ),
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_ADD_BUTTON_ALT',
- 'name'=>'add_alt',
- 'description'=>'COM_CCK_INTEGRATION_ADD_BUTTON_ALT_DESC',
- 'dev_fieldname'=>'core_dev_select',
- 'dev_override'=>array( 'defaultvalue'=>'2', 'type'=>'radio', 'options'=>'Above=1||Below=2||None=0', 'css'=>'cck-integration btn-group btn-group-yesno pull-left' )
- ),
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_ADD_REDIRECT',
- 'name'=>'add_redirect',
- 'description'=>'COM_CCK_INTEGRATION_ADD_REDIRECT_DESC',
- 'dev_fieldname'=>'core_dev_bool',
- 'dev_override'=>array( 'defaultvalue'=>'1', 'type'=>'radio', 'css'=>'cck-integration btn-group btn-group-yesno pull-left' )
- ),
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_EDIT_LINK',
- 'name'=>'edit',
- 'description'=>'COM_CCK_INTEGRATION_EDIT_LINK_DESC',
- 'dev_fieldname'=>'core_dev_select',
- 'dev_override'=>array( 'defaultvalue'=>'0', 'type'=>'radio', 'options'=>'FORCE_SEBLOD=1||Auto=0', 'css'=>'cck-integration btn-group btn-group-yesno pull-left' )
- ),
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_EDIT_LINK_ALT',
- 'name'=>'edit_alt',
- 'description'=>'COM_CCK_INTEGRATION_EDIT_LINK_ALT_DESC',
- 'dev_fieldname'=>'core_dev_bool',
- 'dev_override'=>array( 'defaultvalue'=>'1', 'type'=>'radio', 'css'=>'cck-integration btn-group btn-group-yesno pull-left' )
- )
- /*
- (object)array(
- 'title'=>'COM_CCK_INTEGRATION_EDIT_REDIRECT',
- 'name'=>'edit_redirect',
- 'description'=>'COM_CCK_INTEGRATION_EDIT_REDIRECT_DESC',
- 'dev_fieldname'=>'core_dev_select',
- 'dev_override'=>array( 'type'=>'radio', 'options'=>'FORCE_SEBLOD=1||Auto=0', 'css'=>'cck-integration btn-group pull-left' )
- )
- */
- );
- $groups = JCckDatabase::loadObjectList( 'SELECT a.* FROM #__cck_core_objects AS a ORDER BY a.title' );
- $options = JCckDatabase::loadObjectListArray( 'SELECT a.title AS text, a.name AS value, a.storage_location FROM #__cck_core_types AS a WHERE a.storage_location != "" AND a.storage_location != "none" ORDER BY text', 'storage_location' );
+ public $type = 'CckIntegration';
- // Prepare
- $html = array();
- $html[] = '
' . JText::_( 'COM_CCK_CONFIG_INTEGRATION_CONTENT_OBJECTS_DESC' ) . '
';
- $html[] = '';
- $html[] = '
';
+ // getInput
+ protected function getInput() {
+ $app = JFactory::getApplication();
+ $doc = JFactory::getDocument();
+ $lang = JFactory::getLanguage();
+ $component = 'com_cck_integration';
+ $config = JCckDev::init(array(), true);
+ $location = (string) $this->element['location'];
+ $lang_default = $lang->setDefault('en-GB');
+ $lang->load('com_cck_default', JPATH_SITE);
+ $lang->setDefault($lang_default);
- $class = JCck::on( '4.0' ) ? '' : 'tab-content';
+ // Init
+ $actions = array(
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_DEFAULT_CONTENT_TYPE',
+ 'name' => 'default_type',
+ 'description' => 'COM_CCK_INTEGRATION_DEFAULT_CONTENT_TYPE_DESC',
+ 'dev_fieldname' => 'core_dev_select',
+ 'dev_override' => array('defaultvalue' => '', 'selectlabel' => 'None', 'bool8' => 0, 'css' => 'cck-integration')
+ ),
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_ADD_BUTTON',
+ 'name' => 'add',
+ 'description' => 'COM_CCK_INTEGRATION_ADD_BUTTON_DESC',
+ 'dev_fieldname' => 'core_dev_select',
+ 'dev_override' => array('defaultvalue' => '1', 'type' => 'radio', 'options' => 'PREFERENCES_OPTION_TOOLTIP=2||PREFERENCES_OPTION_MODAL_BOX=1||None=0', 'css' => 'cck-integration btn-group btn-group-yesno pull-left cck-integration-add')
+ ),
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_ADD_BUTTON_ALT',
+ 'name' => 'add_alt',
+ 'description' => 'COM_CCK_INTEGRATION_ADD_BUTTON_ALT_DESC',
+ 'dev_fieldname' => 'core_dev_select',
+ 'dev_override' => array('defaultvalue' => '2', 'type' => 'radio', 'options' => 'Above=1||Below=2||None=0', 'css' => 'cck-integration btn-group btn-group-yesno pull-left')
+ ),
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_ADD_REDIRECT',
+ 'name' => 'add_redirect',
+ 'description' => 'COM_CCK_INTEGRATION_ADD_REDIRECT_DESC',
+ 'dev_fieldname' => 'core_dev_bool',
+ 'dev_override' => array('defaultvalue' => '1', 'type' => 'radio', 'css' => 'cck-integration btn-group btn-group-yesno pull-left')
+ ),
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_EDIT_LINK',
+ 'name' => 'edit',
+ 'description' => 'COM_CCK_INTEGRATION_EDIT_LINK_DESC',
+ 'dev_fieldname' => 'core_dev_select',
+ 'dev_override' => array('defaultvalue' => '0', 'type' => 'radio', 'options' => 'FORCE_SEBLOD=1||Auto=0', 'css' => 'cck-integration btn-group btn-group-yesno pull-left')
+ ),
+ (object) array(
+ 'title' => 'COM_CCK_INTEGRATION_EDIT_LINK_ALT',
+ 'name' => 'edit_alt',
+ 'description' => 'COM_CCK_INTEGRATION_EDIT_LINK_ALT_DESC',
+ 'dev_fieldname' => 'core_dev_bool',
+ 'dev_override' => array('defaultvalue' => '1', 'type' => 'radio', 'css' => 'cck-integration btn-group btn-group-yesno pull-left')
+ )
+ /*
+ (object)array(
+ 'title'=>'COM_CCK_INTEGRATION_EDIT_REDIRECT',
+ 'name'=>'edit_redirect',
+ 'description'=>'COM_CCK_INTEGRATION_EDIT_REDIRECT_DESC',
+ 'dev_fieldname'=>'core_dev_select',
+ 'dev_override'=>array( 'type'=>'radio', 'options'=>'FORCE_SEBLOD=1||Auto=0', 'css'=>'cck-integration btn-group pull-left' )
+ )
+ */
+ );
+ $groups = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_objects AS a ORDER BY a.title');
+ $options = JCckDatabase::loadObjectListArray('SELECT a.title AS text, a.name AS value, a.storage_location FROM #__cck_core_types AS a WHERE a.storage_location != "" AND a.storage_location != "none" ORDER BY text', 'storage_location');
- $html[] = '
';
+ // Prepare
+ $html = array();
+ $html[] = '
' . JText::_('COM_CCK_CONFIG_INTEGRATION_CONTENT_OBJECTS_DESC') . '
';
+ $html[] = '
';
- foreach ( $groups as $i=>$group ) {
- $actions2 = $actions;
- $active = '';
- if ( $i == 0 ) {
- $active = ' active';
- }
- $values = json_decode( $group->options );
+ foreach ($groups as $i => $group) {
+ $actions2 = $actions;
+ $active = '';
+ if ($i == 0) {
+ $active = ' show active';
+ }
+ $values = json_decode($group->options);
- $html[] = '';
- $html[] = '
';
- $html[] = '';
- $html[] = '';
+ $html[] = '';
+ $html[] = '';
+ $html[] = '';
+ $html[] = '';
- $html[] = '| ';
- $html[] = '' . JText::_( 'COM_CCK_SETTINGS' ) . '';
- $html[] = ' | ';
+ $html[] = '';
+ $html[] = '' . JText::_('COM_CCK_SETTINGS') . '';
+ $html[] = ' | ';
- $html[] = '';
- $html[] = '' . JText::_( 'COM_CCK_UPDATE_SETTINGS' ) . '';
- $html[] = ' | ';
+ $html[] = '';
+ $html[] = '' . JText::_('COM_CCK_UPDATE_SETTINGS') . '';
+ $html[] = ' | ';
- $html[] = '
';
- $html[] = '';
- $html[] = '';
+ $html[] = '';
+ $html[] = '';
+ $html[] = '';
- $xml = JPATH_SITE.'/plugins/cck_storage_location/'.$group->name.'/config.xml';
- if ( is_file( $xml ) ) {
- $k = count( $actions );
- $overrides = array( 'options', 'selectlabel' );
- $xml = JCckDev::fromXML( $xml );
- $lang->load( 'plg_cck_storage_location_'.$group->name );
- foreach ( $xml->children() as $fieldset ) {
- foreach ( $fieldset->children() as $field ) {
- $attr = $field->attributes();
- if ( isset( $attr->construction ) ) {
- $actions2[$k] = (object)array(
- 'title'=>(string)$attr->label,
- 'name'=>(string)$attr->name,
- 'description'=>(string)$attr->description,
- 'dev_fieldname'=>(string)$attr->construction,
- 'dev_override'=>array( 'css'=>'cck-integration btn-group btn-group-yesno pull-left' )
- );
- $actions2[$k]->dev_override['defaultvalue'] = (string)$attr->default;
- if ( isset( $attr->size ) ) {
- $actions2[$k]->dev_override['size'] = (string)$attr->size;
- }
- foreach ( $overrides as $o ) {
- if ( isset( $attr->{'cck_'.$o} ) ) {
- $actions2[$k]->dev_override[$o] = (string)$attr->{'cck_'.$o};
- }
- }
- $k++;
- }
- }
- }
- }
+ $xml = JPATH_SITE . '/plugins/cck_storage_location/' . $group->name . '/config.xml';
+ if (is_file($xml)) {
+ $k = count($actions);
+ $overrides = array('options', 'selectlabel');
+ $xml = JCckDev::fromXML($xml);
+ $lang->load('plg_cck_storage_location_' . $group->name);
+ foreach ($xml->children() as $fieldset) {
+ foreach ($fieldset->children() as $field) {
+ $attr = $field->attributes();
+ if (isset($attr->construction)) {
+ $actions2[$k] = (object) array(
+ 'title' => (string) $attr->label,
+ 'name' => (string) $attr->name,
+ 'description' => (string) $attr->description,
+ 'dev_fieldname' => (string) $attr->construction,
+ 'dev_override' => array('css' => 'cck-integration btn-group btn-group-yesno pull-left')
+ );
+ $actions2[$k]->dev_override['defaultvalue'] = (string) $attr->default;
+ if (isset($attr->size)) {
+ $actions2[$k]->dev_override['size'] = (string) $attr->size;
+ }
+ foreach ($overrides as $o) {
+ if (isset($attr->{'cck_' . $o})) {
+ $actions2[$k]->dev_override[$o] = (string) $attr->{'cck_' . $o};
+ }
+ }
+ $k++;
+ }
+ }
+ }
+ }
- foreach ( $actions2 as $j=>$action ) {
- $inherit = array( 'id'=>'integration_'.$group->name.'-'.$action->name );
- $action->dev_override['storage_field'] = 'integration['.$group->name.']['.$action->name.']';
- $value = isset( $values->{$action->name} ) ? $values->{$action->name} : '';
- if ( $location == 'form' ) {
- $action->dev_override['type'] = 'select_simple';
- $action->dev_override['selectlabel']= 'Inherit';
- $action->dev_override['css'] = str_replace( ' btn-group', '', $action->dev_override['css'] );
- }
+ foreach ($actions2 as $j => $action) {
+ $inherit = array('id' => 'integration_' . $group->name . '-' . $action->name);
+ $action->dev_override['storage_field'] = 'integration[' . $group->name . '][' . $action->name . ']';
+ $value = isset($values->{$action->name}) ? $values->{$action->name} : '';
+ if ($location == 'form') {
+ $action->dev_override['type'] = 'select_simple';
+ $action->dev_override['selectlabel'] = 'Inherit';
+ $action->dev_override['css'] = str_replace(' btn-group', '', $action->dev_override['css']);
+ }
- $html[] = '';
- $html[] = '| ';
- $html[] = '';
- $html[] = ' | ';
- $html[] = '';
+ $html[] = ' |
';
+ $html[] = '| ';
+ $html[] = '';
+ $html[] = ' | ';
+ $html[] = '';
- if ( $action->name == 'default_type' ) {
- $opts = array();
- if ( isset( $options[$group->name] ) && count( $options[$group->name] ) ) {
- foreach ( $options[$group->name] as $o ) {
- $opts[] = $o->text.'='.$o->value;
- }
- }
- $opts = implode( '||', $opts );
- $action->dev_override['options'] = $opts;
- $html[] = JCckDev::getForm( $action->dev_fieldname, $value, $config, $action->dev_override, $inherit );
- } elseif ( $action->name == 'add' ) {
- $html[] = JCckDev::getForm( $action->dev_fieldname, $value, $config, $action->dev_override, $inherit );
- if ( $value == '' ) {
- $value = $action->dev_override['defaultvalue'];
- }
- if ( $value == '2' ) {
- $disabled = ' disabled';
- } elseif ( $value == '1' ) {
- $disabled = '';
- } else {
- $disabled = ' disabled';
- $actions[$j+1]->dev_override['css'] .= ' disabled';
- }
- $name = 'add_layout';
- $value = isset( $values->$name ) ? $values->$name : '';
- if ( $location == 'form' ) {
- $html[] = JCckDev::getForm( 'core_dev_select', $value, $config, array( 'defaultvalue'=>'', 'selectlabel'=>'Inherit', 'options'=>'CONFIG_OPTION_ICON=icon||CONFIG_OPTION_LIST=list', 'css'=>'cck-integration alt-group input-small pull-left'.$disabled, 'storage_field'=>'integration['.$group->name.']['.$name.']' ), array( 'id'=>'integration_'.$group->name.'-'.$name ) );
- } else {
- $html[] = JCckDev::getForm( 'core_dev_select', $value, $config, array( 'defaultvalue'=>'icon', 'type'=>'radio', 'options'=>'CONFIG_OPTION_ICON=icon||CONFIG_OPTION_LIST=list', 'css'=>'cck-integration alt-group btn-group btn-group-yesno pull-left'.$disabled, 'storage_field'=>'integration['.$group->name.']['.$name.']' ), array( 'id'=>'integration_'.$group->name.'-'.$name ) );
- }
- } else {
- $html[] = JCckDev::getForm( $action->dev_fieldname, $value, $config, $action->dev_override, $inherit );
- }
+ if ($action->name == 'default_type') {
+ $opts = array();
+ if (isset($options[$group->name]) && count($options[$group->name])) {
+ foreach ($options[$group->name] as $o) {
+ $opts[] = $o->text . '=' . $o->value;
+ }
+ }
+ $opts = implode('||', $opts);
+ $action->dev_override['options'] = $opts;
+ $html[] = JCckDev::getForm($action->dev_fieldname, $value, $config, $action->dev_override, $inherit);
+ } elseif ($action->name == 'add') {
+ $html[] = JCckDev::getForm($action->dev_fieldname, $value, $config, $action->dev_override, $inherit);
+ if ($value == '') {
+ $value = $action->dev_override['defaultvalue'];
+ }
+ if ($value == '2') {
+ $disabled = ' disabled';
+ } elseif ($value == '1') {
+ $disabled = '';
+ } else {
+ $disabled = ' disabled';
+ $actions[$j + 1]->dev_override['css'] .= ' disabled';
+ }
+ $name = 'add_layout';
+ $value = isset($values->$name) ? $values->$name : '';
+ if ($location == 'form') {
+ $html[] = JCckDev::getForm('core_dev_select', $value, $config, array('defaultvalue' => '', 'selectlabel' => 'Inherit', 'options' => 'CONFIG_OPTION_ICON=icon||CONFIG_OPTION_LIST=list', 'css' => 'cck-integration alt-group input-small pull-left' . $disabled, 'storage_field' => 'integration[' . $group->name . '][' . $name . ']'), array('id' => 'integration_' . $group->name . '-' . $name));
+ } else {
+ $html[] = JCckDev::getForm('core_dev_select', $value, $config, array('defaultvalue' => 'icon', 'type' => 'radio', 'options' => 'CONFIG_OPTION_ICON=icon||CONFIG_OPTION_LIST=list', 'css' => 'cck-integration alt-group btn-group btn-group-yesno pull-left' . $disabled, 'storage_field' => 'integration[' . $group->name . '][' . $name . ']'), array('id' => 'integration_' . $group->name . '-' . $name));
+ }
+ } else {
+ $html[] = JCckDev::getForm($action->dev_fieldname, $value, $config, $action->dev_override, $inherit);
+ }
- $html[] = ' | ';
- $html[] = '
';
- }
+ $html[] = '';
+ $html[] = '';
+ }
- $html[] = '';
- $html[] = '
';
- }
+ $html[] = '';
+ $html[] = '
';
+ }
- $html[] = '
';
+ $html[] = '';
- // Stuff
- JCck::loadjQuery( true, true, array( 'cck.dev-3.22.0.min.js', 'jquery.json.min.js', 'jquery.ui.effects.min.js' ) );
- $ajax = '../media/system/images/modal/spinner.gif';
- $pre = !JCck::on( '4.0' ) ? 'config.save.' : '';
- $js = '
+ // Stuff
+ JCck::loadjQuery(true, true, array('cck.dev-3.22.0.min.js', 'jquery.json.min.js', 'jquery.ui.effects.min.js'));
+ $ajax = '../media/system/images/modal/spinner.gif';
+ $pre = !JCck::on('4.0') ? 'config.save.' : '';
+ $js = '
(function ($){
JCck.Dev = {
doIntegration: 0,
submit: function(task) {
if (JCck.Dev.doIntegration) {
var data = {};
- var loading = \'

\';
+ var loading = \'

\';
$("#integration-sliders .cck-integration").each(function(i) {
var id = $(this).attr("id").substring(12);
var tab = id.split("-");
@@ -253,11 +235,11 @@ protected function getInput()
type: "POST",
url: "index.php?option=com_cck&task=saveIntegrationAjax&"+Joomla.getOptions("csrf.token")+"=1",
beforeSend:function(){ $("#toolbar-help").after(\'
\'+loading+\'
\'); },
- success: function(response){ $("#toolbar-spinner").remove(); Joomla.submitbutton("'.$pre.'component."+task); },
+ success: function(response){ $("#toolbar-spinner").remove(); Joomla.submitbutton("' . $pre . 'component."+task); },
error:function(){}
});
} else {
- Joomla.submitbutton("'.$pre.'component."+task);
+ Joomla.submitbutton("' . $pre . 'component."+task);
}
}
};
@@ -296,9 +278,10 @@ protected function getInput()
});
})(jQuery);
';
- $doc->addScriptDeclaration( $js );
+ $doc->addScriptDeclaration($js);
- return implode( "\n", $html );
- }
+ return implode("\n", $html);
+ }
}
-?>
\ No newline at end of file
+
+?>