Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryRemoving mandatory File upload and modifying Repository dashboard.Removing mandatory File upload and modifying Repository dashboard.
Previous
 
Next
New Post
5/10/2007 11:45 PM
 

Hi there,

I want to use the repository module to publish news items for a project that I'm working on.

You are probably wondering as to why I'm not utilising the News Feed module. I want the user to see brief excerpts of news items on the dash board which contains a link to the main article. The user should be able to click on that excerpt and they should be directed to the article in its entirety.

The News Feed module does not seem to suffice this purpose, where as the repository module does.

In most cases when publishing a news item there is no file to upload, so i am looking to make this a non mandatory requirement. Also on the dashboard I'm looking to include a brief of the article as well as the date and the title.

Please could you point me to where the validation takes place so that I may make changes to the module in both the repository and dashboard repository modules in order for me to fulfill these requirements.

Thank you in advance for any help that you may be able to extend to me.

 
New Post
5/13/2007 7:41 PM
 

Ok I managed to solve this issue.

Basically in the Form.ascx.vb there is a case block that executes the code to validate if a file has been uploaded or not.

I commented out the following code and the repository works just fine.

If objRepository.ItemId = -1 Then
If oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "FILE", "Required", "true") = "true" Then
Dim oValidator As New RequiredFieldValidator
oValidator.ControlToValidate = "__File"
oValidator.CssClass = "normalred"
oValidator.ErrorMessage = Localization.GetString("ValidateFile", oRepositoryBusinessController.LocalResourceFile)
oValidator.ID = "__ValFileID"
oValidator.Display = ValidatorDisplay.Static
PlaceHolder.Controls.Add(oValidator)
End If
Else

Dont forget to comment out the closing End If statement.

The only danger with this is that if a repository is modified and the user has forgotten to upload a file, there will be no validation to correct this.

 
New Post
5/13/2007 10:02 PM
 

I still need a little guidance in modifying the dashboard though to display a short excerpt from the description that is eneterd in the repository. I want to show about 20 characters at the most.

I'm not able to see as to were I need to make changes (i.e. stored procs or in certain classes).

 
New Post
5/15/2007 5:53 AM
 

Did you accomplish what you were after with the dashboard?  Would you be willing to share or point to a live site with a working example?

Thanks,

Paul

 
New Post
5/15/2007 7:10 AM
 

First, while just commenting out the code will accomplish what you want ( allowing the user to upload an item without a file ) it's really not the best way, because it would affect ALL Repository modules on your site, even those where you WANT a file to be required. The correct fix ( and this is fixed in 3.01.12 ) is to allow you to turn the validator on/off using the form.xml settings file.

So, in Form.ascx.vb, find the "FILE" section of the CreateInputForm() function, and add the lines in blue

Case "FILE"
  Dim objFile As New HtmlControls.HtmlInputFile
  objFile.ID = "__File"
  PlaceHolder.Controls.Add(objFile)
  ' we're uploading a file for the first time ( ItemID=-1 ) then we need to insert
  ' a required field validator. If we're editing, we don't because leaving the field blank
  ' will leave the current file in place
  If objRepository.ItemId = -1 Then
    If oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "FILE", "Required", "true") = "true" Then
      Dim oValidator As New RequiredFieldValidator
      oValidator.ControlToValidate = "__File"
      oValidator.CssClass = "normalred"
      oValidator.ErrorMessage = Localization.GetString("ValidateFile", oRepositoryBusinessController.LocalResourceFile)
      oValidator.ID = "__ValFileID"
      oValidator.Display = ValidatorDisplay.Static
      PlaceHolder.Controls.Add(oValidator)
    End If
  Else
    If objRepository.FileName <> "" Then
      PlaceHolder.Controls.Add(New LiteralControl("<br>"))
      Dim objLabel As New Label
      objLabel.Text = oRepositoryBusinessController.ExtractFileName(objRepository.FileName)
      objLabel.CssClass = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "FILE", "CssClass", "normal")
      PlaceHolder.Controls.Add(objLabel)
    End If
  End If

 Then, in the Form.xml file for the Repository template you are using, you can add a setting to include the Validator or not.

 <Object>
  <Token>[FILE]</Token>
  <Settings>
   <Setting>
    <Name>Required</Name>
    <Value>false</Value>
   </Setting>
  </Settings>
 </Object>

Now, setting the value to "false" will tell the CreateInputForm() function to NOT inject a required field validator. If the value is "true" or not set at all, then a required field validator WILL be injected.

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryRemoving mandatory File upload and modifying Repository dashboard.Removing mandatory File upload and modifying Repository dashboard.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out