<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="Web Script" module="erp5.portal_type"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>_Access_contents_information_Permission</string> </key>
            <value>
              <tuple>
                <string>Anonymous</string>
                <string>Assignee</string>
                <string>Assignor</string>
                <string>Associate</string>
                <string>Auditor</string>
                <string>Manager</string>
                <string>Owner</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>_Add_portal_content_Permission</string> </key>
            <value>
              <tuple>
                <string>Assignee</string>
                <string>Assignor</string>
                <string>Manager</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>_Change_local_roles_Permission</string> </key>
            <value>
              <tuple>
                <string>Assignor</string>
                <string>Manager</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>_Modify_portal_content_Permission</string> </key>
            <value>
              <tuple>
                <string>Assignee</string>
                <string>Assignor</string>
                <string>Manager</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>_View_Permission</string> </key>
            <value>
              <tuple>
                <string>Anonymous</string>
                <string>Assignee</string>
                <string>Assignor</string>
                <string>Associate</string>
                <string>Auditor</string>
                <string>Manager</string>
                <string>Owner</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>content_md5</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>default_reference</string> </key>
            <value> <string>slapos_load_schema.js</string> </value>
        </item>
        <item>
            <key> <string>description</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>rjs_slapos_load_schema_js</string> </value>
        </item>
        <item>
            <key> <string>language</string> </key>
            <value> <string>en</string> </value>
        </item>
        <item>
            <key> <string>portal_type</string> </key>
            <value> <string>Web Script</string> </value>
        </item>
        <item>
            <key> <string>short_title</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>text_content</string> </key>
            <value> <string encoding="cdata"><![CDATA[

/*jslint nomen: true, maxlen: 200, indent: 2*/\n
/*global window, rJS, console, RSVP, jQuery, jIO, tv4, URI, JSON, $ */\n
(function (window, rJS, $, RSVP) {\n
  "use strict";\n
\n
  var gk = rJS(window);\n
\n
  function getJSON(url) {\n
    var protocol = URI(url).protocol(); \n
    if ( protocol === "http" || protocol === "https" ) { \n
      if (URI(window.location).protocol() !==  protocol) {\n
        throw new Error("You cannot mixed http and https calls");\n
      }\n
    }\n
    return RSVP.Queue()\n
      .push(function () { \n
        return jIO.util.ajax({\n
          url: url\n
        })\n
        .then(function (evt) {\n
          return evt.target.responseText;\n
        });\n
      });\n
  }\n
\n
  function resolveLocalReference(ref, schema) {\n
    // 2 here is for #/\n
    var i, ref_path = ref.substr(2, ref.length),\n
      parts = ref_path.split("/");\n
    if (parts.length === 1 && parts[0] === "") {\n
      // It was uses #/ to reference the entire json so just return it.\n
      return schema;\n
    }\n
    for (i = 0; i < parts.length; i += 1) {\n
      schema = schema[parts[i]];\n
    }\n
    return schema;\n
  }\n
\n
  function resolveReference(partial_schema, schema, base_url) {\n
    var parts,\n
      external_schema,\n
      ref = partial_schema.$ref;\n
\n
    if (ref === undefined) {\n
      return RSVP.Queue().push(function () {\n
        return partial_schema;\n
      });\n
    }\n
\n
    if (ref.substr(0, 1) === "#") {\n
      return RSVP.Queue().push(function () {\n
        return resolveLocalReference(ref, schema);\n
      });\n
    }\n
\n
    return RSVP.Queue().push(function () {\n
      if (URI(ref).protocol() === "") {\n
        if (base_url !== undefined) {\n
          ref = base_url + "/" + ref;\n
        }\n
      }\n
      return getJSON(ref);\n
    })\n
      .push(function (json) {\n
        external_schema = JSON.parse(json);\n
        parts = ref.split("#");\n
        ref = "#" + parts[1];\n
        return resolveLocalReference(ref, external_schema);\n
      });\n
  }\n
\n
  function clone(obj) {\n
    return JSON.parse(JSON.stringify(obj));\n
  }\n
\n
  // Inspired from https://github.com/nexedi/dream/blob/master/dream/platform/src/jsplumb/jsplumb.js#L398\n
  function expandSchema(json_schema, full_schema, base_url) {\n
    var i,\n
      expanded_json_schema = clone(json_schema) || {};\n
\n
    if (!expanded_json_schema.properties) {\n
      expanded_json_schema.properties = {};\n
    }\n
\n
    return RSVP.Queue().push(function () {\n
      if (json_schema.$ref) {\n
        return resolveReference(\n
          json_schema,\n
          full_schema,\n
          base_url\n
        )\n
          .push(function (remote_schema) {\n
            return expandSchema(\n
              remote_schema,\n
              full_schema,\n
              base_url\n
            );\n
          }).push(function (referencedx) {\n
            $.extend(expanded_json_schema, referencedx);\n
            delete expanded_json_schema.$ref;\n
            return true;\n
          });\n
      }\n
      return true;\n
    }).push(function () {\n
\n
      var property, queue = RSVP.Queue();\n
\n
      function wrapperResolveReference(p) {\n
        return resolveReference(\n
          json_schema.properties[p],\n
          full_schema,\n
          base_url\n
        ).push(function (external_schema) {\n
          // console.log(p);\n
          return expandSchema(\n
            external_schema,\n
            full_schema,\n
            base_url\n
          )\n
            .push(function (referencedx) {\n
              $.extend(expanded_json_schema.properties[p], referencedx);\n
              if (json_schema.properties[p].$ref) {\n
                delete expanded_json_schema.properties[p].$ref;\n
              }\n
              return referencedx;\n
            });\n
        });\n
      }\n
\n
      // expand ref in properties\n
      for (property in json_schema.properties) {\n
        if (json_schema.properties.hasOwnProperty(property)) {\n
          queue.push(\n
            wrapperResolveReference.bind(this, property)\n
          );\n
        }\n
      }\n
      return queue;\n
    })\n
      .push(function () {\n
\n
        var zqueue = RSVP.Queue();\n
\n
        function wrapperExpandSchema(p) {\n
          return expandSchema(\n
            json_schema.allOf[p],\n
            full_schema,\n
            base_url\n
          ).push(function (referencedx) {\n
            if (referencedx.properties) {\n
              $.extend(\n
                expanded_json_schema.properties,\n
                referencedx.properties\n
              );\n
              delete referencedx.properties;\n
            }\n
            $.extend(expanded_json_schema, referencedx);\n
          });\n
        }\n
\n
        if (json_schema.allOf) {\n
          for (i = 0; i < json_schema.allOf.length; i += 1) {\n
            zqueue.push(wrapperExpandSchema.bind(this, i));\n
          }\n
        }\n
        return zqueue;\n
      })\n
      .push(function () {\n
        if (expanded_json_schema.allOf) {\n
          delete expanded_json_schema.allOf;\n
        }\n
        if (expanded_json_schema.$ref) {\n
          delete expanded_json_schema.$ref;\n
        }\n
        // console.log(expanded_json_schema);\n
        return clone(expanded_json_schema);\n
      });\n
  }\n
  function getMetaJSONSchema() {\n
    return getJSON("../../renderjs/slapos_load_meta_schema.json");\n
  }\n
\n
  function validateJSONSchema(json, base_url) {\n
    return getMetaJSONSchema()\n
      .push(function (meta_schema) {\n
        if (!tv4.validate(json, meta_schema)) {\n
          throw new Error("Non valid JSON schema " + json);\n
        }\n
        return JSON.parse(json);\n
      })\n
      .push(function (schema) {\n
        return expandSchema(schema, schema, base_url);\n
      });\n
  }\n
\n
  gk\n
    .declareMethod("loadJSONSchema", function (url) {\n
      return getJSON(url)\n
        .push(function (json) {\n
          var base_url, url_uri;\n
\n
          url_uri = URI(url);\n
          base_url = url_uri.path().split("/");\n
          base_url.pop();\n
          base_url = url.split(url_uri.path())[0] + base_url.join("/");\n
          \n
          return validateJSONSchema(json, base_url);\n
        });\n
    })\n
\n
    .declareMethod("loadSoftwareJSON", function (url) {\n
      return getJSON(url)\n
        .push(function (json) {\n
          return JSON.parse(json);\n
        });\n
    })\n
\n
    .declareMethod("validateJSONForSoftwareType", function (schema_url, software_type, generated_json) {\n
      return getJSON(schema_url)\n
        .push(function (json) {\n
          return JSON.parse(json);\n
        })\n
        .push(function (json_object) {\n
          var parameter_schema_url,\n
            st,\n
            base_url,\n
            url_uri = URI(schema_url);\n
        \n
          for (st in json_object["software-type"]) {\n
            if (json_object["software-type"].hasOwnProperty(st)) {\n
              if (st === software_type) {\n
                parameter_schema_url = json_object["software-type"][st].request;\n
              }\n
            }\n
          }\n
          \n
          if (URI(parameter_schema_url).protocol() === "") {\n
            base_url = url_uri.path().split("/");\n
            base_url.pop();\n
            base_url = schema_url.split(url_uri.path())[0] + base_url.join("/");\n
            if (base_url !== undefined) {\n
              parameter_schema_url = base_url + "/" + parameter_schema_url;\n
            }\n
          }\n
          \n
          return getJSON(parameter_schema_url)\n
            .push(function (json) {\n
              var schema = JSON.parse(json);\n
\n
              return expandSchema(schema, schema, base_url)\n
                .push(function (loaded_json) {\n
                  return tv4.validateMultiple(generated_json, loaded_json);\n
                });\n
            });\n
         });\n
    })\n
\n
    .declareMethod("validateJSON", function (schema_url, generated_json) {\n
      return getJSON(schema_url)\n
        .push(function (json) {\n
          var base_url,\n
            url_uri = URI(schema_url),\n
            schema = JSON.parse(json);\n
\n
          base_url = url_uri.path().split("/");\n
          base_url.pop();\n
          base_url = schema_url.split(url_uri.path())[0] + base_url.join("/");\n
\n
          return expandSchema(schema, schema, base_url)\n
            .push(function (loaded_schema) {\n
              return tv4.validateMultiple(generated_json, loaded_schema);\n
            });\n
        });\n
    });\n
\n
}(window, rJS, $, RSVP));

]]></string> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string>slapos_load_schema.js</string> </value>
        </item>
        <item>
            <key> <string>version</string> </key>
            <value> <string>002</string> </value>
        </item>
        <item>
            <key> <string>workflow_history</string> </key>
            <value>
              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
  <record id="2" aka="AAAAAAAAAAI=">
    <pickle>
      <global name="PersistentMapping" module="Persistence.mapping"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>data</string> </key>
            <value>
              <dictionary>
                <item>
                    <key> <string>document_publication_workflow</string> </key>
                    <value>
                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                    </value>
                </item>
                <item>
                    <key> <string>edit_workflow</string> </key>
                    <value>
                      <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
                    </value>
                </item>
                <item>
                    <key> <string>processing_status_workflow</string> </key>
                    <value>
                      <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
                    </value>
                </item>
              </dictionary>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
  <record id="3" aka="AAAAAAAAAAM=">
    <pickle>
      <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
    </pickle>
    <pickle>
      <tuple>
        <none/>
        <list>
          <dictionary>
            <item>
                <key> <string>action</string> </key>
                <value> <string>publish_alive</string> </value>
            </item>
            <item>
                <key> <string>actor</string> </key>
                <value> <string>zope</string> </value>
            </item>
            <item>
                <key> <string>comment</string> </key>
                <value> <string></string> </value>
            </item>
            <item>
                <key> <string>error_message</string> </key>
                <value> <string></string> </value>
            </item>
            <item>
                <key> <string>time</string> </key>
                <value>
                  <object>
                    <klass>
                      <global name="DateTime" module="DateTime.DateTime"/>
                    </klass>
                    <tuple>
                      <none/>
                    </tuple>
                    <state>
                      <tuple>
                        <float>1425591032.03</float>
                        <string>UTC</string>
                      </tuple>
                    </state>
                  </object>
                </value>
            </item>
            <item>
                <key> <string>validation_state</string> </key>
                <value> <string>published_alive</string> </value>
            </item>
          </dictionary>
        </list>
      </tuple>
    </pickle>
  </record>
  <record id="4" aka="AAAAAAAAAAQ=">
    <pickle>
      <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
    </pickle>
    <pickle>
      <tuple>
        <none/>
        <list>
          <dictionary>
            <item>
                <key> <string>action</string> </key>
                <value> <string>edit</string> </value>
            </item>
            <item>
                <key> <string>actor</string> </key>
                <value> <string>zope</string> </value>
            </item>
            <item>
                <key> <string>comment</string> </key>
                <value>
                  <none/>
                </value>
            </item>
            <item>
                <key> <string>error_message</string> </key>
                <value> <string></string> </value>
            </item>
            <item>
                <key> <string>serial</string> </key>
                <value> <string>941.48697.33489.29337</string> </value>
            </item>
            <item>
                <key> <string>state</string> </key>
                <value> <string>current</string> </value>
            </item>
            <item>
                <key> <string>time</string> </key>
                <value>
                  <object>
                    <klass>
                      <global name="DateTime" module="DateTime.DateTime"/>
                    </klass>
                    <tuple>
                      <none/>
                    </tuple>
                    <state>
                      <tuple>
                        <float>1426706745.9</float>
                        <string>UTC</string>
                      </tuple>
                    </state>
                  </object>
                </value>
            </item>
          </dictionary>
        </list>
      </tuple>
    </pickle>
  </record>
  <record id="5" aka="AAAAAAAAAAU=">
    <pickle>
      <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
    </pickle>
    <pickle>
      <tuple>
        <none/>
        <list>
          <dictionary>
            <item>
                <key> <string>action</string> </key>
                <value> <string>detect_converted_file</string> </value>
            </item>
            <item>
                <key> <string>actor</string> </key>
                <value> <string>zope</string> </value>
            </item>
            <item>
                <key> <string>comment</string> </key>
                <value> <string></string> </value>
            </item>
            <item>
                <key> <string>error_message</string> </key>
                <value> <string></string> </value>
            </item>
            <item>
                <key> <string>external_processing_state</string> </key>
                <value> <string>converted</string> </value>
            </item>
            <item>
                <key> <string>serial</string> </key>
                <value> <string>0.0.0.0</string> </value>
            </item>
            <item>
                <key> <string>time</string> </key>
                <value>
                  <object>
                    <klass>
                      <global name="DateTime" module="DateTime.DateTime"/>
                    </klass>
                    <tuple>
                      <none/>
                    </tuple>
                    <state>
                      <tuple>
                        <float>1425591012.56</float>
                        <string>UTC</string>
                      </tuple>
                    </state>
                  </object>
                </value>
            </item>
          </dictionary>
        </list>
      </tuple>
    </pickle>
  </record>
</ZopeData>
