Commit 6e81eb57 authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: Add import/export of index from/to JSON file

Index can be saved to a Json file and shared to others users.
The json file can also be imported in Mynij to avoid build the index from scrash
parent ede62a0a
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Import from Torrent</string> </value> <value> <string>Import Index Torrent</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>mynij_search_search_in_index</string> </value> <value> <string>mynij_search_import_file</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Search in index</string> </value> <value> <string>Import Index File</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_searchInIndexMynijSearch</string> </value> <value> <string>string:${object_url}/MynijSearchCollection_importIndexFile</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_js_script</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_js_script</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mynij_index_export_file</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>List portal members</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Export Index to File</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_exportIndexMynijSearch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -311,9 +311,7 @@ ...@@ -311,9 +311,7 @@
var gadget = this, var gadget = this,
doc = { doc = {
title: title, title: title,
links: links, links: links
info_hash: infoHash,
magnet_uri: magnetURI
}; };
return gadget.getSetting("portal_type") return gadget.getSetting("portal_type")
.push(function (portal_type) { .push(function (portal_type) {
...@@ -424,11 +422,6 @@ ...@@ -424,11 +422,6 @@
return gadget.jio_get(id); return gadget.jio_get(id);
} }
} }
})
.push(function (doc) {
doc.info_hash = torrent.infoHash;
doc.magnet_uri = torrent.magnetURI;
return gadget.jio_put(id, doc);
}); });
}; };
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.48399.36109.57497</string> </value> <value> <string>988.55437.32344.9847</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1608301491.76</float> <float>1608722907.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
}); });
}) })
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.ready(function () { .ready(function () {
var indices = [], db; var indices = [], db;
...@@ -70,32 +73,49 @@ ...@@ -70,32 +73,49 @@
return this.state.db.get(id); return this.state.db.get(id);
}) })
.declareMethod("save_index", function (index_name) { .declareMethod("pushIndexBlob", function (index_id, index_dict, info) {
var gadget = this, var gadget = this;
serialized = this.state.indices[index_name].export_test(),
index_id = "index-" + index_name;
return this.state.db.put( return this.state.db.put(
index_id, index_id,
{type: "index", info: this.state.indices[index_name].info()} {type: "index", info: info}
) )
.push(function () { .push(function () {
return gadget.state.db.putAttachment( return gadget.state.db.putAttachment(
index_id, "ids", index_id, "ids",
new Blob([serialized.ids], {type : "application/json"})); new Blob([index_dict.ids], {type : "application/json"}));
}) })
.push(function () { .push(function () {
return gadget.state.db.putAttachment( return gadget.state.db.putAttachment(
index_id, index_id,
"map", "map",
new Blob([serialized.map], {type : "application/json"})); new Blob([index_dict.map], {type : "application/json"}));
}) })
.push(function () { .push(function () {
return gadget.state.db.putAttachment( return gadget.state.db.putAttachment(
index_id, index_id,
"ctx", "ctx",
new Blob([serialized.ctx], {type : "application/json"})); new Blob([index_dict.ctx], {type : "application/json"}));
}) });
})
.declareMethod("pushIndex", function (index_name) {
var gadget = this;
return gadget.getSetting('index_list', [])
.push(function (index_list) {
if (index_list.indexOf(index_name) === -1) {
index_list.push(index_name);
return gadget.setSetting('index_list', index_list);
}
});
})
.declareMethod("save_index", function (index_name) {
var gadget = this,
serialized = this.state.indices[index_name].export_test(),
index_id = "index-" + index_name;
return gadget.pushIndexBlob(index_id,
serialized,
this.state.indices[index_name].info())
.push(function () { .push(function () {
console.log("Index saved : "); console.log("Index saved : ");
console.log(gadget.state.indices[index_name].info()); console.log(gadget.state.indices[index_name].info());
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.17215.10748.5085</string> </value> <value> <string>988.53918.53330.53026</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1606517315.87</float> <float>1608674258.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -104,6 +104,11 @@ hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9 ...@@ -104,6 +104,11 @@ hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovQmFzZV9idWlsZEluZGV4TXluaWpTZWFyY2g=\n hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovQmFzZV9idWlsZEluZGV4TXluaWpTZWFyY2g=\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovTXluaWpTZWFyY2hDb2xsZWN0aW9uX2ltcG9ydEluZGV4\n hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovTXluaWpTZWFyY2hDb2xsZWN0aW9uX2ltcG9ydEluZGV4\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9uIE1vZHVsZS9teW5pal9pbmRleF9pbXBvcnQ\n hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9uIE1vZHVsZS9teW5pal9pbmRleF9pbXBvcnQ\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovQmFzZV9leHBvcnRJbmRleE15bmlqU2VhcmNo\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9uL215bmlqX2luZGV4X2V4cG9ydF9maWxl\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfbXluaWovTXluaWpTZWFyY2hDb2xsZWN0aW9uX2ltcG9ydEluZGV4RmlsZQ\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL015bmlqIFNlYXJjaCBDb2xsZWN0aW9uIE1vZHVsZS9teW5pal9zZWFyY2hfaW1wb3J0X2ZpbGU=\n
\n
\n \n
NETWORK:\n NETWORK:\n
*</string> </value> *</string> </value>
...@@ -239,7 +244,7 @@ NETWORK:\n ...@@ -239,7 +244,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.48448.28585.15018</string> </value> <value> <string>988.52845.49063.61405</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +262,7 @@ NETWORK:\n ...@@ -257,7 +262,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1608303775.09</float> <float>1608626181.83</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">mynij_search_collection_module</script> <script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">mynij_search_collection_module</script>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Mynij Search Collection</script> <script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Mynij Search Collection</script>
<script data-renderjs-configuration="portal_skin_folder" type="text/x-renderjs-configuration">erp5_mynij</script> <script data-renderjs-configuration="portal_skin_folder" type="text/x-renderjs-configuration">erp5_mynij</script>
<script data-renderjs-configuration="app_actions" type="text/x-renderjs-configuration">('Mynij Search Collection Module | mynij_search_view', 'Mynij Search Collection Module | mynij_index_import', 'Mynij Search Collection | mynij_search_view', 'Mynij Search Collection | mynij_search_build_index')</script> <script data-renderjs-configuration="app_actions" type="text/x-renderjs-configuration">('Mynij Search Collection Module | mynij_search_view', 'Mynij Search Collection Module | mynij_index_import', 'Mynij Search Collection Module | mynij_search_import_file', 'Mynij Search Collection | mynij_search_view', 'Mynij Search Collection | mynij_search_build_index', 'Mynij Search Collection | mynij_index_export_file')</script>
<script data-renderjs-configuration="app_allowed_sub_types" type="text/x-renderjs-configuration">('Mynij Search Collection Module | Mynij Search Collection',)</script> <script data-renderjs-configuration="app_allowed_sub_types" type="text/x-renderjs-configuration">('Mynij Search Collection Module | Mynij Search Collection',)</script>
<script data-renderjs-configuration="mynij_search_collection_module_dict" type="text/x-renderjs-configuration">{"title": "Mynij Search", "filter_action": 1, "hide_add_button": 0, "history_previous_link": 1}</script> <script data-renderjs-configuration="mynij_search_collection_module_dict" type="text/x-renderjs-configuration">{"title": "Mynij Search", "filter_action": 1, "hide_add_button": 0, "history_previous_link": 1}</script>
<script data-renderjs-configuration="mynij_search_collection_dict" type="text/x-renderjs-configuration">{"title": "Mynij Search", "editable": 1, "history_previous_link": 1}</script> <script data-renderjs-configuration="mynij_search_collection_dict" type="text/x-renderjs-configuration">{"title": "Mynij Search", "editable": 1, "history_previous_link": 1}</script>
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.42540.39532.44953</string> </value> <value> <string>988.52799.47822.20923</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1607948996.39</float> <float>1608626466.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>gadget_field_action_js_script</string>
<string>action_description</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_exportIndexMynijSearch</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_buildIndexMynijSearch</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>ERP5 Form</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>your_info_hash</string> </value> <value> <string>action_description</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Torrent infoHash</string> </value> <value> <string>Export Index</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="TextAreaField" module="Products.Formulator.StandardFields"/> <global name="GadgetField" module="Products.ERP5Form.GadgetField"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>your_magnet_uri</string> </value> <value> <string>gadget_field_action_js_script</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -19,20 +19,8 @@ ...@@ -19,20 +19,8 @@
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item> <item>
<key> <string>line_too_long</string> </key> <key> <string>no_validator</string> </key>
<value> <string>A line was too long.</string> </value> <value> <string>Does not support this operation.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
...@@ -49,6 +37,10 @@ ...@@ -49,6 +37,10 @@
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -74,7 +66,7 @@ ...@@ -74,7 +66,7 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>gadget_url</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -82,19 +74,11 @@ ...@@ -82,19 +74,11 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>max_lines</string> </key> <key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -102,15 +86,11 @@ ...@@ -102,15 +86,11 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>validator_form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -128,6 +108,10 @@ ...@@ -128,6 +108,10 @@
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -153,7 +137,7 @@ ...@@ -153,7 +137,7 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>gadget_url</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -161,19 +145,11 @@ ...@@ -161,19 +145,11 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>max_lines</string> </key> <key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -181,15 +157,11 @@ ...@@ -181,15 +157,11 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>validator_form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -207,6 +179,10 @@ ...@@ -207,6 +179,10 @@
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>data_url</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -217,7 +193,7 @@ ...@@ -217,7 +193,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -232,44 +208,34 @@ ...@@ -232,44 +208,34 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>gadget_url</string> </key>
<value> <int>5</int> </value> <value> <string>action_mynij_search_import_export_index.html</string> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>renderjs_extra</string> </key>
<value> <int>0</int> </value> <value>
<list/>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Magnet Uri</string> </value> <value> <string>gadget_field_action_js_script</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>validator_field_id</string> </key>
<value> <int>0</int> </value> <value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>validator_form_id</string> </key>
<value> <int>40</int> </value> <value> <string></string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
</item> </item>
<item> <item>
<key> <string>gadget_url</string> </key> <key> <string>gadget_url</string> </key>
<value> <string>action_mynij_search_import_index.html</string> </value> <value> <string>action_mynij_search_import_torrent.html</string> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>gadget_field_action_js_script</string>
<string>action_description</string>
<string>my_index_file</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>MynijSearchCollection_importIndexFile</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>MynijSearchCollection_importIndex</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>ERP5 Form</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LabelField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>action_description</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirm import</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="GadgetField" module="Products.ERP5Form.GadgetField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_field_action_js_script</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>no_validator</string> </key>
<value> <string>Does not support this operation.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string>action_mynij_search_import_export_index.html</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>gadget_field_action_js_script</string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="FileField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_index_file</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string>accept=".mynij"</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string>text</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Mynij Index File</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -79,8 +79,6 @@ ...@@ -79,8 +79,6 @@
<string>my_title</string> <string>my_title</string>
<string>my_links</string> <string>my_links</string>
<string>my_seed</string> <string>my_seed</string>
<string>your_info_hash</string>
<string>your_magnet_uri</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -24,8 +24,10 @@ url_list = [ ...@@ -24,8 +24,10 @@ url_list = [
"mynij_google_logo.png", "mynij_google_logo.png",
"action_mynij_search_build_index.html", "action_mynij_search_build_index.html",
"action_mynij_search_build_index.js", "action_mynij_search_build_index.js",
"action_mynij_search_import_index.html", "action_mynij_search_import_torrent.html",
"action_mynij_search_import_index.js", "action_mynij_search_import_torrent.js",
"action_mynij_search_import_export_index.html",
"action_mynij_search_import_export_index.js",
"flexsearch.js", "flexsearch.js",
"flexsearch_en.js", "flexsearch_en.js",
"mynij_rss-parser.min.js", "mynij_rss-parser.min.js",
......
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="flexsearch.js" type="text/javascript"></script>
<script src="action_mynij_search_import_export_index.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_mynij_model.html" data-gadget-scope="model"
data-gadget-sandbox="public"></div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>action_mynij_search_import_export_index.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>action_mynij_search_build_index.html</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
(function (window, rJS, RSVP, jIO, File, Blob, document) {
"use strict";
rJS(window)
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_post", "jio_post")
.ready(function () {
var gadget = this;
return this.getDeclaredGadget("model")
.push(function (model) {
return gadget.changeState({
model_gadget: model
});
});
})
.declareMethod("preRenderDocument", function (parent_options) {
var gadget = this;
console.log(parent_options);
if (!parent_options.jio_key)
return;
return gadget.jio_get(parent_options.jio_key)
.push(function (parent_document) {
return parent_document;
});
})
.declareMethod("getIndexPage", function (ids) {
var gadget = this,
i,
get_page,
page_dict = {},
get_queue = new RSVP.Queue();
get_page = function (page_id) {
get_queue
.push(function () {
return gadget.state.model_gadget.get_page(page_id);
})
.push(function (page) {
page_dict[page_id] = page;
});
};
// get all page of this index
for (i = 0; i < ids.length; i += 1) {
get_page(ids[i].slice(1));
}
return get_queue
.push(function () {
return page_dict;
});
})
.declareMethod("putIndexPage", function (page_dict) {
var gadget = this,
key,
put_page,
put_queue = new RSVP.Queue();
put_page = function (page_id, data) {
put_queue
.push(function () {
return gadget.state.model_gadget.put(page_id, data);
});
};
for (key in page_dict) {
put_page(key, page_dict[key]);
}
return put_queue;
})
.declareMethod("exportIndex", function (index_doc) {
var gadget = this,
ids,
map,
ctx,
index_name = index_doc.title,
index_id = "index-" + index_name;
return gadget.state.model_gadget.getAttachment(
index_id,
"ids",
{"format": "json"})
.push(function (result) {
ids = result;
return gadget.state.model_gadget.getAttachment(
index_id,
"map",
{"format": "text"});
})
.push(function (result) {
map = result;
return gadget.state.model_gadget.getAttachment(
index_id,
"ctx",
{"format": "text"});
})
.push(function (result) {
ctx = result;
return gadget.getIndexPage(ids);
})
.push(function (result) {
var i,
file_dict,
file_blob,
link,
url;
file_dict = {
name: index_name,
links: index_doc.links,
ids: JSON.stringify(ids),
map: map,
ctx: ctx,
page: result
};
file_blob = new Blob([JSON.stringify(file_dict)], {type : "application/json"});
link = document.createElement("a");
link.style = "display: none";
document.body.appendChild(link);
url = window.URL.createObjectURL(file_blob);
link.href = url;
link.download = index_id + ".mynij";
link.click();
window.URL.revokeObjectURL(url);
});
})
.declareMethod("importIndex", function (dataurl) {
var gadget = this,
index_dict,
doc = {},
index_id;
return new RSVP.Queue()
.push(function () {
return jIO.util.dataURItoBlob(dataurl);
})
.push(function (file_blob) {
return jIO.util.readBlobAsText(file_blob, "application/json");
})
.push(function (evt) {
index_dict = JSON.parse(evt.target.result);
doc.title = index_dict.name;
doc.links = index_dict.links;
index_id = "index-" + doc.title;
//return gadget.createIndexDoc(doc.title, doc.links, torrent.infoHash,
// torrent.magnetURI);
return gadget.getSetting("portal_type");
})
.push(function (portal_type) {
doc.portal_type = portal_type;
return gadget.getSetting("parent_portal_type");
})
.push(function (parent_portal_type) {
doc.parent_portal_type = parent_portal_type;
})
.push(function () {
return gadget.state.model_gadget.pushIndexBlob(
index_id,
index_dict,
{});
})
.push(function (parent_portal_type) {
return gadget.jio_post(doc);
})
.push(function () {
return gadget.putIndexPage(index_dict.page);
})
.push(function () {
return gadget.state.model_gadget.pushIndex(index_dict.name);
});
})
.declareMethod("handleSubmit", function (content_dict, parent_options) {
var return_submit_dict,
gadget = this,
jio_key = parent_options.action_options.jio_key;
return new RSVP.Queue()
.push(function(){
return gadget.notifySubmitting();
})
.push(function(){
return gadget.getSetting('index_list', []);
})
.push(function(index_list){
var i,
built = false,
index = parent_options.doc,
redirect = {
command: "display",
options: {page : "ojs_local_controller", jio_key: jio_key}
};
if (content_dict.index_file && content_dict.index_file.url) {
return gadget.importIndex(content_dict.index_file.url)
.push(function () {
return {
notify: {
message: "Index " + content_dict.index_file.file_name + " Imported.",
status: "success"
},
redirect: redirect
};
})
.push(undefined, function (e) {
console.log(e);
return {
notify: {
message: "Failed to export index '" + index.title + "'",
status: "error"
},
redirect: redirect
};
});
}
// try to import
for (i = 0; i < index_list.length; i += 1) {
if (index_list[i] === index.title) {
built = true;
break;
}
}
if (!built || !index_list.length) {
return {
notify: {
message: "Index " + index.title + " is not built.",
status: "error"
},
redirect: redirect
};
}
return gadget.exportIndex(index)
.push(function () {
return {
notify: {
message: "Index " + index.title + " Exported.",
status: "success"
},
redirect: redirect
};
})
.push(undefined, function () {
return {
notify: {
message: "Failed to export index '" + index.title + "'",
status: "error"
},
redirect: redirect
};
});
});
});
}(window, rJS, RSVP, jIO, File, Blob, document));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>action_mynij_search_import_export_index.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>action_mynij_search_build_index.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="action_mynij_search_import_index.js" type="text/javascript"></script> <script src="action_mynij_search_import_torrent.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_erp5_mynij_webtorrent.html" data-gadget-scope="torrent" <div data-gadget-url="gadget_erp5_mynij_webtorrent.html" data-gadget-scope="torrent"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>action_mynij_search_import_index.html</string> </value> <value> <string>action_mynij_search_import_torrent.html</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>action_mynij_search_import_index.js</string> </value> <value> <string>action_mynij_search_import_torrent.js</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
......
Mynij Search Collection Module | mynij_index_import Mynij Search Collection Module | mynij_index_import
Mynij Search Collection Module | mynij_search_import_file
Mynij Search Collection Module | mynij_search_view Mynij Search Collection Module | mynij_search_view
Mynij Search Collection Module | view Mynij Search Collection Module | view
Mynij Search Collection | jio_view Mynij Search Collection | jio_view
Mynij Search Collection | mynij_index_export_file
Mynij Search Collection | mynij_search_build_index Mynij Search Collection | mynij_search_build_index
Mynij Search Collection | mynij_search_search_in_index
Mynij Search Collection | view Mynij Search Collection | view
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment