Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Posts posted by jimfog

  1. You don't think that someone writing a 6000+ line program would do something as basic and simple as keeping track of which view the calendar is in? Have you looked at the code for switching views to see what it does?

    As I said...I am searching the issue. I am not saying you are wrong.

  2. It seems like the solution to determine which view it is in would be a variable that is specifically for that, instead of relying on a column count variable.

    I do not disagree...but I have not find such variable(yet)till I find one I will have to go with the method described above.

     

    Besides we are talking for 6100 lines of code...which none is mine.it is the fullcalendar jquery plugin.

     

    Searching through such code is not easy,even by using an IDE(I use Nebeans).

  3. I have found somehow a solution to the problem.The function that produces the dates in the top of the columns is this-and specifically a for loop(I have commented it):

    function buildHeadHTML() {		var headerClass = tm + "-widget-header";		var html = '';		var col;		var date;		html += "<thead><tr>";		if (showWeekNumbers) {			html +=				"<th class='fc-week-number " + headerClass + "'>" +				htmlEscape(weekNumberTitle) +				"</th>";		}		for (col=0; col<colCnt; col++) {//this loop prints the dates			date = cellToDate(0, col);			html +=				"<th class='fc-day-header fc-" + dayIDs[date.getDay()] + " " + headerClass + "'>" +				htmlEscape(formatDate(date, colFormat)) +				"</th>";		}		html += "</tr></thead>";		return html;	} 

    The reason behind this topic is a way to find a way to make a distinction when the calendar displays weekview and dayview.

    To put it differently.The way the code of the plugin is structured If I change the code in week view, day view is also affected something I do not want since I want to make changes that affect only week view.

     

    The solution is to "observe" the colCnt variable...it has a different a value if it is week view and different when it is day view.

     

    My original intention was to use innerHTML to accomplish what I describe above(with a logic I would think of)...it is no longer necessary.

     

    Any comments are welcome.

  4. If it's not returning any elements, then wouldn't the obvious solution be that there isn't a matching element on the page when you run that code? I mean, document.getElementsByClassName works, right? So, if it works, and it doesn't return any elements, then what does that mean?

    You are right to say the there are not elements there to be returned-probably.

    I mean the class is returned but not the innerHTML.

     

    I can make only one assumption based on the above.I am trying the "get" the element before this is rendered.

    I am not sure but probably the explanation.

     

    Meaning I have to call the function after the element is rendered.And that means I have to find the proper line to place it in the file I gave you above.

  5. It sounds like list[0] doesn't have anything in it. What does list.length say?

    This is the function:

    function findview(){ var list=document.getElementsByClassName("fc-mon fc-widget-header");  len=list.length  return len;       }

    The above function returns 1.

    Now,if I use this code:

    function findview(){ var list=document.getElementsByClassName("fc-mon fc-widget-header")[0].innerHTML;  len=list.length;  return len;       }

    The result is 9...which of course is the number of the characters inside the HTML part,.more specifically the date depiction in a format such as Tue 4/29(that is today)

  6.  

    Apparently Mozilla supports multiple classes -- so go ahead and test the length of the array to see if it is indeed returning the element or elements you expect it to.

    function findview(){ var list=document.getElementsByClassName("fc-mon fc-widget-header");  alert('len='+list.length);  return list[0].innerHTML;       }

    The code produces the same result in both browsers(FF and Chrome)...in other words the list.length is equal to 1 and also the inner HTML is printed to the browser.

     

    The functions-as standalone works...but in the context of the code I am mentioning above and you will find in the link I gave it does not.

    The console prints Cannot read property 'innerHTML' of undefined.

     

    As I said,this the problem I am trying to solve....just read my original post.

  7. In my case I just go to find one class...this is done with this code:

    var DOM=document.getElementsByClassName("fc-mon fc-widget-header");

    The above code works,,,

     

    Just read my post again what is the problem.

  8. I am building a calendar.This is the HTML that is produced in weekview and are the days on top of the columns:

       <thead><tr class="fc-first fc-last"><th class="fc-agenda-axis fc-widget-header fc-first" style="width: 50px;"> </th><th class="fc-sun fc-col0 fc-widget-header" style="width: 181px;">Κυρ 4/27</th>               <th class="fc-mon fc-col1 fc-widget-header" style="width: 180px;">Mon 4/28</th>               <th class="fc-tue fc-col2 fc-widget-header" style="width: 180px;">Tue 4/29</th>               <th class="fc-wed fc-col3 fc-widget-header" style="width: 180px;">Wed 4/30</th>               <th class="fc-thu fc-col4 fc-widget-header" style="width: 180px;">Thu 5/1</th>               <th class="fc-fri fc-col5 fc-widget-header" style="width: 180px;">Fri 5/2</th>               <th class="fc-sat fc-col6 fc-widget-header">Σάββ 5/3</th>               <th class="fc-agenda-gutter fc-widget-header fc-last" style="width: 15px;"> </th></tr>       </thead>

    If I want to access Mon 4/28 I use this:

    var DOM=document.getElementsByClassName("fc-mon fc-widget-header")[0].innerHTML;

    The above test are made in the dev tools console.

    Now if I want to use a function this is the code:

    function findview()        { var DOM=document.getElementsByClassName("fc-mon fc-widget-header")[0].innerHTML;           return DOM;               }

    The above,in the console also works but it does not where it should really go.Let me explain:

    This is the file that prints the calendar http://1drv.ms/1ke2gfe and in line 3650 you will see the function that prints week/day view(I have placed a comment there)...exactly above you will find the above function and in line 4331 the function is being called.

     

    And here is the problem...in the console I get the below message:

    Uncaught TypeError: Cannot read property 'innerHTML' of undefined 

    What I am trying to say is that the function as standalone works(when used in the console) but when called in the file and from within the function AgendaEventRenderer() it does not.Why that happens?

     

    Lastly the file I gave you above is from this plugin here...http://arshaw.com/fullcalendar/

  9. I do not understand the problem. Are you unaware that you can access object properties directly? If so, how did you get this far without knowing that? You can use event.title, or event["title"]. Why are you looping through the properties?

    Because there is more than one object at any moment. That is why I am using loop.

    Anyway I found a workaround and no loop is needed at all...but I am just letting you know why I used loop in the first place.

  10. This is the code I am using which and which loops through all of the properties:

        for (var key in event) {                      if (event.hasOwnProperty(key)) {                        console.dir(key + " -> " + event[key]);                      }                    }

    As you see I am printing the results in the console.event is the name of the object

     

    As I said above I want to access only the title property.

  11. I have 2 objects:

    {id:3, title:kostas Papageorgiou, staff_ID:5, start:2014-04-09 04:30:00, end:2014-04-09 06:00:00,…}1: {id:4, title:gianis, staff_ID:5, start:2014-04-10 04:00:00, end:2014-04-10 06:00:00, color:#0072C6,…}

    I want to loop only through the property title of them.How am I going to do it?

     

    I have found code in the web that loops through all of the properties but not for a specific one.

    In other words and having as an example the above I want to get Kostas Papageorgiou and gianis.

  12. I have found this site https://medium.com/...on thing that caught my attention is the smooth animation of the sidebar(just click the M on the upper left )

     

    What I have not found though is what technique is used to accomplish this smooth animation...it is not jquery and(I think) it is not CSS.

     

    So what is it?

    Can someone help me on this?

     

    thanks

  13. $_SERVER['REQUEST_URI'] is a good starting point.It grabs the URL submitted.

     

    But how am I going to separate from the URI the number after events.php...which can be any number,it is just in this

    example that it is 219.

  14. Suppose we have a url like this:

     

    http://localhost/Appointments/Administrator/events.php/219

     

    IS there a way some PHP code can "grab" that 219 above?

    I think that the above URL is RESTFULL.

     

    Nonetheless in the backend I do not have a REST interface.

    GET will not work here-the structure of the URL will not "allow" it.

     

    So, is there a way PHP can "grab" that 219 or I should change the structure of the URL.

    I could go straight for the second option but it is not so easy as you might think.

  15. Functions like FROM_UNIXTIME do not take a query as a parameter, they take a single column or value.

    Yes...but how am I going to "target" a specific cell from a table with FROM_UNIXTIME?

  16. My problem now has to do with the syntax-selecting specifically the unix timestamp from the table column and converting it.

    I tried this(need to stress here that the column where unix timestamp is stored is called startDate)...here is what I tried:

    SELECT FROM_UNIXTIME(select startDate from appointments); 

    And here is the error message I get:

    Error code 1064, SQL state 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select startDate from appointments)' at line 1

    Ηow can I select the unix timestamp from the column and the same type use FROM_UNIXTIME?

  17.  

     

    My purpose is that the same file/script processes also PUT requests.

    My question is if there is a way the script can "understand" what type of request is made,POST or PUT.

     

    Because different code/logic must apply for POST and different for PUT,unless the solution being creating a new file for the

    PUT request.

     

    Thanks.

  18. According to backbone manual the backbone.sync function is used to make requests to the server(to save a model in the database for example).

     

    If the request is successful a "sync" event is returned.And here is my problem.

     

    What exactly is this sync event?

     

    In my case the request is made successfully but nothing is returned from the server.This is the code from an app I am building where events are stored in the db.

         if (this.model.isNew()) {                                                                                this.collection.create(this.model, {success: this.close});
    close: function() {
    //code that closes a dialog box.
    },

     

    The success callback above is triggered when the request is successful.In my case it never "fires" cause there is not a sync event returned from the server despite the data are saved to the db.I do not what exactly is going on here.

     

    If the success callback fired that would had as a result that the close function(shown below) will be called.

     

    Obviously, I am seeking help from someone who is experienced with backbone.

  19. The console of dev tools showed an error(just noticed it.)

    This is the message that I saw:

    Uncaught Error: Can't add the same model to a set twice,1

     

    The following code is from backbone.js-it demonstrates the function which is related with the error message:

     _add : function(model, options) {      options || (options = {});      model = this._prepareModel(model, options);      if (!model) return false;      var already = this.getByCid(model) || this.get(model);      if (already) throw new Error(["Can't add the same model to a set twice", already.id]);      this._byId[model.id] = model;      this._byCid[model.cid] = model;      var index = options.at != null ? options.at :                  this.comparator ? this.sortedIndex(model, this.comparator) :                  this.length;      this.models.splice(index, 0, model);      model.bind('all', this._onModelEvent);      this.length++;      if (!options.silent) model.trigger('add', model, this, options);      return model;    },

    I do not know a lot from backbone so it is difficult to explain what this message means.

  20. Ι do not want to post any code yet before checking your claims above.Here is the new PHP code-according to thescientist this must be correct:

     $event[0] = array('id'=>'1','title' => 'dim', 'start' =>'2014-03-17T10:00:00Z','end'=>'2014-03-17T12:30:00Z','color'=>'#0072C6','allDay'=>false);    $event[1] = array('id'=>'1','title1' => 'dimi', 'start' =>'2014-03-18T11:00:00Z','end'=>'2014-03-18T13:30:00Z','color'=>'#0072C6','allDay'=>false);    echo json_encode($event);

    Nonetheless the events are not rendered in the calendar again.

    I think I followed the advice above correctly.

×
×
  • Create New...