aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch')
-rw-r--r--recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch329
1 files changed, 329 insertions, 0 deletions
diff --git a/recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch b/recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch
new file mode 100644
index 0000000000..0391cfcd83
--- /dev/null
+++ b/recipes/linux/linux-rp-2.6.24/tosa/0034-Driver-for-WM97xx-touchscreens-in-streaming-mode-on.patch
@@ -0,0 +1,329 @@
+From 821604bad5ce1ef942eeb420afd9ea2c5c92875e Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Sat, 26 Jan 2008 21:14:19 +0300
+Subject: [PATCH 34/64] Driver for WM97xx touchscreens in streaming mode on Mainstone
+
+Signed-off-by: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com>
+Signed-off-by: Mike Arthur <mike.arthur@wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
+Cc: Stanley Cai <stanley.cai@intel.com>
+Cc: Rodolfo Giometti <giometti@enneenne.com>
+Cc: Russell King <rmk@arm.linux.org.uk>
+Cc: Marc Kleine-Budde <mkl@pengutronix.de>
+Cc: Ian Molton <spyro@f2s.com>
+Cc: Vince Sanders <vince@kyllikki.org>
+Cc: Andrew Zabolotny <zap@homelink.ru>
+---
+ drivers/input/touchscreen/mainstone-wm97xx.c | 298 ++++++++++++++++++++++++++
+ 1 files changed, 298 insertions(+), 0 deletions(-)
+ create mode 100644 drivers/input/touchscreen/mainstone-wm97xx.c
+
+diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
+new file mode 100644
+index 0000000..8e1c35d
+--- /dev/null
++++ b/drivers/input/touchscreen/mainstone-wm97xx.c
+@@ -0,0 +1,298 @@
++/*
++ * mainstone-wm97xx.c -- Mainstone Continuous Touch screen driver for
++ * Wolfson WM97xx AC97 Codecs.
++ *
++ * Copyright 2004, 2007 Wolfson Microelectronics PLC.
++ * Author: Liam Girdwood
++ * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com
++ * Parts Copyright : Ian Molton <spyro@f2s.com>
++ * Andrew Zabolotny <zap@homelink.ru>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * Notes:
++ * This is a wm97xx extended touch driver to capture touch
++ * data in a continuous manner on the Intel XScale archictecture
++ *
++ * Features:
++ * - codecs supported:- WM9705, WM9712, WM9713
++ * - processors supported:- Intel XScale PXA25x, PXA26x, PXA27x
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/version.h>
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/delay.h>
++#include <linux/irq.h>
++#include <linux/interrupt.h>
++#include <linux/wm97xx.h>
++#include <linux/io.h>
++#include <asm/arch/pxa-regs.h>
++
++#define VERSION "0.13"
++
++struct continuous {
++ u16 id; /* codec id */
++ u8 code; /* continuous code */
++ u8 reads; /* number of coord reads per read cycle */
++ u32 speed; /* number of coords per second */
++};
++
++#define WM_READS(sp) ((sp / HZ) + 1)
++
++static const struct continuous cinfo[] = {
++ {WM9705_ID2, 0, WM_READS(94), 94},
++ {WM9705_ID2, 1, WM_READS(188), 188},
++ {WM9705_ID2, 2, WM_READS(375), 375},
++ {WM9705_ID2, 3, WM_READS(750), 750},
++ {WM9712_ID2, 0, WM_READS(94), 94},
++ {WM9712_ID2, 1, WM_READS(188), 188},
++ {WM9712_ID2, 2, WM_READS(375), 375},
++ {WM9712_ID2, 3, WM_READS(750), 750},
++ {WM9713_ID2, 0, WM_READS(94), 94},
++ {WM9713_ID2, 1, WM_READS(120), 120},
++ {WM9713_ID2, 2, WM_READS(154), 154},
++ {WM9713_ID2, 3, WM_READS(188), 188},
++};
++
++/* continuous speed index */
++static int sp_idx;
++static u16 last, tries;
++
++/*
++ * Pen sampling frequency (Hz) in continuous mode.
++ */
++static int cont_rate = 200;
++module_param(cont_rate, int, 0);
++MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)");
++
++/*
++ * Pen down detection.
++ *
++ * This driver can either poll or use an interrupt to indicate a pen down
++ * event. If the irq request fails then it will fall back to polling mode.
++ */
++static int pen_int;
++module_param(pen_int, int, 0);
++MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)");
++
++/*
++ * Pressure readback.
++ *
++ * Set to 1 to read back pen down pressure
++ */
++static int pressure;
++module_param(pressure, int, 0);
++MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no pressure)");
++
++/*
++ * AC97 touch data slot.
++ *
++ * Touch screen readback data ac97 slot
++ */
++static int ac97_touch_slot = 5;
++module_param(ac97_touch_slot, int, 0);
++MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number");
++
++
++/* flush AC97 slot 5 FIFO on pxa machines */
++#ifdef CONFIG_PXA27x
++static void wm97xx_acc_pen_up(struct wm97xx *wm)
++{
++ set_current_state(TASK_INTERRUPTIBLE);
++ schedule_timeout(1);
++
++ while (MISR & (1 << 2))
++ MODR;
++}
++#else
++static void wm97xx_acc_pen_up(struct wm97xx *wm)
++{
++ int count = 16;
++ set_current_state(TASK_INTERRUPTIBLE);
++ schedule_timeout(1);
++
++ while (count < 16) {
++ MODR;
++ count--;
++ }
++}
++#endif
++
++static int wm97xx_acc_pen_down(struct wm97xx *wm)
++{
++ u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
++ int reads = 0;
++
++ /* data is never immediately available after pen down irq */
++ set_current_state(TASK_INTERRUPTIBLE);
++ schedule_timeout(1);
++
++ if (tries > 5) {
++ tries = 0;
++ return RC_PENUP;
++ }
++
++ x = MODR;
++ if (x == last) {
++ tries++;
++ return RC_AGAIN;
++ }
++ last = x;
++ do {
++ if (reads)
++ x = MODR;
++ y = MODR;
++ if (pressure)
++ p = MODR;
++
++ /* are samples valid */
++ if ((x & 0x7000) != WM97XX_ADCSEL_X ||
++ (y & 0x7000) != WM97XX_ADCSEL_Y ||
++ (p & 0x7000) != WM97XX_ADCSEL_PRES)
++ goto up;
++
++ /* coordinate is good */
++ tries = 0;
++ input_report_abs(wm->input_dev, ABS_X, x & 0xfff);
++ input_report_abs(wm->input_dev, ABS_Y, y & 0xfff);
++ input_report_abs(wm->input_dev, ABS_PRESSURE, p & 0xfff);
++ input_sync(wm->input_dev);
++ reads++;
++ } while (reads < cinfo[sp_idx].reads);
++up:
++ return RC_PENDOWN | RC_AGAIN;
++}
++
++static int wm97xx_acc_startup(struct wm97xx *wm)
++{
++ int idx = 0;
++
++ /* check we have a codec */
++ if (wm->ac97 == NULL)
++ return -ENODEV;
++
++ /* Go you big red fire engine */
++ for (idx = 0; idx < ARRAY_SIZE(cinfo); idx++) {
++ if (wm->id != cinfo[idx].id)
++ continue;
++ sp_idx = idx;
++ if (cont_rate <= cinfo[idx].speed)
++ break;
++ }
++ wm->acc_rate = cinfo[sp_idx].code;
++ wm->acc_slot = ac97_touch_slot;
++ dev_info(wm->dev,
++ "mainstone accelerated touchscreen driver, %d samples/sec\n",
++ cinfo[sp_idx].speed);
++
++ /* codec specific irq config */
++ if (pen_int) {
++ switch (wm->id) {
++ case WM9705_ID2:
++ wm->pen_irq = IRQ_GPIO(4);
++ set_irq_type(IRQ_GPIO(4), IRQT_BOTHEDGE);
++ break;
++ case WM9712_ID2:
++ case WM9713_ID2:
++ /* enable pen down interrupt */
++ /* use PEN_DOWN GPIO 13 to assert IRQ on GPIO line 2 */
++ wm->pen_irq = MAINSTONE_AC97_IRQ;
++ wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN,
++ WM97XX_GPIO_POL_HIGH,
++ WM97XX_GPIO_STICKY,
++ WM97XX_GPIO_WAKE);
++ wm97xx_config_gpio(wm, WM97XX_GPIO_2, WM97XX_GPIO_OUT,
++ WM97XX_GPIO_POL_HIGH,
++ WM97XX_GPIO_NOTSTICKY,
++ WM97XX_GPIO_NOWAKE);
++ break;
++ default:
++ dev_err(wm->dev,
++ "pen down irq not supported on this device\n");
++ pen_int = 0;
++ break;
++ }
++ }
++
++ return 0;
++}
++
++static void wm97xx_acc_shutdown(struct wm97xx *wm)
++{
++ /* codec specific deconfig */
++ if (pen_int) {
++ switch (wm->id & 0xffff) {
++ case WM9705_ID2:
++ wm->pen_irq = 0;
++ break;
++ case WM9712_ID2:
++ case WM9713_ID2:
++ /* disable interrupt */
++ wm->pen_irq = 0;
++ break;
++ }
++ }
++}
++
++static void wm97xx_irq_enable(struct wm97xx *wm, int enable)
++{
++ if (enable)
++ enable_irq(wm->pen_irq);
++ else
++ disable_irq(wm->pen_irq);
++}
++
++static struct wm97xx_mach_ops mainstone_mach_ops = {
++ .acc_enabled = 1,
++ .acc_pen_up = wm97xx_acc_pen_up,
++ .acc_pen_down = wm97xx_acc_pen_down,
++ .acc_startup = wm97xx_acc_startup,
++ .acc_shutdown = wm97xx_acc_shutdown,
++ .irq_enable = wm97xx_irq_enable,
++};
++
++static int mainstone_wm97xx_probe(struct platform_device *pdev)
++{
++ struct wm97xx *wm = platform_get_drvdata(pdev);
++ return wm97xx_register_mach_ops(wm, &mainstone_mach_ops);
++}
++
++static int mainstone_wm97xx_remove(struct platform_device *pdev)
++{
++ struct wm97xx *wm = platform_get_drvdata(pdev);
++ wm97xx_unregister_mach_ops(wm);
++ return 0;
++}
++
++static struct platform_driver mainstone_wm97xx_driver = {
++ .probe = mainstone_wm97xx_probe,
++ .remove = mainstone_wm97xx_remove,
++ .driver = {
++ .name = "wm97xx-touch",
++ },
++};
++
++static int __init mainstone_wm97xx_init(void)
++{
++ return platform_driver_register(&mainstone_wm97xx_driver);
++}
++
++static void __exit mainstone_wm97xx_exit(void)
++{
++ platform_driver_unregister(&mainstone_wm97xx_driver);
++}
++
++module_init(mainstone_wm97xx_init);
++module_exit(mainstone_wm97xx_exit);
++
++/* Module information */
++MODULE_AUTHOR("Liam Girdwood <liam.girdwood@wolfsonmicro.com>");
++MODULE_DESCRIPTION("wm97xx continuous touch driver for mainstone");
++MODULE_LICENSE("GPL");
+--
+1.5.3.8
+
/graph-tool'>paule/graph-tool OpenEmbedded Core user contribution treesGrokmirror user
summaryrefslogtreecommitdiffstats
path: root/templates/layerindex/editlayer.html
blob: b7ff5dc4c97de72226651ac03380075faa031340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
{% extends "base.html" %}
{% load i18n %}

{% comment %}

  layerindex-web - layer editing form page template

  Copyright (C) 2013 Intel Corporation
  Licensed under the MIT license, see COPYING.MIT for details

{% endcomment %}

<!--
{% block title_append %} - edit layer{% endblock %}
-->

{% block topfunctions %}
<!-- Remove submit link/tools drop-down added by base.html, otherwise clicking it may lose changes -->
{% endblock %}


{% block content %}
{% autoescape on %}

<div class="container-fluid">
    <div class="row-fluid">
        {% block heading %}
        <div class="page-header">
            <h1>Edit layer</h1>
        </div>
        {% endblock %}

{% block formtop %}
{% endblock %}
<form id="edit_layer_form" method="post">
{% csrf_token %}
    {% for hidden in form.hidden_fields %}
        {{ hidden }}
    {% endfor %}

    <div class="formfields">
        {% for field in form.visible_fields %}
            {% if field.name != 'captcha' %}
            {% if field.errors %}
            <div class="control-group alert alert-error">
            {{ field.errors }}
            {% else %}
            <div class="control-group">
            {% endif %}
                <div class="control-label">
                    {{ field.label_tag }}
                </div>
                <div class="controls">
                    {% if field.name = 'deps' %}
                        <div class="scrolling">
                            <table><tbody>
                                {% for deplayer in deplistlayers %}
                                    {% if deplayer.id in form.checked_deps %}
                                        <tr>
                                            <td class="checkboxtd"><input type="checkbox" name="deps" value="{{ deplayer.id }}" id="id_deps_{{forloop.counter}}" checked="checked" /></td>
                                            {% if deplayer.status = 'N' %}
                                            <td><label class="muted" for="id_deps_{{forloop.counter}}">{{ deplayer.name }} (unpublished)</label></td>
                                            {% else %}
                                            <td><label for="id_deps_{{forloop.counter}}">{{ deplayer.name }}</label></td>
                                            {% endif %}
                                        </tr>
                                    {% endif %}
                                {% endfor %}
                                {% for deplayer in deplistlayers %}
                                    {% if not deplayer.id in form.checked_deps %}
                                        <tr>
                                            <td class="checkboxtd"><input type="checkbox" name="deps" value="{{ deplayer.id }}" id="id_deps_{{forloop.counter}}" /></td>
                                            {% if deplayer.status = 'N' %}
                                            <td><label class="muted" for="id_deps_{{forloop.counter}}">{{ deplayer.name }} (unpublished)</label></td>
                                            {% else %}
                                            <td><label for="id_deps_{{forloop.counter}}">{{ deplayer.name }}</label></td>
                                            {% endif %}
                                        </tr>
                                    {% endif %}
                                {% endfor %}
                            </tbody></table>
                        </div>
                    {% else %}
                        {{ field }}
                    {% endif %}
                    <span class="help-inline custom-help">
                        {{ field.help_text }}
                    </span>
                </div>
            </div>
            {% endif %}
        {% endfor %}
    </div>
    <h3 id="maintainers">Maintainers</h3>
    {{ maintainerformset.non_form_errors }}
    {{ maintainerformset.management_form }}
    {% for maintainerform in maintainerformset %}
        <div class="maintainerform" id="maintainerform-{{forloop.counter0}}">
            <h4>Maintainer {{forloop.counter}}</h4>
            <div class="maintainerformfields">
                {% for hidden in maintainerform.hidden_fields %}
                    {{ hidden }}
                {% endfor %}

                {% for field in maintainerform.visible_fields %}
                    {% if field.errors %}
                    <div class="control-group alert alert-error">
                    {{ field.errors }}
                    {% else %}
                    <div class="control-group">
                    {% endif %}
                        <div class="control-label">
                            {{ field.label_tag }}
                        </div>
                        <div class="controls">
                            {{ field }}
                            <span class="help-inline custom-help">
                                {{ field.help_text }}
                            </span>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    {% endfor %}
    <p><a href="#" class="btn btn-small" id="addanothermaintainer"><i class="icon-plus"></i>Add maintainer</a><p>


    {% if form.captcha %}
        <div class="captchafield">
            <h3>Verification</h3>
            {% if form.captcha.errors %}
            <div class="control-group alert alert-error">
            {{ form.captcha.errors }}
            {% else %}
            <div class="control-group">
            {% endif %}
                <div class="controls">
                    {{ form.captcha }}
                    <span class="help-inline custom-help">
                        {{ form.captcha.help_text }}
                    </span>
                </div>
            </div>
        </div>
    {% endif %}

