Changeset 3014

Show
Ignore:
Timestamp:
10/20/05 22:13:42 (3 years ago)
Author:
timothy
Message:

Tweaks to make adding an element in the <head> of the template easy. Some Web Interface additions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Colloquy.xcodeproj/project.pbxproj

    r2997 r3014  
    601601                1CABFD0C0658629200801C15 /* JVStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JVStyle.h; sourceTree = "<group>"; }; 
    602602                1CABFD0D0658629200801C15 /* JVStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JVStyle.m; sourceTree = "<group>"; }; 
    603                 1CB2CD8C052DDC570094AAA4 /* Colloquy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Colloquy.app; sourceTree = BUILT_PRODUCTS_DIR; }; 
     603                1CB2CD8C052DDC570094AAA4 /* Colloquy.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Colloquy.app; sourceTree = BUILT_PRODUCTS_DIR; }; 
    604604                1CB3716F060CC7E200F6A81F /* KABubbleWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KABubbleWindowController.h; sourceTree = "<group>"; }; 
    605605                1CB37170060CC7E200F6A81F /* KABubbleWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KABubbleWindowController.m; sourceTree = "<group>"; }; 
     
    18991899                        projectReferences = ( 
    19001900                                { 
     1901                                        ProductGroup = 0A7F240B08556A9B00FA3D9B /* Products */; 
     1902                                        ProjectRef = 1C04394607CAFC7D00304949 /* AppleScript Support.xcodeproj */; 
     1903                                }, 
     1904                                { 
     1905                                        ProductGroup = 0A7F23F308556A6C00FA3D9B /* Products */; 
     1906                                        ProjectRef = 0A60C15F0630D96D00DC6280 /* Chat Core.xcodeproj */; 
     1907                                }, 
     1908                                { 
    19011909                                        ProductGroup = 0A7F242D08556AC100FA3D9B /* Products */; 
    19021910                                        ProjectRef = 1CE3F9BB07C7C29A0049A366 /* F-Script Support.xcodeproj */; 
    1903                                 }, 
    1904                                 { 
    1905                                         ProductGroup = 1CBBDF5708B6EA92002A8BA6 /* Products */; 
    1906                                         ProjectRef = 1CBBDF5608B6EA92002A8BA6 /* Ruby Support.xcodeproj */; 
    1907                                 }, 
    1908                                 { 
    1909                                         ProductGroup = 0A7F240B08556A9B00FA3D9B /* Products */; 
    1910                                         ProjectRef = 1C04394607CAFC7D00304949 /* AppleScript Support.xcodeproj */; 
    19111911                                }, 
    19121912                                { 
     
    19151915                                }, 
    19161916                                { 
    1917                                         ProductGroup = 0A7F23F308556A6C00FA3D9B /* Products */; 
    1918                                         ProjectRef = 0A60C15F0630D96D00DC6280 /* Chat Core.xcodeproj */; 
     1917                                        ProductGroup = 1CBBDF5708B6EA92002A8BA6 /* Products */; 
     1918                                        ProjectRef = 1CBBDF5608B6EA92002A8BA6 /* Ruby Support.xcodeproj */; 
    19191919                                }, 
    19201920                        ); 
  • trunk/JVStyleView.m

    r3013 r3014  
    798798        else shell = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"template" ofType:@"html"] encoding:NSUTF8StringEncoding error:NULL]; 
    799799 
    800         return [NSString stringWithFormat:shell, @"", [resources absoluteString], [[[self emoticons] styleSheetLocation] absoluteString], [[[self style] mainStyleSheetLocation] absoluteString], variantStyleSheetLocation, [[[self style] baseLocation] absoluteString], [[self style] contentsOfBodyTemplateWithName:[self bodyTemplate]]]; 
     800        return [NSString stringWithFormat:shell, @"", @"", [resources absoluteString], [[[self emoticons] styleSheetLocation] absoluteString], [[[self style] mainStyleSheetLocation] absoluteString], variantStyleSheetLocation, [[[self style] baseLocation] absoluteString], [[self style] contentsOfBodyTemplateWithName:[self bodyTemplate]]]; 
    801801} 
    802802 
  • trunk/Plug-Ins/Web Interface/JVWebInterfacePlugin.m

    r3002 r3014  
    270270                bodyShell = [NSString stringWithContentsOfURL:bodyShellLocation encoding:NSUTF8StringEncoding error:NULL]; 
    271271 
    272         bodyShell = ( [bodyShell length] ? [NSString stringWithFormat:bodyShell, @"/resources", content] : content );    
    273  
    274         return [NSString stringWithFormat:shell, @"", @"/resources", emoticonStyleSheet, mainStyleSheet, variant, baseLocation, bodyShell]; 
     272        bodyShell = ( [bodyShell length] ? [NSString stringWithFormat:bodyShell, @"/resources", content] : content ); 
     273 
     274        int fontSize = [[[panel display] preferences] defaultFontSize]; 
     275        NSString *fontFamily = [[[panel display] preferences] sansSerifFontFamily]; 
     276        NSString *header = [NSString stringWithFormat:@"<style type=\"text/css\">body { font-size: %dpx; font-family: %@ }</style>", fontSize, fontFamily]; 
     277 
     278        return [NSString stringWithFormat:shell, [panel description], header, @"/resources", emoticonStyleSheet, mainStyleSheet, variant, baseLocation, bodyShell]; 
    275279} 
    276280 
  • trunk/Plug-Ins/Web Interface/Resources/base.css

    r3011 r3014  
    4848        position: absolute; 
    4949        overflow: hidden; 
     50        outline: 0; 
    5051        word-wrap: break-word; 
    5152} 
  • trunk/Plug-Ins/Web Interface/Resources/common.js

    r3010 r3014  
    44var scrollBackLimit = 300; 
    55var activePanel = null; 
     6var foreground = true; 
    67 
    78function createRequestObject() { 
     
    1516currentRequest.open( "GET", "/command/setup" ); 
    1617currentRequest.send( null ); 
     18 
     19function windowBlured() { 
     20        foreground = false; 
     21} 
     22 
     23function windowFocused() { 
     24        foreground = true; 
     25        activePanel.newMessage = 0; 
     26        activePanel.newHighlightMessage = 0; 
     27        activePanel.listItem.className = activePanel.listItem.className.replace( /\s*newMessage/g, "" ); 
     28        activePanel.listItem.className = activePanel.listItem.className.replace( /\s*newHighlight/g, "" ); 
     29        activePanel.listItem.title = "No messages waiting"; 
     30} 
    1731 
    1832function checkQueue() { 
     
    2337} 
    2438 
     39function panelForIdentifier( id ) { 
     40        for( var i = 0; i < panels.length; i++ ) 
     41                if( panels[i].id == id ) 
     42                        return panels[i]; 
     43        return null; 
     44} 
     45 
    2546function switchPanel( id ) { 
    2647        for( var i = 0; i < panels.length; i++ ) { 
    2748                var panel = panels[i]; 
    2849                if( panel.id == id ) { 
    29                         panel.frame.style.setProperty( "visibility", "visible", "" ); 
    30                         panel.listItem.className += " selected"; 
    31                         panel.active = true; 
    32                         activePanel = panel; 
     50                        if( ! panel.active ) { 
     51                                panel.frame.style.setProperty( "visibility", "visible", "" ); 
     52                                panel.listItem.className += " selected"; 
     53                                panel.active = true; 
     54                                panel.newMessage = 0; 
     55                                panel.newHighlightMessage = 0; 
     56                                panel.listItem.className = panel.listItem.className.replace( /\s*newMessage/g, "" ); 
     57                                panel.listItem.className = panel.listItem.className.replace( /\s*newHighlight/g, "" ); 
     58                                panel.listItem.title = "No messages waiting"; 
     59                                activePanel = panel; 
     60                        } 
    3361                } else { 
    3462                        panel.frame.style.setProperty( "visibility", "hidden", "" ); 
    35                         panel.listItem.className = panel.listItem.className.replace( /\s*selected/, "" ); 
     63                        panel.listItem.className = panel.listItem.className.replace( /\s*selected/g, "" ); 
    3664                        panel.active = false; 
    3765                } 
     
    4068 
    4169function createPanel( id, name, server, type ) { 
     70        if( panelForIdentifier( id ) ) return; 
     71 
    4272        var panel = new Object(); 
    4373        panel.id = id; 
     
    4575        panel.server = server; 
    4676        panel.type = type; 
     77        panel.newMessage = 0; 
     78        panel.newHighlightMessage = 0; 
     79        panel.active = false; 
    4780        panel.frame = document.createElement( "iframe" ); 
    4881        panel.listItem = document.createElement( "li" ); 
     
    117150                                messages++; 
    118151                                var message = children[i]; 
     152                                var id = message.getAttribute( "panel" ); 
    119153                                appendMessage( message.getAttribute( "panel" ), message.firstChild.nodeValue ); 
     154                                var panel = panelForIdentifier( id ); 
     155                                if( ( ( ! foreground && panel.active ) || ! panel.active ) && panel.listItem.className.indexOf( "newMessage" ) == -1 ) { 
     156                                        panel.listItem.className += " newMessage"; 
     157                                        panel.newMessage++; 
     158                                        panel.listItem.title = panel.newMessage + " messages waiting"; 
     159                                } 
    120160                                break; 
    121161                        } 
  • trunk/Plug-Ins/Web Interface/Resources/index.html

    r3010 r3014  
    99        <script type="text/ecmascript" defer="defer" src="common.js" encoding="utf-8" /> 
    1010</head> 
    11 <body
     11<body onblur="windowBlured()" onfocus="windowFocused()"
    1212<div id="main"> 
    1313<div id="panels"></div> 
  • trunk/Plug-Ins/Web Interface/Web Interface.xcodeproj/project.pbxproj

    r2996 r3014  
    88 
    99/* Begin PBXBuildFile section */ 
     10                1C3458F20905FC4F00AC2C16 /* base.css in Resources */ = {isa = PBXBuildFile; fileRef = 1C3458F10905FC4800AC2C16 /* base.css */; }; 
    1011                1C36998308FF75A200F34892 /* JVWebInterfacePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C36998208FF75A200F34892 /* JVWebInterfacePlugin.m */; }; 
    1112                1C3699BC08FF768900F34892 /* basic_modules.c in Sources */ = {isa = PBXBuildFile; fileRef = 1C3699AF08FF768900F34892 /* basic_modules.c */; }; 
     
    4950                089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 
    5051                1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 
     52                1C3458F10905FC4800AC2C16 /* base.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = base.css; path = Resources/base.css; sourceTree = "<group>"; }; 
    5153                1C36998108FF75A200F34892 /* JVWebInterfacePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JVWebInterfacePlugin.h; sourceTree = "<group>"; }; 
    5254                1C36998208FF75A200F34892 /* JVWebInterfacePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JVWebInterfacePlugin.m; sourceTree = "<group>"; }; 
     
    111113                                1CC7250B0901A775004651F8 /* index.html */, 
    112114                                1CC7265F0901BAAE004651F8 /* common.js */, 
     115                                1C3458F10905FC4800AC2C16 /* base.css */, 
    113116                        ); 
    114117                        name = Resources; 
     
    264267                                1CC7250C0901A775004651F8 /* index.html in Resources */, 
    265268                                1CC726710901BBD2004651F8 /* common.js in Resources */, 
     269                                1C3458F20905FC4F00AC2C16 /* base.css in Resources */, 
    266270                        ); 
    267271                        runOnlyForDeploymentPostprocessing = 0; 
  • trunk/Plug-Ins/Web Interface/nanohttpd/basic_modules.c

    r3001 r3014  
    5656        } 
    5757 
    58         DIR *dir = opendir( filename ); 
     58        DIR *dir = opendir( real ); 
    5959        if( ! dir ) { 
    6060#ifdef LOG_HTTP 
     
    108108 
    109109        struct stat sb; 
    110         if( stat( filename, &sb ) < 0 ) { 
     110        if( stat( real, &sb ) < 0 ) { 
    111111                resp -> status_code = 404; 
    112112                resp -> reason_phrase = "Cannot access document"; 
     
    122122 
    123123        const char *content_type = NULL; 
    124         char *ext = getext( filename ); 
     124        char *ext = getext( real ); 
    125125        if( ext ) content_type = server -> get_mime( server, ext ); 
    126126        if( content_type ) resp -> content_type = (char *)content_type; 
    127127 
    128         int fd = open( filename, O_RDONLY ); 
     128        int fd = open( real, O_RDONLY ); 
    129129        if( fd > 0 ) { 
    130130                char buf[1024]; 
  • trunk/Resources/template.html

    r2963 r3014  
    77        <meta name="formatter" content="libxslt 1.1.11" /> 
    88        <title>%@</title> 
     9        %@ 
    910        <script id="defaultScript" type="text/ecmascript" defer="defer" src="%@/default.js" encoding="utf-8" /> 
    10         <link id="defaultStyle" rel="stylesheet" type="text/css" href="%2$@/default.css" /> 
     11        <link id="defaultStyle" rel="stylesheet" type="text/css" href="%3$@/default.css" /> 
    1112        <link id="emoticonStyle" rel="stylesheet" type="text/css" href="%@" /> 
    1213        <link id="mainStyle" rel="stylesheet" type="text/css" href="%@" />