simple-review.com
September 09, 2010, 08:28:22 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Help now open.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Missing Titles  (Read 2303 times)
Raithgar
Newbie
*
Posts: 2


View Profile Email
« on: May 12, 2008, 10:33:20 PM »

I've run into a slight speed bump while setting up Simple Reviews..

I can create a catagory, however all titles I assign dissapear after I save.  Is there something I might have missed in the configuration?
Any assistance would be great.

Running Joomla 1.0.15
Simple Reviews Version:2.0 BETA 5.5

Edit: I've been able to get things to work correctly though Firefox.. Seems the error is an IE7.. sorry about any confusion
« Last Edit: May 12, 2008, 10:39:02 PM by Raithgar » Logged
row1
SR Sole Developer
Hero Member
*****
Posts: 824



View Profile
« Reply #1 on: May 13, 2008, 03:03:30 AM »

Hi,
Thanks for finding that. You should not be using BETA 5.5, the final release has a lot of fixes in code and to the database.

Unfortunately this bug is in the final version.
Replace the contents of this file with the below:\components\com_simple_review\javascript\TitleManager.js

Code:
/**
* Manager for adding titles to a component.
* instanceVariableName: the name of the variable which references the instance of this class
* idPrefix: the prefix for the html elements id e.g. "title"
* idPostfix: the postfix for the html elements id e.g. ""
* maxTitles: the number of titles allowed to be created e.g. 20
*/
function TitleManager(instanceVariableName, idPrefix, idPostfix, maxTitles)
{
    this._instanceVariableName = instanceVariableName;
    this._prefix = idPrefix;
    this._postfix = idPostfix;
    this._maxTitles = maxTitles;
    this._numberOfTitles = 0;
}

TitleManager.prototype =
{

   AddTitle : function(titleValue, titleName, titleDBIDs)
   {
      if(this._numberOfTitles >= this._maxTitles)
      {
      alert("Only " + this._maxTitles + " fields are allowed");
      return;   
      }
     
      var titles = document.getElementById("titlesdiv");   
      ++this._numberOfTitles;    
      var titleID = this._prefix+this._numberOfTitles;
       
      //add the text label
      var newTitleText = document.createElement("label");  
      newTitleText.setAttribute("for", titleID);
      newTitleText.setAttribute("class", "titleLabel");
     
      //add the text to the label
      var labelText = document.createTextNode(titleName);
      newTitleText.appendChild(labelText);   
      titles.appendChild(newTitleText);
     
      //add the text area
      var newTitle = null;
      try
      {
            var attrs = "name='"+titleID+"' id='"+titleID+"' rows='1' cols='70'";
            newTitle = document.createElement("<textarea "+attrs+"></textarea>");
      }
      catch(e)
      {
            newTitle = document.createElement("textarea");
            newTitle.setAttribute("name", titleID);
            newTitle.setAttribute("id", titleID);  
            newTitle.setAttribute("rows", "1");
            newTitle.setAttribute("cols", "70");       
      }
       
      //add the text to the text area
      newTitle.appendChild(document.createTextNode(titleValue));   
      titles.appendChild(newTitle);
     
      //expand/contract image
      var expander = document.createElement("img");
      expander.setAttribute("src", "images/expandall.png");
      expander.setAttribute("onclick", this._instanceVariableName+".Expand('"+titleID+"');");
      expander.setAttribute("id", "expand"+titleID);
      expander.setAttribute("alt", "Expand");
      expander.setAttribute("title", "Expand");
      expander.setAttribute("style", "vertical-align: top;");
      titles.appendChild(expander);
     
      //category/review title id, hidden field
      //name format : prefix_hiddenFieldNumber_titleNumber
      for(var i=0; i < titleDBIDs.length; i++)
      {
      var hfCategoryTitleID = null;
      try
      {
        var attrs = "type='hidden' name='"+this._prefix + "ID_" + i + "_" + this._numberOfTitles + this._postfix+"' value='"+titleDBIDs[i]+"'";
        hfCategoryTitleID = document.createElement("<input "+attrs +"/>");
      }
      catch(e)
      {
              hfCategoryTitleID = document.createElement("input");
          hfCategoryTitleID.setAttribute("type", "hidden");
          hfCategoryTitleID.setAttribute("name", this._prefix + "ID_" + i + "_" + this._numberOfTitles + this._postfix );
          hfCategoryTitleID.setAttribute("value", titleDBIDs[i]);
          titles.appendChild(hfCategoryTitleID);      
      }
      titles.appendChild(hfCategoryTitleID);      
      }
     
      if(isIE())
      {
          //i.e needs this
          //http://whyiesucks.blogspot.com/2006/07/_ie-cannot-set-events-via-dom-in-order.html
          expander.parentNode.innerHTML = expander.parentNode.innerHTML ;
      }
     
      titles.appendChild( document.createElement("br")); 
    },

    Expand : function(textAreaID)
    {

        var dynamicfield = document.getElementById(textAreaID);
        var expander = document.getElementById("expand"+textAreaID);
        if (dynamicfield.getAttribute("rows") > 1)
        {
            dynamicfield.setAttribute("rows", "1");
            expander.setAttribute("src", "images/expandall.png");
            expander.setAttribute("alt", "Expand");
            expander.setAttribute("title", "Expand");
        }
        else
        {
            dynamicfield.setAttribute("rows", "5");
            expander.setAttribute("src", "images/collapseall.png");
            expander.setAttribute("alt", "Contract");
            expander.setAttribute("title", "Contract");
        }
    },
   
    GetNextNumberedTitleName : function(namePrefix)
    {   
      return namePrefix + " " + (this._numberOfTitles + 1);
    }   
}

var _ie = null;
function isIE()
{
    if(_ie == null)
    {
        var version=0
        if (navigator.appVersion.indexOf("MSIE")!=-1)
        {
            temp=navigator.appVersion.split("MSIE")
            version=parseFloat(temp[1])
        }
        _ie = (version > 0);       
    }
    return _ie;
   
}
Logged

If you find Simple Review useful please submit a Review (http://extensions.joomla.org/extensions/communities-&-groupware/ratings-&-reviews/4725/details), your positive reviews will help keep me going!
Please also make suggestions and possible improvements in the forum!
Raithgar
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: May 14, 2008, 06:35:24 PM »

This worked like a charm.. Thanks for the quick reply (and apologies for the delay in mine)
Logged
row1
SR Sole Developer
Hero Member
*****
Posts: 824



View Profile
« Reply #3 on: May 17, 2008, 10:32:43 PM »

Fixed in Simple Review 2.0.1
Logged

If you find Simple Review useful please submit a Review (http://extensions.joomla.org/extensions/communities-&-groupware/ratings-&-reviews/4725/details), your positive reviews will help keep me going!
Please also make suggestions and possible improvements in the forum!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!