View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
09883Bug reportsImport/Exportpublic2015-11-10 12:28
Reporternwinter Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.06+ 
Fixed in Version2.06+ 
Summary09883: Stata (xml) plugin needs small edits to match element IDs in 2.06
Description

The ExportSTATAxml.php file that sets up the Stata XML export plugin needs the element IDs changed to match those used in 2.06. I have attached an updated version of this file that I believe addresses the issue.

Steps To Reproduce

Select "STATA (.xml)" on the Export Results page. Note that it does not automatically select options as it should, and the console reports an error from the getElementById() calls.

TagsNo tags attached.
Attached Files
ExportSTATAxml.php (2,655 bytes)   
<?php
class ExportSTATAxml extends \ls\pluginmanager\PluginBase {
    
    protected $storage = 'DbStorage';
       
    static protected $description = 'Core: Export survey results to a STATA xml file';
    static protected $name = 'STATA Export';
    
    public function init() {
        
        /**
         * Here you should handle subscribing to the events your plugin will handle
         */
        $this->subscribe('listExportPlugins');
        $this->subscribe('listExportOptions');
        $this->subscribe('newExport');
    }
    
    protected $settings = array(
        'statafileversion' => array(
            'type' => 'select',
            'label' => 'Export for Stata',
            'options' => array('113' => 'version 8 through 12', '117'  => 'version 13 and up'),
            'default' => '113',
            'submitonchange'=> false
            )
        );

    public function listExportOptions()
    {
        $event = $this->getEvent();
        $type = $event->get('type');
        
        switch ($type) {
            case 'stataxml':
                $event->set('label', gT("STATA (.xml)"));
                $event->set('onclick', '
				 document.getElementById("answers-short").checked=true;
				 document.getElementById("answers-long").disabled=true;
                     document.getElementById("converty").checked=true;
                     document.getElementById("convertn").checked=true;
                     document.getElementById("convertnto").value=0;
                     document.getElementById("convertyto").value=1;
                     document.getElementById("headstyle-code").disabled=true;
                     document.getElementById("headstyle-abbreviated").disabled=true;
                     document.getElementById("headstyle-full").checked=true;
                     document.getElementById("headstyle-codetext").disabled=true;
				 ');
                break;

            default:
                break;
        }
    }   
    
    /**
     * Registers this export type
     */
    public function listExportPlugins()
    {
        $event = $this->getEvent();
        $exports = $event->get('exportplugins');
        
        // Yes we overwrite existing classes if available
        $exports['stataxml'] = get_class();
        $event->set('exportplugins', $exports);
    }
    
    /**
     * Returns the required IWriter
     */
    public function newExport()
    {
        $event = $this->getEvent();
        $type = $event->get('type');

        $pluginsettings=$this->getPluginSettings(true);
        $writer = new STATAxmlWriter($pluginsettings);
        $event->set('writer', $writer);
    }
}
ExportSTATAxml.php (2,655 bytes)   
Bug heat6
Complete LimeSurvey version number (& build)150911
I will donate to the project if issue is resolvedNo
BrowserAll
Database type & version184
Server OS (if known)centOS
Webserver software & version (if known)apache 2.4.6
PHP Version5.4.16

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2015-09-28 18:55

developer   ~33191

@nwinter : can you make a pull request on our github repo ?

nwinter

nwinter

2015-09-28 18:57

reporter   ~33192

I have no idea how to make a pull request; if you point me to something online that explains this a bit I can probably work it out, though.

c_schmitz

c_schmitz

2015-09-30 13:05

administrator   ~33246

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=16041

c_schmitz

c_schmitz

2015-09-30 13:05

administrator   ~33247

Thank you!

Related Changesets

LimeSurvey: master 5ff7e2f1

2015-09-30 11:05:44

c_schmitz

Details Diff
Fixed issue 09883: Stata plugin options not properly working - patch by nwinter Affected Issues
09883
mod - application/core/plugins/ExportSTATAxml/ExportSTATAxml.php Diff File

Issue History

Date Modified Username Field Change
2015-09-14 21:04 nwinter New Issue
2015-09-14 21:04 nwinter File Added: ExportSTATAxml.php
2015-09-28 18:55 DenisChenu Note Added: 33191
2015-09-28 18:57 nwinter Note Added: 33192
2015-09-29 16:18 c_schmitz Assigned To => c_schmitz
2015-09-29 16:18 c_schmitz Status new => assigned
2015-09-30 13:05 c_schmitz Changeset attached => LimeSurvey master 5ff7e2f1
2015-09-30 13:05 c_schmitz Note Added: 33246
2015-09-30 13:05 c_schmitz Resolution open => fixed
2015-09-30 13:05 c_schmitz Note Added: 33247
2015-09-30 13:05 c_schmitz Status assigned => resolved
2015-09-30 13:05 c_schmitz Fixed in Version => 2.06+
2015-11-10 12:28 c_schmitz Status resolved => closed