• file_area.dir object

    From Tegularius@VERT/BAUDHOUS to All on Thu Jul 9 05:32:00 2009
    The docs say that this is an associative array of all directories. This
    is the only time it is mentioned in the docs. It has no properties.
    So what use is it?

    I'm still trying to solve my little problem using js: given the internal
    code of a desired file area, to change bbs.curdir to the one with that code.

    ---
    þ Synchronet þ The Bauding House - baudhous.synchro.net
  • From Nightfox@VERT/DIGDIST to Tegularius on Thu Jul 9 08:33:00 2009
    Re: file_area.dir object
    By: Tegularius to All on Thu Jul 09 2009 09:32:39

    The docs say that this is an associative array of all directories. This is the only time it is mentioned in the docs. It has no properties.

    I've noticed this with some of the Synchronet JavaScript docs. But if the docs don't list properties, that doesn't mean there aren't any properties. There must be some of the object exists. If you want to find out what properties are in an object, you can iterate through an object's properties and output them as follows:

    for (var prop in file_area.dir)
    console.print(prop + "\r\n");

    That will output all the property names, followed by a carriage return & newline.

    If you also wanted to output the values of the properties, you could do this: for (var prop in file_area.dir)
    console.print(prop + ": " + file_area.dir[prop] + "\r\n");

    Nightfox


    ---
    þ Synchronet þ Digital Distortion BBS
  • From Digital Man@VERT to Tegularius on Fri Jul 10 20:09:00 2009
    Re: file_area.dir object
    By: Tegularius to All on Thu Jul 09 2009 09:32 am

    The docs say that this is an associative array of all directories. This
    is the only time it is mentioned in the docs. It has no properties.
    So what use is it?

    The objects in the file_area.dir array are the same as the objects in the file_area.list_list[].dir_list[] array, they're just organized differently and the array contains *all* directories instead of just those that the current user has access to.

    digital man

    Snapple "Real Fact" #190:
    Thailand means "Land of the Free."

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Tegularius@VERT/BAUDHOUS to All on Mon Jul 13 02:50:00 2009
    Re: file_area.dir object
    By: Digital Man to Tegularius on Sat Jul 11 2009 00:09:49

    The little job is almost done. I've discovered that it is just a matter of assigning the desired internal code to bbs.curdir_code, i.e.:
    bbs.curdir_code=newcode

    If newcode is valid, then the change is made; if not, it isn't. The case
    (upper or lower) of newcode doesn't matter. However, the value
    of bbs.curdir_code is reported all in lower-case.

    This brings up my remaining little question. I would like my .js to
    recognize whether the change of directory is successful by comparing
    newcode to bbs.curdir_code after an attempt to change it. However,
    if the cases of the two strings don't match, the comparison returns false.
    How do I change the case of a string to upper or lower? The guide mentions toLowerCase and toUpperCase as methods of strings, but I can't make them
    work. Are they obsolete? Could someone give an example of the syntax?

    Oh yes, one more question, about console.getstr. This takes a string
    as an optional argument. What is the purpose of this argument? It
    doesn't appear to be either the string variable to be assigned (which
    is done via the returned value) or a prompt. Something needs to be
    there if one wants to use the other arguments, but I can't determine
    what it does.



    ---
    þ Synchronet þ The Bauding House - baudhous.synchro.net
  • From Nightfox@VERT/DIGDIST to Tegularius on Mon Jul 13 08:37:00 2009
    Re: file_area.dir object
    By: Tegularius to All on Mon Jul 13 2009 06:50:57

    This brings up my remaining little question. I would like my .js to recognize whether the change of directory is successful by comparing newcode to bbs.curdir_code after an attempt to change it. However,
    if the cases of the two strings don't match, the comparison returns false How do I change the case of a string to upper or lower? The guide mentio toLowerCase and toUpperCase as methods of strings, but I can't make them work. Are they obsolete? Could someone give an example of the syntax?

    toUpperCase() and toLowerCase() return a copy of the string in upper/lower case. You could use it like this:
    if (bbs.curdir_code.toUpperCase() == "SOME_DIR")


    ---
    þ Synchronet þ Digital Distortion BBS
  • From Digital Man@VERT to Tegularius on Mon Jul 13 14:53:00 2009
    Re: file_area.dir object
    By: Tegularius to All on Mon Jul 13 2009 06:50 am

    Re: file_area.dir object
    By: Digital Man to Tegularius on Sat Jul 11 2009 00:09:49

    The little job is almost done. I've discovered that it is just a matter
    of assigning the desired internal code to bbs.curdir_code, i.e.:
    bbs.curdir_code=newcode

    If newcode is valid, then the change is made; if not, it isn't. The case (upper or lower) of newcode doesn't matter. However, the value
    of bbs.curdir_code is reported all in lower-case.

    This brings up my remaining little question. I would like my .js to recognize whether the change of directory is successful by comparing
    newcode to bbs.curdir_code after an attempt to change it. However,
    if the cases of the two strings don't match, the comparison returns false. How do I change the case of a string to upper or lower? The guide mentions toLowerCase and toUpperCase as methods of strings, but I can't make them work. Are they obsolete? Could someone give an example of the syntax?

    No, they're not obsolete. What did you try?

    There's an example here: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/String/t oLowerCase

    Oh yes, one more question, about console.getstr. This takes a string
    as an optional argument. What is the purpose of this argument?

    It's the default value of the string (e.g. when used with the K_EDIT mode flag).

    It
    doesn't appear to be either the string variable to be assigned (which
    is done via the returned value) or a prompt. Something needs to be
    there if one wants to use the other arguments, but I can't determine
    what it does.

    Actually, unless you're using K_EDIT, you don't need to specify the string at all. The method implementation is smart enough to know the difference between numbers (e.g. maxlen and mode arguments) and string arguments. Many of the Synchronet JS methods are this way.

    digital man

    Snapple "Real Fact" #65:
    A one-day weather forecast requires about 10 billion math calculations.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Tegularius@VERT/BAUDHOUS to Digital Man on Wed Jul 15 17:02:00 2009
    Re: file_area.dir object
    By: Digital Man to Tegularius on Mon Jul 13 2009 18:53:44

    No, they're not obsolete. What did you try?

    There's an example here: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Strin oLowerCase

    Thanks. I figured that one out shortly after posting. I had simply
    forgotten to put () at the end.


    Oh yes, one more question, about console.getstr. This takes a string
    as an optional argument. What is the purpose of this argument?

    It's the default value of the string (e.g. when used with the K_EDIT mode flag).

    Thanks again!

    Web and FTP are basically working now. This is starting to be fun...



    ---
    þ Synchronet þ The Bauding House - baudhous.synchro.net
  • From Digital Man@VERT to Tegularius on Wed Jul 15 21:29:00 2009
    Re: file_area.dir object
    By: Tegularius to Digital Man on Wed Jul 15 2009 09:02 pm

    Web and FTP are basically working now. This is starting to be fun...

    As it should be! :-)

    digital man

    Snapple "Real Fact" #23:
    The San Francisco Cable cars are the only mobile national monument.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net