Adding WCF.User-Object in JavaScript
authorTim Düsterhus <timwolla@arcor.de>
Mon, 1 Aug 2011 21:04:04 +0000 (23:04 +0200)
committerTim Düsterhus <timwolla@arcor.de>
Mon, 1 Aug 2011 21:13:51 +0000 (23:13 +0200)
Currently only holds username and userID

com.woltlab.wcf/templates/headInclude.tpl
wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/js/WCF.js

index 15b11a34707c79190993cc0cc473be2ffbc7923a..8311bbcc60e8a3ce31dca9f46621bc95d72c6549 100644 (file)
@@ -13,4 +13,9 @@
 </script>
 <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery.min.js"></script>
 <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery-ui.min.js"></script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/WCF.js"></script>
\ No newline at end of file
+<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/WCF.js"></script>
+<script type="text/javascript">
+       //<![CDATA[
+       WCF.User.init({$__wcf->user->userID}, '{@$__wcf->user->username|encodejs}');
+       //]]>
+</script>
index db028e089fb729e683366cfa3d264d0d3e90bca0..db9ac773cd3060833c8498838eadcd778355733c 100644 (file)
        <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/jquery-ui.min.js"></script>
        <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/WCF.js"></script>
        <script type="text/javascript" src="{@RELATIVE_WCF_DIR}acp/js/WCF.ACP.js"></script>
+       <script type="text/javascript">
+               //<![CDATA[
+               WCF.User.init({$__wcf->user->userID}, '{@$__wcf->user->username|encodejs}');
+               //]]>
+       </script>
        
        {*
        {if $specialStyles|isset}
index 5b2b416426d3b2c0155b2c11e948b8c1112de432..2304cd33ef89daa9cc8a8ea508d28ad8d088c3cf 100644 (file)
@@ -1510,6 +1510,36 @@ WCF.ToggleOptions.prototype = {
        }
 };
 
+/**
+ * Holds userdata of the current user
+ */
+WCF.User = {
+       /**
+        * UserID of the user
+        * 
+        * @var integer
+        */
+       userID: 0,
+       
+       /**
+        * Username of the user
+        * 
+        * @var string
+        */
+       username: '',
+       
+       /**
+        * Initializes userdata
+        * 
+        * @param       integer userID
+        * @param       string  username
+        */
+       init: function(userID, username) {
+               this.userID = userID;
+               this.username = username;
+       }
+};
+
 /**
  * Basic implementation for WCF dialogs.
  */