coliver     2003/07/07 22:46:55

  Modified:    src/blocks/linotype/samples flow.js
               src/blocks/linotype/samples/repository/news/2 document.xml
  Log:
  Formatted code and fixed typo
  
  Revision  Changes    Path
  1.6       +74 -76    cocoon-2.1/src/blocks/linotype/samples/flow.js
  
  Index: flow.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/linotype/samples/flow.js,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- flow.js   19 Jun 2003 09:28:17 -0000      1.5
  +++ flow.js   8 Jul 2003 05:46:55 -0000       1.6
  @@ -18,46 +18,46 @@
       var args = new Array(arguments.length - 1);
       for (var i = 1; i < arguments.length; i++) {
           args[i-1] = arguments[i];
  -    }        
  +    }            
   
  -     if ((userid == undefined) || (userid == "")) {
  -             login(action, args);
  -     }
  -             
  -     invoke(action, args);
  +    if ((userid == undefined) || (userid == "")) {
  +        login(action, args);
  +    }
  +                
  +    invoke(action, args);
   }
   
   /*
    * If the user is not yet authorized, than authentication takes place
    */
   function login(action, args) {
  -     var name = "";
  -     var password = "";
  -     var userError = "";
  -     var passError = "";
  -
  -     while (true) {
  -             sendPageAndWait("screen/login", { username : name, userError : 
userError, passError : passError});
  -
  -             name = cocoon.request.getParameter("username");
  -             password = cocoon.request.getParameter("password");
  -             
  -             if (users.isValidName(name)) {
  -                 if (users.isValidPassword(name,password)) {
  -                     userid = name;
  -                     username = users.getFullName(name);
  -                             break;
  -                     } else {
  -                             userError = "";
  -                             passError = "Password doesn't match";
  -                     }
  -             } else {
  -                     userError = "User not found";
  -                     passError = "";
  -             }
  -     }
  -     
  -     cocoon.createSession();
  +    var name = "";
  +    var password = "";
  +    var userError = "";
  +    var passError = "";
  +
  +    while (true) {
  +        sendPageAndWait("screen/login", { username : name, userError : userError, 
passError : passError});
  +
  +        name = cocoon.request.getParameter("username");
  +        password = cocoon.request.getParameter("password");
  +                
  +        if (users.isValidName(name)) {
  +            if (users.isValidPassword(name,password)) {
  +                userid = name;
  +                username = users.getFullName(name);
  +                break;
  +            } else {
  +                userError = "";
  +                passError = "Password doesn't match";
  +            }
  +        } else {
  +            userError = "User not found";
  +            passError = "";
  +        }
  +    }
  +        
  +    cocoon.createSession();
   }
   
   /*
  @@ -70,10 +70,10 @@
   function invoke(action, args) {
       func = this[action];
       if (func != undefined) {
  -     func.apply(this,args);
  -     } else {
  -             sendPage("screen/" + action, {"user" : username});
  -     }
  +        func.apply(this,args);
  +    } else {
  +        sendPage("screen/" + action, {"user" : username});
  +    }
   }
   
   // ----------------------------- actions ----------------------------------
  @@ -83,52 +83,50 @@
    * that the user has logged out and should be further considered authenticated. 
    */
   function logout() {
  -     userid = "";
  -     sendPage("screen/logout");
  +    userid = "";
  +    sendPage("screen/logout");
   }
      
   /*
    * The edit action performs the editing subflow.
    */
   function edit(id,type,subpage) {
  -     var repository = home + "repository/" + type + "/";
  +    var repository = home + "repository/" + type + "/";
       
  -     if (id == "template") {
  -             id = repo.getID(repository);
  -             repo.copy(repository + "template", repository + id);
  -             redirect("../" + id + "/");
  -     } else if ((subpage != undefined) && (subpage != "")) {
  -             sendPage("edit/" + type + "/" + id + "/" + subpage,{});
  -     } else {
  -             var document = repository + id;
  -
  -             while (true) {
  -                     var versions = repo.getVersions(document);
  -             sendPageAndWait("edit/" + type + "/" + id + "/", 
  -                     { 
  -                             userid : userid, 
  -                             username : username, 
  -                             versions : versions,
  -                             innerHTML : cocoon.request.getParameter("innerHTML") 
  -                     }
  -             );
  -             var action = cocoon.request.getParameter("action");
  -             if (action == "delete") {
  -                     repo.remove(document);
  -                     break;
  -             } else if (action == "restore") {
  -                     var version = cocoon.request.getParameter("version");
  -                     repo.revertFrom(document,version);
  -             } else {
  -                     var output = repo.getOutputStream(document);
  -                     process("samples/linotype/action/save-" + type,{},output);
  -                     output.close();
  -                     repo.save(cocoon.request, document);
  -                     if (action == "finish") break;
  -                     }               
  -             }
  +    if (id == "template") {
  +        id = repo.getID(repository);
  +        repo.copy(repository + "template", repository + id);
  +        redirect("../" + id + "/");
  +    } else if ((subpage != undefined) && (subpage != "")) {
  +        sendPage("edit/" + type + "/" + id + "/" + subpage,{});
  +    } else {
  +        var document = repository + id;
  +
  +        while (true) {
  +            var versions = repo.getVersions(document);
  +            sendPageAndWait("edit/" + type + "/" + id + "/", { 
  +                userid : userid, 
  +                username : username, 
  +                versions : versions,
  +                innerHTML : cocoon.request.getParameter("innerHTML") 
  +            });
  +            var action = cocoon.request.getParameter("action");
  +            if (action == "delete") {
  +                repo.remove(document);
  +                break;
  +            } else if (action == "restore") {
  +                var version = cocoon.request.getParameter("version");
  +                repo.revertFrom(document,version);
  +            } else {
  +                var output = repo.getOutputStream(document);
  +                process("samples/linotype/action/save-" + type,{},output);
  +                output.close();
  +                repo.save(cocoon.request, document);
  +                if (action == "finish") break;
  +            }                   
  +        }
   
  -             redirect("../../../" + type);
  -     }
  +        redirect("../../../" + type);
  +    }
   }
   
  
  
  
  1.3       +1 -1      
cocoon-2.1/src/blocks/linotype/samples/repository/news/2/document.xml
  
  Index: document.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/linotype/samples/repository/news/2/document.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- document.xml      18 Jun 2003 06:14:18 -0000      1.2
  +++ document.xml      8 Jul 2003 05:46:55 -0000       1.3
  @@ -11,7 +11,7 @@
   <br/>
   Then click on the linotype here on the left.<br/>
   <br/>
  -When the login appear, use:<br/>
  +When the login appears, use:<br/>
   <ul><li>user -&gt; guest</li>
   <li>password -&gt; guest</li>
   </ul>
  
  
  

Reply via email to