browser staff : print config UI initial
authorBill Erickson <berick@esilibrary.com>
Wed, 16 Apr 2014 21:38:00 +0000 (17:38 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 16 Apr 2014 21:38:00 +0000 (17:38 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/admin/workstation/index.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/admin/workstation/t_printing.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/t_navbar.tt2
Open-ILS/web/js/ui/default/staff/admin/workstation/app.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

diff --git a/Open-ILS/src/templates/staff/admin/workstation/index.tt2 b/Open-ILS/src/templates/staff/admin/workstation/index.tt2
new file mode 100644 (file)
index 0000000..d20444f
--- /dev/null
@@ -0,0 +1,15 @@
+[%
+  WRAPPER "staff/t_base.tt2";
+  ctx.page_title = l("Workstation Administration"); 
+  ctx.page_app = "egWorkstationAdmin";
+%]
+
+[% BLOCK APP_JS %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/grid.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/admin/workstation/app.js"></script>
+[% END %]
+
+<div ng-view></div>
+
+[% END %]
diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_printing.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_printing.tt2
new file mode 100644 (file)
index 0000000..38de293
--- /dev/null
@@ -0,0 +1,116 @@
+<div class="container">
+
+  <style>
+    /* TODO: move me */
+    textarea {
+      height: 400px;
+      width: 100%;
+    }
+      
+  </style>
+
+  <div class="row"> 
+    <div class="col-md-12">
+      <h2>[% l('Printer Context') %]</h2>
+    </div>
+  </div>
+
+  <div class="row"> 
+    <div class="col-md-12">
+      <div class="btn-group">
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : context=='default'}"
+          ng-click="setContext('default')">[% l('Default') %]</button>
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : context=='receipt'}"
+          ng-click="setContext('receipt')">[% l('Receipt') %]</button>
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : context=='label'}"
+          ng-click="setContext('label')">[% l('Label') %]</button>
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : context=='mail'}"
+          ng-click="setContext('mail')">[% l('Mail') %]</button>
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : context=='offline'}"
+          ng-click="setContext('offline')">[% l('Offline') %]</button>
+      </div>
+    </div>
+  </div>
+
+  <div class="row"> 
+    <div class="col-md-12">
+      <h2>[% l('Printer Test') %]</h2>
+    </div>
+  </div>
+
+  <div class="row"> 
+    <div class="col-md-10">
+      <div class="btn-group">
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : contentType=='text/plain'}"
+          ng-click="setContentType('text/plain')">[% l('Plain Text') %]</button>
+        <button type="button" 
+          class="btn btn-default btn-lg" 
+          ng-class="{active : contentType=='text/html'}"
+          ng-click="setContentType('text/html')">[% l('HTML') %]</button>
+      </div>
+    </div>
+    <div class="col-md-2">
+      <button type="button" 
+        ng-click="testPrint()"
+        class="btn btn-default btn-lg pull-right">[% l('Print') %]</button>
+    </div>
+
+  </div>
+
+  <div class="row"> 
+    <div class="col-md-12">
+      <div ng-show="contentType=='text/plain'"
+ng-init="textPrintContent='
+[% l('Test Print') %]
+
+1234567890
+
+12345678901234567890
+
+123456789012345678901234567890
+
+1234567890123456789012345678901234567890
+
+12345678901234567890123456789012345678901234567890
+
+12345678901234567890123456789012345678901234567890123456790
+
+[% l('Test Print') %]
+'">
+        <pre><textarea>{{textPrintContent}}</textarea></pre>
+      </div>
+
+      <div ng-show="contentType=='text/html'">
+        <textarea ng-model="htmlPrintContent" 
+ng-init="htmlPrintContent='
+<div>
+  <style>p { color: blue }</style>
+  <h2>[% l('Test HTML Print') %]</h2>
+  <br/>
+  <img src=\'/opac/images/main_logo.png\' width=\'140\' height=\'24\'/>
+  <p>[% l('Welcome, Stranger!') %]</p>
+  <p>{{value1}}</p>
+  <p>{{value2}}</p>
+</div>
+'">
+        </textarea>
+
+      </div>
+    </div>
+  </div>
+
+
+</div>
+
diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2
new file mode 100644 (file)
index 0000000..ceb3cab
--- /dev/null
@@ -0,0 +1,52 @@
+<br/>
+<div class="container">
+  <div class="row" id="splash-nav">
+
+    <div class="col-md-4">
+      <div class="panel panel-success">
+        <div class="panel-heading">
+          <div class="panel-title text-center">
+            [% l('Printing, Templates, etc.') %]
+          </div>
+        </div>
+        <div class="panel-body">
+          <div>
+            <span class="glyphicon glyphicon-print"></span>
+            <a target="_self" href="./admin/workstation/printing">
+              [% l('Printer Settings') %]
+            </a>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="col-md-4">
+      <div class="panel panel-success">
+        <div class="panel-heading">
+          <div class="panel-title text-center">
+            [% l('Other') %]
+          </div>
+        </div>
+        <div class="panel-body">
+          <div>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="col-md-4">
+      <div class="panel panel-success">
+        <div class="panel-heading">
+          <div class="panel-title text-center">
+            [% l('Other') %]
+          </div>
+        </div>
+        <div class="panel-body">
+          <div>
+          </div>
+        </div>
+      </div>
+    </div>
+
+  </div>
+</div>
index 75d4f3a..b2c80a0 100644 (file)
           </li>
        </ul>
       </li>
