Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: js/HermesJS/modules.json
- ===================================================================
- --- js/HermesJS/modules.json (revision 3474)
- +++ js/HermesJS/modules.json (working copy)
- @@ -23,12 +23,16 @@
- 'portalispm.widget.Combobox' : 'modules.portalispm.widget.combobox',
- 'portalispm.widget.Itemselector' : 'modules.portalispm.widget.itemselector',
- 'portalispm.WidgetTest' : 'modules.portalispm.widgetTest',
- - 'portalispm.widget.TextField' : 'modules.portalispm.widget.textField',
- - 'portalispm.widget.TextMulti' : 'modules.portalispm.widget.textMulti',
- -
- - // System Templates
- - 'portalispm.system.templates.LocalTemplate' : 'modules.portalispm.system.templates.localTemplate',
- + 'portalispm.widget.TextField' : 'modules.portalispm.widget.textField',
- + 'portalispm.widget.TextMulti' : 'modules.portalispm.widget.textMulti',
- +
- + // System Templates
- + 'portalispm.system.templates.LocalTemplate' : 'modules.portalispm.system.templates.localTemplate',
- + 'portalispm.system.templates.RemoteTemplate' : 'modules.portalispm.system.templates.remoteTemplate',
- + // System
- + 'system.RemoteSystem': 'modules.portalispm.system.remoteSystem',
- +
- // Incident
- 'incident.ticket.Edit' : 'modules.incident.ticket.edit',
- @@ -137,10 +141,7 @@
- //Ivreport
- 'performance.report.ViewReports' : 'modules.performance.report.viewReports'
- -
- -
- -
- - },
- + },
- functions : {
- 'get' : 'functions.global',
- Index: js/modules/portalispm/system/remoteSystem.js
- ===================================================================
- --- js/modules/portalispm/system/remoteSystem.js (revision 0)
- +++ js/modules/portalispm/system/remoteSystem.js (revision 0)
- @@ -0,0 +1,66 @@
- +Ext.namespace('system');
- +
- +/**
- + * Screen used per remote systems
- + *
- + * @author Felipe Cardoso Martins
- + *
- + * @class portalispm.system.RemoteSystems
- + */
- +system.RemoteSystem = Ext.extend(
- + function() {},
- + {
- + /**
- + * Do login
- + */
- + doLogin: function()
- + {
- + if (this._config.authenticationType == 'htmlForm') {
- +
- + // create form
- + var loginForm = new NExt.form.FormPanel({
- + name: 'form_' + this._config.formName,
- + standardSubmit: true,
- + hidden: true,
- + defaults: { forceLayout: false },
- + defaultType: 'textfield',
- + items: [
- + {
- + name: this._config.usernameField,
- + value: this._config.username
- + },
- + {
- + name: this._config.passwordField,
- + value: this._config.password
- + }
- + ]
- + });
- +
- + this._tab.add(loginForm);
- +
- + // create iframe
- + var frameName = "iframe_" + this._config.formName;
- + var targetClass = new portalispm.system.templates.RemoteTemplate(this._config.url, frameName);
- + var instance = new targetClass(this._tab);
- +
- + // submit form to iframe
- + loginForm.getForm().getEl().dom.target = frameName;
- + loginForm.getForm().getEl().dom.action = this._config.url;
- + loginForm.getForm().submit({});
- +
- + return instance;
- + }
- + },
- +
- + /**
- + * Constructor
- + */
- + constructor: function(config, tab)
- + {
- + this._config = config;
- + this._tab = tab;
- +
- + return this.doLogin();
- + }
- + }
- +);
- \ No newline at end of file
- Index: js/modules/portalispm/system/templates/remoteTemplate.js
- ===================================================================
- --- js/modules/portalispm/system/templates/remoteTemplate.js (revision 0)
- +++ js/modules/portalispm/system/templates/remoteTemplate.js (revision 0)
- @@ -0,0 +1,72 @@
- +Ext.namespace( 'portalispm.system.templates' );
- +
- +/**
- + * Template de sistema RemoteTemplate
- + *
- + * +--------------------------+
- + * | TOP |
- + * +---+----------------------+
- + * | |
- + * | |
- + * | Frame |
- + * | |
- + * +---+----------------------+
- + *
- + * @author Felipe Cardoso Martins
- + * @class portalispm.system.templates.RemoteTemplate
- + * @extends portalispm.System
- + */
- +portalispm.system.templates.RemoteTemplate = Ext.extend(
- + function() {},
- + {
- + /**
- + * Create template
- + * @function
- + * @private
- + */
- + _createTemplate: function(url, name)
- + {
- + portalispm.system.templates.RemoteTemplate.template = Ext.extend(
- + portalispm.System,
- + {
- + /**
- + * Cria o Layout
- + * @function
- + * @private
- + */
- + _createLayout: function(tab)
- + {
- + tab.add(
- + new Ext.Panel({
- + html: '<iframe src="'+url+'" name="'+name+'" width="100%" height="100%"></iframe>'
- + })
- + );
- + tab.doLayout();
- + },
- +
- + /**
- + * Construtor
- + * @function
- + * @private
- + */
- + constructor : function(tab)
- + {
- + portalispm.system.templates.RemoteTemplate.template.superclass.constructor.call(this);
- + this._createLayout(tab);
- + }
- + }
- + );
- + },
- +
- + /**
- + * Constructor
- + * @function
- + * @private
- + */
- + constructor: function(url, name)
- + {
- + this._createTemplate(url, name);
- + return portalispm.system.templates.RemoteTemplate.template;
- + }
- + }
- +);
- \ No newline at end of file
- Index: js/modules/portalispm/portalispm.js
- ===================================================================
- --- js/modules/portalispm/portalispm.js (revision 3474)
- +++ js/modules/portalispm/portalispm.js (working copy)
- @@ -256,14 +256,17 @@
- this.initTab = function( tab ){
- tab.un( 'activate', $this.initTab );
- - if( typeof tab.portal[ 'class' ] == 'string' ){
- - var targetClass = eval( tab.portal[ 'class' ] );
- - }else{
- - var targetClass = tab.portal[ 'class' ];
- + if (tab.portal['remoteSystem']['url'] == '') {
- + if( typeof tab.portal[ 'class' ] == 'string' ) {
- + var targetClass = eval( tab.portal[ 'class' ] );
- + }else{
- + var targetClass = tab.portal[ 'class' ];
- + }
- + tab.instance = new targetClass(tab);
- + } else {
- + tab.instance = new system.RemoteSystem(tab.portal['remoteSystem'], tab);
- }
- - tab.instance = new targetClass( tab );
- -
- if( tab.portal.system ){
- tab.instance.setID( tab.portal.system.id );
- tab.instance.setName( tab.portal.system.name );
- @@ -286,18 +289,36 @@
- url : '/access/listMySystems',
- disableCaching : false,
- success : function( data, config ){
- - for( var i = 0; i < data.results.length; i++ ){
- - var className = String( data.results[ i ].name || '' );
- - $this.addTab( {
- - title : data.results[ i ].name,
- - portal : {
- - 'class' : className.toLowerCase() + '.' + className,
- - system : {
- - id : data.results[ i ].id,
- - name : data.results[ i ].name
- - }
- - }
- - } );
- + for( var i = 0; i < data.results.length; i++ ) {
- +
- + var className = String(data.results[ i ].name || '');
- + var url = String(data.results[i].url || '');
- + var username = String(data.results[i].username || '');
- + var password = String(data.results[i].password || '');
- + var formName = String(data.results[i].formName || '');
- + var usernameField = String(data.results[i].usernameField || '');
- + var passwordField = String(data.results[i].passwordField || '');
- + var authenticationType = String(data.results[i].authenticationType || '');
- +
- + $this.addTab({
- + title: data.results[ i ].name,
- + portal: {
- + 'class': className.toLowerCase() + '.' + className,
- + remoteSystem: {
- + url: url,
- + username: username,
- + password: password,
- + formName: formName,
- + usernameField: usernameField,
- + passwordField: passwordField,
- + authenticationType: authenticationType
- + },
- + system: {
- + id: data.results[ i ].id,
- + name: data.results[ i ].name
- + }
- + }
- + });
- }
- $this.unmask();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement