Changeset 2312


Ignore:
Timestamp:
Sep 2, 2013, 4:25:39 PM (5 years ago)
Author:
matthijs
Message:

luci: Only preload data for new custom configurations

Before, it would copy data from the custom profile into itself for no
good reason on subsequent edits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/modules/admin-fon/luasrc/model/cbi/fon_umts/device_config.lua

    r2277 r2312  
    4848        m:set(section_name, 'vendor', device.vendor)
    4949        m:set(section_name, 'product', device.product)
     50
     51        -- Preload data from current profile
     52        if (device.profile) then
     53                m:set(section_name, 'control', device.profile.control)
     54                m:set(section_name, 'data', device.profile.data)
     55                m:set(section_name, 'dialcmd', device.profile.dialcmd)
     56                if not m:get(section_name, base) then
     57                        m:set(section_name, 'base', device.profile.name)
     58                end
     59                for _, mode in ipairs(modes) do
     60                        cmd = device.profile.modes[mode]
     61                        if cmd and #cmd ~= 0 then
     62                                m:set(section_name, 'mode_' .. mode, device.profile.modes[mode])
     63                        end
     64                end
     65        end
    5066end
    5167
     
    5369-- cbi).
    5470m.save = m:submitstate()
    55 
    56 -- Preload data from current profile
    57 if (device.profile) then
    58         m:set(section_name, 'control', device.profile.control)
    59         m:set(section_name, 'data', device.profile.data)
    60         if not m:get(section_name, base) then
    61                 m:set(section_name, 'base', device.profile.name)
    62         end
    63         for _, mode in ipairs(modes) do
    64                 cmd = device.profile.modes[mode]
    65                 if cmd and #cmd ~= 0 then
    66                         m:set(section_name, 'mode_' .. mode, device.profile.modes[mode])
    67                 end
    68         end
    69 end
    7071
    7172-- Workaround a problem that on_success_to isn't fired when create() is
Note: See TracChangeset for help on using the changeset viewer.