-    </ul>
+
+      <!-- cataloging -->
+      <li class="dropdown">
+        <a href="javascript:;" class="dropdown-toggle" 
+          data-toggle="dropdown">[% l('Administration') %]
+            <b class="caret"></b>
+        </a>
+        <ul class="dropdown-menu">
+          <li>
+            <a href="./admin/workstation/index" target="_self">
+              <span class="glyphicon glyphicon-hdd"></span>
+              [% l('Workstation Administration') %]
+            </a>
+          </li>
+       </ul>
+      </li>
+
+    </ul> <!-- end left side entries -->
 
     <!-- entries along the right side of the navbar -->
     <ul class="nav navbar-nav navbar-right" style='margin-right: 6px;'>
diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js
new file mode 100644 (file)
index 0000000..2c77311
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * App to drive the base page. 
+ * Login Form
+ * Splash Page
+ */
+
+angular.module('egWorkstationAdmin', ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod'])
+
+.config(['$routeProvider','$locationProvider','$compileProvider', 
+ function($routeProvider , $locationProvider , $compileProvider) {
+
+    $locationProvider.html5Mode(true);
+    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); 
+    var resolver = {delay : function(egStartup) {return egStartup.go()}};
+
+    $routeProvider.when('/admin/workstation/printing', {
+        templateUrl: './admin/workstation/t_printing',
+        controller: 'PrintingCtrl',
+        resolve : resolver
+    });
+
+    // default page 
+    $routeProvider.otherwise({
+        templateUrl : './admin/workstation/t_splash',
+        controller : function() {},
+        resolve : resolver
+    });
+}])
+
+.controller('PrintingCtrl',
+       ['$scope','egPrintStore',
+function($scope , egPrintStore) {
+    console.log('PrintingCtrl');
+
+    $scope.setContext = function(ctx) { $scope.context = ctx }
+    $scope.setContentType = function(type) { $scope.contentType = type }
+    $scope.testPrint = function() {
+        if ($scope.contentType == 'text/plain') {
+            egPrintStore.print($scope.contentType, $scope.textPrintContent);
+        } else {
+            egPrintStore.print(
+                $scope.contentType, 
+                $scope.htmlPrintContent, 
+                {'value1' : 'Value One', 'value2' : 'Value Two'}
+            );
+        }
+    }
+
+    $scope.setContext('default');
+    $scope.setContentType('text/plain');
+
+}])
index 5cb2900..e3db2ad 100644 (file)
@@ -231,15 +231,31 @@ function($scope,  $q,  $filter,  egNet,  egAuth,  egUser,  patronSvc,  egEnv,  e
 .controller('PatronSearchCtrl',
        ['$scope','$q','$routeParams','$timeout','$window','$location','egEnv',
        '$filter','egIDL','egNet','egAuth','egEvent','egList','egUser',
-       'patronSvc', 'egGridFlatDataProvider',
+       'patronSvc','egGridDataProvider','egPrintStore',
 function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egEnv,
         $filter,  egIDL,  egNet,  egAuth,  egEvent,  egList,  egUser,  
-        patronSvc , egGridDataProvider) {
+        patronSvc , egGridDataProvider , egPrintStore) {
 
     $scope.initTab('search');
     $scope.focusMe = true;
     $scope.searchArgs = {};
 
+    egPrintStore.setItem('FOO', 'BAR').then(function() { 
+        return egPrintStore.appendItem('FOO', 'BAR') 
+    }).then(function() { 
+        return egPrintStore.getItem('FOO')  
+    }).then(function(result) { 
+        console.log('LOADED FOO ' + result);
+        return egPrintStore.getKeys();
+    }).then(function(keys) { 
+        console.log("we have keys " + keys);
+        return egPrintStore.removeItem('FOO');
+    }).then(function() { 
+        return egPrintStore.getKeys() 
+    }).then(function(keys) { 
+        console.log("we have keys " + keys) 
+    });
+
     if (patronSvc.lastSearch) {
         // populate the search form with our cached search info
         angular.forEach(patronSvc.lastSearch.search, function(val, key) {