PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/pigeoncms/Modules/PigeonCms.ItemsAdmin/views/Default.ascx

http://pigeoncms.googlecode.com/
ASP.NET | 317 lines | 278 code | 39 blank | 0 comment | 5 complexity | 7a39dbe32af3468a02c6e87a749b998b MD5 | raw file
  1<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Default.ascx.cs" Inherits="Controls_ItemsAdmin" %>
  2<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  3<%@ Register src="~/Controls/ItemParams.ascx" tagname="ItemParams" tagprefix="uc1" %>
  4<%@ Register src="~/Controls/PermissionsControl.ascx" tagname="PermissionsControl" tagprefix="uc1" %>
  5<%@ Register src="~/Controls/ContentEditorControl.ascx" tagname="ContentEditorControl" tagprefix="uc1" %>
  6
  7<script type="text/javascript">
  8// <!CDATA[
  9
 10function preloadAlias(sourceControlName, targetControl) {
 11    var res = document.getElementById(sourceControlName).value;
 12    if (targetControl.value == "") {
 13        res = res.toLowerCase();
 14        res = res.replace(/\ /g, '-');    //replace all occurs
 15        targetControl.value = res;
 16    }
 17}
 18
 19function pageLoad(sender, args) {
 20    $(document).ready(function () {
 21        $("a.fancyRefresh").fancybox({
 22            'width': '80%',
 23            'height': '80%',
 24            'type': 'iframe',
 25            'hideOnContentClick': false,
 26            onClosed: function () {
 27                RemoveFromCache(onSuccess, onFailure);
 28            }
 29        });
 30
 31        $('td.key').each(function () {
 32            var hide = true;                
 33            var html = $(this).html();
 34            if ($.trim(html) != '')
 35                hide = false;
 36            if (hide)
 37                $(this).parent('tr').hide();
 38        });
 39    });
 40}
 41
 42var deleteQuestion = '<%=PigeonCms.Utility.GetLabel("RECORD_DELETE_QUESTION") %>';
 43
 44//use in popup version
 45function closePopup() {
 46    parent.$.fancybox.close();
 47}
 48
 49function onSuccess(result) { }
 50function onFailure(result) { }
 51// ]]>
 52</script>
 53
 54<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
 55<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1" AssociatedUpdatePanelID="Upd1">
 56    <ProgressTemplate>
 57        <div class="loading"><%=PigeonCms.Utility.GetLabel("LblLoading", "loading") %></div>
 58    </ProgressTemplate>
 59</asp:UpdateProgress>
 60
 61<asp:UpdatePanel ID="Upd1" runat="server">
 62<ContentTemplate>
 63
 64    <asp:Label ID="LblErr" runat="server" Text="" CssClass="error"></asp:Label>
 65    <asp:Label ID="LblOk" runat="server" Text="" CssClass="success"></asp:Label>
 66
 67    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" OnActiveViewChanged="MultiView1_ActiveViewChanged">
 68
 69        <asp:View ID="ViewSee" runat="server">
 70            <div class="adminToolbar">
 71                <%=PigeonCms.Utility.GetLabel("LblCreateNew", "Create new", DropNew)%>&nbsp;
 72                <asp:DropDownList runat="server" ID="DropNew"  AutoPostBack="true" CssClass="adminMediumText" 
 73                OnSelectedIndexChanged="DropNew_SelectedIndexChanged">
 74                </asp:DropDownList>
 75                <asp:Button ID="BtnNew" runat="server" Text="<%$ Resources:PublicLabels, CmdNew %>" Visible="false" CssClass="button" OnClick="BtnNew_Click" />
 76            </div>
 77            <fieldset class="adminFilters">
 78                <%=PigeonCms.Utility.GetLabel("LblFilters", "Filters") %>&nbsp;
 79                <asp:DropDownList ID="DropEnabledFilter" runat="server" AutoPostBack="true" CssClass="adminMediumText" OnSelectedIndexChanged="DropEnabledFilter_SelectedIndexChanged">
 80                </asp:DropDownList>
 81                <asp:DropDownList ID="DropSectionsFilter" runat="server" AutoPostBack="true" CssClass="adminMediumText" OnSelectedIndexChanged="DropSectionsFilter_SelectedIndexChanged">
 82                </asp:DropDownList>
 83                <asp:DropDownList ID="DropCategoriesFilter" runat="server" AutoPostBack="true" CssClass="adminMediumText" OnSelectedIndexChanged="DropCategoriesFilter_SelectedIndexChanged">
 84                </asp:DropDownList>
 85                <asp:DropDownList ID="DropItemTypesFilter" runat="server" AutoPostBack="true" CssClass="adminMediumText" OnSelectedIndexChanged="DropItemTypesFilter_SelectedIndexChanged">
 86                </asp:DropDownList>
 87            </fieldset>
 88            <br />
 89            <asp:GridView ID="Grid1" runat="server" AllowPaging="True" AllowSorting="true" Width="100%" AutoGenerateColumns="False"
 90                DataSourceID="ObjDs1" DataKeyNames="Id" OnRowCommand="Grid1_RowCommand" OnRowCreated="Grid1_RowCreated" OnRowDataBound="Grid1_RowDataBound">
 91                <Columns>
 92                    <asp:TemplateField ItemStyle-Width="10" Visible="false">
 93                        <ItemTemplate>
 94                        <asp:ImageButton ID="ImgSel" CommandName="Select" CommandArgument='<%#Eval("Id") %>' 
 95                        runat="server" SkinID="ImgEditFile" />
 96                        </ItemTemplate>
 97                    </asp:TemplateField>
 98
 99                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblTitle %>" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
100                        <ItemTemplate>
101                            <asp:LinkButton ID="LnkTitle" runat="server" CausesValidation="false" CommandName="Select" CommandArgument='<%#Eval("Id") %>'></asp:LinkButton>
102                        </ItemTemplate>
103                    </asp:TemplateField>
104
105                    <asp:BoundField DataField="Alias" HeaderText="Alias" SortExpression="Alias" />
106
107                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblSection %>" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
108                        <ItemTemplate>
109                            <asp:Literal ID="LitSectionTitle" runat="server" />
110                        </ItemTemplate>
111                    </asp:TemplateField>
112
113                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblCategory %>" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
114                        <ItemTemplate>
115                            <asp:Literal ID="LitCategoryTitle" runat="server" />
116                        </ItemTemplate>
117                    </asp:TemplateField>
118
119                    <asp:BoundField DataField="ItemTypeName" HeaderText="<%$ Resources:PublicLabels, LblType %>" />
120
121                    <asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-BorderStyle="None" ItemStyle-Width="25" SortExpression="Ordering">
122                        <ItemTemplate>
123                            <asp:ImageButton ID="ImgMoveUp" CommandName="MoveUp" CommandArgument='<%#Eval("Id") %>'
124                            SkinID="ImgSortAsc" runat="server" />
125                            <asp:ImageButton ID="ImgMoveDown" CommandName="MoveDown" CommandArgument='<%#Eval("Id") %>'
126                            SkinID="ImgSortDesc" runat="server" />
127                        </ItemTemplate>
128                    </asp:TemplateField>
129                    <asp:BoundField DataField="Ordering" HeaderText="<%$ Resources:PublicLabels, LblOrder %>" SortExpression="Ordering" ItemStyle-HorizontalAlign="Right" />
130
131                        
132                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblEnabled %>" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
133                        <ItemTemplate>
134                            <asp:ImageButton runat="server" ID="ImgEnabledOk" CommandName="ImgEnabledOk" CommandArgument='<%#Eval("Id") %>' SkinID="ImgOk" Visible="false" />
135                            <asp:ImageButton runat="server" ID="ImgEnabledKo" CommandName="ImgEnabledKo" CommandArgument='<%#Eval("Id") %>' SkinID="ImgUnchecked" Visible="false" />
136                        </ItemTemplate>
137                    </asp:TemplateField>
138                    
139                    <asp:TemplateField HeaderText="Access type" SortExpression="AccessType">
140                        <ItemTemplate>
141                        <asp:Literal ID="LitAccessTypeDesc" runat="server" Text=""></asp:Literal>
142                        </ItemTemplate>
143                    </asp:TemplateField>
144                    
145                    <asp:TemplateField HeaderText="Access Level" SortExpression="AccessCode, AccessLevel">
146                        <ItemTemplate>
147                        <asp:Literal ID="LitAccessLevel" runat="server" Text=""></asp:Literal>
148                        </ItemTemplate>
149                    </asp:TemplateField>
150
151                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblFiles %>" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
152                        <ItemTemplate>
153                            <asp:HyperLink runat="server" ID="LnkUploadFiles">
154                                <asp:Image ID="FilesUpload" runat="server" SkinID="ImgUpload" AlternateText="Gestione files" Visible="true" ToolTip="Gestione files" />
155                            </asp:HyperLink>
156                            <br />
157                            <span><asp:Literal ID="LitFilesCount" runat="server" Text=""></asp:Literal></span>
158                        </ItemTemplate>
159                    </asp:TemplateField>
160                    
161                    <asp:TemplateField HeaderText="<%$ Resources:PublicLabels, LblImages %>" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
162                        <ItemTemplate>
163                            <asp:HyperLink runat="server" ID="LnkUploadImg">
164                                <asp:Image ID="ImgUpload" runat="server" SkinID="ImgUpload" AlternateText="Gestione immagini" Visible="true" ToolTip="Gestione immagini" />
165                            </asp:HyperLink>
166                            <br />
167                            <span><asp:Literal ID="LitImgCount" runat="server" Text=""></asp:Literal></span>
168                        </ItemTemplate>
169                    </asp:TemplateField>
170                    
171                    <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10">
172                        <ItemTemplate>
173                        <asp:ImageButton ID="LnkDel" CommandName="DeleteRow" CommandArgument='<%#Eval("Id") %>' 
174                        runat="server" SkinID="ImgDelFile" 
175                        OnClientClick="return confirm(deleteQuestion);"  />
176                        </ItemTemplate>
177                    </asp:TemplateField>
178                    
179                    <asp:BoundField DataField="Id" HeaderText="ID" SortExpression="Id" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" />
180                </Columns>
181            </asp:GridView>
182            
183            <asp:ObjectDataSource ID="ObjDs1" runat="server" 
184                SortParameterName="sort" SelectMethod="GetByFilter" 
185                TypeName="PigeonCms.ItemsManager`2[[PigeonCms.Item],[PigeonCms.ItemsFilter]]" 
186                OnObjectCreating="ObjDs1_ObjectCreating"
187                OnSelecting="ObjDs1_Selecting">
188                <SelectParameters>
189                    <asp:Parameter Name="filter" Type="Object" />
190                    <asp:Parameter Name="sort" Type="String" DefaultValue="" />
191                </SelectParameters>
192                <DeleteParameters>
193                    <asp:Parameter Name="Id" Type="Int32" />
194                </DeleteParameters>
195            </asp:ObjectDataSource>
196        </asp:View>
197   
198
199        <asp:View ID="ViewInsert" runat="server">
200        
201            <div class="adminToolbar">
202                <asp:Button ID="BtnSave" runat="server" Text="<%$ Resources:PublicLabels, CmdSave %>" CssClass="button" OnClick="BtnSave_Click" />
203                <asp:Button ID="BtnCancel" runat="server" Text="<%$ Resources:PublicLabels, CmdCancel %>" CssClass="button" CausesValidation="false" OnClick="BtnCancel_Click" />
204            </div>
205            
206            <div class="col width-60">
207                <fieldset class="adminForm">
208                    <legend></legend>
209                    <table class="adminTable">
210                    <tr>
211                        <td class="key"><%=base.GetLabel("LblItemType", "Item type", LitItemType, true)%></td>
212                        <td colspan="3">
213                            <asp:Literal ID="LitItemType" runat="server"></asp:Literal></td>
214                    </tr>
215                    <tr>
216                        <td class="key"><%=base.GetLabel("LblCategory", "Category", DropCategories, true)%></td>
217                        <td style="width: 500px">
218                            <asp:DropDownList ID="DropCategories" runat="server" CssClass="adminMediumText"></asp:DropDownList>&nbsp;&nbsp;&nbsp;
219                        </td>
220                    </tr>
221                    <tr>
222                        <td class="key"><%=base.GetLabel("LblEnabled", "Enabled", ChkEnabled, true)%></td>
223                        <td>
224                            <asp:CheckBox ID="ChkEnabled" runat="server" Enabled="true" />
225                        </td>
226                    </tr>                    
227                    <tr>
228                        <td class="key"><%=base.GetLabel("LblTitle", "Title", null, true)%></td>
229                        <td>
230                            <asp:Panel runat="server" ID="PanelTitle"></asp:Panel>
231                        </td>
232                    </tr>
233                    <tr>
234                        <td class="key"><%=base.GetLabel("LblAlias", "Alias", TxtAlias, true)%></td>
235                        <td>
236                            <asp:TextBox ID="TxtAlias" runat="server" CssClass="adminMediumText"></asp:TextBox>
237                            <asp:RequiredFieldValidator ID="ReqAlias" ControlToValidate="TxtAlias" runat="server" Text="*"></asp:RequiredFieldValidator>
238                        </td>
239                    </tr>                    
240                    <tr>
241                        <td class="key"><%=base.GetLabel("LblItemDate", "Item date", TxtItemDate, true)%></td>
242                        <td class="calendar">
243                            <asp:TextBox ID="TxtItemDate" runat="server" CssClass='adminSmallText'></asp:TextBox>        
244                            <cc1:CalendarExtender ID="CalItemDate" runat="server"
245                                TargetControlID="TxtItemDate" Format="dd/MM/yyyy"></cc1:CalendarExtender>
246                        </td>
247                    </tr>
248                    <tr>
249                        <td class="key"><%=base.GetLabel("LblValidFrom", "Valid from", TxtValidFrom, true)%></td>
250                        <td class="calendar">
251                            <asp:TextBox ID="TxtValidFrom" runat="server" CssClass='adminSmallText'></asp:TextBox>        
252                            <cc1:CalendarExtender ID="CalValidFrom" runat="server"
253                                TargetControlID="TxtValidFrom" Format="dd/MM/yyyy"></cc1:CalendarExtender>
254                        </td>
255                    </tr>
256                    <tr>
257                        <td class="key"><%=base.GetLabel("LblValidTo", "Valid to", TxtValidTo, true)%></td>
258                        <td class="calendar">
259                            <asp:TextBox ID="TxtValidTo" runat="server" CssClass='adminSmallText'></asp:TextBox>        
260                            <cc1:CalendarExtender ID="CalValidTo" runat="server"
261                                TargetControlID="TxtValidTo" Format="dd/MM/yyyy"></cc1:CalendarExtender>
262                        </td>
263                    </tr>
264                    
265                    <tr>
266                        <td class="key"><%=base.GetLabel("LblDescription", "Description", null, true)%></td>
267                        <td>
268                            <asp:Panel runat="server" ID="PanelDescription"></asp:Panel>
269                        </td>
270                    </tr>
271                    </table>
272                </fieldset>
273            </div>
274            
275            <div class="col width-40">
276                
277                <fieldset class="adminForm recordInfo">
278                    <legend><%=base.GetLabel("LblRecordInfo", "Record info") %></legend>
279                    <table class="adminTable" cellspacing="0">
280                    <tr>
281                        <td class="key"><%=base.GetLabel("LblRecordId", "ID") %></td>
282                        <td><asp:Label ID="LblId" runat="server" Text=""></asp:Label></td>
283                    </tr>
284                    <tr>
285                        <td class="key"><%=base.GetLabel("LblCreated", "Created") %></td>
286                        <td><asp:Label ID="LblCreated" runat="server" Text=""></asp:Label></td>
287                    </tr>
288                    <tr>
289                        <td class="key"><%=base.GetLabel("LblLastUpdate", "Last update") %></td>
290                        <td><asp:Label ID="LblUpdated" runat="server" Text=""></asp:Label></td>
291                    </tr>
292                    <tr>
293                        <td class="key"><%=base.GetLabel("LblOrderId", "Order Id") %></td>
294                        <td><asp:Label ID="LblOrderId" runat="server" Text=""></asp:Label></td>
295                    </tr>
296                    </table>
297                </fieldset>
298                
299                <fieldset class="adminForm">
300                    <uc1:PermissionsControl ID="PermissionsControl1" runat="server" />
301                </fieldset>                
302                
303                <fieldset class="adminForm">
304                    <uc1:ItemParams ID="ItemFields1" runat="server" />
305                </fieldset>                
306                
307                <fieldset class="adminForm">
308                    <uc1:ItemParams ID="ItemParams1" runat="server" />
309                </fieldset>
310            </div>
311            <div class="clear"/>
312        </asp:View>
313    
314    </asp:MultiView>
315
316</ContentTemplate>
317</asp:UpdatePanel>