<div class="submitbuttons">
{% block submitbuttons %}
<input type="submit" value="Save layer" class="btn btn-primary btn-large submitbutton" />
<a href="{{ return_url }}" class="btn btn-large">Cancel</a>
{% endblock %}
</div>
</form>

    </div>
</div>

{% endautoescape %}

{% endblock %}

{% block scripts %}
<script>
    if (typeof String.prototype.startsWith != 'function') {
        String.prototype.startsWith = function (str){
            return this.slice(0, str.length) == str;
        };
    }

    function AutoWebFields(repoval) {
        if( repoval[repoval.length-1] == '/' )
            repoval = repoval.slice(0, repoval.length-1)

        if( repoval.startsWith('git://git.openembedded.org/') ) {
            reponame = repoval.replace(/^.*\//, '')
            this.vcs_web_url = 'http://cgit.openembedded.org/cgit.cgi/' + reponame
            this.vcs_web_tree_base_url = 'http://cgit.openembedded.org/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
            this.vcs_web_file_base_url = 'http://cgit.openembedded.org/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
        }
        else if( repoval.indexOf('git.yoctoproject.org/') > -1 ) {
            reponame = repoval.replace(/^.*\//, '')
            this.vcs_web_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame
            this.vcs_web_tree_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
            this.vcs_web_file_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
        }
        else if( repoval.indexOf('github.com/') > -1 ) {
            reponame = repoval.replace(/^.*github.com\//, '')
            reponame = reponame.replace(/.git$/, '')
            this.vcs_web_url = 'http://github.com/' + reponame
            this.vcs_web_tree_base_url = 'http://github.com/' + reponame + '/tree/%branch%/'
            this.vcs_web_file_base_url = 'http://github.com/' + reponame + '/blob/%branch%/'
        }
        else if( repoval.indexOf('gitorious.org/') > -1 ) {
            reponame = repoval.replace(/^.*gitorious.org\//, '')
            reponame = reponame.replace(/.git$/, '')
            this.vcs_web_url = 'http://gitorious.org/' + reponame
            this.vcs_web_tree_base_url = 'http://gitorious.org/' + reponame + '/trees/%branch%/'
            this.vcs_web_file_base_url = 'http://gitorious.org/' + reponame + '/blobs/%branch%/'
        }
        else if( repoval.indexOf('bitbucket.org/') > -1 ) {
            reponame = repoval.replace(/^.*bitbucket.org\//, '')
            reponame = reponame.replace(/.git$/, '')
            this.vcs_web_url = 'http://bitbucket.org/' + reponame
            this.vcs_web_tree_base_url = 'http://bitbucket.org/' + reponame + '/src/%branch%/%path%?at=%branch%'
            this.vcs_web_file_base_url = 'http://bitbucket.org/' + reponame + '/src/%branch%/%path%?at=%branch%'
        }
        else {
            this.vcs_web_url = ''
            this.vcs_web_tree_base_url = ''
            this.vcs_web_file_base_url = ''
        }
    }

    auto_web_fields = function (e) {
        repoval = $('#id_vcs_url').val()
        awf = new AutoWebFields(repoval)
        if (awf.vcs_web_url) {
            if (e) {
                $('#id_vcs_web_url').val(awf.vcs_web_url)
                $('#id_vcs_web_tree_base_url').val(awf.vcs_web_tree_base_url)
                $('#id_vcs_web_file_base_url').val(awf.vcs_web_file_base_url)
            }
            $('#id_vcs_web_url').prop('readonly', true);
            $('#id_vcs_web_tree_base_url').prop('readonly', true);
            $('#id_vcs_web_file_base_url').prop('readonly', true);
        }
        else {
            $('#id_vcs_web_url').prop('readonly', false);
            $('#id_vcs_web_tree_base_url').prop('readonly', false);
            $('#id_vcs_web_file_base_url').prop('readonly', false);
        }
    };

    split_email = function() {
        // Split email name/email address pairs
        name_input = $(this)
        split_regex = /^"?([^"@$<>]+)"? *<([^<> ]+)>[ -]*(.*)?$/
        matches = split_regex.exec(name_input.val())
        if( matches ){
            name_input.val($.trim(matches[1]))
            email_id = name_input.attr('id').replace('-name', '-email')
            $('#' + email_id).val($.trim(matches[2]))
            resp_id = email_id.replace('-email', '-responsibility')
            currval = $('#' + resp_id).val()
            // Set the responsibility with the remainder of the value unless the user has entered a value for
            // responsibility already
            if( currval == window['last_' + resp_id] || currval == "" ) {
                newval = $.trim(matches[3])
                $('#' + resp_id).val(newval)
                window['last_' + resp_id] = newval
            }
        }
    }

    expand_maintainer = function() {
        for(i=0;i<{{ maintainerformset.total_form_count }};i++) {
            maintbox = $('#maintainerform-' + i)
            if( maintbox.is(':hidden') ) {
                maintbox.slideToggle();
                if( i == {{maintainerformset.total_form_count}} - 1 )
                    $('#addanothermaintainer').hide()
                break
            }
        }
        return false;
    }

    $(document).ready(function() {
        $('.maintainerform').hide()

        for(i=0;i<{{ maintainerformset.total_form_count }};i++) {
            name_input = $('#id_layermaintainer_set-' + i + '-name')
            name_input.change(split_email)
            resp_id = 'id_layermaintainer_set-' + i + '-responsibility'
            window['last_' + resp_id] = ""
            if( i==0 || name_input.val() )
                $('#maintainerform-' + i).show()
        }
        $('#addanothermaintainer').click(expand_maintainer)

        $('#id_vcs_url').change(auto_web_fields)
        auto_web_fields(null)

        firstfield = $("#edit_layer_form input:text, #edit_layer_form textarea").first();
        if( ! firstfield.val() )
            firstfield.focus()
    });
</script>
{% endblock %}