Skip to content

Commit

Permalink
[TASK] made RecordPicker use actuall vidi
Browse files Browse the repository at this point in the history
  • Loading branch information
nxpthx committed Nov 8, 2011
1 parent b27adc2 commit cc82197
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 53 deletions.
38 changes: 22 additions & 16 deletions Classes/Service/ModuleLoader.php
Expand Up @@ -149,8 +149,11 @@ public function setAllowedDataTypes(array $tables) {



public function register() {
$moduleCode = $this->mainModule . '_Vidi' . ucfirst($this->extensionKey) . ucfirst($this->moduleKey);
public function register($omitModule = false, $moduleCode = '') {
if ($moduleCode === '') {
$moduleCode = $this->mainModule . '_Vidi' . ucfirst($this->extensionKey) . ucfirst($this->moduleKey);
}

$GLOBALS['TBE_MODULES_EXT']['vidi'][$moduleCode] = array();
$GLOBALS['TBE_MODULES_EXT']['vidi'][$moduleCode]['extKey'] = $this->extensionKey;
$GLOBALS['TBE_MODULES_EXT']['vidi'][$moduleCode]['allowedDataTypes'] = $this->allowedDataTypes;
Expand All @@ -159,20 +162,23 @@ public function register() {
$GLOBALS['TBE_MODULES_EXT']['vidi'][$moduleCode]['ddInterface'] = $this->ddInterface;
$GLOBALS['TBE_MODULES_EXT']['vidi'][$moduleCode]['gridDataService'] = $this->gridService;

Tx_Extbase_Utility_Extension::registerModule(
'vidi',
$this->mainModule,
$this->extensionKey . '_' . $this->moduleKey,
$this->position,
array(
'Vidi' => 'module, browse',
),
array(
'access' => 'user,group',
'icon' => $this->icon,
'labels' => $this->moduleLanguageFile,
)
);
if ($omitModule === FALSE) {
Tx_Extbase_Utility_Extension::registerModule(
'vidi',
$this->mainModule,
$this->extensionKey . '_' . $this->moduleKey,
$this->position,
array(
'Vidi' => 'module, browse',
),
array(
'access' => 'user,group',
'icon' => $this->icon,
'labels' => $this->moduleLanguageFile,
)
);
}

}

/**
Expand Down
23 changes: 1 addition & 22 deletions Resources/Private/Backend/Templates/Vidi/Browse.html
@@ -1,29 +1,8 @@
{namespace ext=Tx_Vidi_ViewHelpers}

imagine the record picker to be shown here.. \o/


<ul>
<li><a href="#" onclick="callback('sys_file', 2, 'Testfile1'); return false;">Testfile1</a></li>
<li><a href="#" onclick="callback('sys_file', 1, 'Testfile2'); return false;">Testfile2</a></li>
</ul>

<script type="text/javascript"><![CDATA[
function callback(table, uid, label) {
]]>
if ('{callbackMethod}' && '{objectId}' && {callbackMethod})
{callbackMethod}('{objectId}', table, uid, label);
<![CDATA[
}
]]>
</script>

<![CDATA[
<ext:Be.moduleContainer
pageTitle="Sample Module" >

<ext:includeCssFile name="Vidi.css" />
<ext:includeCssFile name="FilterBar.css" />

</ext:Be.moduleContainer>
]]>
</ext:Be.moduleContainer>
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/Actions/File.js
Expand Up @@ -45,7 +45,7 @@ TYPO3.Vidi.Actions.File = {
editTextFile: function(record) {
Ext.create(
'TYPO3.Vidi.Components.Overlay',
'file_edit.php?' + Ext.Object.toQueryString({target: record.get('id'), type: '_FILE'}, true),
'file_edit.php?' + Ext.Object.toQueryString({returnUrl: 'typo3/dummy.php',fileReference: record.get('id'), type: '_FILE'}, true),
'editContentRecord',
function() {}
);
Expand Down
19 changes: 19 additions & 0 deletions Resources/Public/JavaScript/Module/RecordPicker/GridToolBar.js
@@ -0,0 +1,19 @@

Ext.define('TYPO3.Vidi.Module.RecordPicker.SelectFilesToolbar', {
extend: 'Ext.toolbar.Paging',
alias: 'widget.TYPO3-Vidi-RecordPicker-SelectFilesToolbar',
prependButtons: true,
displayInfo: false,
constructor: function(cfg) {
this.items = [
"->"
];
this.callParent([cfg]);
},
afterRender: function() {
this.callParent(arguments);
},

});

TYPO3.TYPO3.Core.Registry.set('vidi/mainModule/gridToolbar', 'TYPO3-Vidi-RecordPicker-SelectFilesToolbar', 99);
@@ -0,0 +1,4 @@

TYPO3.TYPO3.Core.Registry.set('vidi/mainModule/collectionManagement/enabled', false, 99);
TYPO3.TYPO3.Core.Registry.set('vidi/mainModule/filterBar/hidden', true, 99);
TYPO3.TYPO3.Core.Registry.set('vidi/docheader/enabled', false, 99);
9 changes: 4 additions & 5 deletions Resources/Public/JavaScript/RecordPicker.js
Expand Up @@ -11,11 +11,10 @@ top.TYPO3.Vidi.RecordPicker = {
width: 600,
height: 400
},
'mod.php?M=user_VidiVidiM1' +
'&tx_vidi_user_vidividim1%5Baction%5D=browse' +
'&tx_vidi_user_vidividim1%5Ballowed%5D=' + allowed +
'&tx_vidi_user_vidividim1%5BcallbackMethod%5D=top.TYPO3.Vidi.RecordPicker.' + (type === 'inline' ? 'callbackTypeInline' : 'callbackTypeGroup') +
'&tx_vidi_user_vidividim1%5BobjectId%5D=' + objectId
'mod.php?M=recordPicker' +
'&tx_vidi_recordPicker%5Ballowed%5D=' + allowed +
'&tx_vidi_recordPicker%5BcallbackMethod%5D=top.TYPO3.Vidi.RecordPicker.' + (type === 'inline' ? 'callbackTypeInline' : 'callbackTypeGroup') +
'&tx_vidi_recordPicker%5BobjectId%5D=' + objectId
)
},

Expand Down
34 changes: 25 additions & 9 deletions ext_tables.php
Expand Up @@ -5,19 +5,35 @@

// Override ExtJS Theme for ExtJS 4 compatibility
// @todo: remove this hook when TYPO3 v4 will be compatible with ExtJS 4
if (strpos($GLOBALS['_GET']['M'],'_Vidi') !== false) {
if (strpos($GLOBALS['_GET']['M'], '_Vidi') !== false || $GLOBALS['_GET']['M'] == 'recordPicker') {
$GLOBALS['TBE_STYLES']['extJS']['theme'] = t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Libraries/ExtJS/resources/css/ext-all-gray.css';
}

if (TYPO3_MODE === 'BE') {
/**
* @var Tx_Vidi_Service_ModuleLoader $moduleLoader
*/
$moduleLoader = t3lib_div::makeInstance('Tx_Vidi_Service_ModuleLoader', $_EXTKEY);
$moduleLoader->addStandardTree(Tx_Vidi_Service_ModuleLoader::TREE_PAGES);

$moduleLoader->setAllowedDataTypes(array('tt_content', 'pages', 'cache_extensions', 'tx_ttnews', '_FILE'));
$moduleLoader->register();

/** @var Tx_Vidi_Service_ModuleLoader $moduleLoader */
$moduleLoader = t3lib_div::makeInstance('Tx_Vidi_Service_ModuleLoader', 'vidi');
$moduleLoader->addStandardTree(Tx_Vidi_Service_ModuleLoader::TREE_FILES);
$moduleLoader->setAllowedDataTypes(array('_FILE'));
$moduleLoader->addJavaScriptFiles(array(
'Module/RecordPicker/ModuleConfiguration.js',
'Module/RecordPicker/GridToolBar.js'
),
'Resources/Public/JavaScript'
);
$moduleLoader->register(TRUE, 'recordPicker');

$GLOBALS['TBE_MODULES']['_configuration']['recordPicker'] = array(
'extensionName' => 'Vidi',
'name' => 'recordPicker',
'script' => 'mod.php?M=recordPicker',
);
$GLOBALS['TBE_MODULES']['recordPicker'] = 'recordPicker';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Vidi']['modules']['recordPicker'] = array();
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Vidi']['modules']['recordPicker']['controllers']['Vidi']['actions'][] = 'browse';




$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'][$_EXTKEY] = 'EXT:vidi/Classes/Hook/TceformsHook.php:Tx_Vidi_Hook_TceformsHook';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['renderPossibleRecordsSelectorTypeGroupDB'][$_EXTKEY] = 'EXT:vidi/Classes/Hook/TceformsHook.php:Tx_Vidi_Hook_TceformsHook';
Expand Down

0 comments on commit cc82197

Please sign in to comment.