Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- miniShop.window.createGoods = function(config) {
- config = config || {};
- this.ident = config.ident || 'qcr'+Ext.id();
- Ext.applyIf(config,{
- title: _('ms.goods.create')
- ,id: this.ident
- ,width: 700
- ,modal: true
- ,labelAlign: 'left'
- ,labelWidth: 150
- ,url: miniShop.config.connector_url
- ,action: 'mgr/goods/create'
- ,shadow: false
- ,listeners: {
- success: function(){
- this.getStore().reload();
- }
- }
- ,fields: [{
- xtype: 'modx-tabs'
- ,activeTab: config.activeTab || 0
- ,bodyStyle: { background: 'transparent' }
- ,deferredRender: false
- ,autoHeight: true
- ,stateful: true
- ,stateId: 'ms-tabs-goods'
- ,stateEvents: ['tabchange']
- ,getState:function() {
- return { activeTab:this.items.indexOf(this.getActiveTab()) };
- }
- ,items: [{
- id: 'modx-'+this.ident+'-resource'
- ,title: _('resource')
- ,layout: 'form'
- ,cls: 'modx-panel'
- ,bodyStyle: {
- background: 'transparent',
- padding: '10px'
- }
- ,autoHeight: true
- ,labelAlign: 'top'
- ,labelWidth: 100
- ,items: [{
- layout: 'column'
- ,border: false
- ,items: [{
- columnWidth: .5
- ,border: false
- ,layout: 'form'
- ,items: [
- {
- xtype: 'textfield',
- name: 'pagetitle',
- id: 'modx-'+this.ident+'-pagetitle',
- fieldLabel: _('pagetitle'),
- anchor: '100%',
- allowBlank: false
- }
- ,{
- xtype: 'textfield',
- name: 'longtitle',
- id: 'modx-'+this.ident+'-longtitle',
- fieldLabel: _('long_title'),
- anchor: '100%'
- }
- ,{
- xtype: 'textarea',
- name: 'description',
- id: 'modx-'+this.ident+'-description',
- fieldLabel: _('description'),
- anchor: '100%',
- grow: false,
- height: 50,
- style: 'font-family:Arial'
- }
- ,{
- xtype: 'textarea',
- name: 'introtext',
- id: 'modx-'+this.ident+'-introtext',
- fieldLabel: _('introtext'),
- anchor: '100%',
- height: 50
- }
- ,{
- xtype: 'xcheckbox',
- name: 'deleted',
- id: 'modx-'+this.ident+'-deleted',
- boxLabel: _('deleted'),
- description: _('resource_delete_help'),
- inputValue: 1,
- checked: false
- }
- ,{
- xtype: 'xcheckbox',
- name: 'clearCache',
- id: 'modx-'+this.ident+'-clearcache',
- boxLabel: _('clear_cache_on_save'),
- description: _('clear_cache_on_save_msg'),
- inputValue: 1,
- checked: true
- }
- ,{
- xtype : 'xcheckbox',
- name : 'richtext',
- id : 'modx-'+this.ident+'-richtext',
- boxLabel : _('resource_richtext'),
- description: _('resource_richtext_help'),
- inputValue : 1,
- checked : MODx.config.richtext_default == '1' && config.disable_categories ? 1 : 0
- }
- ]
- },{
- columnWidth: .5
- ,border: false
- ,layout: 'form'
- ,items: [
- {
- xtype: 'minishop-combo-goodstemplate',
- id: 'modx-'+this.ident+'-template',
- fieldLabel: _('template'),
- editable: false,
- anchor: '100%',
- value: miniShop.config.ms_goods_tpls[0]
- }
- ,{
- xtype: 'minishop-filter-category',
- id: 'modx-'+this.ident+'-category',
- name: 'parent',
- fieldLabel: _('ms.category'),
- baseParams: {
- action: 'mgr/combo/cats_and_goods',
- addall: 0
- },
- anchor: '100%',
- hiddenName: 'parent'
- }
- ,{
- xtype: 'textfield',
- name: 'alias',id: 'modx-'+this.ident+'-alias',
- fieldLabel: _('alias'),
- anchor: '100%'
- }
- ,{
- xtype: 'textfield',name: 'menutitle',id: 'modx-'+this.ident+'-menutitle',fieldLabel: _('resource_menutitle'),anchor: '100%'}
- ,{
- xtype: 'xcheckbox',name: 'published',id: 'modx-'+this.ident+'-published',boxLabel: _('resource_published'),description: _('resource_published_help'),inputValue: 1,checked: MODx.config.publish_default == '1' && config.disable_categories ? 1 : 0}
- ,{
- xtype: 'xcheckbox',name: 'hidemenu',id: 'modx-'+this.ident+'-hidemenu',boxLabel: _('resource_hide_from_menus'),description: _('resource_hide_from_menus_help'),inputValue: 1,checked: MODx.config.hidemenu_default == '1' && config.disable_categories ? 1 : 0}
- ,{
- xtype: 'xcheckbox',name: 'searchable',id: 'modx-'+this.ident+'-searchable',boxLabel: _('resource_searchable'),description: _('resource_searchable_help'),inputValue: 1,checked: MODx.config.search_default == '1' && config.disable_categories ? 1 : 0}
- ,{
- xtype: 'xcheckbox',name: 'cacheable',id: 'modx-'+this.ident+'-cacheable',boxLabel: _('resource_cacheable'),description: _('resource_cacheable_help'),inputValue: 1,checked: MODx.config.cache_default == '1' && config.disable_categories ? 1 : 0}
- ]
- }]
- }
- ,{
- xtype: 'hidden',
- name: 'class_key',
- value: 'modDocument'
- }
- ,{
- xtype: 'hidden',name: 'context_key'}
- ,{xtype: 'hidden',name: 'content_type' ,value: 1}
- ,{xtype: 'hidden',name: 'content_dispo',value: 0}
- ,{xtype: 'hidden',name: 'isfolder' ,value: 0}
- ]
- },{
- id: 'modx-'+this.ident+'-descr'
- ,title: 'Описание'
- ,layout: 'form'
- ,cls: 'modx-panel'
- ,bodyStyle: {
- background: 'transparent',
- padding: '5px'
- }
- ,autoHeight: true
- ,labelAlign: 'top'
- ,labelWidth: 100
- ,items: [{
- xtype : config.record.richtext ? 'htmleditor' : 'textarea',
- name : 'content',
- id : 'modx-'+this.ident+'-content',
- anchor : '100%',
- style : 'font-family:Arial',
- height : 450
- }]
- },{
- id: 'modx-'+this.ident+'-properties'
- ,title: _('ms.properties')
- ,layout: 'form'
- ,cls: 'modx-panel'
- ,autoHeight: true
- ,forceLayout: true
- ,labelAlign: 'left'
- ,labelWidth: 200
- ,defaults: {autoHeight: true ,border: false}
- ,style: 'background: transparent;'
- ,bodyStyle: { background: 'transparent', padding: '10px' }
- ,items: [
- {
- xtype: 'hidden',
- name: 'id'
- }
- ,{
- xtype: 'hidden',
- name: 'wid'
- }
- ,{
- xtype: 'textfield',
- name: 'article',
- fieldLabel: _('ms.article')
- }
- ,{
- xtype: 'spinnerfield',
- name: 'price',
- fieldLabel: _('ms.price'),
- minValue: 0,
- maxValue: 1000000,
- allowDecimals: true,
- decimalPrecision: 2,
- incrementValue: 0.01,
- alternateIncrementValue: 10.0,
- accelerate: true
- }
- ,{
- // xtype: 'numberfield',
- xtype: 'spinnerfield',
- name: 'weight',
- fieldLabel: _('ms.weight'),
- minValue: 0,
- maxValue: 1000,
- allowDecimals: true,
- decimalPrecision: 3,
- incrementValue: 0.001,
- alternateIncrementValue: 1.0,
- accelerate: true
- }
- ,{
- xtype: 'ms-combo-browser',
- openTo: config.record.img,
- name: 'img',
- fieldLabel: _('ms.img'),
- anchor: '100%'
- }
- ,{
- xtype: 'spinnerfield',
- name: 'remains',
- fieldLabel: _('ms.remains'),
- minValue: 0,
- maxValue: 10000,
- allowDecimals: false,
- incrementValue: 1,
- alternateIncrementValue: 100,
- accelerate: true
- }
- ,{
- xtype: 'textfield',
- name: 'reserved',
- disabled: true,
- fieldLabel: _('ms.reserved')
- }
- ,{
- xtype: 'ms-superbox-tags',
- name: 'tags[]',
- value: config.record.tags,
- fieldLabel: _('ms.tags')
- }
- ,{
- xtype: 'minishop-combo-brands',
- fieldLabel: _('ms.goods.add1'),
- id: 'minishop-'+this.ident+'-add1',
- name: 'add1',
- anchor: '100%',
- }
- ,{
- xtype: 'textfield',
- name: 'add2',
- fieldLabel: _('ms.goods.add2'),
- anchor: '100%'
- }
- ,{
- xtype: 'textfield',
- name: 'add3',
- fieldLabel: _('ms.goods.add3'),
- autoHeight: false,
- anchor: '100%'
- },{
- xtype: 'checkbox',
- name: 'duplicate',
- value: 1,
- style: 'padding: 10px;',
- fieldLabel: _('ms.goods.duplicate'),
- description: _('ms.goods.duplicate.desc')
- }
- ]
- },{
- id: 'modx-'+this.ident+'-params',
- title: _('ms.params'),
- items: [
- {
- xtype: 'minishop-grid-params',
- disabled: config.disable_categories,
- baseParams: {
- action: 'mgr/goods/params/getlist',
- gid: gid
- },
- gid: gid,
- emptyText: _('ms.params.select')
- }
- ]
- }
- /*,{
- id: 'modx-'+this.ident+'-tvs'
- ,title: 'TVs'
- ,items: [{
- xtype: 'minishop-grid-tvs',
- disabled: config.disable_categories,
- baseParams: {
- action: 'mgr/goods/tv/getlist',
- gid: gid
- }
- }]
- }*/
- ,{
- id: 'modx-'+this.ident+'-gallery',
- title: 'Фотографии',
- items: [{
- xtype: 'minishop-grid-gallery',
- disabled: config.disable_categories,
- baseParams: {
- action: 'mgr/goods/gallery/getlist',
- gid: gid
- },
- gid: gid
- }]
- }
- /* ,{
- id: 'modx-'+this.ident+'-categories',
- title: _('ms.categories'),
- items: [{
- xtype: 'minishop-grid-categories',
- disabled: config.disable_categories,
- baseParams: {
- action: 'mgr/goods/getcatlist',
- gid: gid
- }
- }]
- }*/
- ]
- }],
- keys: [{
- key: Ext.EventObject.ENTER,
- shift: true,
- fn: function() {
- changed = 1; this.submit()
- },
- scope: this
- }],
- buttons: [{
- text: config.cancelBtnText || _('cancel'),
- scope: this,
- handler: function() {this.hide(); }
- },{
- xtype: 'tbfill'
- },{
- text: config.saveBtnText || _('save_and_close'),
- scope: this,
- handler: function() {changed = 1; this.submit()}
- },{
- text: config.saveAndContinueBtnText || 'Сохранить',
- scope: this,
- handler: function() {
- changed = 1;
- this.submit(false);
- // this.update();
- }
- }]
- });
- miniShop.window.createGoods.superclass.constructor.call(this,config);
- };
- Ext.extend(miniShop.window.createGoods,MODx.Window);
- Ext.reg('minishop-window-creategoods',miniShop.window.createGoods);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement