BUG 000 Change in the hook for the auth. sources plugins

This commit is contained in:
Julio Cesar Laura
2011-09-19 18:02:37 -04:00
parent 9707ed13a7
commit 2bb8f87afa
2 changed files with 159 additions and 90 deletions

View File

@@ -35,25 +35,25 @@ class headPublisher {
var $maborakLoaderFiles = array (); var $maborakLoaderFiles = array ();
var $scriptFiles = array (); var $scriptFiles = array ();
var $leimnudLoad = array (); var $leimnudLoad = array ();
/* extJsSkin init coreLoad flag*/ /* extJsSkin init coreLoad flag*/
var $extJsInit = 'false'; var $extJsInit = 'false';
/* extJsSkin store the current skin for the ExtJs*/ /* extJsSkin store the current skin for the ExtJs*/
var $extJsSkin = ''; var $extJsSkin = '';
/* extJsScript Array, to store the file to be include */ /* extJsScript Array, to store the file to be include */
var $extJsScript = array (); var $extJsScript = array ();
/* extJsLibrary Array, to store extended ExtJs lybraries */ /* extJsLibrary Array, to store extended ExtJs lybraries */
var $extJsLibrary = array (); var $extJsLibrary = array ();
/* extJsContent Array, to store the file to be include in the skin content */ /* extJsContent Array, to store the file to be include in the skin content */
var $extJsContent = array (); var $extJsContent = array ();
/* extVariable array, to store the variables generated in PHP, and used in JavaScript */ /* extVariable array, to store the variables generated in PHP, and used in JavaScript */
var $extVariable = array (); var $extVariable = array ();
var $leimnudInitString = ' var leimnud = new maborak(); var $leimnudInitString = ' var leimnud = new maborak();
leimnud.make({ leimnud.make({
zip:true, zip:true,
@@ -70,25 +70,25 @@ class headPublisher {
}catch(e){}'; }catch(e){}';
var $disableHeaderScripts = false; var $disableHeaderScripts = false;
var $title = ''; var $title = '';
/** /**
* Function headPublisher * Function headPublisher
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public * @access public
* @return string * @return string
*/ */
private function __construct() { private function __construct() {
$this->addScriptFile ( "/js/maborak/core/maborak.js" ); $this->addScriptFile ( "/js/maborak/core/maborak.js" );
} }
function &getSingleton() { function &getSingleton() {
if (self::$instance == NULL) { if (self::$instance == NULL) {
self::$instance = new headPublisher ( ); self::$instance = new headPublisher ( );
} }
return self::$instance; return self::$instance;
} }
/** /**
* Function setTitle * Function setTitle
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -100,7 +100,7 @@ class headPublisher {
function setTitle($title) { function setTitle($title) {
$this->title = $title; $this->title = $title;
} }
/** /**
* Function addMaborakFile * Function addMaborakFile
* @access public * @access public
@@ -114,7 +114,7 @@ class headPublisher {
else else
$this->maborakFiles [] = $filename; $this->maborakFiles [] = $filename;
} }
/** /**
* Function addScriptFile * Function addScriptFile
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -129,7 +129,7 @@ class headPublisher {
if ($LoadType == 2) if ($LoadType == 2)
$this->leimnudLoad [$url] = $url; $this->leimnudLoad [$url] = $url;
} }
/** /**
* Function addInstanceModule * Function addInstanceModule
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -138,11 +138,11 @@ class headPublisher {
* @parameter string module * @parameter string module
* @return string * @return string
*/ */
function addInstanceModule($instance, $module) { function addInstanceModule($instance, $module) {
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Instance:" . $instance . ",Type:'module'});\n"; $this->headerScript .= "leimnud.Package.Load('" . $module . "',{Instance:" . $instance . ",Type:'module'});\n";
} }
/** /**
* Function addClassModule * Function addClassModule
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -154,7 +154,7 @@ class headPublisher {
function addClassModule($class, $module) { function addClassModule($class, $module) {
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Class:" . $class . ",Type:'module'});\n"; $this->headerScript .= "leimnud.Package.Load('" . $module . "',{Class:" . $class . ",Type:'module'});\n";
} }
/** /**
* Function addScriptCode * Function addScriptCode
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -165,7 +165,7 @@ class headPublisher {
function addScriptCode($script) { function addScriptCode($script) {
$this->headerScript .= $script; $this->headerScript .= $script;
} }
/** /**
* Function printHeader * Function printHeader
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
@@ -185,20 +185,20 @@ class headPublisher {
if ($this->disableHeaderScripts) if ($this->disableHeaderScripts)
return ''; return '';
// available js-calendar languages array // available js-calendar languages array
$availableJsCalendarLang = array('ca', 'cn', 'cz', 'de', 'en', 'es', 'fr', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv'); $availableJsCalendarLang = array('ca', 'cn', 'cz', 'de', 'en', 'es', 'fr', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv');
// get the system language without locale // get the system language without locale
$sysLang = explode('-', SYS_LANG); $sysLang = explode('-', SYS_LANG);
$sysLang = $sysLang[0]; $sysLang = $sysLang[0];
// verify if the requested lang by the system is supported by js-calendar library, if not set english by default // verify if the requested lang by the system is supported by js-calendar library, if not set english by default
$sysLang = in_array($sysLang, $availableJsCalendarLang) ? $sysLang : 'en'; $sysLang = in_array($sysLang, $availableJsCalendarLang) ? $sysLang : 'en';
$this->addScriptFile ( "/js/widgets/js-calendar/unicode-letter.js" ); $this->addScriptFile ( "/js/widgets/js-calendar/unicode-letter.js" );
$this->addScriptFile ( "/js/widgets/js-calendar/lang/".$sysLang.".js" ); $this->addScriptFile ( "/js/widgets/js-calendar/lang/".$sysLang.".js" );
$this->addScriptFile ( "/js/widgets/js-calendar/lang/en.js" ); $this->addScriptFile ( "/js/widgets/js-calendar/lang/en.js" );
$head = ''; $head = '';
$head .= '<TITLE>' . $this->title . "</TITLE>\n"; $head .= '<TITLE>' . $this->title . "</TITLE>\n";
foreach ( $this->scriptFiles as $file ) foreach ( $this->scriptFiles as $file )
@@ -211,7 +211,7 @@ class headPublisher {
$head .= "</script>\n"; $head .= "</script>\n";
return $head; return $head;
} }
/** /**
* Function printRawHeader * Function printRawHeader
* Its prupose is to load el HEADs initialization javascript * Its prupose is to load el HEADs initialization javascript
@@ -245,7 +245,7 @@ class headPublisher {
//$head .= "</script>\n"; //$head .= "</script>\n";
return $head; return $head;
} }
/** /**
* Function clearScripts * Function clearScripts
* Its prupose is to clear all the scripts of the header. * Its prupose is to clear all the scripts of the header.
@@ -260,7 +260,7 @@ class headPublisher {
$this->leimnudInitString = ''; $this->leimnudInitString = '';
$this->headerScript = ''; $this->headerScript = '';
} }
/** /**
* Function includeExtJs * Function includeExtJs
* with this function we are using the ExtJs library, this library is not compatible with * with this function we are using the ExtJs library, this library is not compatible with
@@ -295,31 +295,31 @@ class headPublisher {
//$head .= " <script type='text/javascript' src='/gulliver/loader?t=js-translations&locale=".SYS_LANG."'></script>\n"; //$head .= " <script type='text/javascript' src='/gulliver/loader?t=js-translations&locale=".SYS_LANG."'></script>\n";
$head .= " <script type='text/javascript' src='/js/ext/translation.".SYS_LANG.".js'></script>\n"; $head .= " <script type='text/javascript' src='/js/ext/translation.".SYS_LANG.".js'></script>\n";
if (! isset ( $this->extJsSkin ) || $this->extJsSkin == '') { if (! isset ( $this->extJsSkin ) || $this->extJsSkin == '') {
$this->extJsSkin = 'xtheme-gray'; $this->extJsSkin = 'xtheme-gray';
//$this->extJsSkin = 'gtheme'; //$this->extJsSkin = 'gtheme';
} }
//$head .= $this->getExtJsStylesheets(); //$head .= $this->getExtJsStylesheets();
$head .= $this->getExtJsScripts(); $head .= $this->getExtJsScripts();
$head .= $this->getExtJsVariablesScript(); $head .= $this->getExtJsVariablesScript();
return $head; return $head;
} }
function getExtJsStylesheets($skinName){ function getExtJsStylesheets($skinName){
$script = " <link rel='stylesheet' type='text/css' href='/css/$skinName.css' />\n"; $script = " <link rel='stylesheet' type='text/css' href='/css/$skinName.css' />\n";
/* /*
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/ext-all-notheme.css' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/ext-all-notheme.css' />\n";
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/" . $this->extJsSkin.".css' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/" . $this->extJsSkin.".css' />\n";
// <!-- DEPRECATED, this will be removed in a future - the three next lines // <!-- DEPRECATED, this will be removed in a future - the three next lines
if (file_exists ( PATH_HTML . 'skins' . PATH_SEP . 'ext' . PATH_SEP . 'pmos-' . $this->extJsSkin . '.css' )) { if (file_exists ( PATH_HTML . 'skins' . PATH_SEP . 'ext' . PATH_SEP . 'pmos-' . $this->extJsSkin . '.css' )) {
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/pmos-" . $this->extJsSkin . ".css' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/pmos-" . $this->extJsSkin . ".css' />\n";
} }
//DEPRECATED, this will be removed in a future --> //DEPRECATED, this will be removed in a future -->
//new interactive css decorator //new interactive css decorator
$script .= " <link rel='stylesheet' type='text/css' href='/gulliver/loader?t=extjs-cssExtended&s=".$this->extJsSkin."' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='/gulliver/loader?t=extjs-cssExtended&s=".$this->extJsSkin."' />\n";
$script .= " <link rel='stylesheet' type='text/css' href='/images/icons_silk/sprite.css' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='/images/icons_silk/sprite.css' />\n";
@@ -333,10 +333,10 @@ class headPublisher {
$script .= " <link rel='stylesheet' type='text/css' href='" . $cssFile->sCssFile . ".css' />\n"; $script .= " <link rel='stylesheet' type='text/css' href='" . $cssFile->sCssFile . ".css' />\n";
} }
} }
return $script; return $script;
} }
function getExtJsScripts(){ function getExtJsScripts(){
$script = ''; $script = '';
if (isset ( $this->extJsScript ) && is_array ( $this->extJsScript )) { if (isset ( $this->extJsScript ) && is_array ( $this->extJsScript )) {
@@ -346,10 +346,10 @@ class headPublisher {
} }
return $script; return $script;
} }
function getExtJsVariablesScript(){ function getExtJsVariablesScript(){
$script = ''; $script = '';
if (count ( $this->extVariable ) > 0) { if (count ( $this->extVariable ) > 0) {
$script = "<script language='javascript'>\n"; $script = "<script language='javascript'>\n";
foreach ( $this->extVariable as $key => $val ) { foreach ( $this->extVariable as $key => $val ) {
@@ -369,10 +369,10 @@ class headPublisher {
} }
$script .= "</script>\n"; $script .= "</script>\n";
} }
return $script; return $script;
} }
/** /**
* add a ExtJS extended library * add a ExtJS extended library
* *
@@ -387,7 +387,7 @@ class headPublisher {
} }
array_push ( $this->extJsLibrary, $library ); array_push ( $this->extJsLibrary, $library );
} }
/** /**
* Function setExtSkin * Function setExtSkin
* with this function we are using the ExtJs library, this library is not compatible with * with this function we are using the ExtJs library, this library is not compatible with
@@ -401,7 +401,7 @@ class headPublisher {
function setExtSkin($skin) { function setExtSkin($skin) {
$this->extJsSkin = $skin; $this->extJsSkin = $skin;
} }
/** /**
* Function addExtJsScript * Function addExtJsScript
* adding a javascript file .js * adding a javascript file .js
@@ -418,10 +418,10 @@ class headPublisher {
* @return string * @return string
*/ */
function addExtJsScript($filename, $debug = false, $isExternal=false) { function addExtJsScript($filename, $debug = false, $isExternal=false) {
$sPath = PATH_TPL; $sPath = PATH_TPL;
//if the template file doesn't exists, then try with the plugins folders //if the template file doesn't exists, then try with the plugins folders
if (! is_file ( $sPath . $filename . ".js" )) { if (! is_file ( $sPath . $filename . ".js" )) {
$aux = explode ( PATH_SEP, $filename ); $aux = explode ( PATH_SEP, $filename );
@@ -442,7 +442,7 @@ class headPublisher {
if (! file_exists ( $jsFilename )) { if (! file_exists ( $jsFilename )) {
return; return;
} }
$mtime = filemtime ( $jsFilename ); $mtime = filemtime ( $jsFilename );
G::mk_dir ( PATH_C . 'ExtJs' ); G::mk_dir ( PATH_C . 'ExtJs' );
if ($debug) { if ($debug) {
@@ -453,7 +453,7 @@ class headPublisher {
else { else {
$cacheName = md5 ( $mtime . $jsFilename ); $cacheName = md5 ( $mtime . $jsFilename );
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js'; $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js';
if (! file_exists ( $cacheFilename )) { if (! file_exists ( $cacheFilename )) {
require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php'); require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php');
$content = JSMin::minify ( file_get_contents ( $jsFilename ) ); $content = JSMin::minify ( file_get_contents ( $jsFilename ) );
@@ -468,9 +468,9 @@ class headPublisher {
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename); $pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
if (count($pluginJavascripts) > 0) { if (count($pluginJavascripts) > 0) {
$jsPluginCacheName = '';
if ($debug) { if ($debug) {
foreach ($pluginJavascripts as $pluginJsFile) { foreach ($pluginJavascripts as $pluginJsFile) {
$jsPluginCacheName = '';
if (substr($pluginJsFile, -3) != '.js') { if (substr($pluginJsFile, -3) != '.js') {
$pluginJsFile .= '.js'; $pluginJsFile .= '.js';
} }
@@ -478,12 +478,16 @@ class headPublisher {
if (file_exists(PATH_PLUGINS . $pluginJsFile)) { if (file_exists(PATH_PLUGINS . $pluginJsFile)) {
$jsPluginCacheName = str_replace ( '/', '_', str_replace('.js', '', $pluginJsFile) ); $jsPluginCacheName = str_replace ( '/', '_', str_replace('.js', '', $pluginJsFile) );
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName.".js"; $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName.".js";
file_put_contents ( $cacheFilename, file_get_contents ( PATH_PLUGINS . $pluginJsFile ) ); file_put_contents ( $cacheFilename, file_get_contents ( PATH_PLUGINS . $pluginJsFile ) );
}
if ($jsPluginCacheName != '') {
$this->extJsScript [] = '/extjs/' . $jsPluginCacheName;
} }
} }
} }
else { else {
foreach ($pluginJavascripts as $pluginJsFile) { foreach ($pluginJavascripts as $pluginJsFile) {
$jsPluginCacheName = '';
if (substr($pluginJsFile, -3) !== '.js') { if (substr($pluginJsFile, -3) !== '.js') {
$pluginJsFile .= '.js'; $pluginJsFile .= '.js';
} }
@@ -491,23 +495,23 @@ class headPublisher {
$mtime = filemtime ( PATH_PLUGINS . $pluginJsFile ); $mtime = filemtime ( PATH_PLUGINS . $pluginJsFile );
$jsPluginCacheName = md5 ( $mtime . $pluginJsFile ); $jsPluginCacheName = md5 ( $mtime . $pluginJsFile );
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . '.js'; $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . '.js';
if (! file_exists ( $cacheFilename )) { if (! file_exists ( $cacheFilename )) {
require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php'); require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php');
$content = JSMin::minify ( file_get_contents ( PATH_PLUGINS . $pluginJsFile ) ); $content = JSMin::minify ( file_get_contents ( PATH_PLUGINS . $pluginJsFile ) );
file_put_contents ( $cacheFilename, $content ); file_put_contents ( $cacheFilename, $content );
} }
} }
if ($jsPluginCacheName != '') {
$this->extJsScript [] = '/extjs/' . $jsPluginCacheName;
}
} }
} }
if ($jsPluginCacheName != '') {
$this->extJsScript [] = '/extjs/' . $jsPluginCacheName;
}
} }
//end hook for registered javascripts from plugins //end hook for registered javascripts from plugins
} }
/** /**
* Function AddContent * Function AddContent
* adding a html file .html. * adding a html file .html.
@@ -522,7 +526,7 @@ class headPublisher {
function AddContent($templateHtml) { function AddContent($templateHtml) {
$this->extJsContent [] = $templateHtml; $this->extJsContent [] = $templateHtml;
} }
/** /**
* Function assign * Function assign
* assign a STRING value to a JS variable * assign a STRING value to a JS variable
@@ -535,7 +539,7 @@ class headPublisher {
function Assign($variable, $value) { function Assign($variable, $value) {
$this->extVariable [] = array ('name' => $variable, 'value' => $value, 'type' => 'string' ); $this->extVariable [] = array ('name' => $variable, 'value' => $value, 'type' => 'string' );
} }
/** /**
* Function assignNumber * Function assignNumber
* assign a Number value to a JS variable * assign a Number value to a JS variable
@@ -573,7 +577,7 @@ class headPublisher {
} }
} }
} }
$template = new TemplatePower ( $sPath . $file . '.html' ); $template = new TemplatePower ( $sPath . $file . '.html' );
$template->prepare (); $template->prepare ();
$body .= $template->getOutputContent (); $body .= $template->getOutputContent ();
@@ -602,7 +606,7 @@ class headPublisher {
} }
return $sJson; return $sJson;
} }
/** /**
* Function disableHeaderScripts * Function disableHeaderScripts
* this function sets disableHeaderScripts to true * this function sets disableHeaderScripts to true

View File

@@ -58,49 +58,50 @@ var comboStatusStore;
var editForm; var editForm;
var contextMenu; var contextMenu;
var w; var w;
var actionButtons;
Ext.onReady(function(){ Ext.onReady(function(){
Ext.QuickTips.init(); Ext.QuickTips.init();
pageSize = parseInt(CONFIG.pageSize); pageSize = parseInt(CONFIG.pageSize);
newButton = new Ext.Action({ newButton = new Ext.Action({
text: _('ID_NEW'), text: _('ID_NEW'),
iconCls: 'button_menu_ext ss_sprite ss_add', iconCls: 'button_menu_ext ss_sprite ss_add',
handler: NewAuthSource handler: NewAuthSource
}); });
editButton = new Ext.Action({ editButton = new Ext.Action({
text: _('ID_EDIT'), text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil', iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: EditAuthSource, handler: EditAuthSource,
disabled: true disabled: true
}); });
deleteButton = new Ext.Action({ deleteButton = new Ext.Action({
text: _('ID_DELETE'), text: _('ID_DELETE'),
iconCls: 'button_menu_ext ss_sprite ss_delete', iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: DeleteAuthSource, handler: DeleteAuthSource,
disabled: true disabled: true
}); });
usersButton = new Ext.Action({ usersButton = new Ext.Action({
text: _('ID_IMPORT_USERS'), text: _('ID_IMPORT_USERS'),
iconCls: 'button_menu_ext ss_sprite ss_user_add', iconCls: 'button_menu_ext ss_sprite ss_user_add',
handler: ImportUsers, handler: ImportUsers,
disabled: true disabled: true
}); });
searchButton = new Ext.Action({ searchButton = new Ext.Action({
text: _('ID_SEARCH'), text: _('ID_SEARCH'),
handler: DoSearch handler: DoSearch
}); });
contextMenu = new Ext.menu.Menu({ contextMenu = new Ext.menu.Menu({
items: [editButton, deleteButton,'-',usersButton] items: [editButton, deleteButton,'-',usersButton]
}); });
searchText = new Ext.form.TextField ({ searchText = new Ext.form.TextField ({
id: 'searchText', id: 'searchText',
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
@@ -119,26 +120,45 @@ Ext.onReady(function(){
} }
} }
}); });
clearTextButton = new Ext.Action({ clearTextButton = new Ext.Action({
text: 'X', text: 'X',
ctCls:'pm_search_x_button', ctCls:'pm_search_x_button',
handler: GridByDefault handler: GridByDefault
}); });
actionButtons = _addPluginActions([newButton, '-', editButton, deleteButton, '-', usersButton, {xtype: 'tbfill'}, searchText, clearTextButton, searchButton]);
smodel = new Ext.grid.RowSelectionModel({ smodel = new Ext.grid.RowSelectionModel({
singleSelect: true, singleSelect: true,
listeners:{ listeners:{
rowselect: function(sm){ rowselect: function(sm, index, record){
editButton.enable(); editButton.enable();
deleteButton.enable(); deleteButton.enable();
usersButton.enable(); usersButton.enable();
if (typeof(_rowselect) !== 'undefined') {
if (Ext.isArray(_rowselect)) {
for (var i = 0; i < _rowselect.length; i++) {
if (Ext.isFunction(_rowselect[i])) {
_rowselect[i](sm, index, record);
}
}
}
}
}, },
rowdeselect: function(sm){ rowdeselect: function(sm, index, record){
editButton.disable(); editButton.disable();
deleteButton.disable(); deleteButton.disable();
usersButton.disable(); usersButton.disable();
if (typeof(_rowdeselect) !== 'undefined') {
if (Ext.isArray(_rowdeselect)) {
for (var i = 0; i < _rowdeselect.length; i++) {
if (Ext.isFunction(_rowdeselect[i])) {
_rowdeselect[i](sm, index, record);
}
}
}
}
} }
} }
}); });
@@ -167,7 +187,7 @@ Ext.onReady(function(){
] ]
}) })
}); });
cmodel = new Ext.grid.ColumnModel({ cmodel = new Ext.grid.ColumnModel({
defaults: { defaults: {
width: 50, width: 50,
@@ -183,13 +203,13 @@ Ext.onReady(function(){
{header: _('ID_ACTIVE_USERS'), dataIndex: 'CURRENT_USERS', width: 90, hidden: false, align: 'center'} {header: _('ID_ACTIVE_USERS'), dataIndex: 'CURRENT_USERS', width: 90, hidden: false, align: 'center'}
] ]
}); });
storePageSize = new Ext.data.SimpleStore({ storePageSize = new Ext.data.SimpleStore({
fields: ['size'], fields: ['size'],
data: [['20'],['30'],['40'],['50'],['100']], data: [['20'],['30'],['40'],['50'],['100']],
autoLoad: true autoLoad: true
}); });
comboPageSize = new Ext.form.ComboBox({ comboPageSize = new Ext.form.ComboBox({
typeAhead : false, typeAhead : false,
mode : 'local', mode : 'local',
@@ -207,9 +227,9 @@ Ext.onReady(function(){
} }
} }
}); });
comboPageSize.setValue(pageSize); comboPageSize.setValue(pageSize);
bbarpaging = new Ext.PagingToolbar({ bbarpaging = new Ext.PagingToolbar({
pageSize: pageSize, pageSize: pageSize,
store: store, store: store,
@@ -218,7 +238,7 @@ Ext.onReady(function(){
emptyMsg: _('ID_GRID_PAGE_NO_AUTHENTICATION_MESSAGE'), emptyMsg: _('ID_GRID_PAGE_NO_AUTHENTICATION_MESSAGE'),
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize] items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
}); });
infoGrid = new Ext.grid.GridPanel({ infoGrid = new Ext.grid.GridPanel({
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
@@ -239,7 +259,7 @@ Ext.onReady(function(){
store: store, store: store,
cm: cmodel, cm: cmodel,
sm: smodel, sm: smodel,
tbar: [newButton, '-', editButton, deleteButton,'-',usersButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton], tbar: actionButtons,
bbar: bbarpaging, bbar: bbarpaging,
listeners: { listeners: {
rowdblclick: EditAuthSource, rowdblclick: EditAuthSource,
@@ -254,22 +274,22 @@ Ext.onReady(function(){
emptyText: _('ID_NO_RECORDS_FOUND') emptyText: _('ID_NO_RECORDS_FOUND')
}) })
}); });
infoGrid.on('rowcontextmenu', infoGrid.on('rowcontextmenu',
function (grid, rowIndex, evt) { function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel(); var sm = grid.getSelectionModel();
sm.selectRow(rowIndex, sm.isSelected(rowIndex)); sm.selectRow(rowIndex, sm.isSelected(rowIndex));
}, },
this this
); );
infoGrid.on('contextmenu', infoGrid.on('contextmenu',
function (evt) { function (evt) {
evt.preventDefault(); evt.preventDefault();
}, },
this this
); );
infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this); infoGrid.addListener('rowcontextmenu',onMessageContextMenu,this);
infoGrid.store.load(); infoGrid.store.load();
@@ -301,7 +321,7 @@ GridByDefault = function(){
//Do Search Function //Do Search Function
DoSearch = function(){ DoSearch = function(){
infoGrid.store.load({params: {textFilter: searchText.getValue()}}); infoGrid.store.load({params: {textFilter: searchText.getValue()}});
}; };
//Update Page Size Configuration //Update Page Size Configuration
@@ -365,11 +385,11 @@ DeleteAuthSource = function(){
viewport.getEl().unmask(); viewport.getEl().unmask();
} }
}); });
} }
}); });
}else{ }else{
PMExt.error(_('ID_AUTH_SOURCES'),_('ID_MSG_CANNOT_DELETE_AUTHENTICATION')); PMExt.error(_('ID_AUTH_SOURCES'),_('ID_MSG_CANNOT_DELETE_AUTHENTICATION'));
} }
}, },
failure: function(r,o){ failure: function(r,o){
@@ -386,3 +406,48 @@ ImportUsers = function(){
location.href = 'authSources_SearchUsers?sUID=' +rowSelected.data.AUTH_SOURCE_UID; location.href = 'authSources_SearchUsers?sUID=' +rowSelected.data.AUTH_SOURCE_UID;
} }
}; };
// Mover a un archivo m<>s gen<65>rico - Start
var _pluginActionButtons = [];
var _rowselect = [];
var _rowdeselect = [];
var _addPluginActions = function(defaultActionButtons) {
try {
if (Ext.isArray(_pluginActionButtons)) {
if (_pluginActionButtons.length > 0) {
var positionToInsert = _tbfillPosition(defaultActionButtons);
var leftActionButtons = defaultActionButtons.slice(0, positionToInsert);
var rightActionButtons = defaultActionButtons.slice(positionToInsert, defaultActionButtons.length - 1);
return leftActionButtons.concat(_pluginActionButtons.concat(rightActionButtons));
}
else {
return defaultActionButtons;
}
}
else {
return defaultActionButtons;
}
}
catch (error) {
return defaultActionButtons;
}
};
var _tbfillPosition = function(actionButtons) {
try {
for (var i = 0; i < actionButtons.length; i++) {
if (Ext.isObject(actionButtons[i])) {
if (actionButtons[i].xtype == 'tbfill') {
return i;
}
}
}
return i;
}
catch (error) {
return 0;
}
};
// Mover a un archivo m<>s gen<65>rico - End