1 // ========================================================================== 2 // Papercube.PapersPerYearController 3 // 4 // License: PaperCube is open source software released under 5 // the MIT License (see license.js) 6 // ========================================================================== 7 8 require('core'); 9 10 /** @class 11 12 This controller is used to control the papers per year view. 13 14 @extends SC.Object 15 @author Peter Bergstrom 16 @version 1.0 17 @copyright 2008-2009 Peter Bergström. 18 @static 19 */ 20 Papercube.papersPerYearController = SC.Object.create( 21 /** @scope Papercube.papersPerYearController */ { 22 23 24 /** 25 The increment value for the depth slider. 26 27 @property {Integer} 28 @default 1 29 */ 30 depthStep: 1, 31 32 /** 33 The max value for the depth slider. 34 35 @property {Integer} 36 @default 15 37 */ 38 depthValueMax: 15, 39 40 /** 41 The min value for the depth slider. 42 43 @property {Integer} 44 @default 1 45 */ 46 depthValueMin: 1, 47 48 /** 49 The value for the depth slider. 50 51 @property {Integer} 52 @default 8 53 */ 54 depth: 8, 55 56 /** 57 The default depth value. 58 59 @property {Integer} 60 @default 8 61 */ 62 defaultDepth: 8, 63 64 /** 65 The increment value for the refThreshold slider. 66 67 @property {Integer} 68 @default 1 69 */ 70 refThresholdStep: 1, 71 72 /** 73 The max value for the refThreshold slider. 74 75 @property {Integer} 76 @default 30 77 */ 78 refThresholdValueMax: 30, 79 80 /** 81 The min value for the refThreshold slider. 82 83 @property {Integer} 84 @default 0 85 */ 86 refThresholdValueMin: 0, 87 88 /** 89 The value for the refThreshold slider. 90 91 @property {Integer} 92 @default 0 93 */ 94 refThreshold: 0, 95 96 /** 97 The default refThreshold value. 98 99 @property {Integer} 100 @default 0 101 */ 102 defaultRefThreshold: 0, 103 104 /** 105 The increment value for the citeThreshold slider. 106 107 @property {Integer} 108 @default 1 109 */ 110 citeThresholdStep: 1, 111 112 /** 113 The max value for the citeThreshold slider. 114 115 @property {Integer} 116 @default 30 117 */ 118 citeThresholdValueMax: 30, 119 120 /** 121 The min value for the citeThreshold slider. 122 123 @property {Integer} 124 @default 0 125 */ 126 citeThresholdValueMin: 0, 127 128 /** 129 The value for the citeThreshold slider. 130 131 @property {Integer} 132 @default 0 133 */ 134 citeThreshold: 0, 135 136 /** 137 The default citeThreshold value. 138 139 @property {Integer} 140 @default 0 141 */ 142 defaultCiteThreshold: 0, 143 144 145 /** 146 Hide bogus years. If true, no papers with false years will be shown. 147 148 @property {Boolean} 149 @default false 150 */ 151 hideBogusYears: false, 152 153 /** 154 Route to the appropriate max strength action. 155 156 @param opt {boolean} If YES, ref, if NO, cite. 157 */ 158 maxStrength: function(opt) 159 { 160 if(opt) 161 { 162 this.maxRefStrength(); 163 } 164 else 165 { 166 this.maxCiteStrength(); 167 } 168 }, 169 170 /** 171 Route to the appropriate min strength action. 172 173 @param opt {boolean} If YES, ref, if NO, cite. 174 */ 175 minStrength: function(opt) 176 { 177 178 if(opt) 179 { 180 this.minRefStrength(); 181 } 182 else 183 { 184 this.minCiteStrength(); 185 } 186 }, 187 188 /** 189 Increment the ref strength towards the maximum. 190 */ 191 maxRefStrength: function() 192 { 193 if(this.get('refThreshold') < this.get('refThresholdValueMax')) 194 this.set('refThreshold', this.get('refThreshold')+1); 195 }, 196 197 /** 198 Increment the ref strength towards the minimum. 199 */ 200 minRefStrength: function() 201 { 202 if(this.get('refThreshold') > this.get('refThresholdValueMin')) 203 this.set('refThreshold', this.get('refThreshold')-1); 204 }, 205 206 /** 207 Increment cite ref strength towards the maximum. 208 */ 209 maxCiteStrength: function() 210 { 211 if(this.get('citeThreshold') < this.get('citeThresholdValueMax')) 212 this.set('citeThreshold', this.get('citeThreshold')+1); 213 }, 214 215 /** 216 Increment cite ref strength towards the minimum. 217 */ 218 minCiteStrength: function() 219 { 220 if(this.get('citeThreshold') > this.get('citeThresholdValueMin')) 221 this.set('citeThreshold', this.get('citeThreshold')-1); 222 }, 223 224 /** 225 Increment the depth towards the maximum. 226 Take her down! 227 */ 228 maxDepth: function() 229 { 230 if(this.get('depth') < this.get('depthValueMax')) 231 this.set('depth',this.get('depth')+1); 232 }, 233 234 /** 235 Increment the depth towards the maximum. 236 237 Rig for surface! 238 */ 239 minDepth: function() 240 { 241 if(this.get('depth') > this.get('depthValueMin')) 242 this.set('depth',this.get('depth')-1); 243 }, 244 245 /** 246 Set the default values for the controller. 247 */ 248 setDefaults: function() 249 { 250 this.set('refThreshold', this.get('defaultRefThreshold')); 251 this.set('citeThreshold', this.get('defaultCiteThreshold')); 252 this.set('depth', this.get('defaultDepth')); 253 } 254 }) ; 255