Commit 6bdde913 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Add new field to selection publication section and remove select

because we will select camera automatically
parent 2ae8b435
......@@ -110,6 +110,7 @@
<string>your_version</string>
<string>your_group</string>
<string>your_publication_section</string>
<string>your_publication_state</string>
<string>your_description</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_publication_state</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>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</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>field_id</string> </key>
<value> <string>my_dialog_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Publication State</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [("", ""), ("Draft", "draft"), ("Shared", "shared"), ("Released", "relase"), ("Published", "publish")]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,6 +16,10 @@
filter: brightness(1);
}
.camera {
min-height: 390px;
}
.camera-input, .camera-output {
text-align: center;
}
......
......@@ -10,12 +10,6 @@
<title>Gadget Document Scanner</title>
</head>
<body>
<label>Select camera</label>
<div class="device-selector">
<select>
<option value="">--------</option>
</select>
</div>
<div class="camera">
<div class="camera-input" style="display: none">
<video class="video">Webcam is not available</video>
......@@ -28,9 +22,6 @@
<div class="edit-picture">
<button class="capture-button">Crop</button>
<button class="reset-button">Reset</button>
<label for="brightness">Brightness (NOT WORKING)</label>
<input type="range" step="1" min="1" value="1" max="100" name="brightness"/><br/>
<input type="checkbox" name="grayscale" value="enabled"/> Grayscale (DON'T CLICK)<br/>
</div>
</div>
</div>
......
......@@ -12,7 +12,9 @@
canvas,
photo,
photoInput,
imageCapture;
cameraSelected,
imageCapture,
cameraList = [];
function readBlobAsDataURL(blob) {
var fr = new FileReader();
......@@ -193,21 +195,19 @@
rJS(window)
.declareMethod('render', function (options) {
var el,
root,
selector;
root;
return this.getElement()
.push(function (element) {
root = element;
selector = element.querySelector("select");
preferredCroppedCanvasData = preferredCroppedCanvasData || JSON.parse(
options.preferred_cropped_canvas_data
);
// Clear photo input
element.querySelector('.photoInput').value = "";
if (!selector.value && video) {
if (video) {
video.pause();
}
if (selector.value) {
if (cameraSelected) {
root.querySelector(".camera-input").style.display = "";
root.querySelector(".capture-button").style.display = "";
root.querySelector(".camera-output").style.display = "none";
......@@ -221,21 +221,15 @@
var j,
device,
len = info_list.length;
if (selector.length > 1) {
return;
}
for (j = 0; j < len; j += 1) {
device = info_list[j];
if (device.kind === 'videoinput') {
el = document.createElement("option");
el.value = device.deviceId;
el.innerText = device.label || device.kind + " " + device.deviceId;
selector.appendChild(el);
cameraList.push(device);
}
}
if (selector.options.length === 2) {
selector.options[selector.options.length - 1].selected = true;
return startup(root, selector.value);
if (cameraList.length >= 1) {
// trick to select back camera in mobile
return startup(root, cameraList[cameraList.length - 1].deviceId);
}
});
})
......@@ -248,7 +242,7 @@
});
return result;
})
.onEvent("change", function (evt) {
/*.onEvent("change", function (evt) {
if (evt.target.type === "select-one") {
return this.getElement()
.push(function (root) {
......@@ -270,7 +264,7 @@
}
});
}
}, false, true)
}, false, true)*/
.onEvent("click", function (evt) {
var gadget, canvasData;
......
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