Nola hobetu zure COREBlog bloga IV: Kolaboratzaileei gure blogeko artikuluak aldatzeko aukera eman
Aurreko artikuluan aipatu nuen nola egin genezakeen COREBlog-ekin egindako blog baten (eibar.org-en daudenak adibidez) artikuluak gehitzeko pantaila bat, blog baten kolaboratzaileek aukera izan zezaten artikuluak gehitzeko. Baina ez nuen azaldu nola egin pantaila bat kolaboratzaile horiek idatzitako artikuluak aldatu ahal izateko (hau memoria!). Ba hona hemen.
Egin beharreko gauza bakarra da gure blogaren erroan DTMLMethod bat sortu, "editEntryForm" izenarekin eta ondoko edukiarekin:
<dtml-var blog_header>
<dtml-var blog_banner>
<div id="content">
<div class="blog">
<h3 class="title">Aldatu artikulua</h3>
<div class="comments-head">Aldatu nahi dituzun eremuak</div>
<div class="comments-body">
<form ACTION="manage_editEntry" METHOD="POST" enctype="multipart/form-data">
<table cellspacing="1" cellpadding="0" border="0">
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Egilea
</div>
</td>
<td align="left" valign="top">
<input type="text" name="author" size="40" value="<dtml-var "author.replace(_.chr(34),'"').replace('á','á').replace('é','é').replace('í','í').replace('ó','ó').replace('ú','ú').replace('Á','Á').replace('É','É').replace('Í','Í').replace('Ó','Ó').replace('Ú','Ú').replace('ñ','ñ').replace('Ñ','Ñ')">" />
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Izenburua
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="80" value="<dtml-var "title.replace(_.chr(34),'"').replace('á','á').replace('é','é').replace('í','í').replace('ó','ó').replace('ú','ú').replace('Á','Á').replace('É','É').replace('Í','Í').replace('Ó','Ó').replace('Ú','Ú').replace('ñ','ñ').replace('Ñ','Ñ')">"/> </td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-optional">
Azpititulua
</div>
</td>
<td align="left" valign="top">
<input type="text" name="subtitle" size="80" value="<dtml-var "subtitle.replace(_.chr(34),'"').replace('á','á').replace('é','é').replace('í','í').replace('ó','ó').replace('ú','ú').replace('Á','Á').replace('É','É').replace('Í','Í').replace('Ó','Ó').replace('Ú','Ú').replace('ñ','ñ').replace('Ñ','Ñ')">"/> </td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Atala
</div>
</td>
<td align="left" valign="top">
<dtml-call "REQUEST.set('kategoria',category[0])">
<select name="main_category:int">
<dtml-in category_list>
<option <dtml-if "_.str(id)==_.str(kategoria)">selected</dtml-if> value="<dtml-var id>"><dtml-var name missing="category name is missing"></option>
</dtml-in>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-optional">
Azpiatalak
</div>
</td>
<td align="left" valign="top">
<dtml-in category_list>
<input type="checkbox"<dtml-if "mota(entry_category_list)=='list'"><dtml-if "id in entry_category_list"> checked</dtml-if><dtml-else><dtml-if "mota(entry_category_list)=='string'"><dtml-if "id==entry_category_list"> checked</dtml-if></dtml-if></dtml-if> name="sub_category:list" value="<dtml-var id>" /><dtml-var name missing="category name is missing">
</dtml-in>
</td>
</tr>
<input type="hidden" name="format:int" value="1">
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Sarrera
</div>
</td>
<td align="left" valign="top">
<textarea name="body:text" style="width: 500px; height: 250px; border: 1px solid #000000;"><dtml-var body></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-optional">
Gorputza
</div>
</td>
<td align="left" valign="top">
<textarea name="extend:text" cols="60" rows="6"><dtml-var extend></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-optional">
Laburpena
</div>
</td>
<td align="left" valign="top">
<textarea name="excerpt:text" cols="60" rows="6"><dtml-var excerpt></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Erantzunak
</div>
</td>
<td align="left" valign="top">
<select name="allow_comment:int">
<option value="0" <dtml-if "allow_comment==0">selected</dtml-if> >Ezer ez (ezin gehitu, ezkutatuta)</option>
<option value="1" <dtml-if "allow_comment==1">selected</dtml-if> >Irekita (gehitu daiteke, agerian)</option>
<option value="2" <dtml-if "allow_comment==2">selected</dtml-if> >Itxita (ezin gehitu, agerian)</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">
Trackback-ak
</div>
</td>
<td align="left" valign="top">
<select name="receive_trackback:int">
<option value="0" <dtml-if "receive_trackback==0">selected</dtml-if> >Ezer ez (ezin gehitu, ezkutatuta)</option>
<option value="1" <dtml-if "receive_trackback==1">selected</dtml-if> >Irekita (gehitu daiteke, agerian)</option>
<option value="2" <dtml-if "receive_trackback==2">selected</dtml-if> >Itxita (ezin gehitu, agerian)</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header">
<div class="form-label">Egoera</div>
</td>
<td align="left" valign="top">
<select name="moderated:int">
<option value="0" <dtml-if "moderated==0">selected</dtml-if> >Itxita</option> <option value="1" <dtml-if "moderated==1">selected</dtml-if> >Irekita</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top" class="list-header" rowspan="2">
<div class="form-optional">Trackback helbidea(k)</div>
</td>
<td align="left" valign="top">
<textarea name="trackback_url:text" cols="60" rows="4"><dtml-in trackback_url><dtml-var sequence-item></dtml-in></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top">
<input type="checkbox" name="sendnow" checked />Bidali trackback eskaera(k) orain</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit" value="Artikulua aldatu" />
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<dtml-var blog_footer>
Aurreko artikuluan aipatutako baimenak jarrita badaude, bukatzeko egin beharreko gauza bakarra da metodo honetako baimenetan "View" bakarrik utzi "manager" eta "owner" erabiltzaileei. Orduan, kolaboratzaile batek artikulu bat aldatzeko, nahikoa du artikuluaren helbideari "editEntryForm" gehitzea.
Aurreko artikuluak: