@@ -193,115 +193,125 @@ public override void Submit_OnClick(object sender, EventArgs e)
193
193
try
194
194
{
195
195
var channelId = AuthRequest . GetQueryInt ( "ChannelId" ) ;
196
- var nodeInfo = new ChannelInfo
196
+
197
+ var contentModelPluginId = DdlContentModelPluginId . SelectedValue ;
198
+ var contentRelatedPluginIds =
199
+ ControlUtils . GetSelectedListControlValueCollection ( CblContentRelatedPluginIds ) ;
200
+ var channelName = TbNodeName . Text ;
201
+ var indexName = TbNodeIndexName . Text ;
202
+ var filePath = TbFilePath . Text ;
203
+ var channelFilePathRule = TbChannelFilePathRule . Text ;
204
+ var contentFilePathRule = TbContentFilePathRule . Text ;
205
+ var groupNameCollection = TranslateUtils . ObjectCollectionToString ( ControlUtils . GetSelectedListControlValueStringList ( CblNodeGroupNameCollection ) ) ;
206
+ var imageUrl = TbImageUrl . Text ;
207
+ var content = ContentUtility . TextEditorContentEncode ( SiteInfo , Request . Form [ ChannelAttribute . Content ] ) ;
208
+ var keywords = TbKeywords . Text ;
209
+ var description = TbDescription . Text ;
210
+ var isChannelAddable = TranslateUtils . ToBool ( RblIsChannelAddable . SelectedValue ) ;
211
+ var isContentAddable = TranslateUtils . ToBool ( RblIsContentAddable . SelectedValue ) ;
212
+ var linkUrl = TbLinkUrl . Text ;
213
+ var linkType = DdlLinkType . SelectedValue ;
214
+ var defaultTaxisType = ETaxisTypeUtils . GetValue ( ETaxisTypeUtils . GetEnumType ( DdlTaxisType . SelectedValue ) ) ;
215
+ var channelTemplateId = DdlChannelTemplateId . Items . Count > 0 ? TranslateUtils . ToInt ( DdlChannelTemplateId . SelectedValue ) : 0 ;
216
+ var contentTemplateId = DdlContentTemplateId . Items . Count > 0 ? TranslateUtils . ToInt ( DdlContentTemplateId . SelectedValue ) : 0 ;
217
+
218
+ var channelInfo = new ChannelInfo
197
219
{
198
220
SiteId = SiteId ,
199
221
ParentId = channelId ,
200
- ContentModelPluginId = DdlContentModelPluginId . SelectedValue ,
201
- ContentRelatedPluginIds =
202
- ControlUtils . GetSelectedListControlValueCollection ( CblContentRelatedPluginIds )
222
+ ContentModelPluginId = contentModelPluginId ,
223
+ ContentRelatedPluginIds = contentRelatedPluginIds
203
224
} ;
204
225
205
- if ( TbNodeIndexName . Text . Length != 0 )
226
+ if ( ! string . IsNullOrEmpty ( indexName ) )
206
227
{
207
- var nodeIndexNameArrayList = DataProvider . ChannelDao . GetIndexNameList ( SiteId ) ;
208
- if ( nodeIndexNameArrayList . IndexOf ( TbNodeIndexName . Text ) != - 1 )
228
+ var indexNameList = DataProvider . ChannelDao . GetIndexNameList ( SiteId ) ;
229
+ if ( indexNameList . IndexOf ( indexName ) != - 1 )
209
230
{
210
231
FailMessage ( "栏目添加失败,栏目索引已存在!" ) ;
211
232
return ;
212
233
}
213
234
}
214
235
215
- if ( TbFilePath . Text . Length != 0 )
236
+ if ( ! string . IsNullOrEmpty ( filePath ) )
216
237
{
217
- if ( ! DirectoryUtils . IsDirectoryNameCompliant ( TbFilePath . Text ) )
238
+ if ( ! DirectoryUtils . IsDirectoryNameCompliant ( filePath ) )
218
239
{
219
240
FailMessage ( "栏目页面路径不符合系统要求!" ) ;
220
241
return ;
221
242
}
222
243
223
- if ( PathUtils . IsDirectoryPath ( TbFilePath . Text ) )
244
+ if ( PathUtils . IsDirectoryPath ( filePath ) )
224
245
{
225
- TbFilePath . Text = PageUtils . Combine ( TbFilePath . Text , "index.html" ) ;
246
+ filePath = PageUtils . Combine ( filePath , "index.html" ) ;
226
247
}
227
248
228
- var filePathArrayList = DataProvider . ChannelDao . GetAllFilePathBySiteId ( SiteId ) ;
229
- if ( filePathArrayList . IndexOf ( TbFilePath . Text ) != - 1 )
249
+ var filePathList = DataProvider . ChannelDao . GetAllFilePathBySiteId ( SiteId ) ;
250
+ if ( filePathList . IndexOf ( filePath ) != - 1 )
230
251
{
231
252
FailMessage ( "栏目添加失败,栏目页面路径已存在!" ) ;
232
253
return ;
233
254
}
234
255
}
235
256
236
- if ( ! string . IsNullOrEmpty ( TbChannelFilePathRule . Text ) )
257
+ if ( ! string . IsNullOrEmpty ( channelFilePathRule ) )
237
258
{
238
- if ( ! DirectoryUtils . IsDirectoryNameCompliant ( TbChannelFilePathRule . Text ) )
259
+ if ( ! DirectoryUtils . IsDirectoryNameCompliant ( channelFilePathRule ) )
239
260
{
240
261
FailMessage ( "栏目页面命名规则不符合系统要求!" ) ;
241
262
return ;
242
263
}
243
- if ( PathUtils . IsDirectoryPath ( TbChannelFilePathRule . Text ) )
264
+ if ( PathUtils . IsDirectoryPath ( channelFilePathRule ) )
244
265
{
245
266
FailMessage ( "栏目页面命名规则必须包含生成文件的后缀!" ) ;
246
267
return ;
247
268
}
248
269
}
249
270
250
- if ( ! string . IsNullOrEmpty ( TbContentFilePathRule . Text ) )
271
+ if ( ! string . IsNullOrEmpty ( contentFilePathRule ) )
251
272
{
252
- if ( ! DirectoryUtils . IsDirectoryNameCompliant ( TbContentFilePathRule . Text ) )
273
+ if ( ! DirectoryUtils . IsDirectoryNameCompliant ( contentFilePathRule ) )
253
274
{
254
275
FailMessage ( "内容页面命名规则不符合系统要求!" ) ;
255
276
return ;
256
277
}
257
- if ( PathUtils . IsDirectoryPath ( TbContentFilePathRule . Text ) )
278
+ if ( PathUtils . IsDirectoryPath ( contentFilePathRule ) )
258
279
{
259
280
FailMessage ( "内容页面命名规则必须包含生成文件的后缀!" ) ;
260
281
return ;
261
282
}
262
283
}
263
284
264
- var parentNodeInfo = ChannelManager . GetChannelInfo ( SiteId , _channelId ) ;
265
- var styleInfoList = TableStyleManager . GetChannelStyleInfoList ( parentNodeInfo ) ;
285
+ var parentChannelInfo = ChannelManager . GetChannelInfo ( SiteId , _channelId ) ;
286
+ var styleInfoList = TableStyleManager . GetChannelStyleInfoList ( parentChannelInfo ) ;
266
287
var extendedAttributes = BackgroundInputTypeParser . SaveAttributes ( SiteInfo , styleInfoList , Request . Form , null ) ;
267
- nodeInfo . Additional . Load ( extendedAttributes ) ;
288
+ channelInfo . Additional . Load ( extendedAttributes ) ;
268
289
//foreach (string key in attributes)
269
290
//{
270
- // nodeInfo .Additional.SetExtendedAttribute(key, attributes[key]);
291
+ // channelInfo .Additional.SetExtendedAttribute(key, attributes[key]);
271
292
//}
272
293
273
- nodeInfo . ChannelName = TbNodeName . Text ;
274
- nodeInfo . IndexName = TbNodeIndexName . Text ;
275
- nodeInfo . FilePath = TbFilePath . Text ;
276
- nodeInfo . ChannelFilePathRule = TbChannelFilePathRule . Text ;
277
- nodeInfo . ContentFilePathRule = TbContentFilePathRule . Text ;
278
-
279
- var list = new ArrayList ( ) ;
280
- foreach ( ListItem item in CblNodeGroupNameCollection . Items )
281
- {
282
- if ( item . Selected )
283
- {
284
- list . Add ( item . Value ) ;
285
- }
286
- }
287
- nodeInfo . GroupNameCollection = TranslateUtils . ObjectCollectionToString ( list ) ;
288
- nodeInfo . ImageUrl = TbImageUrl . Text ;
289
- nodeInfo . Content = ContentUtility . TextEditorContentEncode ( SiteInfo , Request . Form [ ChannelAttribute . Content ] ) ;
290
- nodeInfo . Keywords = TbKeywords . Text ;
291
- nodeInfo . Description = TbDescription . Text ;
292
- nodeInfo . Additional . IsChannelAddable = TranslateUtils . ToBool ( RblIsChannelAddable . SelectedValue ) ;
293
- nodeInfo . Additional . IsContentAddable = TranslateUtils . ToBool ( RblIsContentAddable . SelectedValue ) ;
294
-
295
- nodeInfo . LinkUrl = TbLinkUrl . Text ;
296
- nodeInfo . LinkType = DdlLinkType . SelectedValue ;
297
-
298
- nodeInfo . Additional . DefaultTaxisType = ETaxisTypeUtils . GetValue ( ETaxisTypeUtils . GetEnumType ( DdlTaxisType . SelectedValue ) ) ;
299
-
300
- nodeInfo . ChannelTemplateId = DdlChannelTemplateId . Items . Count > 0 ? TranslateUtils . ToInt ( DdlChannelTemplateId . SelectedValue ) : 0 ;
301
- nodeInfo . ContentTemplateId = DdlContentTemplateId . Items . Count > 0 ? TranslateUtils . ToInt ( DdlContentTemplateId . SelectedValue ) : 0 ;
302
-
303
- nodeInfo . AddDate = DateTime . Now ;
304
- insertChannelId = DataProvider . ChannelDao . Insert ( nodeInfo ) ;
294
+ channelInfo . ChannelName = channelName ;
295
+ channelInfo . IndexName = indexName ;
296
+ channelInfo . FilePath = filePath ;
297
+ channelInfo . ChannelFilePathRule = channelFilePathRule ;
298
+ channelInfo . ContentFilePathRule = contentFilePathRule ;
299
+
300
+ channelInfo . GroupNameCollection = groupNameCollection ;
301
+ channelInfo . ImageUrl = imageUrl ;
302
+ channelInfo . Content = content ;
303
+ channelInfo . Keywords = keywords ;
304
+ channelInfo . Description = description ;
305
+ channelInfo . Additional . IsChannelAddable = isChannelAddable ;
306
+ channelInfo . Additional . IsContentAddable = isContentAddable ;
307
+ channelInfo . LinkUrl = linkUrl ;
308
+ channelInfo . LinkType = linkType ;
309
+ channelInfo . Additional . DefaultTaxisType = defaultTaxisType ;
310
+ channelInfo . ChannelTemplateId = channelTemplateId ;
311
+ channelInfo . ContentTemplateId = contentTemplateId ;
312
+
313
+ channelInfo . AddDate = DateTime . Now ;
314
+ insertChannelId = DataProvider . ChannelDao . Insert ( channelInfo ) ;
305
315
//栏目选择投票样式后,内容
306
316
}
307
317
catch ( Exception ex )
0 commit comments