
<topic>
    <title>Read-Only (Locked) Elements </title>
    <shortdesc>This section describes actions necessary to disable editing of certain XML elements and attributes within the editor. </shortdesc>
    <body>
        <section>
            <title>Making Elements Read-Only </title>
            <p>
                 There are three scenarios when XML editor might need to prevent user from modifying certain elements of XML: 
                <ul>
                    <li>Prevent editing of certain attribute</li>
                    <li>Prevent element from being removed from its parent</li>
                    <li>Prevent editing of element and all child nodes contained in it </li>
                </ul>
            </p>
            <p>All three scenarios could be enforced for certain class of elements (see <i>lock</i> attribute in <xref href='model.xml'>model.xml</xref>) as well as only for specific element within provided XML. </p>
            <p>
                 To enforce one of these rules on specific elements within XML, developer could use special <i>_lock</i> attribute. Its value will identify how the element should be handled. Here is the list of available values: 
                <simpletable>
                    <sthead>
                        <stentry><i>_lock</i> attribute value</stentry>
                        <stentry>Description </stentry>
                    </sthead>
                    <strow>
                        <stentry>attribute:&lt;attribute_name&gt; </stentry>
                        <stentry>
                             Prohibits editing of the specified attribute. For example: 
                            <pre>&lt;section product="UV Scanner"
        _lock="attribute:product"&gt;
    ...
&lt;/section&gt; </pre>
                        </stentry>
                    </strow>
                    <strow>
                        <stentry>content </stentry>
                        <stentry>
                             Prohibits editing of element along with attributes and child nodes. For example: 
                            <pre>&lt;section _lock="content"&gt;
    ...
&lt;/section&gt; </pre>
                        </stentry>
                    </strow>
                    <strow>
                        <stentry>inparent</stentry>
                        <stentry>
                             Prevents any action that could remove element from its parent. For example: 
                            <pre>&lt;section _lock="inparent"&gt;
    ...
&lt;/section&gt; </pre>
                        </stentry>
                    </strow>
                    <strow>
                        <stentry><i>any combination of values above</i></stentry>
                        <stentry>
                             Combines effect of multiple settings. Values should be coma or space separated. For example: 
                            <pre>&lt;section
      _lock="inparent,attribute:product"&gt;
    ...
&lt;/section&gt; </pre>
                        </stentry>
                    </strow>
                </simpletable>
            </p>
            <note type='restriction'>At the moment editor would only enforce read-only policy for WYSIWYG and Outline editing modes. Using raw XML editing mode user can overwrite read-only customizations. This issue will be addressed in the future versions of the editor.</note>
            <p>You can find examples of the <i>_lock</i> attribute effect in the <xref href='_lockDemo.xml'>Sample Documents </xref>section. </p>
        </section>
        <section>
            <title>CSS Styling for Read-only Elements </title>
              To indicate that certain element and all of its child nodes can not be edited, DITA Storm uses CSS style called <i>readonly</i>. In the initial configuration it turns background light gray, letters dark gray and italic: 
            <codeblock>.readonly {
	background-color: #F5F5F5;
	color: #A0A0A0;
	font-style: italic;
}</codeblock>
             User can customize styling by updating definition in CSS file styles.css located in DITAStorm directory. 
        </section>
    </body>
</topic>

