modules: add backup module for mtdblock devices
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / admin_system / flashops.htm
index f3d2e8d7b09defe0dd51d5fa79089effddbc8971..8204d38e3435e25e81ed23fe5809f2b9219dd563 100644 (file)
                        <div class="cbi-section-error"><%:The backup archive does not appear to be a valid gzip file.%></div>
                <% end %>
        </div>
+
+       <% local mtds = require("luci.sys").mtds(); if #mtds > 0 then -%>
+       <h3><%:Save mtdblock contents%></h3>
+       <div class="cbi-section-descr"><%:Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )%></div>
+       <div class="cbi-section-node">
+               <form class="inline" method="post" action="<%=url('admin/system/flashops/backupmtdblock')%>">
+                       <input type="hidden" name="token" value="<%=token%>" />
+                       <div class="cbi-value">
+                               <label class="cbi-value-title" for="mtdblockname"><%:Choose mtdblock%></label>
+                               <div class="cbi-value-field">
+                                       <select class="cbi-input-select" data-update="change" name="mtdblockname" id="mtdblockname">
+                                               <% for i, key in ipairs(mtds) do
+                                                       if key and key.name ~= "rootfs_data" then -%>
+                                                               <option<%=
+                                                                       attr("id", "mtdblockname-" .. key.name) ..
+                                                                       attr("value", key.name .. '/'.. key.size .. '/' .. i - 1) ..
+                                                                       attr("data-index", i) ..
+                                                                       ifattr(key.name == "linux" or key.name == "firmware", "selected", "selected")
+                                                               %>><%=pcdata(key.name)%></option>
+                                               <%      end
+                                                end -%>
+                                       </select>
+                               </div>
+                       </div>
+                       <div class="cbi-value cbi-value-last<% if reset_avail then %> cbi-value-error<% end %>">
+                               <label class="cbi-value-title" for="image"><%:Download mtdblock%></label>
+                               <div class="cbi-value-field">
+                                       <input type="submit" class="cbi-button cbi-button-action important" value="<%:Save mtdblock%>" />
+                               </div>
+                       </div>
+               </form>
+       </div>
+       <% end %>
+
 </div>
 
 <div class="cbi-section">